Home > front end >  Transmitting MIDI Message from Ruby to Pure Data over OSC
Transmitting MIDI Message from Ruby to Pure Data over OSC

Time:05-19

I'd like to transmit a MIDI message from an USB Midi Device, where the MIDI data is captured via Ruby/libusb, to Pure Data by using OSC.

The reason why I need this construction is that the USB MIDI interface is integrated into a USB control surface and the entire device is claimed already by Ruby for other communication reasons, so it is blocked for using it directly in Pd.

This is how I tried it. Assume that "mididata" holds an array, which is already converted to a string with @mididata=data.bytes


  @client.send Message.new("/Midi",@m.mididata.join(" "))

I have to use a blank space as a delimiter, because if I try to comma-separate it, Pd (or Ruby) invokes an backslash before the comma.

So this gives me on the Pd side:

print: 8 128 46 64

I have no clue where the "8" comes from, but this is not my main concern. It is more about how to split that information into Number-Chunks of "128" "46" "64" in order to form a message for the Pd Synthesizer instance with this information - instead of using the usual "Midiin"-Object.

CodePudding user response:

You can get the individual items of a list with the unpack object. for a list of four floats use [unpack f f f f]. Did I understand the issue correctly? Also look for into the helpfiles of [netreceive], [oscparse], [oscformat]

  • Related