[openal] Questions about OpenAL Soft's Resampler

Ethan Lee flibitijibibo at flibitijibibo.com
Tue Nov 7 14:10:33 EST 2017


Hey there!

I'm currently working on a reimplementation of Microsoft's XACT runtime, 
called FACT...

https://github.com/flibitijibibo/FACT

... and one of the things we have to deal with is resampling Wave data, 
similar to how OpenAL has to resample buffers to match the output 
frequency. Since we're using SDL for audio output I gave SDL's own 
resampler a try, and it actually works for basic output...

https://github.com/flibitijibibo/FACT/blob/5f11030964a735c05f3ff7507919e4ad2879539a/src/FACT_platform_sdl2.c#L97

... but I also have to factor in pitch changes, which SDL_AudioStream 
doesn't account for (it only expects one input frequency for the 
duration of its existence).

Normally I'd just use OpenAL for this sort of thing, but part of FACT's 
job is mimicking XAudio2 accurately, which unfortunately makes the two 
incompatible in really subtle ways (and fixing them would mean ripping 
up the library for what is essentially one exact use case and nothing 
else). I'd still like to use OpenAL's ideas though, but to keep the 
permissive license intact I'd have to, at most, look at papers/documents 
that explain how it's done, rather than just using the code directly.

TL;DR: How does OpenAL's resampler work with adjustable pitch changes, 
and are there any resources online that were used as references for the 
resampler? I'm not too concerned about the resampling function itself 
(we'll probably just use a linear resampler), but I'm a lot more 
concerned about stuff like weird step sizes, fractions of samples, 
padding buffer sizes (for both resampling and possibly for output...?), 
handling wildly fluctuating pitches, little details like that.

-Ethan



More information about the openal mailing list