Again, I must be doing something wrong, can you please help.
Withought FFT modifications sound produced is fine. But when I do FFT modifications (clearing bellow 50Hz and above 3 kHz) I'm still getting same issue as in above spectogram.
Here is my code (don't mind dirty code, it is just for testing):
var fftSize = 2048;
var encBuffer = new float[fftSize];
var lastoutbuf = new float[fftSize / 2];
while (Bass.BASS_ChannelIsActive(decoder) == BASSActive.BASS_ACTIVE_PLAYING)
{
var tempBuffer = new float[fftSize/2];
Bass.BASS_ChannelGetData(_currentStream, tempBuffer, tempBuffer.Length);
// copy lastoutbuffer to 1st part of full buffer
Array.Copy(lastoutbuf, 0, encBuffer, 0, fftSize / 2);
// copy new data to 2nd part of full buffer
Array.Copy(tempBuffer, 0, encBuffer, fftSize / 2, fftSize / 2 - 1);
var output = new float[fftSize];
/*
here i'm converting encBuffer to FFT, doing modifications, then inverse FFT result to output array
*/
// overlap/mix the output
for (int a = 0; a < fftSize / 2; a++)
output[a] = ((output[a] * a + lastoutbuf[a] * (fftSize / 2 - 1 - a)) / (fftSize / 2 - 1));
// retain 2nd half of output
Array.Copy(output, fftSize / 2 - 1, lastoutbuf, 0, fftSize / 2);
// copy first part of output for stream put data
Array.Copy(output,0, tempBuffer, 0, fftSize / 2);
Bass.BASS_StreamPutData(recStream, tempBuffer, tempBuffer.Length);
// call get data just to move to the end of recorded stream
Bass.BASS_ChannelGetData(recStream, tempBuffer, tempBuffer.Length);
} // end while