I am trying to build a simple equalizer and i am trying Web AudioContext for the same. I have tried instantiating the context after a user click/gesture. and i see the state is running.
I have a slider that basically changes the gains to get the desired effect, the code works fine on chrome and firefox but on safari it does not and i do not see any errors/warning being thrown as well. I have tried the google chrome web audio docs as well but failed. Please help me finding what i am doing wrong.
Here is the link to deployed app: Demo
Here is the Code for the same: Code
Thanks.
- i tried checking if the state is suspended.
- tried resuming when user does any action.
- made sure the AudioContext state is running before changing gains.
- followed google chrome docs docs
Expected Behavior:
- The changes to gain should be observed when using safari and the audio effects should apply.
This seems to be a long standing bug in Safari.
https://bugs.webkit.org/show_bug.cgi?id=180696
Your demo works when playing a local file instead of a remote stream.
It's probably possible to write some code which loads the stream in chunks using
fetch()
and then parses and decodes it manually to finally play it with the Web Audio API. But it's certainly not an easy thing to do.