davy7125 / polyphone

A soundfont editor for quickly designing musical instruments.
https://www.polyphone.io
GNU General Public License v3.0
344 stars 45 forks source link

releasing sustain pedal sometimes cuts off held notes #184

Closed mrbumpy409 closed 5 months ago

mrbumpy409 commented 5 months ago

Repeating a note already held by the sustain pedal and then releasing the pedal cuts off the note, even if the key is still being held down. Tested using current git Polyphone, but the bug is present in older versions as well.

Steps to Reproduce

  1. Using any SoundFont preset with sustainable tones, play and hold a note via MIDI keyboard.
  2. Depress the sustain pedal.
  3. Repeat and hold the same note as in step 1.
  4. Lift the sustain pedal.

Actual Result

The note cuts off.

Expected Result

The note should continue as its key is still being held down.

davy7125 commented 5 months ago

productive day today :) This bug was also with the sostenuto pedal (not sure it is commonly used though)

mrbumpy409 commented 5 months ago

Unfortunately, the fix to this bug has introduced another bug:

  1. Press sustain pedal.
  2. Play and release a note.
  3. Release the sustain pedal.

Actual Result

The note continues to ring after the sustain pedal is released.

Expected Result

The note should cease playing when the sustain pedal is released.

mrbumpy409 commented 5 months ago

In case it's helpful for narrowing things down, whether or not a note is released has to do with whether the key or pedal is released first:

Scenario A: play note, pedal down, pedal up, release note: SUCCESS Scenario B: play note, pedal down, release note, pedal up: FAIL Scenario C: pedal down, play note, pedal up, release note: SUCCESS Scenario E: pedal down, play note, release note, pedal up: FAIL

mrbumpy409 commented 5 months ago

Also, I haven't had a chance to test it yet, but your sostenuto logic appears to be inverted. In sources/context/mididevice.cpp line 374, shouldn't the check be: if (value < 64)?

mrbumpy409 commented 5 months ago

Okay, so I have found the issue and solved it in code. I will open a new ticket for the matter and create a pull request.