-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable sustain/sostenuto pedals after last MIDI event #1167
Conversation
43f4aae
to
1c63637
Compare
Oh really? Sounds like a bug. Could you provide an example MIDI where you've observed that? |
Sure! I'm using a recent commit on master ( Just for fun, add a debug line at
Then, I tried to fast-render jtbach.mid using the FluidSynth-provided SF2 file
(Realtime-render does the same thing if you wait for the song to end, and other SF2 files also seem to do the same thing.) When I do this, it eventually just repeatedly spams:
|
Ok thanks! The problem is that MIDI channel 0 activates the sustain pedal pretty much at the end of the track, but doesn't disable it, causing some notes to keep playing in sustain forever. Therefore I would suggest the following more straightforward fix:
It worked fine with the MIDI you provided. You might want to test a few more. |
1c63637
to
8663791
Compare
I've made the change you recommended (with a twist; it only applies the pedal changes once). This change seems to work on all of the files I have to test with. The 2000ms extra for reverb still seems like overkill to me, but I'm running with default reverb settings. |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
While working with a larger set of MIDI files with the changes in #1159, I discovered that for some of the files,
fluid_synth_get_active_voice_count(player->synth)
never goes to zero (at least, not after as long as I was willing to wait for it, maybe 15-30 seconds). This causes the player to appear to terminate automatically on some songs bug hang indefinitely on others.In an attempt to prevent that situation, this PR changes the post-MIDI-events player logic in #1159 from "wait until
fluid_synth_get_active_voice_count(player->synth)
is zero, then wait untilFLUID_PLAYER_STOP_GRACE_MS
have elapsed" to instead "wait until eitherfluid_synth_get_active_voice_count(player->synth)
orFLUID_PLAYER_STOP_GRACE_MS
have elapsed".