Fix Sf2 Player's reverb and chorus effects - #8274
Conversation
|
Other than that this will probably break backward compatibility (I have absolutely made projects using the parameters assuming that they worked and failed to disable when they didn't, and I'm certain others have too, we will probably have to fix that), I do have a query. |
I didn't consider this, and I think it also brings up the question of how to handle it if someone had an effect enabled and it just happened to work for their soundfont.
From what I found in Polyphone (and probably the SoundFont specification too), the only control that a soundfont has (outside a file/sample with the effect baked in) is one generator/parameter for each effect to control the percentage of each effect. All of the other parameters for an effect (like reverb damping and amount of chorus voices) are within the program/player playing the soundfont (in this case, the Fluidsynth library used by Sf2 Player), rather than the soundfont itself. So they're actually just audio effects built into Sf2 Player, with the soundfont determining the effect amount. Not sure if it makes sense or if it's actually how it works though. |
https://discord.com/channels/203559236729438208/203559236729438208/1475444249955667998 |
Thanks for the information (and a explanation more concise than mine)! With this in mind though, I might add some new modes for reverb/chorus effects to better support Soundfonts that already have reverb effects. The four I have in mind:
If you or anyone else has any other feedback (before I think about adding it in), feel free to bring it up. |
|
I'm not entirely sure how it works, and it's possible some have fluidsynth's inbuilt set available for enabling as you mentioned. |
Added check to ensure older projects with effects enabled don't sound different (by disabling said effects). Additional TODO notes are in DataFile.
|
Does your commit run a backward compatibility check, or does it universally turn it off? |
|
This is not backward compatibility. |
|
Backwards compatibility is tricky here because this has been a problem for a very long time. If there is a reasonable way on project load to detect if a soundfont was previously broken and saved in an old version, then the chorus/reverb parameters should be silently set to 0 to preserve the project's behavior. If there is no reasonable way to detect this (which sounds like it might be the case), then backwards compatibility might be more trouble than it's worth, and users can either turn their chorus & reverb off or load their project in an older version of LMMS. |
|
Honestly, the whole problem of getting this to work with old projects and various different SoundFonts has kinda made it difficult for me to continue working on this PR, and it's made me contemplate whether it should be fixed at all (especially if I'm approaching it incorrectly and there's if there's no other solution for backwards compatibility). I did randomly think of an alternate solution that involves setting the MIDI controllers directly within LMMS (through the MIDI CC rack) when reverb/chorus is toggled, but I don't know if an instrument can and should be allowed to do that. Not to mention it would also require a fix that actually sends the controllers from the rack to Fluidsynth (they currently aren't). I might ask more about this on the Discord (but not now because college is scary!!) because I don't want to try implementing something that could be even more iffy than what I already had. |
I was initially going to have everything in Sf2Player, but I didn't know (until now) if other instruments had version checks when loading/saving settings. There is still no check for default reverb/chorus parameters since there doesn't seem to be a good way to determine them (within Fluidsynth) without janky workarounds.
|
This was randomly closed (see #8448 (comment) for why), but I've been thinking of closing this for a while. There's still some problems with keeping it backwards compatible with older projects and whole bunch of other alternatives I need to consider. I've also been thinking of actually making a PR for #8437, which would at least allow the user to force-enable reverb/chorus if they need it. It also relates to my previous comment/idea. |

This PR fixes Sf2 Player's built in reverb and chorus effects not working with most soundfonts by automatically setting some MIDI controllers that control them (controllers 91 and 93). From what I looked at in the SoundFont specification, controllers 91 and 93 add to soundfont generators/parameters for reverb and chorus effect sends. Some of the soundfonts I looked at (i.e. just the SGM soundfont) don't have anything set for those generators, resulting in a default value of 0 and no audio being sent or processed by any effects.
I typically use separate audio effects for reverb and chorus, but I think it's still useful for beginners who might not know about them yet (and see the ones in Sf2 Player).
Some other notes (might out of scope for this PR?)