0
$\begingroup$

I was playing around with FFTs and decided to try extending the time domain of the original signal. I did this through taking an FFT to the frequency domain, doubling the amount of samples by averaging every two samples, and then taking IFFT back to the time domain.

This repeated the signal (and probably changed the phase relationships somewhat), which is understandable. However, it also introduced a fadeout throughout the first sample and a fade in throughout the second. When I trippled the amount of samples, two fade-in-fade-out pairs were introduced and the behavior of each remains the same. Why does the fade happen?

waveforms

code and audio files: https://github.com/echometerain/sound-derivative

$\endgroup$

1 Answer 1

3
$\begingroup$

There's two FFT properties at work here.

Just for convenience, let $x_n$ be your original signal, and $X_k$ be its DFT (remember that an FFT is just a fast way to implement the discrete Fourier transform -- what I have to say applies to any discrete Fourier transform, so I'm going to use "DFT" here).

The two properties are:

  1. If you take $X_k$ and upsample it; i.e. let $^2X_k = \begin{bmatrix}X_0 & 0 & X_1 & 0 & \cdots\end{bmatrix}$, then its inverse Fourier transform, $^2 x_n = \mathcal F^{-1} \{^2 X\}$, will be $x_n$ repeated twice: $^2 x_n = \begin{bmatrix}x & x\end{bmatrix}$.
  2. If you take any signal $Y$ in the frequency domain and convolve it by $X$, and take the inverse Fourier transform, then the result will be the point-by-point multiplication of the inverse Fourier transforms of each: $\mathcal F^{-1}\{X \star Y\} = F^{-1}\{X\}F^{-1}\{Y\}$
    1. Note that for a DFT, the convolution is circular.

We can take your problem and make it fit these properties.

Observe that making $\begin{bmatrix}X_0 & X_0 & X_1 & X_1 & \cdots\end{bmatrix}$ is mathematically identical to convolving $X_k$ with $Y_k = \begin{bmatrix}1 & 1 & 0 & 0 & 0 & \cdots\end{bmatrix}$.

So when you do that, the result of your IFFT is your original signal, repeated, and multiplied by the IFFT of that $Y_k$. The IFFT of $\begin{bmatrix}1 & 1 & 0 & 0 & 0 & \cdots\end{bmatrix}$ is what provides the fading in your example -- the IFFT of three ones in a row followed by zeros is similar, and so causes similar fading in your second example.

$\endgroup$
6
  • $\begingroup$ conv([1 2 3],[1 1 0 0]) = [1 3 5 3 0 0] which is not [1 1 2 2 3 3] ? Looks more like a kronecker product to me. $\endgroup$
    – Peter K.
    Jul 7, 2023 at 20:49
  • 1
    $\begingroup$ You're missing the resampling (and the fact that it's the circular convolution -- but I may not have mentioned that). $\begin{bmatrix}1 & 0 & 2 & 0 & 3 & 0\end{bmatrix} * \begin{bmatrix}1 & 1 & 0 & 0 & 0 & 0\end{bmatrix} = \begin{bmatrix}1 & 1 & 2 & 2 & 3 & 3\end{bmatrix}$. $\endgroup$
    – TimWescott
    Jul 8, 2023 at 0:47
  • $\begingroup$ OK, but this isn't true: Observe that making $\begin{bmatrix}X_0 & X_0 & X_1 & X_1 & \cdots\end{bmatrix}$ is mathematically identical to convolving $X_k$ with $Y_k = \begin{bmatrix}1 & 1 & 0 & 0 & 0 & \cdots\end{bmatrix}$. Should probably say "upsampled $X_k$" or something to make it clear. I lost the connection, so others will too. $\endgroup$
    – Peter K.
    Jul 8, 2023 at 14:49
  • $\begingroup$ Tim, might it be as good or better to use the O&S convention with $X[k]$ instead of $X_k$? $\endgroup$ Jul 9, 2023 at 3:35
  • $\begingroup$ @PeterK. He's convolving $Y_k$ with $X_k$ that's zero-inserted and twice as long. $\endgroup$ Jul 9, 2023 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.