Go Down

Topic: Receive OSC UDP messages - gibberish output... (Read 995 times) previous topic - next topic

netphreak

Hello all,

I have struggled quite a bit trying to achieve my goal - receiving OSC messages sent from Reaper (DAW application, for music production) to Arduino!

Hardware is Uno + W5500 ethernet shield.

My code so far:

Code: [Select]


#include <Ethernet2.h>
#include <EthernetUdp2.h>
#include <SPI.h>   

#include <OSCBundle.h>
#include <OSCBoards.h>
#include <SLIPEncodedSerial.h>
SLIPEncodedSerial SLIPSerial(Serial);

EthernetUDP Udp;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

//Arduino IP & port
IPAddress ip(10, 20, 30, 252);
const unsigned int inPort = 9001;

void setup() {
  //setup ethernet part
  Ethernet.begin(mac,ip);
  Udp.begin(inPort);
  Serial.begin(19200);

}

void loop(){
    OSCBundle msg;
   int size;
 
   if( (size = Udp.parsePacket())>0)
   {
     while(size--)
       msg.fill(Udp.read());

      if(!msg.hasError())
        msg.send(SLIPSerial);
        SLIPSerial.endPacket();
        msg.empty();
        delay(20);
        Serial.println("");       
   }
}


It receives UDP messages - but not like I would like it to be:


I believe the problem is that the values I'm after are floats? Some values are received as string (in addition to float), and are readable.

Anyone have an idea how I can filter the output (let's say I'm only interested in OSC values of messages starting with "/track/3/fx/2/value)? And of course the hardest part - "translate" the gibberish values to readable ones?

Romonaga

I will not pretend that I understand what you are using.  What I do know is that reading the documentation of the library, that you must parse the message you received as it can contain no char data.

It looks like the OSCMessage has a get function that returns A OscArgument.


The OscArgument has get functions that should return the value.
https://www.cs.princeton.edu/~prc/ChucKU/Code/OSCAndMIDIExamples/VideoAction/oscP5/documentation/oscmessage_method_get.htm

I do not believe you will have great success without parsing the OscMesage and building a payload that you can send and parse at the receiving end.
The universe exists only because we are aware of it.
We want a few mad people now. See where the sane ones have landed us!

Go Up