-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support for multiple tracks #18
Comments
Hi! I think the demos from the docs page might be a good example of how to do this: https://github.com/esonderegger/web-audio-peak-meter/blob/master/docs/index.html#L182-L195 Basically, For every page, you want to only have a single web audio context:
But then you can have as many meter nodes with corresponding meter elements as you like. This code can be run in a loop, or customized to fit your use case:
And finally, you need to have a way to ensure the web audio context is started as a result of a user action. Since this library was written, browsers have begun restricting the web audio API so that the context cannot be started without an explicit user action. So there needs to be something like this that will be triggered by something like a user clicking to start playing audio.
Hope this helps! Please let me know if it works for you. |
Hi,
When I create HTML code audio with different names and use example javascript code
the only for the first file played show peak meter. It will be nice to see a working example code for 2 or more files displaying peak meter. |
@sp2ong You would need two meter instances and two audio elements. Plus you would have to set the Id's uniquely, as usual. |
Hello @esonderegger ,
Not an issue, just a question.
Can you please provide me an example about how to use the Peak Meter with Web Audio API playing multiple tracks at the same time?
Thanks in advance.
The text was updated successfully, but these errors were encountered: