Faust Midi CC and Bend

Hi,
new here! :wave:

I’m trying to use CC MIDI messages on my Lich with Faust … is this supported?
import(“stdfaust.lib”);
declare options “[midi:on]”;
s = hslider(“scale[midi:ctrl 11 1]”,0.08,0,1.0,0.01) : si.smoo;
doesn’t seem to work

It’s possible to use bitchbend messages on different MIDI channels?

thanks

MIDI/CC are not used like that, this would be redundant on OWL. We already can control OWL parameters via MIDI/CC in firmware, so anything that is used as parameter becomes controllable by MIDI automatically. Here’s tthe list of CC numbers to use: OpenWare/OpenWareMidiControl.h at master · pingdynasty/OpenWare · GitHub

Pitch bend bend should be usable as one of the special variables labels (freq/gain/gate/bend). Currently fixed pitch bend range of 2 octaves is used. So you should multiply your frequency (defined with “freq” label for MIDI control) by pitchbend value (defined with “bend” label) to get final frequency value.

Looks like this needs a better explanation in the docs

1 Like

On Faust side, you can find more info on pitchbend use here: MIDI Support - Faust Documentation especially the use of the ba.semi2ratio function.

@sletz did bend use to work differently in FAUST?

It should be noted that currently, our implementation works like this:
if you declare a bend parameter, it will be assigned the pitch bend ratio which can be immediately multiplied with the frequency.

So currently we would do:
bend = hslider("bend", 1, 0.25, 4, 0.01);
which returns 1 for no bend, 0.5 for half-bend down (-1 octave) and 4 for full-bend up (+2 octaves)

It seems this corresponds to:
bend = ba.semi2ratio(hslider("bend[midi:pitchwheel]",0,-2,2,0.01));
in the FAUST documentation.

We could update our implementation, I guess we only need to add [midi:pitchwheel]. And [midi:ctrl] would be nice to have too.

We indeed reworked our implementation to better follow the standard MIDI pitchbend semantic. So the new way is now ba.semi2ratio(hslider("bend[midi:pitchwheel]",0,-2,2,0.01));

Thank you for the answer!
For MIDI CC 75 the code should be: s = hslider(“scale[OWL:AA]”,0.08,0,1.0,0.01) : si.smoo;
right?

yes that’s right @akirasrebirth

I imagine it could be useful if OWL listens on one channel, while patch uses another channel number - this would allow arbitrary CC values to be used that would be interpreted by firmware otherwise.

It would be quite useful for output if there’s external gear to control if we want to add MIDI output support.

@mars ok … seems there is something wrong with my Lich. I tried a Befaco VCMC and a Nano Kontrol2 as midi controller, but it doesn’t work. Is there something I can do to verify if the Lich has detected the midi controller?

There is a known issue with the current firmware, which means that after a MIDI controller has been disconnected then the module must be power cycled (or software reset, e.g. through the Device page) before MIDI host works again.

To check if it is working, try this sequence:

  • connect a MIDI controller, and a USB cable to your computer
  • power synth on
  • load the Harmonic Lich patch
  • send some MIDI notes from your computer (e.g. using Chrome, open the patch and click “SHOW KEYBOARD”)
  • you should hear the oscillator base pitch changing
  • send some MIDI notes from your controller
    • you should hear the base pitch changing again

Ok … made the test with a Befaco VCMC and the Harmonic Lich patch it’s working.
I configured a fader on the VCMC to output CC 75 messages, but it’s not working with this code:
s = hslider(“scale[OWL:AA]”,0.08,0,1.0,0.01) : si.smoo;

Here is my complete code 3d rotation patch

I’ve tried this patch and can confirm that sending MIDI CC = 75 with various parameters changes the scale parameter as expected. I was using connection to USB device from computer, not USB host. So at least it’s not a problem in FAUST patch/integration.

1 Like

I suspect the issue is with how we currently handle USB Host data: since the refactor, we send it straight to the patch instead of processing it first on the firmware level.

I’ll make some tests and look into this, should be possible to fix and roll into next fw version.

1 Like

Are you saying that direct midi cannot be interpreted in patches?
OWL parameters scale midi values from 0-127 to 0-1, which makes them inaccurate. There is no correspondent 0.5 value (is it 63, 64 or 65 in midi values?).
I have controller Samson Conspiracy, which step encoder knobs are entirely configurable, I can make them send out values 2-10 for example, how can I read those accurately (for example to switch between 8 wavetables) if OWL takes only parameters and scales values to 0-1 range?

FAUST patches don’t process MIDI, only audio. That’s why MIDI has to be exposed as UI controls for parameters or special gate/pitch/bend variables. To get integer values you can multiply and round it to map to a specific range. In C++ patches you can process raw MIDI data in patch’s MIDI callback.