-
Notifications
You must be signed in to change notification settings - Fork 10
modspeech doesn't work on iPad Safari 13.x and 14.1 (works on 14.5) #110
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
Comments
…111) - Workaround for #110 where we've observed that the sample rate of 19000 isn't supported. We'll aim to increase the sample rate in a separate PR but this will at least mean the simulator isn't put in a bad state. - Reuse the audio context created after the user interaction, as there are limits to how many you can create on Safari 13 (4 in my BrowserStack testing). I think we always intended to do this, but careful review needed as this is a more significant change than I was anticipating. We already had clean up code for the nodes when the board stops. We never cleaned up the context. So I think we were assuming it lived forever. If this doesn't work out then an alternative is to try closing the old one before creating the new one.
I've just tested There's also a
Yes, that's correct. I guess you would like to have the default mode compile-time configurable? |
@dpgeorge yes, I think it would make sense for the simulator build to define the mode. |
OK, I've now pushed a commit to the #define MICROPY_PY_SPEECH_DEFAULT_MODE (3) |
Needs testing but likely closes #110
Thanks, confirmed this works in Safari 13. I'll close this issue when the simulator changes are merged. |
On #109 we fixed audio for older Safari by using the prefixed APIs and older style of node/buffer creation.
It didn't fix speech because modspeech uses a 19000 sample rate but old Safari has a lower bound of 22050 (contrary to the spec but it was early days).
Coincidentally (I assume!), modspeech has a mode=3 option that doubles the sample rate. That mode works in Safari 13. There’s also some code for linear interpolation but not sure it happens with mode=3 or whether it's needed for an OK result.
So far as I can tell we can only trigger mode=3 by passing an undocumented mode keyword argument from user code.
@dpgeorge what is the mode used for? Do you think we could use this or something similar to get a >= 22050 sample rate in the simulator? We could consider doing this just for older Safari if we felt it would impact the output. We could detect the need to do this in the speech hal init function or any point after a user interaction with the simulator.
Alternatively we could look at resampling in JavaScript between modspeech and Web Audio. The older Web Audio API has no support for this so we'd be doing it ourselves.
The text was updated successfully, but these errors were encountered: