Convert OSC messages to MIDI CC values

RELATED
PRODUCTS
ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Sun Dec 04, 2022 6:29 am

Hello,
how to convert an OSC message, something like "/slider1 x", where "x" ranges from 0 to 1 (in floats) into MIDI CC in Bitwig, without physical hardware to create these midi input messages (or midi bridges from specific OSC software)?

In the API it seems to be possible to create a "virtual hardware control surface", the tutorials from Jürgen Moßgraber on Youtube mention this, but how to generate "Midi Input" from the OSC values into MidiCC to control VSTs ? How to bind the OSC commands to specific Midi messages ?

The value from OSC can be "catched" using the "message.getFloat(index number)". For sure, the range from 0 to 1 from OSC will have to be multiplied by 127 to match the Midi CC range, but what is the function to generate midi CC input into Bitwig? Where to put this OSC value into a Midi CC generating function?

The only thing appearing possible at the moment, would be to create a Midi Out function and use a midi loopback.

Thanks

User avatar
moss
KVRAF
3512 posts since 13 May, 2004

Post Mon Dec 05, 2022 2:08 am

You can send MIDI to Bitwig with the method sendRawMidiEvent() of NoteInput (which you can get from the MidiInput). You can use any MIDI input port for this (e.g. a virtual MIDI driver). Still a bit of a workaround but that's what I did in my OSC extension.

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Mon Dec 05, 2022 3:39 am

Hi Moss, so I would still need an external virtual midi driver (loopback)?

At the moment sendChannelController() is doing the job when an OSC message comes in, which ends up also using a virtual midi driver (loopback)... Do you think this is also a good alternative to sendRawMidiEvent?

So, the conclusion is that it is not possible to generate midi CC messages, from and into Bitwig, without using an external midi driver?

By the way, thank you very much for your youtube tutorials!

User avatar
moss
KVRAF
3512 posts since 13 May, 2004

Post Mon Dec 05, 2022 4:29 am

ojggaspar wrote: Mon Dec 05, 2022 3:39 am Hi Moss, so I would still need an external virtual midi driver (loopback)?
Basically, it can be ANY midi input which you do not use otherwise. No, need that it can be looped but virtual ones have the advantage that you can create them quite easily and use them exclusively for such a workaround.
ojggaspar wrote: Mon Dec 05, 2022 3:39 am At the moment sendChannelController() is doing the job when an OSC message comes in, which ends up also using a virtual midi driver (loopback)... Do you think this is also a good alternative to sendRawMidiEvent?
In this case you really need the loopback which is a bit complicated to set up.
ojggaspar wrote: Mon Dec 05, 2022 3:39 am So, the conclusion is that it is not possible to generate midi CC messages, from and into Bitwig, without using an external midi driver?
Correct. It is on the todo list of Bitwig but I guess quite at the end ;-)
ojggaspar wrote: Mon Dec 05, 2022 3:39 am By the way, thank you very much for your youtube tutorials!
You are welcome :-)

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Tue Dec 06, 2022 11:03 am

Hey Moss, I am trying to use the sendpitchbend() from the midi resource functions.

I can confirm the Synth accepts pitchbend messages from hardware, I even correctly monitored the ouput values from this function in a midi monitor and can confirm the values are being sent.

For some reason the VSTs do not respond to the scripted pitch bend when coming from the OSC message.

I have tried the values ranging from 0-127, 0-16384, but none of them work! I could emulate the hardware value range and channel but still no response.

The midi function from the controller script api is:

Code: Select all

function sendPitchBend(channel, value)
{
   host.getMidiOutPort(0).sendMidi(0xE0 | channel, value & 0x7F, (value >> 7) & 0x7F);
}
I have tried in Int and Float formats, directly from the OSC message, but nothing.

Can you give some insight ?
Thank you

User avatar
moss
KVRAF
3512 posts since 13 May, 2004

Post Tue Dec 06, 2022 12:37 pm

Why should it? You are sending the message to the outside world not Bitwig. Use the method I showed you above.

User avatar
llze
KVRAF
4539 posts since 21 Jan, 2008 from oO

Post Tue Dec 06, 2022 1:17 pm

What is the drawback of OSC that holds back DAW devs to maketheir software fully compatible? I don't really get it somehow.

User avatar
moss
KVRAF
3512 posts since 13 May, 2004

Post Tue Dec 06, 2022 2:15 pm

llze wrote: Tue Dec 06, 2022 1:17 pm What is the drawback of OSC that holds back DAW devs to maketheir software fully compatible? I don't really get it somehow.
It's simply too flexible. It does not define any specific commands / functions. Therefore, most of the time it is easier to write you own implementation.
But if you just want to use it with Bitwig, my DrivenByMoss extension does also support OSC, see the turial video here:
https://www.youtube.com/watch?v=GEH7k1k ... okJ6SruEpq

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Tue Dec 06, 2022 3:47 pm

--
Last edited by ojggaspar on Tue Dec 06, 2022 3:54 pm, edited 1 time in total.

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Tue Dec 06, 2022 3:53 pm

moss wrote: Tue Dec 06, 2022 12:37 pm Why should it? You are sending the message to the outside world not Bitwig. Use the method I showed you above.
Hum, I am using the loopback midi, so it is not sending exactly to the outside world but back into Bitwig. I can confirm the MIDI message is working correctly because, in fact, I also tried sending it to the outside world and the same VST responded accordingly and correctly to the pitchbend movement. It is just that when the MIDI message is sent from and back into Bitwig, using sendPitchBend() it seems to not be recognized as such, with no response whatsoever. I just would like to understand if this is a bug or my ignorance : ) If it is ignorance, why does this happen?

The loopback midi workaround worked correctly for sending CCs (using the sendChannelController()) from and back into Bitwig, it just seems that pitchBend may have some other special requirements.
llze wrote: Tue Dec 06, 2022 1:17 pm What is the drawback of OSC that holds back DAW devs to maketheir software fully compatible? I don't really get it somehow.
This actually seems to not be an OSC problem at all, OSC is working perfectly, It seems to be more a problem with the appropriate function for pitchBend ( is it?)

Thanks!
Last edited by ojggaspar on Tue Dec 06, 2022 6:40 pm, edited 1 time in total.

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Tue Dec 06, 2022 5:42 pm

Ok. Got it to work with sendRawMidiEvent() :ud:
Last edited by ojggaspar on Tue Dec 06, 2022 6:38 pm, edited 1 time in total.

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Tue Dec 06, 2022 6:38 pm

Is there a way to retrieve (via OSC) the name of a midi mapped parameter back to the touchOSC surface?

I know this can be done with the device parameter/pages, but is it possible to get the name of the midi mapped parameter (outside the device parameters pages) back to an OSC label in TouchOSC (or whatever touch surface software) whenever it gets mapped?

Much appreciated!

User avatar
moss
KVRAF
3512 posts since 13 May, 2004

Post Wed Dec 07, 2022 1:20 am

ojggaspar wrote: Tue Dec 06, 2022 6:38 pm Is there a way to retrieve (via OSC) the name of a midi mapped parameter back to the touchOSC surface?

I know this can be done with the device parameter/pages, but is it possible to get the name of the midi mapped parameter (outside the device parameters pages) back to an OSC label in TouchOSC (or whatever touch surface software) whenever it gets mapped?

Much appreciated!
Yes, if you create a mapping by using a user parameter.

User avatar
moss
KVRAF
3512 posts since 13 May, 2004

Post Wed Dec 07, 2022 1:21 am

ojggaspar wrote: Tue Dec 06, 2022 3:53 pm This actually seems to not be an OSC problem at all, OSC is working perfectly, It seems to be more a problem with the appropriate function for pitchBend ( is it?)
I guess you did not forward pitchbend in the NoteInput of your loopback input.

ojggaspar
KVRer
Topic Starter
23 posts since 17 Mar, 2019

Post Wed Dec 07, 2022 1:53 am

moss wrote: Wed Dec 07, 2022 1:20 am Yes, if you create a mapping by using a user parameter.
Ok, this is a bit confusing. "User parameter" in this case refers to controls that can be freely mapped by right-clicking any control in the UI and "Learn Controller Assignment" (Map to controller or key), this is what I would like to know if it is possible to do. When you map something this way it would automatically send the name of the midi mapped parameter via OSC to the OSC text label, is this possible ?

Are you referring to parameter inside what is called Preset Pages (just like the Device pages) when you say a "user parameter"?

Again, thank you!

Return to “Controller Scripting”