MOD-UI pedal for SFZ input

Once I get sound coming out of mod UI, this may be turn out to be a silly question, but I’m curious if it’s possible to load a sound font into mod UI as a pedal and then pass it through other bits of he chain…

I know there are pedals who basically act as sources of sounds from MIDI instruments that then get fun effects thrown on them–wasn’t sure if those pedals are based on SFZ/SF2/GIG or some other format?

I think you mean the FluidPlugs? They are LV2 wrapper around a soundfont (I think based on fluigsynth). Currently they use hard-coded soundfonts. The current lack of MOD-UI seems to be that you have no file browser for selecting soundfonts/samples/sysex/IRs/…

I own a MOD-Duo - for this device the MOD-UI is primarily written. MOD may want to create a file browser, but this may be far away on their to-do-list-of-death. So the only solution is to create a wrapper or to extend MOD-UI (it is freely available on github).

Maybe the following idea s a way?

  • write a generic LV2 plugin (based on the FluidPlug?) which loads its soundfont from a file that is named like itself.
  • use a seperate web-server on Zynthian for uploading soundfonts
  • after uploading the soundfont an automatic creation of the generic FluidPlug-LV2 in combination with the installation of the soundfont is done in the plugin folder.

So you have not to build a new hard-coded plugin for every soundfont… when I have time I will ask the MODs what they think about this and start to code…

Regards, Holger

2 Likes

@programsam
Hah - it seems easier than I thought! :grin:

The following is completely untested, but should work:

  1. MY_SF="mysoundfont_name_without_extension"
  2. cd /zynthian/zynthian-plugins/lv2
  3. cp -R FluidBass.lv2 $MY_SF.lv2
  4. cd $MY_SF.lv2
    5.cp [MY_SF].sf2 FluidPlug.sf2
  5. sed -i -e "s/FluidBass/$MY_SF/g" manifest.ttl
  6. sed -i -e "s/FluidBass/$MY_SF/g" default-preset.ttl
  7. sed -i -e "s/Fluid Bass/Fluid $MY_SF/g FluidPlug.ttl

Now you have to do something by hand… I don’t know how to script this - but it is not impossible:

  • edit FluidPlug.ttl
  • go to line 50 (that is index 4, called program)
  • you have to edit the names for the list of programs of your soundfont and add/remove entries
  • be aware of the turtle-syntax: a block (after the ]) has to end with semicolon!)

Don’t forget to restart mod-host and mod-ui:
systemctl restart mod-host && systemctl restart mod-ui

Should work, but for normal usage we need a good shell script or web-ui integration :wink:

Regards, Holger

2 Likes

You are my hero, @C0d3man! Really!! :heart_eyes:

Can you confirm that this is really working @jofemodo? :scream_cat:

: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