fluidsynth icon indicating copy to clipboard operation
fluidsynth copied to clipboard

Incorrect DLS Support

Open spessasus opened this issue 5 months ago • 1 comments

FluidSynth version

Execute fluidsynth --version and provide the output.

FluidSynth runtime version 2.3.6
Copyright (C) 2000-2024 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

FluidSynth executable version 2.3.6
Sample type=double

Describe the bug

Provide a clear and concise description of the current situation, e.g. how the bug manifests. The DLS support in fluidsynth is missing critical features. The MIDI attached uses bank selects and attached gm.dls has them (like Square or Sine Wave) but fluidsynth defaults to bank 0 (Square Wave).

Another very important thing are the drums. They use 0 tick length notes (quite common) but there's no sound, indicating that it doesn't support volEnvDecay in DLS!

I've attached an sf2 converted version of this soundfont, and playing apple.mid with it works fine.

Expected behavior

Provide a clear and concise description of what you expected to happen. Playing apple.mid through gm.dls should sound exactly like playing it with GS Sound Set (16-bit).sf2.

Steps to reproduce

Please explain the steps required to duplicate the issue, esp. if you are able to provide a sample application. E.g. how to start fluidsynth, what shell commands to enter, what midi events to send, etc.

  1. Download the attached file
  2. fluidsynth gm.dls -o synth.device-id=16 -o synth.gain=0.5 apple.mid

dls_fluid_issue.zip

Additional context

If you are able to illustrate the bug with an example, please provide simple source code below or as attached file. List any other information that is relevant to your issue, e.g. stack traces, related issues, build logs, suggestions on how to fix, links to related discussions at fluid-dev, etc.

Since fluidsynth seems to ignore articulators entirely, here's some helpful stuff I found out:

I've made my own DLS to SF2 converter (which I used to convert the file) and all parameters are stored using DLS articulators (think SF2 Modulators). My converter checks if source, control (secondary source in SF2) and transform are all 0. That usually means a soundFont generator.

If not, there are a few special cases: for example source is VibLfo and destination is pitch, then it's VibLfoToPitch (and sometimes control is modulation wheel, so that's a modulator). Or another case, source is keyNum and destination is VolEnvDecay, that's keyNumToVolEnvDecay. Note that in this case, (keyNum to something) there's a special correction that I needed to apply.

Other than that, it tries to transform the remaining articulators into SF2 modulators.

I hope this helps!

// I can paste the entire DLS parser here if you want ;-)

spessasus avatar Aug 26 '24 23:08 spessasus