Multiple soundfonts feature
Added feature
The user of the plugin can now install his/her own soundfonts inside the plugin's folder.
How does it work for the user?
Setup
- User copies his/her soundfonts (.sf2 files) inside the folder
gmsynth.lv2/soundfonts/ - User runs the python script
gmsynth.lv2/scan_soundfonts.py - Python sanitize soundfonts filenames and rewrites
manifest.ttl,gmsynth.ttlandsoundfonts_list.txt - User open his/her DAW and performs a plugin rescan.
- DAW now sees in its library one new plugin for each soundfont installed in this way
Usage
After setup the user has 1 plugin for each soundfont named gmsynth <sounfont_name>.
User can load any of these plugins on virtual instrument tracks.
Coding details
Python dependency
The setup and installation now depends on having python on the system.
I have chosen this method just for speed of development, the Python script can be converted into a C compiled program in order not to have the Python dependency.
It's just a bit more difficult to perform these tasks in C in a cross-platform way rather than writing a simple Python script.
Folder structure change
The default soundfont has been moved to the gmsynth.lv2/soundfonts/ subdirectory.
This is just to avoid having a mess of files when the user installs a lot of soundfonts.
soundfonts_list.txt
This is for the plugin.
I needed something easy to read when performing the function lv2_lib_descriptor() in order to avoid a complete directory read in search for all the soundfonts every time the plugin is instantiated.
Testing
Tested in REAPER daw on Linux Mint.
I compiled it and installed it on my system.
It worked with a rather complex GM file and had the default soundfont "GeneralUser_LV2.sf2" working as usual.
Then I copied a few of my soundfonts, run the Python script and rescanned for LV2 plugins in REAPER.
No errors, everything worked as expected.
I wish you had reached out before setting out on that task.
Sadly this is not what this plugin is intended for. GMsynth, as the name suggests, is a General MIDI synth that reliably produces the same GM/GS compatible sounds. It is intentionally simple and constrained.
However there is derivative project, using this codebase that does allow a user to load any soundfont: https://github.com/Ardour/ardour/tree/master/libs/plugins/a-fluidsynth.lv2 - includes MIDNAM support and can also report used patch/program to the host.
As for the actual implementation: I expect you will loose 90% of the users at step2. The casual musician won't know how to run a python script from the command-line. Furthermore it may also break sessions later, when you load an old session with a different configuration, or open the session on a different machine where a soundfont is not available.
On the upside, I'm glad that you were able to help yourself and found a solution that works for you!
PS. Filipe Coelho had a similar idea a few years ago. He just copied the plugin as-is multiple times, and just changed the name, URI and soundfont of each.
thank you for your answer.
no problem, I was expecting a similar answer, I did it for fun/learning anyways. I will check out the project you suggested.
regarding this:
PS. Filipe Coelho had a similar idea a few years ago. He just copied the plugin as-is multiple times, and just changed the name, URI and soundfont of each.
I tried this in many ways but wasn't able to have multiple soundfonts available for the same project without recompiling from source the plugin for each soundfont. The problem I think comes from the fact that when the hosts calls lv2_descriptor(), if the returned string doesn't match the manifest, the host refuses to load the plugin. What have I missed?