Free OCS Android app
Simply enter the IP address of the sonic-pi host in the android application settings and allow OSC messages in sonic-pi.
OSC Controller
Example: Play a sample on sonic-pi by an OSC Controller button and control the amplitude with an OSC Controller slider.
live_loop :foo do
a = sync "/osc/oscControl/button1"
b = get "/osc/oscControl/slider1"
if a[0] == 1
sample :bd_boom, amp: b[0]
end
end
OSC Surface
Example: Play a synth on sonic-pi using an OSC Surface keyboard and control the amplitude with an OSC Surface slider(knob1).
live_loop :foo do
a = sync "/osc/note"
b = get "/osc/cc/1"
if a[2]>0
synth :beep, note: a[1],amp: b[0]
end
end
OscHook
Example: Control the ocean wave in Sonic-pi with the sensors of an Android smartphone.
with_fx :reverb, mix: 0.5 do
live_loop :foo do
a = sync "/osc/accelerometer/raw/y"
if a[0]>7
s = synth [:bnoise, :cnoise, :gnoise].choose, amp: rrand(0.5, 1.5), attack: rrand(0, 4), sustain: rrand(0, 2), release: rrand(1, 5), cutoff_slide: rrand(0, 5), cutoff: rrand(60, 100), pan: rrand(-1, 1), pan_slide: rrand(1, 5), amp: rrand(0.5, 1)
control s, pan: rrand(-1, 1), cutoff: rrand(60, 110)
else if a[0]<-7
s = synth [:bnoise, :cnoise, :gnoise].choose, amp: rrand(0.5, 1.5), attack: rrand(0, 4), sustain: rrand(0, 2), release: rrand(1, 5), cutoff_slide: rrand(0, 5), cutoff: rrand(60, 100), pan: rrand(-1, 1), pan_slide: rrand(1, 5), amp: rrand(0.5, 1)
control s, pan: rrand(-1, 1), cutoff: rrand(60, 110)
end
end
end
end