Closed furudean closed 3 years ago
The goal of this library is to provide a unified API surface in all browsers. It should not be necessary to do any feature detection in your own code. That's why in general a feature is only available in standardized-audio-context if it can be used in every browser.
No rule without exceptions. There are some things which throw a NotSupportedError when used in a browser which doesn't have this feature.
But in this case I would rather not like to introduce an exception since as far as I know everything that can be done with the detune AudioParam can also be done with the playbackRate AudioParam. Please let me know if you have a use case which can't be implemented with the playbackRate AudioParam.
After looking into it more, I figured out that this was indeed possible to solve using playbackRate
.
function detuneWithPlaybackRate(cents) {
const semitones = cents / 100;
return 2 ** (semitones / 12)
}
source.playbackRate.value = detuneWithPlaybackRate(600);
Thanks!
From the README,
What is the rationale behind at least not implementing it for supported browsers and throwing if its not? It's a no-go for me to use standardized-audio-context due to the lack of this feature, since even on supported browsers I can't use detune.
Is there a way around this?