esonderegger / web-audio-peak-meter

Customizable peak meters, using the web audio API.
https://esonderegger.github.io/web-audio-peak-meter/
MIT License
125 stars 33 forks source link

reset the peak reading after delay #17

Closed videojedi closed 2 years ago

videojedi commented 3 years ago

Not an issue.... just wanted to say thanks for a great bit of code.

What might be a reasonable way to reset the peak reading after a small delay?

Thanks again,

Richard

esonderegger commented 3 years ago

Hi Richard! Thank you for suggesting this!

I believe this has been implemented in an acceptable way in https://github.com/esonderegger/web-audio-peak-meter/pull/19 - and released in version 2.1.0 - when you have a chance, please check it out and let me know what you think.

To use it, in the options object (the third parameter to createMeter), include something like { peakHoldDuration: 5000, }, which would cause the held peak to reset after 5 seconds.

videojedi commented 3 years ago

Works perfectly, thank you!