1

I'm constructing a karaoke-type application that eliminates the sound of one voice, based on it's position in the stereo space. I calculate the left and right FFT's, and find the frequencies that are almost equal in volume (normalized for the angle in the stereo spectrum). This is my code (Vb.Net). IMx and REx are the Imaginary and Real part of the FFT output. l or r stand for Left and Right channel:

                For k = 1 To nSamples / 2
                    Dim cV As Double = VolumL(k) / VolumR(k)
                    If cV >= LowMargin AndAlso cV <= HighMargin Then
                        IMXl(k) = 0
                        REXl(k) = 0
                        IMXr(k) = 0
                        REXr(k) = 0
                    End If
                Next

Testing with a 2 sec 400Hz sample (left: volume from 0 to 1, right: from 1 to 0) I hear the IFFT about halves the volume in the part where I expect to have silence. It must be because I have to adjust the data in the other half of the FFT-output, but I have no idea which index in the second half corresponds with that in the first.

Adding (assuming the frequencies in the second half range from 1 to 22050)

 each array(k + nSamples/2) = 0

adds only distortion

Adding (assuming the frequencies in the second half are inverse)

 each array(nSamples + 1 - k) = 0

gives much much better results, but there remains a low volume sound.

What is the way to get silence? Or which article explains me what I do when changing volume of certain frequencies (like you do in an equalizer)?

  • I think you will always get some sound, unless you already know exactly what frequencies are at what amplitude and phase in the sound environment. – Rory Alsop May 9 '14 at 16:59
  • I'm testing with a pure 400 Hz wave, and somem of the 400Hz remains. What I would like to know is WHICH of the fft-data refers to the 400Hz frequency, using a 22050 length sample, which should result in exactly 1 bin for each frequency. – Martin May 11 '14 at 7:38
2

That is because what you are doing is called DFT rather than FFT. All stuff in computers are discrete. Sounds become aliased when they are sampled into 'grids' while the analog counterparts don't. Thus analog signals have true FFTs while the digital ones will always have some errors.

If you try doing DFT on a pure sine wave, what you will get will not be a single line of the particular frequency. Instead, it will look like a distribution around the desired frequency. Eliminating that frequency will leave the other bars in the distribution unchanged. So you will still hear something.

It's not the problem of your program. It's the nature of digital sound.

EDIT: However its not impossible to overcome this problem. Though erroneous, the error has a limit, a range around the true frequency. You could decay this range(maybe with an envelop like a bowl?). But other stuff will also be decayed.

So if you want to decay vocal only, you need to decay only vocal frequencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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