I am making an ultrasonic theremin using sonic pi and thonny(python). It does detect the distance, and the sonic pi’s live loop does work, but the sonic pi wont receive any information from the python code detecting the distance.
Sonic Pi code:
live_loop :listen do
use_real_time
m = sync “/osc*/play_this”
note = m[0]
play note
end
Python code:
from gpiozero import DistanceSensor
from time import sleep
from pythonosc import osc_message_builder
from pythonosc import udp_client
At least going by the code that you have shared above, there is a difference between the addresses that you are sending messages to and receiving messages from:
I am using sonic pi 3.3.1 and I can’t see any cues in the cues log. I only have access to the programs during class, so I will try your suggestion as soon as I can.
I have corrected the error, and tried puts more instead of play note. Neither have made the programs work as wished. There is nothing showing up in the cues, so I think that either the python code is not sending the information or that Sonic Pi isn’t open to receiving information.
By ‘puts more’, it’s possible Robin meant ‘puts note’ to see what the value of ‘note’ was
You can check whether the OSC networking feature is enabled by looking at the IO tab of the preferences panel, (or IO menu in the main menu) and seeing whether ‘Allow incoming OSC’ is checked.
If it is checked, then assuming you are in fact sending and receiving to/from the same address, (which would be easier to see if you’re able to share your code again), there might be a networking problem, such as a firewall blocking a port. If that were the case, it would be helpful for us to see your log files, in your home directory, in .sonic-pi/log.