alsa-utils icon indicating copy to clipboard operation
alsa-utils copied to clipboard

when aplaymidi exits the sustained notes are played forever.

Open mercuriete opened this issue 5 years ago • 4 comments

Transfered from here: https://github.com/OpenTTD/OpenTTD/issues/7637

Expected Result

All notes are stoped before exit aplaymidi

Actual Result

Notes are sustained forever and I have to press the panic button on Qsynth

Steps to Reproduce

  1. Open Qsynth with fluid-soundfonts
  2. do this: aplaymidi --port 128:0 file.mid
  3. do control+c to kill aplaymidi
  4. Qsynth plays a note forever.

Possible fix

Capture SIGINT and send midi off messages before exit properly.

mercuriete avatar Jul 03 '19 20:07 mercuriete

I don't think aplaymidi should do any termination things by itself: the user had a reason for the abrupt ctrl+c. You can do manually something like:

amidi -S ff

folkertvanheusden avatar Jul 16 '21 09:07 folkertvanheusden

I understand that you think is not the responsibility of amidi to do a proper exit

but as I stated on the ticket... some "misbehaving" application can leave the "sound card" playing forever.

I think that after you finish a midi song... the card should be stopped.

thanks for your understanding.

the problem is described here: https://github.com/OpenTTD/OpenTTD/issues/7637

mercuriete avatar Jul 16 '21 10:07 mercuriete

I experienced this yesterday. It seems that the final Note Off message doesn't have a chance to be sent before aplaymidi closes itself upon reaching the end of a file. It's not exclusive to Qsynth, but any MIDI device. Perhaps some latency in MIDI message transferring should be accounted for before the application terminates.

wraybowling avatar Mar 10 '23 19:03 wraybowling

This issue is a common one among many users, as can be seen by a simple Google search, for example here: https://stackoverflow.com/questions/38687774/stopping-aplaymidi-leaves-stuck-notes.

None of the workarounds given do not work with software midi synths, as they can not accept raw midi commands (AFAIK). Instead users should fire up a sequencer, make an "all notes off" -mid file and play it.

A humble opinion: aplaymidi to send all notes off when CTRL+C has been given.

WildPenquin avatar Feb 28 '24 12:02 WildPenquin