1
$\begingroup$

I am currently coding a school assignment. I have a 1.5s recording of someone's speech that has 4 rogue cosines mixed in. With sampling rate 16000Hz, I divided the recording into frames of 1024 samples with an overlap of 512 samples.

I picked up a frame that has no speech mixed in so that the rogue cosines are not influenced by the the speaker's voice.

Here is the resulting plot of the magnitude of the discrete fourier transform (the phase part is not needed right now):

enter image description here

With a range from 0 to 8000Hz, with the frequency bins sized 16000/1024=15.625Hz, I was able to pinpoint the frequencies of these out. It's about 875, 1750, 2625, 3500, each in Hz.

My first question is this: what does the vertical axis reprezent on the DFT? Yes, it's the magnitude, but what does it really mean? Does it mean that the cosine wave with the frequency 875 Hz has an amplitude of 30? Or is it 60 as there is also the negative frequency?

Our next goal was to filter these out. Okay, so I constructed a filter that has zeroes at those frequencies (and their conjugated pairs for the negative frequencies). Here is what its transfer function looks like:

The coefficients of zeroes are:

$$ 1, -4.847, 12.176 , -20.048 ,23.521, -20.048, 12.176 ,-4.847 , 1 $$

The coefficient of a singular pole is: $$1$$

I thought that would destroy these four frequencies, but it, however, destroyed all frequencies up to about 12000Hz.

Here is the frequency response graph:

enter image description here

To sum it up, there are two things I do not understand:

The meaning of the vertical axis in DFT and its relationship with the amplitudes of the cosines im looking for.

Why the filter filtered out almost everything in my signal.

$\endgroup$

2 Answers 2

2
$\begingroup$
  1. The meaning of DFT coefficients is given directly by the definition of IDFT: $$ x(n) = \frac{1}{N}\sum_{k=0}^{N-1} X(k)e^{j2\pi kn/N} $$ It means that a time sequence $x(n)$ can be represented by a weighted sum of complex sinusodial component $e^{j2\pi kn/N}$, and the weights are the DFT coefficients. It doesn't mean that $x(n)$ is composed of these frequency components. For example, the DFT of a sine wave with an irrational frequency, no matter how many sample DFT do you take, the coefficients always have two peaks (due to conjugate symmetry) but other frequencies remain non-zero, but we know that it is a single frequency signal!

  2. You can't design a notch filter by just put some zeros at the target frequencies. A notch filter removes the undesired frequency components but remains a relatively flat response at other frequencies. To achieve this you want some poles. A biquad notch filter has a transfer function as $$ H(z) = \frac{K(z-e^{j\omega_0})(z-e^{-j\omega_0})}{(z-re^{j\omega_0})(z-re^{-j\omega_0})} $$ where $\omega_0$ is the normalized frequency, $K$ is a constant and $0\leq r<1$ controls the bandwitdh of the notch filter. When $r\rightarrow 1$ the bandwitdh becomes more narrow, but it suffers more from the quantization error.

$\endgroup$
1
$\begingroup$

Looking at the 875 Hz spectral component, it looks like its DFT magnitude is 30. For real-valued signals, the DFT magnitude ‘M’ is M = AN/2 where A is the peak amplitude of the 875 Hz sinusoid within your signal and N is the DFT size. This tells you that the peak amplitude of the 875 Hz sinusoid within your signal is A = 2M/N = 2*30/1024 = 0.0586. It’s that simple.

ZR Han is correct. Your four conjugate zeros on the z-plane have merely created a highpass filter (as you have shown in your figure). You need to cascade four of ZR Han ‘s 2nd-order “notch” filters where each notch filter is centered at one your undesired spectral components. Four cascaded 2nd-order notch filters will eliminate your rogue sinusoids but the question is, “How will simple 2nd-order filters distort the audio signal. I’m guessing that to preserve the quality (fidelity) of your audio signal will require a filter that is more complicated than four cascaded 2nd-order filters.

$\endgroup$
1
  • $\begingroup$ The expression 'M = AN/2' is only true if your time signal contains an integer number of cycles of the 875 Hz sinusoid. If I'm not mistaken, your time signal contains exactly 56 cycles of the 875 Hz sinusoid. $\endgroup$ Dec 22, 2021 at 15:01

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.