Finally got around to making a video of one of my projects that I made using TouchOSC after the great tutorial that @robin.newman made .
Set up 3 buttons to play the I, IV & V chords of a Blues progression and a slider that runs through 5 octaves of a pentatonic scale to use to solo while playing the chords.
Here’s the code
set :trans, 0
pent = scale(:e2, :minor_pentatonic, num_octaves: 5)
osc_send "192.168.1.4", 9000, "osc/Blues/fader1", 0
osc_send "192.168.1.4", 9000, "osc/Blues/toggle1", 0
sleep 0.2
live_loop :Ichord do
use_real_time
b = sync "/osc/Blues/push1"
puts "Button 1 is ", b[0]
if b[0] > 0
play [52, 56, 62, 71], amp: 3, release: 0.5
end
end
live_loop :IVchord do
use_real_time
b = sync "/osc/Blues/push2"
puts "Button 1 is ", b[0]
if b[0] > 0
play [57, 61, 67, 76], amp: 3, release: 0.5
end
end
live_loop :Vchord do
use_real_time
b = sync "/osc/Blues/push3"
puts "Button 1 is ", b[0]
if b[0] > 0
play [59, 63, 69, 78], amp: 3, release: 0.5
end
end
live_loop :slider do
use_real_time
b = sync "/osc/Blues/fader1"
puts "slider is ", b[0]
set :trans, b[0]*24
end
live_loop :toggle do
use_real_time
b = sync "/osc/Blues/toggle1"
puts "toggle is ", b[0]
if b[0] > 0
use_synth :tb303
x = play pent[get(:trans).floor], sustain: 1000
set :x, x
in_thread do
loop do
control get(:x),note: pent[get(:trans).floor]
sleep 0.01
end
end
else
control get(:x),amp: 0,amp_slide: 0.1
sleep 0.1
kill get(:x)
end
end
Here’s a link to download the TouchOSC template.