Can someone please help me to talk OSC between Arduino and Pd? I just need some sketch for the Arduino that can get me going.
Arduino->Pd with Open Sound Control
@cfry I used the Arduino library "OSC" by Adrian Freed and in it there are lots of Arduino examples and a few Pd examples using the mrpeach library (which I don't use anymore since vanilla started talking OSC natively). If you can give me a better sense of what you are having trouble with I can make a more helpful example, e.g. do you need bidirectional messaging? What data are you passing (if any)? What Arduino library would you prefer to use (I see there are more now than when I started)? is it over WiFi or ethernet or something else?
But maybe this example from the OSC lib is all you need: UDPSendMessage.ino
Edit: I found my knockoff ethernet shield and wrote this Arduino sender and Pd receiver,. It includes an example of how to route numbers in the OSC path. Hope this helps.
osc rcv dump.pd
@jameslo Thanks a lot!
I can send messages locally between Pd, Processing and Unity. But not Arduino.
These works but I can still not for example replace Processing with Arduino.
@jameslo said in [Arduino->Pd with Open Sound Control] do you need bidirectional messaging? What data are you passing (if any)? What Arduino library would you prefer to use (I see there are more now than when I started)? is it over WiFi or ethernet or something else?
-bidirectional is good. Type of data, analog float, and digital. I have no preference for what library I use. I just want to make it work locally on a single computer.
I would like to use the Arduino as a controller for Pd through OSC.
For example, 5 analog ins on the Arduino that I after som treatment (smoothing and more) send locally to Pd, with custom osc addresses: /myArduino/analog-0
Why do you need Arduino to communicate with Pd with the OSC protocol instead of just sending raw serial bytes? You can receive raw bytes in Pd and then send whatever you want, based on that, to the rest of the software with OSC.
I had an idea that it would be good to have the flexibility to go any route, even not through Pd. Don't know if it is a good idea.
I have made some abstractions to facilitate the communication between the Arduino and Pd. You can find them here https://github.com/alexdrymonitis/Arduino_Pd
You can easily use the
Serial.print()function in the Arduino and receive the data in Pd via the
[serial_print]abstraction. Once you receive your data in Pd you can send it wherever you like through OSC. If you go that route, do read the README file before using it, and check the Arduino sketches to see how to use the
Serial.print()function so it can work properly.
@alexandros Thank you, I have been using (and still do) your abstractions extensively and it is great.
However, I just want to understand Open Sound Control and how I could use it. My idea was that I could use it sort of a hub between several local applications, and all I would have to do was edit the OSC address to change route.
@cfry It's fun just to play with for sure! And if you ever do OSC over WiFi you can easily power your Arduino from a LiPo battery and cut all the cables!
Here's an example of sending OSC from Pd to Arduino. I thought I would be controlling the on-board LED but realized too late that pin 13 is also used for SPI's sck line, oh well. But you can see the OSC path traversal on the serial monitor.