Answers.Body: <p>There is no worry with filtering when you apply the filter on all channels as then the TDOA is unchanged. If you wanted to overlay the filtered data with the original data and you use an FIR filter, then you can exploit the fact that for FIR filters the delay is half the filter size</p>
  <p>Example in Matlab:</p>
  <pre><code>
  yy= fftfilt(fir1(128,0.5),[xx;zeros(64,1)]);
  yy(1:64)=[];
  </code></pre>
  <p>For IIR filters, this does not work as group delay of IIR filters are frequency dependent. But there are routines implemented in signal processing tool-boxes that provide the group delay and one could correct time delay for a given frequency.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-15T16:00:23.420Z
Answers.LastActivityDate: 2022-07-16T13:36:30.693Z
Answers.LastEditDate: 2022-07-16T13:36:30.693Z
Answers.UserDisplayName: WMXZ
Answers.Body: <p>I'm not sure what you mean by &quot;offset&quot;, but I'm assuming you mean the time alignment of the waveforms. Yes, filters generally introduce a time delay in their outputs due to their phase response, such that the output waveform is a filtered AND delayed version of the input:</p>
  <p><a href="https://i.sstatic.net/ETIZX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ETIZX.png" alt="enter image description here" /></a></p>
  <p>[From <a href="https://uk.mathworks.com/help/signal/ug/compensate-for-delay-and-distortion-introduced-by-filters.html" rel="nofollow noreferrer">Mathworks Help Center - Compensate for Delay and Distortion Introduced by Filters</a> ]</p>
  <p>For digital filters, the offset will depend on your sampling frequency, filter type (FIR/IIR), and order, amongst other things, with higher order filters intoducing longer delays.</p>
  <p>This delay should not matter too much for TDOA applications, as long as you apply the exact same filter to all your channels. Thus they would all be delayed by the same amount, and the relative TDOA information would be preserved across the channels.</p>
  <p>Having said that, one option to remove the time delays in offline processing (i.e. for pre-recorded signals only, not for real-time analysis) is to perform the so-called <em>forward-backward filtering</em>: you apply your filter to your recorded signal, time-reverse the filtered signal, apply the same filter again to the time-reversed signal, and bring the signal back to non-reverse-time. The first filtering step introduces its time-delay, and the 2nd filtering step introduces a &quot;negative delay&quot; that compensate for the first one. Programming languages such as <a href="https://uk.mathworks.com/help/signal/ref/filtfilt.html" rel="nofollow noreferrer">Matlab</a> and <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html" rel="nofollow noreferrer">Python/Scipy</a> have this function available with the name <code>filtfilt</code>. See the link directly under the image for a short tutorial on this method using Matlab.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-12T09:51:35.817Z
Answers.LastActivityDate: 2022-07-15T08:52:29.557Z
Answers.LastEditDate: 2022-07-15T08:52:29.557Z
Answers.UserDisplayName: fabio_hirono
Body: <p>I have a multichannel array that I need to bandpass before feeding into my time-difference-of-arrival localisation (TDOA) routine.</p>
  <p>I remember hearing somewhere that I should be vary careful about performing any filtering. I know some filters can alter the offset of high/low frequency components.</p>
  <p>How large are the offsets really, and would it be large enough to mess with the actual TDOAs? My audio is noisy, how do I perform filtering then?</p>
  
Tags: <localisation><array><echolocation><filter>
Title: Filtering audio for multichannel time-difference-of-arrival localisation
ThreadText: # Filtering audio for multichannel time-difference-of-arrival localisation
  
  (Asked by: username_0 on 2022-07-11)
  
  I have a multichannel array that I need to bandpass before feeding into my time-difference-of-arrival localisation (TDOA) routine.
  
  I remember hearing somewhere that I should be vary careful about performing any filtering. I know some filters can alter the offset of high/low frequency components.
  
  How large are the offsets really, and would it be large enough to mess with the actual TDOAs? My audio is noisy, how do I perform filtering then?
  
  **Tags:** localisation, array, echolocation, filter
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2022-07-12. Score: 6 | Accepted answer
  
  I'm not sure what you mean by "offset", but I'm assuming you mean the time alignment of the waveforms. Yes, filters generally introduce a time delay in their outputs due to their phase response, such that the output waveform is a filtered AND delayed version of the input:
  
  [![enter image description here](https://i.sstatic.net/ETIZX.png)](https://i.sstatic.net/ETIZX.png)
  
  [From [Mathworks Help Center - Compensate for Delay and Distortion Introduced by Filters](https://uk.mathworks.com/help/signal/ug/compensate-for-delay-and-distortion-introduced-by-filters.html) ]
  
  For digital filters, the offset will depend on your sampling frequency, filter type (FIR/IIR), and order, amongst other things, with higher order filters intoducing longer delays.
  
  This delay should not matter too much for TDOA applications, as long as you apply the exact same filter to all your channels. Thus they would all be delayed by the same amount, and the relative TDOA information would be preserved across the channels.
  
  Having said that, one option to remove the time delays in offline processing (i.e. for pre-recorded signals only, not for real-time analysis) is to perform the so-called *forward-backward filtering*: you apply your filter to your recorded signal, time-reverse the filtered signal, apply the same filter again to the time-reversed signal, and bring the signal back to non-reverse-time. The first filtering step introduces its time-delay, and the 2nd filtering step introduces a "negative delay" that compensate for the first one. Programming languages such as [Matlab](https://uk.mathworks.com/help/signal/ref/filtfilt.html) and [Python/Scipy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html) have this function available with the name `filtfilt`. See the link directly under the image for a short tutorial on this method using Matlab.
  
  
  ---
  
  ### Answer by username_1 on 2022-07-15. Score: 3
  
  There is no worry with filtering when you apply the filter on all channels as then the TDOA is unchanged. If you wanted to overlay the filtered data with the original data and you use an FIR filter, then you can exploit the fact that for FIR filters the delay is half the filter size
  Example in Matlab:
  
  yy= fftfilt(fir1(128,0.5),[xx;zeros(64,1)]);
  yy(1:64)=[];
  
  For IIR filters, this does not work as group delay of IIR filters are frequency dependent. But there are routines implemented in signal processing tool-boxes that provide the group delay and one could correct time delay for a given frequency.
  
  
  ---
  
  