[Openal] Audio rate conversion
Chris Robinson
chris.kcat at gmail.com
Thu Jul 31 16:04:43 PDT 2008
On Thursday 31 July 2008 07:57:03 am Stevens, Peter wrote:
> I'm running into what seems to be either openal-soft or alsa performing
> rate conversion when it is not expected. The situation is that if I play
> 60 seconds, 120 seconds, and then 180 seconds of streamed audio (using
> the same file) I end up with actual play times (via stop watch) of 61,
> 122, 183. The reason for the stop watch is that I wanted rule out any
> overhead associated with program startup.
Are you timing it from OpenAL's AL_SAMPLE_OFFSET or AL_SEC_OFFSET property, or
from the system time? If you're timing from the system, then it may be, in
part, simple timer drift. The audio card timer and system timer won't be in
perfect sync, so if the card plays one minute of audio, the system may be a
little off from that one minute.
> So it would seem I end up with
> a constant percentage of my audio being stretched? Can anybody explain
> this behaviour or has anybody seen anything like this happen before? The
> only thing I can think of is that somehow the audio stream is being
> resampled; is there a way to show when this is happening?
If the source buffer isn't the same frequency as playback, it must resample
otherwise it'd play back too fast or slow. The quality of that resample is
implementation/hardware dependant, though. OpenAL Soft does a basic linear
resample and should be accurate up to 1/16384th of a sample (14 bits
dedicated to sub-sample positioning).
More information about the Openal
mailing list