Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.52k stars 983 forks source link

"NotSupportedError" when connecting an LFO to ToneBufferSource.playbackRate in iOS 14.4 #853

Closed alexbainter closed 3 years ago

alexbainter commented 3 years ago

Describe the bug

When connecting an LFO to a ToneBufferSource's playbackRate param, a NotSupportedError is thrown in iOS 14.4.

To Reproduce

Visit https://jsfiddle.net/5re3y0kt/4/ from an iOS device. If you click "start," you should see "NotSupportedError" appear below the button. In other browsers, "it worked" appears.

You can also reproduce it with the following:

const bufferSource = new Tone.ToneBufferSource()
const lfo = new Tone.LFO();
lfo.connect(bufferSource.playbackRate);

Expected behavior I'd expect to be able to control playbackRate with an LFO in iOS.

Additional context I don't have reliable access to an iOS device, and I don't have any access to a Mac, so it's been tricky for me to investigate this further but I will continue to do my best. This was the simplest reproducible example I could get to so far but I realize this might really originate in standardized-audio-context or even WebKit itself. I'll keep looking into it and update this issue as I find out more.

chrisguttandin commented 3 years ago

Hi @metalex9, this is one of the things that didn't work in Safari and couldn't be re-implemented in user-land without huge tradeoffs. Please see chrisguttandin/standardized-audio-context#479 for more details.

However I just realized that newer versions of Safari do support this but since I chose to use something else to determine if it is supported or not all version of Safari throw the error right now.

https://github.com/chrisguttandin/standardized-audio-context/blob/2cd50c0684eda5d0ea652ba47b4845d50c061f78/src/factories/audio-node-constructor.ts#L407-L414

I'll have to come up with a better way to only throw the error when actually necessary.

alexbainter commented 3 years ago

@chrisguttandin Thanks for the explanation!

chrisguttandin commented 3 years ago

v25.1.12 of standardized-audio-context contains the fix which should make it work in the latest Safari.

tambien commented 3 years ago

thank you @chrisguttandin!

alexbainter commented 3 years ago

@chrisguttandin Wow, thank you so much!