Thread: String to Hex
View Single Post
Old 07-06-2022, 01:27 PM   #5
Fleeesch
Human being with feelings
 
Fleeesch's Avatar
 
Join Date: Apr 2011
Location: Germany
Posts: 175
Default

Following the programming manual printf() does what sprintf() does, it's a function used to convert numbers to strings. If you just put a number into it there should be some kind of an error message.

sprintf goes like
Code:
sprintf(#string_out,"%i",input_value)
From right to left: input_value goes in, gets formatted as an integer, string goes out.

For sending MIDI you use this one:

midisend(device_index,m1,m2,m3)

Sends a simple 3 byte message. device_index is the index number of the midi device, m1 the status byte (type of message + channel), m2 the controller number, m3 the value.

So you wanna do something like sending modwheel on channel 1, max position to the first midi device in the list you can do this:

Code:
midisend(0,176,1,127);

or in hex

midisend(0,0xB0,0x01,0x7F);

same thing, just different appearance.
This table here is a good overview of MIDI messages.
Comes with all the data formats and whatnot.

Maybe I'll come up with a quick solution and leave some code that should allow you to write a simple OSC-MIDI converter. Would be in my interest, too, could use some scripts here and there. OscII Bot just won't output any gfx on my machines, sample scripts ain't working right, don't know why, have to go figure.
Fleeesch is offline   Reply With Quote