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)?