web-audio-api-rs icon indicating copy to clipboard operation
web-audio-api-rs copied to clipboard

Resample when the requested sample rate is not available on the audio output device

Open orottier opened this issue 3 years ago • 0 comments
trafficstars

You can specify the requested sample rate via AudioContextOptions.sample_rate If this sample rate is not available at the audio output device, we fall back to a value that is supported. However, the spec mandates that in that case, the audio graph should still render at the user requested sample rate, and only at the DestinationNode one should resample to the rate that is required for the output device:

https://webaudio.github.io/web-audio-api/#AudioContext-constructors

If contextOptions.sampleRate is specified, set the sampleRate of this AudioContext to this value. Otherwise, use the sample rate of the default output device. If the selected sample rate differs from the sample rate of the output device, this AudioContext MUST resample the audio output to match the sample rate of the output device. Note: If resampling is required, the latency of the AudioContext may be affected, possibly by a large amount.

orottier avatar Jul 20 '22 11:07 orottier