Dexed (DX7 emulator) integration

Hi @ll,

I am currently at a point where I have a running DX7 emulation (based on the msfa engine) but have some problems with loading external patches. They sometimes sound strange. I have to check all the parameter dispatching.

The current state is here:

DeeAxe7.lv2

I hope I will find the problems the next days. Until then the current default sound sounds very nice like a DX7-E-Piano.

Regards, Holger

Yippieh! I got DeeAxe7 running! :massage:

But there are some caveats:

  • mod wheel does currently not work
  • converting sysex banks to LV2 presets has sometimes some problems.
  • storing the converted banks is currently done in user section and not as a factory preset of the plugin. I have currently not really an idea how to organize that.

Testing is currently only working with a LV2 host (like jalv or mod-host). But DeeAxe7 will be integrated in the next version of Zynthian.

If someone canā€™t wait, here is a recipe, how to install:

  1. Clone the repo (see message above with the repo address).
  2. cd DeeAxe7/src and edit the Makefile (installation path)
  3. make
  4. (sudo) make install
  5. When you use lv2ls you should see a plugin named ā€œhttps://github.com/dcoredump/DeeAxe7.lv2ā€
  6. If you want to convert banks: There is a script named dx7sysex2lv2. This script also needs dxsyx. Usage: bin/dx7sysx2lv2 patches/sysex.syx (it converts the sysex files to $HOME/.lv2)

If you have questions, just ask :wink:

Regards, Holger

Hi there,

after DeeAxe7 I am now nearly finished with a port fom Dexed to native LV2 for using inside MOD-UI. Dexed has some advantages against DeeAxe7:

  • Modulation wheel works
  • integrated filter with resonance for better adjustment of the sound
  • Unisono mode
  • additionlal two sound engines

But I have a very strange problem - perhaps someone has an idea how to fix this?

The current code is located at https://github.com/dcoredump/dexed. When using this code on a x86 hardware inside MOD-UI everything works fine. Using the same code (with different compiler options) on the Raspi I cannot get it to work inside (Raspi-)MOD-UI. But the same Raspi binary works if I load it directly into mod-host (the LV2 plugin host which is used inside MOD-UI).

This is very strange :dizzy_face:

First it was looking like a type mismatch problem but it seems to work on the Raspi - but not with MOD-UIā€¦

I know, that this is a very complex problem inside LV2 and MOD-UI/mod-host - but perhaps someone has an idea?

Regards, Holger

Hi @C0d3man!

It seems to be a really strange problem. Can you get some error info from MOD-UI? Itā€™s a problem with meta-data or with the binary itself?

If you give me some guidelines, i will try to compile and run your code this evening ā€¦

Regards ā€¦

Hi @jofemodo,

I have tried to show debugging output (shown when compiling with make DEBUG=1) and starting MOD-HOST and MOD-UI by hand, like this (as root):

skill mod-host && LV2_PATH=/home/pi/zynthian/zynthian-plugins/mod-lv2 mod-host &

LV2_PATH=/home/pi/.lv2:/home/pi/zynthian/zynthian-plugins/mod-lv2 MOD_DEV_ENVIRONMENT=0 MOD_SCREENSHOT_JS=/home/pi/zynthian/zynthian-sw/mod-ui/screenshot.js MOD_PHANTOM_BINARY=/usr/bin/phantomjs MOD_DEVICE_WEBSERVER_PORT=8888 /home/pi/zynthian/zynthian-sw/mod-ui/server.py

But I cannot find any real problem. MIDI is recognized - only the rendering seems to make troubleā€¦

Testing would help me very much! The main ā€œVoodooā€ is done inside dexed.cpp in the functions/methods run() and GetSample().

Here is a simple recipe for installation:

cd $ZYNTHIAN_SW_DIR
git clone https://github.com/dcoredump/dexed
cd dexed/src
make
sudo make install # installation at /home/pi/zynthian/zynthian-plugins/mod-lv2

After restarting MOD-UI you should see a new generator (currently with default look). If you try to connect it and play via MIDI (or StepSequnecer) it only clicks.

Now stop MOD-UI and MOD-HOST. Do the following:

sudo LV2_PATH=/home/pi/zynthian/zynthian-plugins/mod-lv2 mod-host -i

Now you can copy&paste the following (as block or line-by-line) and this should make a sound like an e-piano:

add https://github.com/dcoredump/dexed.lv2 0
add http://gareus.org/oss/lv2/stepseq#s8n8 1
connect effect_1:midiout effect_0:midi_in
connect effect_0:audio_out system:playback_1
connect effect_0:audio_out system:playback_2
param_set 1 grid_1_1 1
param_set 1 grid_2_3 1

So: MOD-HOST directly works and MOD-UI not (for me).

Regards, Holger

Perhaps MOD-UI overwirte the default preset values? Have you tried to put some presets ttl?

Regards!

YOU ARE MY HERO!!! :trophy:

The problem was:

The plugin was not initialized with parameters at startup

AND

The plugin uses LVTK (for handling the LV2 stuff). The default installation (on my Raspi) seems to enable some debug output when loading a plugin. This seems not to be enabled on my x86 system.

So MOD-UI gets on the Raspi data via stdin which may confuse its parser and the plugin wonā€™t work (I will tell this falkTX). I disabled the debug output and now it works!

I will release the complete fixed version the next days - hopefully it can be integrated in the new SD-image :slight_smile:

Regards, Holger

Hi @jofemodo,

have you had time to try?

I tried yesterday and the problem still exists :cry: It seems to exist only sometimes. I made two screencasts where you can see what I mean:


I found out that:

  • it has no matter where the initializing for the engine is done: Constructor or activate() - sometimes it works, sometimes not
  • the parameters for the engines are ok - also when setting them explicitly at initialization.
  • this happens only on the Raspi - not on x86.
  • compiler options (ptomizations) have no effect - it happens with or without optimization options.
  • it never happens on Rapsi when loading the plugin directly into MOD-HOST (via CLI).
  • when no sound is produced this happens only to the first intance (see videos).The second and third instance are working. Deleting the first instace and creating a new one does not helpā€¦

Also tried:

  • fresh choeckout and installation of libraries: lv2, serd, sord, sratom, lilv
  • fresh checkout of mod-host and mod-ui

I really have NO idea how to go onā€¦

Regards, Holger

Hi Holger!

Currently iā€™m a little busy finishing a little development, but i hope to be free for monday and i will test your Dexed LV2. I want to include it in the new SD image and iā€™ve some ideas for testing it :wink: By the way, if you have time, try to sniff the websocket and ajax communication from the browser, perhaps you can see what is different between the first instance and the rest.

Have you tried to load a preset after creating the instance? I suspect that the problem is related to the initial parameters. MOD-GUI always send a set of parameter values after loading the plugin and you can see this parameters in the websocket ā€¦

Regards!

Yep - but this also does not help. Only the second instance works and sometimes the firstā€¦

I will try to run wireshark and will hopefully see something more - thanks for this idea!

Regards, Holger

No need for wireshark! You can do it from the browser developper tools :wink:

Hi @jofemodo,

did you had time to test Dexed-LV2?

I tried to use the developer tools and have done a trace of the calls - but I donā€™t recognize anything useful for me. I am more a system programmer than a web-specialist :sweat:

I really tried nearly everything but I cannot get Dexed-LV2 to work as the first instance. In fact it works sometimes as the first instanceā€¦ but only 20% of every test.

It would help very much if someone (you= :wink:) can try if this also happens on other installations.

Thanks, Holger

Hi Holger!

I just have compiled and tested your dexed-lv2:

  1. I can confirm the same strange bahaviour. Tee first instance doesnā€™t work ;-(
  2. Iā€™ve fixed the installation process:

cd $ZYNTHIAN_PLUGINS_SRC_DIR
git clone GitHub - dcoredump/dexed.lv2: FM multi plaform/multi format plugin
cd dexed
git checkout native-lv2
cd src
make
sudo make install
cd ā€¦/ā€¦

Iā€™ve added this to the recipes directory. BTW, as you probably have seen, in the last weeks iā€™ve integrated your recipes in the zynthian-sys repository.

Now i will try to trace the problem with the plugin. We keep in touch.

Regards!

Hi @C0d3man!

Iā€™ve noticed that when you have a ā€œnot working instanceā€ connected to MIDI input and you play ā€œhardā€, it consumes CPU like a ā€œworking instanceā€. No difference. If you disconnect from MIDI input or ā€œbypassā€ the effect, then no CPU consumption. Perhaps this can help you?

Regards!

Hi @C0d3man!

For me, the problem is the same when using mod-host. Iā€™ve repeated this procedure 10 times:

  1. Start ā€œmod-host -iā€
  2. Load first instance:

add GitHub - dcoredump/dexed.lv2: FM multi plaform/multi format plugin 0
connect ttymidi:MIDI_in effect_0:midi_in
connect effect_0:audio_out mod-host:monitor-in_1
The first instance NEVER works for me. The number used with ā€œaddā€ doesnā€™t matter.

  1. Load second instance:

add GitHub - dcoredump/dexed.lv2: FM multi plaform/multi format plugin 1
connect ttymidi:MIDI_in effect_1:midi_in
connect effect_1:audio_out mod-host:monitor-in_1
The second instance ALWAYS works for me. The number used with ā€œaddā€ doesnā€™t matter.

  1. Stop mod-host

When removing and adding without restarting mod-host, then the behaviour is not deterministic. Sometimes work the first instance, sometimes you have to load 2.

Perhaps we can try with other LV2 host?

Regards!

Hi @jofemodo,

hm, I have no problems using dexed with mod-host directly:

systemctl stop jack2
/usr/local/bin/jackd -P70 -t2000 -s -d alsa -dhw:0 -r44100 -p256 -X raw -n2 &
mod-host -i

ā€¦ and then copying the following into mod-host:

add GitHub - dcoredump/dexed.lv2: FM multi plaform/multi format plugin 0
add GitHub - x42/stepseq.lv2: Simple Step Sequencer 1
connect effect_1:midiout effect_0:midi_in
connect effect_0:audio_out system:playback_1
connect effect_0:audio_out system:playback_2
param_set 1 grid_1_1 1
param_set 1 grid_2_3 1

ā€¦ works.

Perhaps it is the lvtk library. I am using it in the non-standard way - but for DeeAxe7 it worked. And it works for Dexed - after creating a 2nd instanceā€¦ and it works on x86. I also tried to change the compiler optimizations - nothing helped.

I just tried to generate Dexed.lv2 for the Mod-Duo but it seems tat Mod-Duo has no lvtk library.

Perhaps I should try to exchange the lvtk library and use the normal lv2 library. But this is not done in an hourā€¦

Perhaps trying with jalv maybe a solutionā€¦ I will try this at weekend - now is band-eveningā€¦ making noise :guitar: :wink:

Thanks for trying!!!

Regards, Holger

I have seen that. It debugged library and function calls and yes: It runs - but produces not hearable output. If you try with modmeter plugin (see recipes) you cann see that there is something produced when generating MIDI events - but at -58 dB! Normal sound is >-8 dB. If you switch the engines you can see that the MSFA engine produces NO output, both others are producing ā€œsomethingā€.

OPL and Modern engines are inheriting from the MSFA class (=FmCore). Perhaps FmCore is not initialized. But why? And why the hell is the 2nd instance working - or seldom the first one???

It is very strangeā€¦ ghosts :ghost: in the machineā€¦
Regards, Holger

Hi @jofemodo,

I changed some parts - nothing helped. Than I changed the range for the output (=gain) in Dexed.ttl from 0.1-2.0 to 0.1-10.0 and now it works for meā€¦ at least the last boots.

Can you pull and confirm this? (I really hope you can :grin:)

Regards, Holger

EDIT: No - now it does not work anymoreā€¦ it must be an external problem. :cry:

Hi @Codeman!
When i ā€œmake cleanā€ in the plugin ā€œsrcā€ directory, the file dexed_ttl.h is deleted and after that i canā€™t ā€œmakeā€ again because the file is needed. Looking in the Makefile:

clean: Makefile
rm -f *.o *~ *.bak *.gch dexed_ttl.h *.so .gch msfa/.gch
rm -rf $(BUNDLE)

Iā€™ve recovered the file with a ā€œgit checkout .ā€ :wink:

Regards!

Hi @C0d3man!

Bad news! For me the problem is still there. Almost the same ;-(

Regards!