## fractional delay filter for non real time applications ?..

Started by 4 years ago●6 replies●latest reply 4 years ago●173 viewsHello,

Hi guys,

I would like to create fractional delay filter that can be applied on a signal for non real time applications. My approach is to apply a linear phase shift via a multiplication of a ideal filter (rectangular window) with linear phase in the frequency domain. In the next step, I transform the signal back to the time domain using a symmetric ifft to obtain a real valued signal.

The Matlab code looks like this:

N = <span class="hljs-number">1e3</span>; <span class="hljs-comment">% number of samples</span> n0 = <span class="hljs-number">0.3</span>; <span class="hljs-comment">% fractional delay in integer samples</span> x = <span class="hljs-built_in">randn</span>(<span class="hljs-number">1</span>,N); <span class="hljs-comment">% time domain signal</span> X = fft(x); <span class="hljs-comment">% frequency domain</span> https://topdatingwebsitesx.com/chatspin https://topdatingwebsitesx.com/random-talk https://chatrandom.live k = <span class="hljs-number">0</span>:N<span class="hljs-number">-1</span>; <span class="hljs-comment">% frequency index vector</span> Y = X.*<span class="hljs-built_in">exp</span>(<span class="hljs-number">-1</span><span class="hljs-built_in">i</span>*<span class="hljs-number">2</span>*<span class="hljs-built_in">pi</span>*k/N*n0); <span class="hljs-comment">% linear phase shift wrt to frequency</span> y = ifft(Y,<span class="hljs-string">'symmetric'</span>); <span class="hljs-comment">% back to time domain</span>

Due to the rectangular window of the filter I will get ringing artifacts the frequency boundaries. Nevertheless, is this a valid approach to delay a signal by a fractional integer delay?

thanks

alexsunny

In applying the linear phase shift, you have to take into account the conjugate symmetry of the fft output.

alex,

Your attempt to obtain linear phase shift over the entire spectral span is doomed by Gibbs phenomena. You have to select a fractional BW, 80% and then use the interval beyond the +/- 40% boundary to smoothly transition from the positive phase at the -40% frequency to the negative phase at the +40% frequency. What you can do is forma filter that you can apply in the time domain or in the frequency domain. I have designed a ten path filter which is a polyphase partitioned filter that will offer you, by choice of the different paths, time delays over 80% of the two sided BW of intervals 0, +/- 0.1, +/- 0.2, +/- 0.3... relative to the central causal delay of the filter set. Run the matlab code... if you don't have matlab, I have also listed the coefficients and you can form filters from each path to see the delay.

What you do is design a good filter with the desired BW and transition BW but design it for M times oversampling, I used 10 times oversampling in my sample code... then split the prototype filter into an M path filter, scaling the filter by M to preserve unity gain for each path. Each path filter starts on index m and increments by M samples... The incrementing does the down sampling to the desired output sample rate, and the starting offset by m is how each path has a different time offset in count of 1/M-th of the input clock interval... If you have a copy of my book (multirate signal procressing) see the chapter on Interpolators... we are pretty good at building very highquality interpolators

fred

As Dr. Harris said, you can create a fractional delay filter in the time domain. See also my post on this subject:

https://www.dsprelated.com/showarticle/1327.php

regards,

Neil

Replacing the text signal with sinusoid confirms the approach. In using the "symmetric" argument in the IFFT function, conjugate symmetry is ensured in the IFFT computation.

As for as I know the simplest way to get fraction delay is to use an All pass filter (Truncated Sinc) with the given delay.

These type of filters is used as interpolator (MMSE Filter)

You can design a MMSE (Truncated Sinc) interpolator.Please see Meyr Digital Communication Receivers (Volume 2).Or many books may be available.If you choose more taps the truncated filter will closely approximate ideal filter.Also if you feed input signal over sampled number of filter taps will come down.I have used this in modems.

Hi Alexsunny,

As others replied you better go for filter in time domain.

Regarding your code; you can use it for cyclic shift provided n0 is integer.

At n0 = 1 you are multiplying by full complex sinusoid and its ifft is same as 1 sample cyclic shift of x input in time domain. with n0 = 2 you get two sample cyclic shift...etc.

if you try fractional n0 such as 0.3 then you are applying 0.3 cycle of complex sinusoid.

I can't see how this implements fractional cyclic shift or fractional delay as these require new sample values be generated.

You can check your code against fractional delay directly by some code like this:

xs = resample(x,10,1);

xs = xs(4:10:end); %0.3 fractional delay (or advance)