# “Flanging” in frequency domain?

Flanging is defined as a mix of two identical signals where one signal is delayed in time by a small and gradually changing period, around 10-20 milliseconds.

Since delay in the time domain is equivalent to a phase shift in the frequency domain, could then a Flanging sound effect be done in frequency domain?

Could we do a DFT transform, make a copy of amplitudes and phases, shift phases (and gradually change the shift between -180 and +180 degrees), and add the result to original amplitudes and phases?

• doesn't appear to be easier or to work better than just doing it in the time domain (which would require a precision delay alg with fractional-sample precision). – robert bristow-johnson Oct 26 '15 at 18:26
• true. but I alread have a DFT-iDFT and window-overlapp-add (wola) system in place, so I have a chance to relatively easy try the idea out. – Danijel Oct 27 '15 at 10:18
• try it out, but it won't work as well. the flanger effect is normally heard with the delay difference (between the two paths) slowly changing. as the rate of change speeds up, you will be able to hear in your DFT-iDFT case that the delay does not change smoothly. each frame will have a constant delay and then the delay jerks to another constant value for the next frame. – robert bristow-johnson Oct 27 '15 at 12:23

Frequency domain does not really work here. A flanger is NOT a linear time invariant system. You could try to implement this is "piece-wise" LTI and change the delay only at a frame boundary but this will mostly likely result in unacceptable artifacts.

A flanger will require a time variant fractional delay. Rounding the delay the nearest integer delay results in unacceptable "zipper" noise.

A time shift $\tau$ of the signal $\tilde x(t)$ can be implemented exploiting the time shift property of the discrete Fourier transform (DFT). So what you propose is possible.

Let $x(n) = \tilde x(nT)$ be the sampled version of $\tilde x$ with sampling interval $T$. The flanged signal $y$ can be obtained by $$y(n) = \operatorname*{IDFT}_N\left[\operatorname*{DFT}_N( x ) + \operatorname*{DFT}_N( x )\exp\left(-\mathrm j \frac{2\pi}{N}k\eta\right) \right]\\ = x(n)+ \operatorname*{IDFT}_N\left[\operatorname*{DFT}_N( x )\exp\left(-\mathrm j \frac{2\pi}{N}k\eta\right) \right],$$ where $\eta = \tau/T$, $k\in[0,N-1]$, and $N$ is the length of the I/DFT.

The time shifted version of $x$ is just an interpolation if $\eta \notin \mathbb N$ and the precision of this interpolation grows with $N$. On the other hand, $\tau$ can only be changed every $N$ values and therefore the greater $N$, the lower the update speed. The value of $N$ is thus a tradeoff between time resolution and update speed.

For every block of $N$ samples an I/DFT pair is required which is computationally expensive.

• Thanks. What would the update speed be in the time domain? One sample? Or it also works per some "frame" of audio samples? – Danijel Oct 27 '15 at 10:23
• $N$ is a number of samples, one sample having duration $T$. The update rate is thus $1/(NT)$ or $f_\mathrm s / N$, where $f_\mathrm s$ is the sampling frequency. – Deve Oct 27 '15 at 10:32
• I meant, what would the update speed be if I implemented the flanger in the time domain, a "normal" way. I am wandering if the freq domain implementation can trully be the same as the one in time domain? Thanks for help. – Danijel Oct 27 '15 at 11:11
• @Danijel Sorry, I misunderstood your comment. Unfortunately, I don't know the exact timed domain implementation, so I can't answer that. – Deve Oct 27 '15 at 11:57
• @Danijel, the issue is how to implement a fractional-sample delay (the right-hand operation above). there are multiple methods of interpolation. some people like something like Lagrange (i don't, i think if you're gonna go that way, Hermite polynomial interpolation is better). i personally would do it with a polyphase FIR filter. this technique is very common for "splitting the unit delay". here's a free paper that might be useful. – robert bristow-johnson Oct 27 '15 at 23:44