Custom lv2 is not saving preset information correctly in the .json file under /zynthian/config/jalv

Hi there, I was creating a lv2 plugin (WIP name ZynPerfomix) with puredata and exporting it to dpf code via heavy compiler. All in all the lv2-plugin is working in oram.

I tested it with the CLI calling it with jalv.gtk. Also tested it as zynthian plugin, saving it in the directory /zynthian/zynthian-plugins/lv2/ as lv directory. It is working in zynthian … fine.

As soon as I want saved the preset, the plugin crashes :frowning: .
The preset ttl files have been written to /zynthian/zynthian-my-data/presets/lv2/ZynPerfomix.presets.lv2/.

But the content written into the file /zynthian/config/jalv/presets_ZynPerfomix.json which contains the links to the preset ttl files doesn’t look good:

{"": {"bank_url": "", "presets": [{"label": "New1", "url": "audio_debug = 0.690000"}]}}

The url written is the name of the last changed lv2 parameter in the zynthian ui.
Compared to, for example, the content of the lv2 Plugin whaa (artyfx), which looked like:

{“None”: {“bank_url”: null, “presets”: [{“label”: “New1”, “url”: “file:///zynthian/zynthian-my-data/presets/lv2/Whaaa.presets.lv2/New1.ttl”}, {“label”: “New2”, “url”: “file:///zynthian/zynthian-my-data/presets/lv2/Whaaa.presets.lv2/New2.ttl”}]}}

Strange.
After calling “search for new engines/presets” in the web-ui, the entry in preset_ZynPerfomix.json changed to:

{“None”: {“bank_url”: null, “presets”: [{“label”: “New1”, “url”: “file:///zynthian/zynthian-my-data/presets/lv2/Whaaa.presets.lv2/New1.ttl”}]}}

If I add another preset, same procedure…

Another issue: only after loading my presets 3 times, the parameters are accepted by the plugin.
Everything works with the CLI and jalv, but not as expected with zynthian.

My question is, why? What am I doing wrong. Why is it working for Whaa? What’s the difference?

Any advices? Appending the lv2 plugin… if someone is interested.

ZynPerfomix.lv2.zip (158.9 KB)

Have you tried to save the preset from the zynthian-ui?

chain options > processor Zynperfomix > save preset

Regards,

Yes, this is what I tried. Inside the chain options, pressed on ZynPerfomix, then saved the preset…
This is what I tried with the aformentioned results.
Did you try it and it worked?

Hi @gitnob !

I just fixed bank creation when saving presets from UI. I think the problem was this.
Please, update and follow this steps to clean up the wrongly saved presets:

rm -rf $ZYNTHIAN_MY_DATA_DIR/presets/lv2/ZynPerfomix.presets.lv2
cd $ZYNTHIAN_UI_DIR/zyngine
./zynthian_lv2.py presets lv2://nobisoft.de/ZynPerfomix
systemctl restart zynthian-ui

After this, you should be capable of saving presets from the UI.

Enjoy!

1 Like

Hi @gitnob !

I was testing your LV2 and think i found the issue with your plugin that make it crash. This is the output from jalv when running your plugin from CLI, like this:

jalv lv2://nobisoft.de/ZynPerfomix
Plugin:       lv2://nobisoft.de/ZynPerfomix
JACK Name:    ZynPerfomix
Sample rate:  48000 Hz
Block length: 256 frames
MIDI buffers: 32768 bytes
Comm buffers: 32768 bytes
Update rate:  30.0 Hz
Scale factor: 1.0

amp_modulation = 0.000000
audio_debug = 1.000000
beat_repeat = 6.000000
beat_repeat_triplet = 0.000000
bpm_custom = 130.000000
buildup_length = 16.000000
buildup_style = 1.000000
cross_trigger = 0.000000
filter_amount_bp = 0.000000
filter_amount_flanger = 0.000000
filter_amount_hp = 0.000000
filter_amount_lp = 0.500000
filter_amount_notch = 0.000000
filter_amount_phaser = 0.000000
fx_bp_freq = 0.700000
fx_bp_mod_inv = 0.000000
fx_bp_q = 0.100000
fx_filters_off = 1.000000
fx_flanger_fback_max = 0.500000
fx_flanger_fback_mod = 1.000000
fx_flanger_freq_max = 0.700000
fx_flanger_freq_mod = 1.000000
fx_flanger_intensity_max = 0.500000
fx_flanger_intensity_mod = 1.000000
fx_notch_freq = 0.700000
fx_notch_mod_inv = 0.000000
fx_notch_q = 0.100000
fx_phaser_freq = 0.200000
fx_phaser_freq_mod = 0.100000
fx_phaser_mod_inv = 0.000000
hp_freq = 3000.000000
hp_mod_inv = 0.000000
hp_q = 1.000000
looper_on_off = 1.000000
lp_freq = 2000.000000
lp_mod_inv = 0.000000
lp_q = 0.100000
retrigger = 1.000000
reverb_crossfreq = 3000.000000
reverb_damp = 60.000000
reverb_feedback = 0.000000
reverb_feedback_mod = 0.000000
reverb_highcut = 24000.000000
reverb_lowcut = 5.000000
reverb_mod = 0.000000
reverb_predelay = 0.000000
stereo_switch_interval = 6.000000
stereo_switch_interval_modulation = 0.000000
stereo_switch_mod = 0.000000
stereopan_hardness = 50.000000
stereopan_interval = 6.000000
stereopan_interval_modulation = 0.000000
stereopan_mod = 0.000000
stutter_hardness = 50.000000
stutter_interval = 6.000000
stutter_interval_modulation = 0.000000
stutter_length = 50.000000
stutter_mod = 0.000000
> > bang 
> bang 
> 0 

Scroll to the end, please. The 2 “bang” and the “0” strings should not be there. They probably come from the puredata engine and you MUST remove it from the standard/error output because they are confusing zynthian when parsing jalv output. LV2 plugins should not write anything to standard/error output.

BTW, i was trying to understand how your plugin works, but i think i need some help from your side. Grouping the parameters would work too. Anyway, congratulations for your work. The plugin works!!

Cheers!

1 Like

Thanks @jofemodo , I was off for some time, but will try it later. I’ll remove the extra bangs and outputs. They helped me debugging with jalv.

The idea behind this lv2 plugin is to build something like a final groovebox plugin for live performances which could be a tool especially for techno oriented zynthian usage (myself using a modular synth system with ES-9 as input for zynthian, which is mixing up everything).

The plugin lets pass through all audio when cross_trigger is 0, but starts a synchronized looper for a build-up sequence. During this build-up, automated lp, hp, phaser etc. will change the sound for a choosable length of beats. During this build-up you can change original source instruments, drums, sounds etc., while the build-up loop with some effects will be heard.

After that, you just set cross_trigger back to 0, the looper stops and the original audio will be heard.

It’s still very WIP, alpha version, but I’ll explain it in more detail on a github page later.
The idea is also to make a tutorial of the development of a lv2 plugin for zynthian with the help of puredata, hvcc, dpf. Big plans, hope to find all the time in my schedule.

Now, time to delete all the print output atoms from pd.

:grinning:

1 Like

jipieeh, this was it. The extra output confused zynthian completely.
Now I can change and save presets.
Thanks a lot.
From time to time I’d really like to go deeper into zynthian’s code…

Hm, did you see, I was speaking about zynthian like I was speaking about a person… I love her/him/it :heart_eyes:

3 Likes

I am interested in the workflow of building lv2 via plugdata, if you can prepare some hints would be great. BTW can you upload the modified ZynPerfomix, to try the workflow?
I put the ZynPerfomix.lv2 folder in /zynthian/zynthian-my-data/presets/lv2/, but it does not show up in engines to activate, or do I something wrong?

@Klangschmied - did you notice the line from @gitnob in the original post in this topic?:

1 Like

Did not see it…but after do “search engines” the ZynPerfomix.lv2 shoes up :slight_smile:

1 Like

@Klangschmied , sure, promised. ATM it’s a bit a scheduling problem, you know … day job, family, zynthian, music, … It’s sometimes hard to balance :slight_smile:

The plugin is still not ready, but I’ll update for you to the actual version for zynthian oram.

ZynPerfomix.lv2.zip (159.1 KB)

Github link will follow, once the plugin is more elaborated.

@gitnob thanks a lot, much appreciated !
May I ask for the source pd-code, to check the workflow?

BTW where is the “correct” place to put a custom lv2 plugin on Zynthian V5 - oram:
/zynthian/zynthian-plugins/usr
or
/zynthian/zynthian-plugins/lv2

This is the right place :wink:

2 Likes

I was thinking about that, too. I was concerned about updating processes if you have a custom lv2 plugin installed there. Wouldn’t it be better to have another place for these custom lv2’s? I know, it’s another search folder, but would be more consequent in separating system supported plugins from custom one’s.
Anyway, I’ll stay with /zynthian/zynthian-plugins/lv2 . I just made a symbolic link to my custom folder then.

Hi @Klangschmied and others,

I’ve written some scripts to get lv2 scripts from puredata patches into zynthian.
I am still not finished yet, but it’s working.
You can find them on github: GitHub - gitnob/pd_to_zynthian_oram: development environment for pd patches .

Because there is no plugdata toolchain for arm64’s like raspberry, it’s easier to develop the plugin on a desktop and then to use scripts to compile the plugin on zynthian directly (after you tested the plugin on the desktop).

If you want to build a plugin for Zynthian with an already existing puredata patch (with heavy’s special inlet parameters), it’s quite easy, well … not a no-brainer, but quite easy.

Say, you want to create a plugin development directory under /usr/local/src/NewPlugin

git clone https://github.com/gitnob/pd_to_zynthian_oram.git /usr/local/src/NewPlugin

cd /usr/local/src/NewPlugin

bin/initialize_lv2_dev.sh

  1. Just drop your pd patch code into the newly created directory with the name “pd”
  2. Customize a json file, which describes some lv2 settings.
  3. Customize the bin/config.sh file to fit your needs and the location of the main pd patch file.
  4. use the bin/compile.sh script to compile the plugin (the new plugin is under ./gen/bin/PluginName.lv2).
  5. link or copy the plugin folder into Zynthian’s infrastructure (/zynthian/zynthian-plugin/lv2/)
  6. In the webconf search for new plugins and your good to go or use the zynthian_lv2.py command as in Custom lv2 is not saving preset information correctly in the .json file under /zynthian/config/jalv - #4 by jofemodo .

The other question was about the code for the patch, I’ve changed the name…
The Perfomix (name is changed, because I thought ZynPerfomix is too close to ZynVerb, ZynDistortion, etc.) plugin you can find under GitHub - gitnob/Perfomix: Build-up audio effects with looper function. .
But be warned, it’s still a pre-alpha-prerelease :wink:

Have fun/luck !
Hope, could help a little. If not, please ask :wink:

5 Likes

@gitnob thanks a lot for your effort to give me/us instructions. will see, how far I can get.
And also thanks for sharing the code of Performix

@Klangschmied You better wait for a later version, as there are still some extras missing. If you struggle, don’t hesitate to ask.