Conversation
Co-authored-by: derselbst <8152480+derselbst@users.noreply.github.com>
Co-authored-by: derselbst <8152480+derselbst@users.noreply.github.com>
…1-7d0c-432f-bb0f-a14b68601b23
derselbst
left a comment
There was a problem hiding this comment.
This actually works, I'm surprised! Some minor issues below.
…1-7d0c-432f-bb0f-a14b68601b23
…1-7d0c-432f-bb0f-a14b68601b23
|
TODO: complete unit test |
|
@spessasus I have solved the portamento issue, in case you want to have a look / listen. Portamento is now also audible in |
src/synth/fluid_chan.c
Outdated
| res = res < Max ? res : Max; | ||
| // Apply a similar scaling hack as SpessaSynth to fix Descent Game08, it's unclear why exactly | ||
| // https://github.com/spessasus/spessasynth_core/blob/0b2d44f48065d3d6bbca24a1d40223b1255dab00/src/synthesizer/audio_engine/engine_methods/portamento_time.ts#L84-L86 | ||
| res = (unsigned int)(res * abs(tokey - fromkey) / 24.0f + 0.5f); |
There was a problem hiding this comment.
Note that I changed that scaling factor to two octaves / 24 semitones. Sounds more natural to me, at least given those few test files that I have.
Actually, it's the other way around. I have access to Sound Canvas VA and SYXG-50 VSTi, and the portamento is way faster there. I have changed my calculation just now to divide by 36 and galactic invasion, cybergate and mm6 all sound much closer to the syxg50. |
|
Ok, fine I guess, still enough portamento left. |
spessasus
left a comment
There was a problem hiding this comment.
@derselbst
I tried it and the portamento sounds too slow,, esp. in Galactic invasion.
I recommend using the DLSbyXG.dls file which uses a sine wave there (LSB 66) instead of a square, making the portamento more clear. Try comparing it with spessasynth or syxg50.
This is probably caused by the fact that you aren't actually using John Novak's SC-55 table but rather approximating it with a concave function.
Also one more thing, though it relates to DLS: drum bank selection seems broken there too. IIRC the preset selection logic is different there . In galactic invasion, the XG drum presets have a finger snap which is played at the start multiple times, yet it's absent when running fluidsynth with DLSbyXG.dls, indicating that it uses GS drums...
Co-authored-by: Stanley <spesekspesek@gmail.com>
|
The curve was indeed a bit off for small CCs. I've tuned it a bit. John only used two MIDIs to derive this curve, I think that should be fine now. Speaking of him, he might be interested in what we're haggling about. I'll give you and @johnnovak a chance to reply before fixing the unit tests yet again ;) Details
|
|
@derselbst Great to see this getting implemented 🎉 I don't have too much time to do testing on this, but if the new values track my "reverse-engineered" curve closely, it should be good. @spessasus has generalised my measurements—again, don't have time to spend too much time on checking that, but I trust his ears 😄 I agree that the start of the curve is very important—composers tend to use those lower values when the portamento is used as a subtle embellishment to create a subtle "snap" at the start of the notes. If the effective portamento times are too long for those low CC values, we'll get audible pitch glides instead of the "snap" effect. This might sound like "out of tune" music in more extreme scenarios with fast notes. If you think about it, it's almost certain the hardware uses a custom curve built up using a few linear segments (via some table lookup, perhaps), so probably a similar approach is the easiest in the emulation code. But if you managed to find a single function that fits closely, that's good too 😄 |
…1-7d0c-432f-bb0f-a14b68601b23
|



Problem
FluidSynth currently always uses 14-bit portamento time calculation (
MSB * 128 + LSB), which causes compatibility issues with older MIDI files that only send MSB values and expect 7-bit behavior. This affects classic MIDI files like those mentioned in issues #705, #1232, #1311, and #1456.Solution
This PR implements a new global tri-state setting
synth.portamento-timewith three modes:auto(default): Start with 7-bit MSB only, automatically switch to 14-bit when an LSB portamento event is detected on any MIDI channelxg-gs: Always use 7-bit MSB only (for older MIDI files compatibility)linear: Always use 14-bit MSB+LSBAdditionally, it changes the default portamento mode to
FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE, causing portamento to be applied to every note, and not just those notes played in succession (=legato) as before.Backward Compatibility
The default
automode maintains existing behavior - files that use both MSB and LSB will work exactly as before, while files that only use MSB will get the expected 7-bit behavior.This resolves the portamento compatibility issues with older MIDI files while preserving full functionality for modern usage.
Fixes #705, #1232, #1311, #1456, #1495, #1517