This is really a tough nut to crack. If it's a single thread, for every output sample, you are adding the results of several FIR filters running in parallel. Some FIR filters are for short impulse responses and shorter buffers. When a sample is output, you must check each filter to see if it has work to do. You do the shorter FIRs first. When a shorter ...
# wiener filter
#f, t, fourier = stft(filtered, fs=fs)
#yw = wiener(fourier)
#y = np.asarray(istft(yw))
#y = y[1, :]
y = wiener(filtered)
and it appears to work for me.
This is the absolute value of the FFT of the resulting signal:
and this is the Wiener filtered signal:
Otherwise, you're doing a Wiener filter on the STFT of the signal which will ...
Like others have said, doing this for a simple, clean, monophonic tune played using a sinusoid tone generator is one thing. Doing it for a complex mix is another. Simple sing-along note books ofte get it plain wrong (over and above simplifying things), so it is hard for humans, too.
For simple input, I would consider doing a STFT, assigning pitches to 440*2^(...
Ask yourself this question: what happens if you multiply a sine wave with another sine wave sample-by-sample? If you now sum the result over the period of one of them what do you get? How does this change if the two sine waves have the same frequency?
If time of arrival differences are significant for some sources in some frequency bands, then one might speculate that this should be detectable using something ala crosscorrelation or its frequency domain equivalent.
For a perfectly aligned microphone pair, I would assume that such time differences are fewer and smaller.
It's easy to tell if you can find passages in the track that are "hard panned". If there is mostly time difference, it's A/B, if it's mostly level difference it's X/Y.
You can also look at the average power spectrum of the sum and difference channel. I'm suspecting that A/B will show some signs of comb filtering correlated to the microphone spacing....
The answer has a lot to do with your point #4. The magnitude of the filter you are building by selecting some frequencies by hand has to be an even function to make sure its impulse response is real.
But even if you do that, you will notice that the filtering is not good.
To show you why this happens lets build a simple example using octave/matlab. First of ...
Repeating what I suggested before:
Your best shot is to time align the signals before you mix them and avoid the comb filter in the first place.
An "anti-comb" filter can be done, but you have to match the fundamental frequency, the depth and the "Q" of the comb very carefully, otherwise the correction will make things only worse. You ...