code2k at March 23rd, 2007 11:07 — #1
Hi, Does anyone know how to filter Low Mid High frequencies throughout a secondary buffer of sound in ONE GO, RATHER THAN letting the mixer mix it into the Primary in realtime when it is played, which causes latency.
I am doing the latter already, using the IID_IDirectSoundFXParamEq8 interface to set param equalizer effects, -but would prefer to apply the filtering to the entire secondary buffer before playing it. Is something like this possible ?
reedbeta at March 23rd, 2007 13:11 — #2
Well, I don't know exactly how equalizers work, but it's related to the Fourier transform. You break the sound data into "frames" of N samples long (usually N is a small power of two, like 8 or 16) and do a discrete Fourier transform (DFT) on each one. The DFT starts with N samples in the time domain and results in N samples in the frequency domain; you can then scale the power levels in the low/mid/high frequency ranges as you desire and apply the inverse DFT to get back to the time domain. You can use a larger frame length to get a finer granularity of frequency control, but it will be slower to process.
code2k at March 23rd, 2007 13:27 — #3
Thanks for that. I think probably for myself the best approach would be to use some DirectSound technique and let it do the processing but I can't for the moment see any DSound funtion that allows me to process a whole chunk of sound data before I play it back on the sound buffer. Any ideas ???