spessasus / SpessaSynth

MIDI SoundFont/DLS synthesizer library written in JavaScript.
https://spessasus.github.io/SpessaSynth/
Other
63 stars 5 forks source link

[BUG] Pressing Shift + Esc in Firefox causes all the voices to persist in App demo #33

Closed OpenSourceAnarchist closed 1 month ago

OpenSourceAnarchist commented 1 month ago

Version

The app or spessasynth_lib? Local Edition or github.io page? Downloaded from releases or via git clone? Please specify. App, confirmed in both local via git clone and the github.io page >=3.16.1

Description

Provide a clear and concise description of what the bug is. It occurs in two different cases. When the demo app is loaded, I use the mouse to make some notes play. I press Shift + Esc to view the Firefox process/performance page. When I switch back to SpessaSynth, the # of voices only increases. None of the notes are properly released and the tab slows to a crawl, with the audio breaking up. Switching back to the process/performance page, the tab is at 100% cpu usage! It is fixed by uploading a midi. When it loads, the voices are set to 0 and it autoplays normally.

In the second case, I load a midi and while it is playing, I hit Shift + Esc. Immediately, the audio becomes a cacophony of many notes/voices building on top of each other. The number of voices quickly goes to 450. This is fixed when I pause the playback. When I hit play again, the problem is not present and the midi plays normally. After the bug is triggered once and fixed with pausing/playing, I can't seem to trigger it again by pressing Shift + Esc.

Expected behavior

The voices are properly released, or maybe it is a problem with noteOff?

MIDI files and SoundFonts

Occurs with default and custom SoundFonts, with or without any midi file.

Environment

Testing on Firefox, Windows 11.

spessasus commented 1 month ago

Shift is the hold pedal bind. When you press it, the keyboard goes darker, indicating that the hold pedal is on. This only applies to the channel that is selected in the MIDI keyboard settings. If you switch it to a channel that has no voices, the issue won't persist.

Web app keybinds and usage

OpenSourceAnarchist commented 1 month ago

That explains the behavior... very useful, but just happened to conflict with me looking at the performance tab and being extremely confused. I know all the shortcuts now :)