Glenn Maynard wrote:
By the way, if anyone knows of fast (eg. fast enough to run a stream, possibly two, in realtime in a game), acceptable-quality, BSD-licensed or similar[1] implementations of an equalizer or resampler, I'd love to know of it. I don't know enough on the topic to write my own.
The only equalizer code I've looked at is the ones FB2k uses, but that takes about 8% CPU on my K7/1000 for a single stream, which is far too much.
I've looked at lots of resampling code, but most fall over on 44.1<->48khz. FB2k's does it, but it's also too expensive (also about 8% on my machine). I need arbitrary rate changes, as the game has modes which play music at variable rates (but it doesn't need to be able to change resample rates smoothly).
The best resampling library I know of is libsamplerate by Erik de Castro Lopo: http://www.mega-nerd.com/SRC/
It has 5 resamplers, including zero-order-hold, linear, and three quality levels of sinc interpolation. It's quite fast and sounds great.
Unfortunately it's GPL. This presented a problem for some projects I was working on, so I recently wrote a new resampling library, with the goal of coming close to the speed and quality of libsamplerate, but with a LGPL or BSD library. I ended up using the LGPL resample-1.7 code from CCRMA as a starting point, but rewrote the code to use a library interface and using modern C programming style and autoconf. My library is called "libresample" and is available here:
http://ccrma-www.stanford.edu/~jos/resample/Available_Software.html
I admit that libsamplerate is both faster and higher quality, so I hope it works for you. But if you need less restricted software, libresample is just as easy to use and should sound much better than just linear resampling.
Both libraries support changing the sample rate on the fly, so you can create nice warping effects, but libsamplerate is limited to a rate change of 1/12...12x. My resample library has no artificial limitations like that, but obviously the quality will degrade if the ratio is very large or very small.
BTW, I'm interested in Equalizers, too, so if you end up finding anything worthwhile, please let me know.
- Dominic