MOD-UI pedal for SFZ input

:scream: I have a mountain of tasks over my table, but i will try to do it ASAP :kissing_heart:

Regards!

Hi all,

I started to write a converter script:
[EDIT: DON’T USE THE CONVERTER - IT WON’T WORK. USE https://github.com/dcoredump/GenericFluidPlug/tree/generic]

https://github.com/dcoredump/sffluidplug.git--

The future usage should be something like this:

$ sffluidplug /path/to/my/soundfont

… and with the magic of perl :anger_right: a new plugin with the mentioned soundfont and presets should appear (after reloading mod-host/mod-ui). Perhaps I will add some options for the color of the modgui…

Regards, Holger

1 Like

Hmmmmm… it is not working as I thought. It seems that you cannot create such a generic plugin because the URI of the plugin must be hardcoded inside the binary. But it is not impossible to create own SF2 LV2 plugins - just my suggested way won’t work.

I am going on to create such a generic plugin out of FluidPlug - but this will take some time…

Regards, Holger

Perhaps we should consider the possibility of passing file names as LV2 plugin parameters. Converting everything to turtle is a little bit twisted (althought it has some advantages). It can be really useful to have the option of loading plugin-specific preset formats. For instance, SYSEX presets in Dexed, or soundfonts in fluidsynth, etc. In that case, a “file browser” widget would be desirable for MOD-UI.

Regards!

Hi @jofemodo,

Right. Anyone who has the skills for this :wink:?
Also the plugins have to be extended to accept filenames…

What is currently possible (and what I will do for now):

  • Fork FluidPlug (=> GitHub - dcoredump/GenericFluidPlug at generic).
  • Convert all TTL’s/sources to (perl-toolkit-)templates.
  • Write a (perl) generator which parses the templates and generates a set of sources ready to compile for one SF2 soundfont.
  • make && make install, use the plugin.

Regards, Holger

1 Like

“… and now for something completely different:”

[EDIT 20170309 due to extended program]
[EDIT 20170313 using aditional perl library for system()]

If you want to be a beta-tester, you can try the generic LV2-FluidPlug-SF2-builder. Here we go:

apt-get install -y templatetoolkit-perl libipc-system-simple-perl
git clone -b generic https://github.com/dcoredump/GenericFluidPlug
cd GenericFluidPlug
perl ./genericfluidplug <path_to_my_sf2_file> <path_and_name_for_LV2_source_code> <path_and_name_for_LV2_plugin>
cd <path_and_name_for_LV2_source_code>
make DEST=/zynthian/zynthian-plugins/lv2 install
systemctl restart mod-host && systemctl restart mod-ui

Works for me… there is still something to do (e.g. eye-candy for modgui)… should work with every soundfont fluidsynth can load… have tested only with “simple” SF2-soundfonts.

Regards, Holger

P.S.: Complete example with real data:

# install system package (only needed the first time)
apt-get install -y templatetoolkit-perl libipc-system-simple-perl
# get your favorite soundfont and put it to /tmp and unzip it
cd /tmp
wget http://rkhive.com/new/new_banks/masterpiece.zip    
unzip masterpiece.zip
# get the magic builder software (only needed the first time)
cd /zynthian/zynthian-sw/plugins
git clone -b generic https://github.com/dcoredump/GenericFluidPlug
# generate your Fluidplug source code
cd GenericFluidPlug
perl ./genericfluidplug /tmp/Masterpiece.sf2 /zynthian/zynthian-sw/plugins/Masterpiece /zynthian/zynthian-plugins/lv2
cd /zynthian/zynthian-sw/plugins/Masterpiece
make install
systemctl restart mod-host && systemctl restart mod-ui

Use/Restart the MOD-UI-engine on your Zynthian, and with a web-browser look at your Zynthian-IP:8888. You should have a (black) plugin inside Generator which is named Masterpiece

P.P.S.: I just added two options for nicely creating MOD-UI boxes (stomp-box-looking). If you have not installed MOD-SDK you can’t use them. If you have installed MOD-SDK (https://github.com/moddevices/mod-sdk) you can use them with the two options -boxy-style=style and -knob-style=style . Set the environment-varibale MODSDK to the installation path and take a look at $MODSDK/html/resources/pedals/boxy and $MODSDK/html/resources/knobs/boxy for available styles.

2 Likes

Hi @ll

here another link to a nice and good oganized collection of soundfonts: https://polyphone-soundfonts.com/en/soundfonts

This collection is located on the page of a real nice soundfont editor called “polyphone”: https://polyphone-soundfonts.com/en/

In combination with GenericFluidPlug a nearly endless sound archive for Zynthian (and other LV2 capable synths).

Regards, Holger

Hello Holger,

I have to ask a stupid question:I follow your example procedure I dont get the “./genericfluidplug” script.

While trying to find the cause I visited the https://github.com/dcoredump/GenericFluidPlug git. All files in there are older then 5 month so I guess its not the right place to look.
What am I doing wrong?

Martin

Solved it:
I was cloning the wrong branch. I had to use:

git clone -b generic GitHub - dcoredump/GenericFluidPlug: SoundFonts as LV2 plugins via FluidSynth

I tried with a sf2 downloaded from here (Nice-Keys-PlusSteinway-JNv2.0)

root@zynthian:/zynthian/zynthian-sw/plugins/GenericFluidPlug# perl ./genericfluidplug /root/sf2neu/NiceKeys.sf2 /zynthian/zynthian-sw/plugins/NiceKeys /zynthian/zynthian-plugins/lv2/
src/sflist: 1: src/sflist: Syntax error: word unexpected (expecting ")")
Creating FluidPlug LV2-plugin at /zynthian/zynthian-sw/plugins/NiceKeys
root@zynthian:/zynthian/zynthian-sw/plugins/GenericFluidPlug# cd /zynthian/zynthian-sw/plugins/NiceKeys/
root@zynthian:/zynthian/zynthian-sw/plugins/NiceKeys# make install
rm -rf /zynthian/zynthian-plugins/lv2//FluidPlug_NiceKeys.lv2
cc -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mneon-for-64bits -mfloat-abi=hard -mvectorize-with-neon-quad -fPIC -DPIC -std=c11 -Wall -c FluidPlug_NiceKeys.c
cc FluidPlug_NiceKeys.o -shared -L/usr/local/lib -lfluidsynth  -o FluidPlug_NiceKeys.so
mkdir -p /zynthian/zynthian-plugins/lv2//FluidPlug_NiceKeys.lv2
cp -R modgui /zynthian/zynthian-plugins/lv2//FluidPlug_NiceKeys.lv2
cp *.ttl /zynthian/zynthian-plugins/lv2//FluidPlug_NiceKeys.lv2
cp FluidPlug_NiceKeys.so /zynthian/zynthian-plugins/lv2//FluidPlug_NiceKeys.lv2
cp NiceKeys.sf2 /zynthian/zynthian-plugins/lv2//FluidPlug_NiceKeys.lv2
root@zynthian:/zynthian/zynthian-sw/plugins/NiceKeys# systemctl restart mod-host && systemctl restart mod-ui

I now have a Pugin in Mod-UI but it does not work:

(The new Plugin is the first on the left)

Gotta get to where MOD UI is making sound in my screwy little dev environment, but then I can’t wait to try this stuff out!

Hi Martin @lod

Oh - yes - sorry. I forgot to make this clear… I added this to the README.MD and will fix my installation manual above.

Wow - very big file! You may get problems using this soundfont. AFAIK Fluidsynth loads the whole soundfont into memory. 1GB RAM - 560MB soundfont… there ist not much memory free for other stuff…

Something strange happens when you start the script… I see: I have to add a check for failing when calling external programs.

  • Can you confirm that you have installed templatetoolkit-perl?
  • I fixed a little problem yesterday night (only a compiler option). Do you have cloned/pulled after 22:00?

I just tried and got Nice-Keys running (on RPi3, my RPi2 based Zynthian is currently at rehearsal room).

Can you pull and try again? If it does not work, please send me the output of the following command:

src/sflist /root/sf2neu/NiceKeys.sf2

Regards, Holger

1 Like

Hi @jofemodo,

When running GenericFluidPlug-generated synths there is a problem with the Zynthian-UI. The sounds are not arranged in presets anymore but in values for a LV2 control port:

 [
        a lv2:InputPort, lv2:ControlPort ;
        lv2:index 4 ;
        lv2:symbol "program" ;
        lv2:name "Program" ;
        lv2:portProperty lv2:enumeration , lv2:integer ;
        lv2:default 0 ;
        lv2:minimum 0 ;
        lv2:maximum 83;
        lv2:scalePoint [
            rdfs:label "Classic Steinway" ;
            rdf:value 0 ;   
        ] , [
            rdfs:label "Studio Steinway" ;
            rdf:value 1 ;
...

This seems not to be recognized by Zynthian-UI so you cannot change the sound by encoder anymore. It seems also that Zynthian-UI hangs until you erase the pedalboard.

Do you have an idea how to fix this?

Regards, Holger

Hello Holger,

Confirmed, templatetoolkit-perl is installed.

I pulled the latest Version from Git - but the error is still there:

root@zynthian:/zynthian/zynthian-sw/plugins/GenericFluidPlug# perl ./genericfluidplug /root/sf2neu/NiceKeys.sf2 /zynthian/zynthian-sw/plugins/NiceKeys /zynthian/zynthian-plugins/lv2/
src/sflist: 1: src/sflist: Syntax error: word unexpected (expecting ")")
Creating FluidPlug LV2-plugin at /zynthian/zynthian-sw/plugins/NiceKeys
root@zynthian:/zynthian/zynthian-sw/plugins/GenericFluidPlug#

The Output of src/sflist /root/sf2neu/NiceKeys.sf2 :

src/sflist /root/sf2neu/NiceKeys.sf2
-bash: src/sflist: No such file or directory

Greetings,
Martin

Edit: sflist does not work … googeling … cant figure out a package for getting this installed …

sflist is a small program made by myself (I noticed that falkTX made such a program after I wrote this small helper :expressionless:). sflist should be compiled automaticly when it not exists. As I wrote: I haven’t checked if the call to system("gcc -o src/sflist src/sflist.c -lfluidsynth"); comes back with an error… I am a bad programmer :cry:

Ok. Let’s compile this small program by ourself:

cd /zynthian/zynthian-sw/plugins/GenericFluidPlug
gcc -std=c11 -o src/sflist src/sflist.c -lfluidsynth

If this works without errors, I hope the generation/installation with genericfluidplug will work, too!

Thanks for testing!

Regards, Holger

P.S.: I am online on gitter (Commuity Zynthian/Makers) if you need “realtime” support :wink:

P.P.S.: Nice-Keys work for me out of the box. Loading time is a little bit longer than for other plugins…

1 Like

Hello Holger,

thank you for finding the root cause so quickly! You where right

cd /zynthian/zynthian-sw/plugins/GenericFluidPlug
gcc -std=c11 -o src/sflist src/sflist.c -lfluidsynth

did the trick. After this step the peal-script worked without error and the soundfont is now available as a plugin in the mod-ui.

It is now working perfectly!

Loading time is still ok - despite the size, thats nice :grinning: . But looking at the RAM usage I have to ask myselve if so many instruments in one plugin are needed - maybe I can split the soundfont into smaller sections …

Greetings,
Martin

Hi Martin @lod

nice to hear that it works and thanks again for testing. Try to use Polyphone for editing sf2 soundfonts.

The problem is fixed in the github-repo, but I want to make the perl script more robust - will do this next week.

Regards, Holger

Hi all,

I added another perl library which makes the call to system() better - it checks internally for errors and creates better error messages.

All users have to install libipc-system-simple-perl when checking out the newest version:

apt-get install -y libipc-system-simple-perl

I also added the make targets clean and veryclean.

Regards, Holger

Hello @C0d3man !

is there a way to make this code-magic of yours also work for *.sfz and maybe *.gig flies as well?

And I would like to add +1 to the qeustion you asked @jofemodo :

Hi @jofemodo,

When running GenericFluidPlug-generated synths there is a problem with the Zynthian-UI. The sounds are not arranged in presets anymore but in values for a LV2 control port:

[
a lv2:InputPort, lv2:ControlPort ;
lv2:index 4 ;
lv2:symbol “program” ;
lv2:name “Program” ;
lv2:portProperty lv2:enumeration , lv2:integer ;
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 83;
lv2:scalePoint [
rdfs:label “Classic Steinway” ;
rdf:value 0 ;
] , [
rdfs:label “Studio Steinway” ;
rdf:value 1 ;

This seems not to be recognized by Zynthian-UI so you cannot change the sound by encoder anymore. It seems also that Zynthian-UI hangs until you erase the pedalboard.

Do you have an idea how to fix this?

Regards, Holger

Hi @lod Martin,

the FluidPlug is a plugin written by falkTX from MOD. I reused it to put a wrapper arround for automatic using of special soundfonts and create the matching configuration files for MOD-UI. FluidPlug is a “simple” LV2 wrapper arround the fluidsynth library - so it can only load soundfonts of supported format. AFAIK this is only SF2.

There is another software arround which loads the other formats: LinuxSampler. I think it is not impossible to make such a plugin - LS has an own LV2 plugin. But we had some license discussion with the LS team in the past: selling Zynthian kits is a problem… I don’t know what this means related to software for a project (where I personally don’t sell anything). The software I had written the last 10 years was completely free. I have no fun to write software and discuss later if I broke the license.

Go ahead and look for their “simple” license. It is short and clear. As far as you don’t make any money (even self-costs of parts!), you can use LS… personally I am not making money - but for the complete project this is not true. What to do???

Regards, Holger