Communicating with Sonic Pi using UDP sockets

You should not call bind, that asks the OS to listen for UDP messages on that (ip, port).

The send call looks correct assuming the OSC receiving software is running on the same host as you are running Julia. If this is not the case, you can try

addr = getaddrinfo("sonicpi")
send(sock, addr, 4560, msg.data)

where "sonicpi" is replaced by the hostname of the machine running Sonic Pi.

You can check that network communication is working by running

sudo tcpdump -i eth0 -X udp port 4560

On the receiving device, you should see a hexadecimal representation of msg.data whenever you send a message. If the receiving device and the sending device are the same, you should replace eth0 by lo in the above command.

If network communication is working as expected, then it is possible Sonic Pi and Julia’s OpenSoundControl disagree about some part of the OSC spec, comparing message data for the Julia and Python versions seems like a good next step.

1 Like