Skip to content
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

Per-channel ALL_SOUND_OFF when seeking/stopping player #980

Merged
merged 22 commits into from
Sep 28, 2021
Merged

Per-channel ALL_SOUND_OFF when seeking/stopping player #980

merged 22 commits into from
Sep 28, 2021

Conversation

albedozero
Copy link
Contributor

@albedozero albedozero commented Sep 15, 2021

  • Only send all sound off on channels which had notes playing
  • Send it as ALL_SOUND_OFF CC to a MIDI router to route it to a different synth channel afterwards

send fluid_synth_all_notes_off instead of fluid_synth_all_sounds_off when seeking the player, as the latter creates audio artifacts by cutting off notes without allowing them to complete their release phase
add an array that can be used to specify which channels to send all_notes_off when stopping or seeking the player
allow sending fluid_synth_all_notes_off on specific channels instead of all channels when seeking or stopping the player, but keep the default behavior of sending on all channels
@albedozero
Copy link
Contributor Author

Discussion/explanation in #981

@albedozero albedozero marked this pull request as ready for review September 15, 2021 06:30
MAX_NUMBER_OF_CHANNELS is limit when looping over player->notesoff_channels
put all relevant notes into release phase, regardless of sustain or sostenuto
avoids hanging notes, even when sustain pedal is depressed
add a setting that tells the player whether to call fluid_synth_all_notes_off for all channels when seeking/stopping, or send an ALL_SOUNDS_OFF event on only the channels that have played notes
remove calls to fluid_synth_all_sounds_off when seeking/stopping player and instead send ALL_SOUND_OFF control change event on playing channels
Copy link
Member

@mawe42 mawe42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good, just some smaller ideas/comments.

I think it could be extended to also send ALL_CTRL_OFF when seeking. That way we get around the hanging notes problem with sustain pedals.

src/midi/fluid_midi.c Outdated Show resolved Hide resolved
src/midi/fluid_midi.h Outdated Show resolved Hide resolved
src/midi/fluid_midi.c Outdated Show resolved Hide resolved
use a fluid_list_t to keep track of channels on which the player has sent messages
@albedozero albedozero marked this pull request as draft September 21, 2021 22:43
@albedozero albedozero requested a review from mawe42 September 22, 2021 19:56
src/midi/fluid_midi.c Outdated Show resolved Hide resolved
src/midi/fluid_midi.c Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

12.9% 12.9% Coverage
0.0% 0.0% Duplication

@albedozero albedozero marked this pull request as ready for review September 28, 2021 04:17
@derselbst derselbst changed the title Per-channel notes off when seeking/stopping player Per-channel ALL_SOUND_OFF when seeking/stopping player Sep 28, 2021
Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@derselbst derselbst merged commit 6c59318 into FluidSynth:master Sep 28, 2021
sykhro pushed a commit to sykhro/fluidsynth-pipewire that referenced this pull request Dec 7, 2021
- Only send all sound off on channels which had notes playing
- Send it as ALL_SOUND_OFF CC to a MIDI router to route it to a different synth channel afterwards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants