[sdlsound] alt_audio_convert

Max Horn max at quendi.de
Tue Mar 11 19:10:36 EST 2003

Am Dienstag, 11.03.03 um 23:28 Uhr schrieb Ryan C. Gordon:

>> I've assumed it's incomplete, since it's not the default.  I gave it a
>> brief try, since a lot of people are complaining about the low quality
>> sample rate conversions (esp. 22khz and 48khz; we always play in 
>> 44khz),
>> but I only got noise.
>> Should I try to fix it yet?
> It's partially functional, but definitely incomplete. I haven't gotten 
> any
> patches from the person who wrote it for several months, so if you 
> want to
> tackle it, you are most welcome to do so.
> The default (non-alt) rate converter is a cut-and-paste from SDL12. The
> original intention was to improve it in SDL_sound and merge the changes
> back into SDL itself, but this never happened...ideally, we should 
> either
> fix altcvt or at least get rid of the cut-and-paste job and call SDL's
> converter on the default path to get rid of the duplicate code.
> SDL's rate converter only handles powers of 2, so you can go from 
> 22khz to
> 44, but not 48...this tends to be, well, disastrous, so I'd really 
> like to
> see altcvt finished.
Actually even the rate 2 conversion is pretty bad. One might think that 
just duplicating every sample is sufficient for a rate conversion from 
22khz to 44khz (or vice versa, leaving out every second sample) but 
that's actually not true - you are introducing undesired new bands into 
the output data. The "proper" way is to add some filters afterwards.... 
admittedly it's been far too long since i did anything on this topic so 
please excuse the sloppy wording, but I hope the idea gets across. 
There are some great "full" resamplers out there, but I am not sure how 
many of those are fit for real time resampling. Anyway having full 
support for arbitrary rate conversions would be cool. It might even 
convince me to rewrite ScummVM to use SDL_Sound :-) (in ScummVM I right 
now use a hand rolled rate converter based on cubic splines which can 
upsample to arbitrary rates, but it also doesn't contain any low pass 
filtering etc. so it's not optimal - plus it doesn't support 
downsampling, i.e. you can't go from 48khz to 44khz - otherwise I'd 
donate that code). Some keywords one might want to google one are FIR 
and low pass filtering... e.g. google on "sample rate conversion FIR".



More information about the sdlsound mailing list