- Home /
Can OnAudioFilterRead be used with WebGl
I would like to do some audio synthesis with WebGl. My code compiles and it runs but no audio plays. Does OnAudioFilterRead not work with WebGl?
private void OnAudioFilterRead (float[] data, int channels)
{
for (int i = 0; i < data.Length; i++)
data [i] = sampleBuffer [i];
}
Thanks!
I'm using usfxr for synth and it's not working in the WebGL build. Getting this error:
Only custom filters can be played. Please add a custom
filter or an audioclip to the audiosource.
What's an example of a custom filter? How would one implement this, and does that mean I could capture all audio being passed through the AudioListener in a WebGL build?
Answer by zeh · Nov 09, 2015 at 02:38 AM
Yes, this seems to be a limitation of the current implementation of WebGL. I'm doing some research for usfxr and gathering my thoughts on an issue for the project.
Depending on what you're doing, you might be able to create your audio with AudioClip.Create
, but it'll mean losing the advantage of creating the audio on a separate thread (more info on that here).
Answer by Apidcl0ud · Apr 16, 2020 at 10:58 PM
Isn't this supported yet? The audio plays just fine now, but OnAudioFilterRead is still not called. Any reason why?
Your answer
![](https://koobas.hobune.stream/wayback/20220613201045im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Audio in WEBGL on IOS devices -1 Answers
Single AudioSource "Ran out of virtual channels" WebGL 0 Answers
Reverb Zone doesn't work in WebGL. 1 Answer
How can I get my audio files to work for WEBGL build? 2 Answers