Midi mapping parameters: Bi Directional?

Hi Guys,

I have a Dwarf here, I can map a parameter of a device to an external midi controller and can control that parameter from the midi controller.

If I change the device parameter via the editor, or load a pedalboard it is not sending midi back to the midi controller to keep it in sync.

At a minimum I would expect it to send the current values as midi when you change the pedalboard otherwise how does the controller know the current values.

Hopefully there is some setting somewhere that enables this but I can’t seem to find it.

Any help would be really appreciated.

All the best

Andy

3 Likes

Hello @AndyCap,

This is quite a common behavior and depends more on your MIDI controller than on your Dwarf.

Anyway, if your controller can receive MIDI and use it to give you accurate feedback you will need to use its MIDI in (set it on the virtual pedalboard running in the Dwarf) and set up some MIDI utilities that allow you to do this. Perhaps even using the virtual MIDI loopback port.

So the question here is: does your MIDI controller allow that?

2 Likes

Hi Jon,

Thanks for the reply.

Yes the midi controller allows it.

How do I set up the Dwarf to send the midi though, I have put a midi monitor on it and it sends nothing.

Thanks

Andy

1 Like

Hi @jon

I had had a few beers last night and didn’t read your message properly.

I think you are saying that when you midi map a parameter the only support is unidirectional.

To get this to work I would have to use some of the midi modules?

1 Like

I hope you enjoyed them :slight_smile:

Both interpretations are correct.
Indeed when you MIDI map only one direction is possible. What you can do is a workaround that allows you to map the parameter to something in between and then output one part of it to the plugin parameter and another to the MIDI out port that goes to the controller.

I would need to do some tests to really understand if this is possible (and I’m not sure when I will have the time), but I’m imagining something either using CV plugins or the virtual loopback MIDI port.
To summarize it, you want to assign the controller to the B parameter, so what you will do is to put another plugin (or plugins) to assign the parameter to A and the out of it goes both to the plugin with the B parameter and to the MIDI out port of your controller.

I hope that it was not too confusing…and I had no beers for a few days :grin:

2 Likes

Hi @jon

I got it working with a “Control To CV” and a “The infamous mindi!”

So I mapped the knob on the CV control to a midi CC, the param I want to effect is controlled by the CV, the value in the Mindi is also controlled by the CV.

This give me bidirectional midi CC and everything syncs up.

This obviously is a bit much if there are going to be loads of parameters so I have started looking through your repository at the midi code, I have found the code for the incoming midi mapping and am now looking for where to shoehorn in the opposite direction, as the control chain supports this already I’m guessing this is possible to do…

5 Likes

Right got it, can use cc_value_set_cb.

I’m going to mess about with this on a linux box to see if I can get something going…

3 Likes

I’m really happy to read this :slight_smile:

I believe that yes, but again, I think it will depend a lot on the controller that you connect, I’m afraid. The implementations on this are not really standardized

Please let us know about your results.

2 Likes

Hi @jon,

I have a proof of concept running on linux.

It only requires changes to mod-host, all changes are in effects.c.

Basically:

  1. Adds jack midi output port to mod-host
  2. Add int8_t midiOutValue to `MIDI_CC_T’. This will hold the 7 bit normalised param value or -1 for no change.
  3. Change effects_init() to set all g_midi_cc_list[].midiOutValue to -1 (no value)
  4. Change effects_set_parameter() to check g_midi_cc_list[] and if MIDI_CC_T matches parameter set midiOutValue to correct CC value.
  5. Change ProcessGlobalClient() and add code to handle Midi Out. Check the g_midi_cc_list[].midiOutValue, if positive then send the midi message and set back to -1.

Automatic connection of the jack output midi port is not yet done, also probably needs a quicker comparison of symbol names in g_midi_cc_list, maybe a simple hash stored.

So now I am at the stage where I thought I would look to build and deploy something to test to the Dwarf and I have hit a bit of a wall. I hoped maybe you could help?

On the dwarf I can see mod-host using jack_lsp but I cannot see a process, I can also see /usr/bin/mod-system-control /dev/ttyS3 1500000 running, I have had a look around but can’t seem to work out exactly what this is.

How is everything setup on the Dwarf?

Next issue is building for the Dwarf, is there a setup somewhere for cross compiling mod-host with the control chain stuff?

Cheers

Andy

4 Likes

mod-host runs as an internal jack client. it is located in /usr/lib/jack as mod-host.so inside the dwarf system.
you can use mod-plugin-builder environment to build mod-host for dwarf, bootstrapping using the special “dev” target. see https://github.com/moddevices/mod-plugin-builder/blob/master/bootstrap.sh#L182

3 Likes

Hi @falkTX,

Fantastic, thanks for the info.

Cheers

Andy

2 Likes

Hi @falkTX

Sorry to be a bit dim here but I though something like this would do:

pushd ~/ModDuo/mod-plugin-builder/
source local.env moddwarf
popd
make

I’m getting:

Package jack was not found in the pkg-config search path.
Perhaps you should add the directory containing `jack.pc'
to the PKG_CONFIG_PATH environment variable

PKG_CONFIG_PATH is correctly set to /home/andrewcapon/mod-workdir/moddwarf/staging/usr/lib/pkgconfig

There is no jack.pc there though.

Have I got the wrong end of the stick?

1 Like

With a bit of hacking I got Jack2 into the dev bootstrap.

The next problem is that it is using 1.9.10 without JackTickDouble.

Arghh

1 Like

change the bootstrap script that I linked to before and add a step for jack2mod package there, after cc-master stuff

3 Likes

Hi @falkTX

Great, thanks. jack2mod working much better than jack2 :slight_smile:

I have a build now.

Are there any defines I should be setting for building for the Dwarf or should everything be automatic?

2 Likes

all the needed definitions are already set from mod-plugin-builder.

3 Likes

Hi @falkTX,

Thanks.

I had removed readline by defining SKIP_READLINE.

The sizes I am getting are way off the installed binaries though so I thought I would try to add that into bootstrap as well, bootstrap works fine and installs the package.

I’m getting build errors on mod-host now though.

Should the Dwarf mod-host include readline?

Edit:

these are the size differences:
mine:

[root@moddwarf ~]# ls -ltrh mod-host.so 
-rwxr-xr-x 1 root root 170K Jan  1 00:21 mod-host.so*

installed:

[root@moddwarf ~]# ls -ltrh /usr/lib/jack/mod-host.so
-rwxr-xr-x 1 root root 365K May 12  2022 /usr/lib/jack/mod-host.so*
1 Like

size difference likely due to missing hylia as lib which is a static one so the entire code gets merged in.
you only need it for ableton live, so can be skipped too.

1 Like

Ah super I will have a look at this…

2 Likes

Hi @falkTX,

I seem to be having some coms troubles with my mod-host:

mod-ui.run[613]: WARNING:tornado.general:Connect error on fd 38: ECONNREFUSED

Have you any ideas what might be missing or causing this?

(I still have readline removed)

Cheers

Andy

1 Like