1

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.

Max N
  • 1,134
  • 11
  • 23
Stef
  • 13
  • 5
  • What's the OS? On Linux I can connect as many apps as I like listening to one MIDI device. – Max N May 15 '22 at 22:01
  • Linux- but that's not the point. As said, the HID/USB Device is claimed entirely by Ruby via Libusb - and that means that you have to detach it from the Kernel drivers, so the Device is not accessible by other programs/drivers anymore. Ruby plays here the role of the Driver, so it has to handle the communication between the HID/integrated Midi Interface and PD via OSC, because PD doesn't see the Midi interface anymore. – Stef May 16 '22 at 17:39
  • OK, so the question is not about Ruby or MIDI or OSC but simply a basic Pd question how to split lists of numbers. For the sake of usefulness of the question in the context of stack overflow as a reference, I'd suggest to edit the whole question and delete all the parts not specific to the issue. – Max N May 24 '22 at 14:54

1 Answers1

0

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]. Also look for into the helpfiles of [netreceive], [oscparse], [oscformat]

Max N
  • 1,134
  • 11
  • 23