Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable sample rate conversion quality #2398

Open
bjornm opened this issue Mar 25, 2014 · 5 comments
Open

Configurable sample rate conversion quality #2398

bjornm opened this issue Mar 25, 2014 · 5 comments
Projects

Comments

@bjornm
Copy link

bjornm commented Mar 25, 2014

I would like a way to control the sample rate conversion quality applied when the AudioContext.sampleRate does not match the underlying output device. The quality could be described as e.g. low latency, low cpu (linear interpolation) or high quality (FIR convolution). This should preferably be configurable at runtime to adapt to host performance. Example:

enum SampleRateConversionQuality {
"fastest", // no interpolation at all
"fast", // linear interpolation
"normal", // fir convolution
..
}

audioContext.sampleRateConversionQuality = ...;

SampleRateConversionQuality would also make sense for AudioBufferSourceNodes with playbackRate != 1 and possibly for WaveShapers with upsampling. Maybe some other nodes as well?

I'm unsure as to whether these settings make sense in all situations. E.g. would it make sense to use no interpolation at all for an upsampled waveshaper when the whole purpose of upsampling is to increase quality?

@cwilso
Copy link
Contributor

cwilso commented Oct 30, 2014

This is subjugated to #300.

@mdjp
Copy link
Member

mdjp commented Nov 6, 2017

Makes sense as audio context contructor property. Will keep for v.next.

@mdjp mdjp transferred this issue from WebAudio/web-audio-api Sep 17, 2019
@padenot
Copy link
Member

padenot commented Jun 10, 2020

Virtual F2F:

  • Measuring the cost of high-quality resampling needs to be done before allowing to change this from being UA specific

@padenot
Copy link
Member

padenot commented Oct 21, 2020

TPAC 2020:

  • Being able to change the resampling quality of the AudioContext and also per node seem very useful.
  • The former because the latency added by a resampler can be significant (compared to, for example, the latency floor of an AudioContext, which is 128 frames for now)
  • The latter because sometimes you know your audio assets don't really deserve super high quality resampling and you'd rather spend the CPU elsewhere (say, a game with a gunshot asset, you'd rather spend the cpu on physics), or you want to save CPU cycles if the machine cannot sustain a high load (degraded mode that still works well vs. constant underruns)
  • It seems like the ability to set an AudioBufferSourceNode and AudioContext resampling quality/cost/latency trade-off at construction would be enough

@rtoy
Copy link
Member

rtoy commented May 20, 2021

Virtual F2F 2021: Everything from https://github.com/WebAudio/web-audio-api-v2/issues/25#issuecomment-713708269 still stands, but we'll probably only do this for an AudioContext and AudioBufferSourceNode.

@mdjp mdjp transferred this issue from WebAudio/web-audio-api-v2 Sep 23, 2021
@mdjp mdjp added this to To do in v.next via automation Sep 23, 2021
@mdjp mdjp moved this from Untriaged to Under Consideration in v.next Sep 29, 2021
@hoch hoch removed the priority-2 label Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v.next
Under Consideration
Development

No branches or pull requests

6 participants