Questions About Raw Midi Events In Osc

I have a couple of questions about the /renoise/trigger/midi(number) OSC message.

First of all, can I use it to trigger a note, and how does this work? A note events consists of three bytes, but the OSC message only takes one argument. Should I convert the three bytes to one large number?

Secondly, what does Renoise do with these midi events? Are they treated the same way as midi events from external midi devices or as events from the ‘master midi keyboard’? Am I right in thinking that these notes are sent to the Renoise OSC device in the list of MIDI input devices in the instrument settings tab?

To trigger a note, you need to send a note-triggering event to Renoise, this one also accepts more arguments:

  
 o_message = OscMessage(  
 "/renoise/trigger/note_on",{  
 {tag="i",value=instrument_number},  
 {tag="i",value=track},  
 {tag="i",value=note_value},  
 {tag="i",value=velocity_value}  
 }  
  

Same goes for the note-off value, though the velocity parameter does not exist for the note-off event.

Technically; yes it does, as far as midi specification goes. Not many people implement it though. May be used for different lengths of Release stage of a envelope on a Note Off for an example.

@vV:
I know, that is how my script currently works. But I was wondering if I could use the API to access the “Renoise OSC device” in the list of midi inputs for each instrument. So I don’t want to specify an instrument or a track, but a midi channel. That way, the script could take advantage of the new midi routing in 2.7.

If this can’t be done, then why is the Renoise OSC device in the midi input list, anyway? How do you use it? You can specify a midi channel in the midi input box, so how do you get it to send a note on a certain channel?

Yes, but we’re talking about OSC here, not midi. In Renoise’s OSC implementation no velocity is specified for note off events.

I think this is the crux of the question.

I too am not sure what this is. It wasn’t in 2.6. I would like to know as well. :)

Yeah, that last part is currently for me a question as well simply because this just got introduced in Renoise 2.7 and isn’t documented in the API yet (or not as far as i could find earlier).
Also the midi message i haven’t figured all out completely, but i simly suspect one can sent a CC message and the according value that comes with it, but i don’t know if that has to come in a binary format or separate arguments as they supposed to come along.

“Renoise OSC device” in the MIDI input routing simply allows routing any MIDI events that come from OSC to an instrument. Maybe not a killer feature, but we thought this may be useful.

Expected numbers are or’ed raw MIDI bytes. See http://www.blitter.com/~russtopia/MIDI/~jglatt/tech/midispec.htm

Example for a note-on event: 0x92 (Note-On status) 0x20 (Note no. 20 hex) and 0x7f (full Velocity)
→ 0x7F2090 hex → 8331408 decimal
→ /renoise/trigger/midi 08331408

Thanks for clearing that up, that is how I was hoping it would work. If I understand this correctly, it opens up some interesting possibilities. I’ll see if I can make something useful with this. (What I’m trying to achieve is triggering different instruments on different tracks from the computer keyboard, which is now only possible with external midi devices)

I noticed the renoise osc input lets you specify channel.
What I don’t know is how you would send osc in a different channel.

I guess you have to us midi channel

for Note On
0x90 to 0x9F where the low nibble is the MIDI channel

so

0x90 0x3C 0x40 Note On/chan 0, Middle C, velocity could be anything except 0

all from the link in taktik reply

Yay, I got it working! :) See this topic.

so when you say or’ed is it not simply adding the 3 bytes together?

Exactly. It’s three separate bytes converted to one number (24 bits). You have to write down the three 2-digit hex numbers in sequence, so that you get one 6-digit number, then convert that to decimal. I used this formula to avoid all the hex stuff:

velocity * 65536 + note *256 + channel+143

or

velocity * 65536 + note *256 + channel+127 for note off events

(65536 = 256^2)

Side note: What I don’t understand is why velocity is the most significant byte here. Wouldn’t it make more sense if status was the most significant byte, since it is the first in the sequence of bytes normally transmitted through midi? Not that it matters, just wondering…