8000 midi: add DLS (DownLoadable Sound) support by T-X · Pull Request #28350 · musescore/MuseScore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

midi: add DLS (DownLoadable Sound) support #28350

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

T-X
Copy link
@T-X T-X commented Jun 11, 2025

(Partially) Resolves: #28202

This pull-requests adds support to parse and use DLS (DownLoadable sound) with MIDI. Currently this is only enabled on Linux, as I don't have access to other OSes.

  • I signed the CLA
    • I only grant these rights to the changes I made in this PR. And will likely refrain from future contributions, I had only noticed this CLA upon filing my PR. I oppose to clauses 1 and 2, as in my opinion such asymmetric rights are against the spirit of the GPL. Also the wording in the CLA is false, "In order to clarify the intellectual property license granted with contributions from any person or entity, MuseScore must have a Contributor License Agreement (CLA)" -> this is simply untrue
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

T-X added 2 commits June 11, 2025 14:25
When building MuseScore without NO_THREADS then there are a few, small
build errors. This changes fixes them.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Glib is required by the libInstPatch library, which is required by
fluidsynth for DLS support.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
@igorkorsukov
Copy link
Contributor
igorkorsukov commented Jun 11, 2025

I think it is not reasonable to add a dependency on glib to the cross-platform application to support a rarely requested feature.
I think that creating a plugin (for example, VST) that uses FluidSynth is more suitable for solving your problem.

@T-X
Copy link
Author
T-X commented Jun 11, 2025

Oh, from the comment from @cbjeukendrup in the linked issue ticket I was under the impression that enabling the DLS support in fluidsynth for native DLS support in MuseScore, without needing an extra plugin, would be an option and desirable. And it seemed to me that DLS, standardized by the MIDI Manufacturers Association, used to be a popular standard, especially for video games. So that there would be demand for it and that it would be a nice addition to the MuseScore core?

How would using a plugin solve the dependency issue?

But I'm getting that Glibc might be tricky on Windows (and Mac OS?). I'm currently trying to figure out how ANMP did it. (But maybe their prebuilt Win10 executable was just built without libinstpatch support.)

@cbjeukendrup
Copy link
Member

Built-in DLS support via FluidSynth is, in itself, certainly reasonable and desirable, but I didn't realise in advance that it would involve adding GNU-specific dependencies. If there is a way without, that would be preferable. Otherwise, we might want to limit the feature to Linux only.

@igorkorsukov
Copy link
Contributor
igorkorsukov commented Jun 11, 2025

How would using a plugin solve the dependency issue?

That would be a plugin dependency... :)
or such a plugin can only be supported by Linux

T-X added 4 commits June 11, 2025 18:33
The libInstPatch library is required by fluidsynth for DLS support.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
We're going to add fluid instpatch / DLS support. To avoid adding many
type specific lines for cleanup and iterators then switch to using the
type generic handlers instead now.

While at it also remove the redundant "if (settings)" check before the
"delete_fluid_settings(settings)" call. This delete function will check
if settings is non-null internally anyway.

No functional change.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Fluidsynth itself already has support for DLS (DownLoadable Sound).
This adds the needed code to allow parsing DLS in MuseScore, too.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
DownLoadable Sound files typically have the extension .dls. Now that
the backend supports using DLS also allow loading the files with
the according file extension.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
@T-X T-X force-pushed the pr-fluidsynth-dls-support branch from fc3f0cd to a06094b Compare June 11, 2025 16:34
Currently, any channel 9 in a MIDI file is automatically added as a drum
instead of a melodic track. Which generally is the correct thing to do,
as this is how MIDI has it specified and standardized.

This new option allows to disable this behaviour though. Which is
especially useful when using DLS (DownLoadable Sound) as DLS has a per
channel bit to specify if it is a drum or melodic track.

Some extracted DLS files from N64 games, extracted via the
N64 Soundbank Tool (https://github.com/jombo23/N64-Tools/tree/master/N64SoundbankTool)
for instance, use a channel 9 and have the drum bit in DLS unset.
So this option would be needed to play such files
correctly.

The ANMP media player (https://github.com/derselbst/ANMP) has a similar option.

According to a disscussion on the FluidSynth issue tracker there
apparently is no way to detect and fix such a conflict between DLS and MIDI
automatically, hence such a manual option seems needed:
FluidSynth/fluidsynth#1576

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
@T-X T-X force-pushed the pr-fluidsynth-dls-support branch from a06094b to 0bedb4c Compare June 11, 2025 16:48
@T-X
Copy link
Author
T-X commented Jun 11, 2025

The CI should now also be happy, except for Mac OS. I could add some excludes to the cmake files for that, but I'd kind of be interested in Mac OS support, too. (As that's what my brother, who's a musician and music teacher who already uses MuseScore, is using and I would love to be able to maybe work on some N64 soundtracks with him :-) .) How could one get libinstpatch into the musescore_deps repository? Would one need to get libinstpatch into the Homebrew package manager first?

@cbjeukendrup
Copy link
Member

You can add it to the build script here:
https://github.com/cbjeukendrup/musescore_deps/blob/main/.github/workflows/macos.yml
And create a pull request at that repository.

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.

DLS for MIDI support?
3 participants
0