Today I learned that we can send OSC from Sonic Pi with the rythm from the spread() function. That is nice.
osc "/vars/bd", rrand_i(2,5) if spread(3,10).look # OSC to Improviz in variable bd = rrand_i(2,5) if spread(3,10).look
Today I learned that we can use “sample 136” to play sample number 136 in the sample folder.
Sonic Pi code
# 220817 2300 tabla with osc to Improviz
use_osc "localhost", 5510 # Setup OSC to Improviz port
use_bpm 78
live_loop :time, delay: 0.01 do
sleep 1
end
live_loop :bd, sync: :time do
stop
sample :bd_haus, cutoff: rrand(80,90), amp: 2 if spread(3,10).tick #and one_in(2)
#sample :bd_haus, cutoff: rrand(80,90), amp: 2 if spread(3,10).tick and one_in(2)
osc "/vars/bd", rrand_i(2,5) if spread(3,10).look # OSC to Improviz in variable bd = rrand_i(2,5) if spread(3,10).look
sleep 0.125
osc "/vars/bd", 0 # OSC to Improviz in variable bd = 0
sleep 0.125
end
with_fx :reverb do
live_loop :tabla1, sync: :time do
stop
# 136 tabla
#puts sample 136+5
sample 136+5
#sample 136+5, rate: ring(1,2,4,8).choose
osc "/vars/tab1", 1 # OSC to Improviz in variable tab1 = 1
sleep 0.5
osc "/vars/tab1", 0 # OSC to Improviz in variable tab1 = 0
sample 136+5+2, rate: ring(1,2,4,8).choose# if one_in(2)
osc "/vars/tab2", 2 # OSC to Improviz in variable tab2 = 1
sleep 0.5
osc "/vars/tab2", 0 # OSC to Improviz in variable tab2 = 0
sleep 3
sample 136+5+4
osc "/vars/tab3", 3 # OSC to Improviz in variable tab3 = 1
sleep 0.5
osc "/vars/tab3", 0 # OSC to Improviz in variable tab3 = 0
sample 136+5+4+2
osc "/vars/tab4", 4 # if one_in(2)# OSC to Improviz in variable tab4 = 1
sleep 0.5
osc "/vars/tab4", 0 # if one_in(2)# OSC to Improviz in variable tab4 = 0
end
live_loop :tabla2, sync: :time do
stop
sample ring(:tabla_te1, :tabla_te2).choose, pan: 0.75 if spread(3,5).tick(:s)
sleep 0.25
end
live_loop :plip, sync: :time do
stop
sample :elec_plip, amp: 3, rate: ring(1,2).choose, pan: rrand(-1,1) if spread(4,21).tick(:s1)
#synth :saw, note: :c5, release: 0.125 if spread(4,21).tick(:s1)
sleep 0.25
end
# not used
live_loop :tabla3, sync: :time do
stop
sample :tabla_tas3, pan: -0.75, amp: 0.5 if spread(5,7).tick(:st)
#puts spread(5,7).tick(:st)
sleep 0.25
end
end # end reverb
# not used
live_loop :plip2, sync: :time do
stop
# sample :elec_plip, amp: 3, rate: ring(1,2).choose, pan: rrand(-1,1) if spread(4,21).tick(:s1)
synth :saw, note: [:c4], amp: 4, release: 0.2, cutoff: 70 if spread(2,21).tick(:s1)
sleep 0.25
end
Improviz code
paintOver()
#motionBlur()
#220817 2300 tabla with osc to Improviz
# https://improviz.rumblesan.com/language.html
t = time/2
background(0)
a =0.5
bd = ext(:bd,a)
tab1 = ext(:tab1, a)
tab2 = ext(:tab2, a)
tab3 = ext(:tab3, a)
tab4 = ext(:tab4, a)
scale(0.8) # 1 2 4
#if (t%2)
rotate(0,0,t)
#noFill()
fill(255,150,0)
cube(bd*2,0.1,0.1)
#stroke(255)
#strokeSize(1)
move(1,2,1)
#move(1,1*tab1*sin(t/10*tab1),0.5*t*tab2)
rotate(t)
#rotate(t*tan(t/4000))
fill(255)
strokeSize(1)
b= 0.5
cube(tab1+b,tab2+b*5,tab3+b*cos(t*2))
#cube(tab1+b,tab2+b*5,tab3+b*tan(t/4))
#cube(tab1*tan(t*4)+b,tab2+b*5,tab3+b*tan(t/4))
fill(0)
cube(tab4*10,tab4*10)