surikov / webaudiofont

Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
https://surikov.github.io/webaudiofont/
GNU General Public License v3.0
891 stars 92 forks source link

Stop or pause event for WebAudioFontPlayer to listen to #86

Closed etayluz closed 2 years ago

etayluz commented 2 years ago

I am able to play audio with player.queueWaveTable but how do I know when WebAudioFontPlayer has finished playing? Are there any events I can listen?

How do I know the current time of the WebAudioFontPlayer so that if there are no events to listen to - at the very least I can poll the current timer of the WebAudioFontPlayer using a re-current timer function.

surikov commented 2 years ago

read old answer https://github.com/surikov/webaudiofont/issues/62

read docs https://surikov.github.io/webaudiofont/npm/src/docs/classes/player.WebAudioFontPlayer.html#cancelQueue https://surikov.github.io/webaudiofont/npm/src/docs/modules/otypes.html#WaveEnvelope

etayluz commented 2 years ago

I don't understand, is there a 'finishedPlaying' event I can listen to? I need to update the UI and I need to understand the current state of the player - not only if it is currently playing but also the exact time and which note is currently being played.

How can I get a callback to a function that is invoked when the note is done playing?

This doesn't answer my question regarding listening to the player: https://github.com/surikov/webaudiofont/issues/62

surikov commented 2 years ago

This is wavetable synthesizer, not a player. WebAudioFont does not emit any events.