I have written this simple exercise to introduce connecting the Wekinator machine learning modeling software to Sonic Pi. I believe I have successfully connected Wekinator to SonicPi. Wekinator is sending classification data to SonicPi, using the default path, and the data values are appearing in CUES. My coding does not appear to be reading the data values to then be used by the program. I am printing the value “c” so that I can better see what is going on. What am I missing here? Can anyone assist?
live_loop :classifier do
use_real_time
c = sync “/osc/wek/outputs”
if c = 2.0
sample :drum_heavy_kick
sleep 0.5
print c
else
play 89
sleep 0.25
print c
end
Thanks for the suggestion. I agree that the program code is not properly accessing/seeing the values fed to CUES. I added the code you suggested but it’s still not working quite yet.
use_osc "localhost", 4560
live_loop :send do
osc "/foo", [2, 5].tick
sleep 1
end
notes = (ring 45,47,48,52)
live_loop :osc_receiver do
use_real_time
c= sync "/osc*/foo"
puts c
if c[0] == 2
sample :drum_heavy_kick
print c
else
play 89
print c
end
play notes.tick
end
Thank you to all who assisted me. I figured it out with the help of all of you. What a great community.
I am going to play with it a bit more and come back to post the final code. This will be presented to students working in a Machine Learning course.