Hi everyone !
I’m currently working on a dance project on the subject of microplastic pollution.
I will use Touch OSC on stage to control my sounds, and I borrowed some code here from chris.krakou for my “control” script. I also have some scripts and a soundbank of samples I created in Reaper. I already have one working with my Touch OSC but I noticed some latency in the behaviour of my loops.
I guess I have to dig a bit deeper in the forum, I have no training in code so the learning is a bit slow for me ^^ But if by chance you can see somtehing I can improve, here are my first two main scripts :
the “control” script:
#OSC script control for Blind Dreamers.
#the first attempt corresponds to the "Simple" Layout in touch osc
#based on this framework: https://in-thread.sonic-pi.net/t/a-basic-framework-for-using-touchosc-with-sonic-pi/2293
#
#multiples toggles
live_loop :toggle1 do
use_real_time
on = sync "/osc*/1/toggle1"
set :tog1, on[0]
end
live_loop :toggle2 do
use_real_time
on = sync "/osc*/1/toggle2"
set :tog2, on[0]
end
live_loop :toggle3 do
use_real_time
on = sync "/osc*/1/toggle3"
set :tog3, on[0]
end
live_loop :toggle4 do
use_real_time
on = sync "/osc*/1/toggle4"
set :tog4, on[0]
end
live_loop :toggle5 do
use_real_time
on = sync "/osc*/1/toggle5"
set :tog5, on[0]
end
live_loop :toggle6 do
use_real_time
on = sync "/osc*/1/toggle6"
set :tog6, on[0]
end
#multiple faders
live_loop :fader1 do
use_real_time
f = sync "/osc*/1/fader1"
set :fader1, f[0]
if (get(:fader1)<=0.5) then
set :vol1, f[0]*2
print :vol1, f[0]*2
else
set :vol1, f[0]+0.5
print :vol1, f[0]+0.5
end
end
live_loop :fader1 do
use_real_time
f = sync "/osc*/1/fader1"
set :fader1, f[0]
if (get(:fader1)<=0.5) then
set :vol1, f[0]*2
print :vol1, f[0]*2
else
set :vol1, f[0]+0.5
print :vol1, f[0]+0.5
end
end
live_loop :fader2 do
use_real_time
f = sync "/osc*/1/fader2"
set :fader2, f[0]
if (get(:fader2)<=0.5) then
set :vol2, f[0]*2
print :vol2, f[0]*2
else
set :vol2, f[0]+0.5
print :vol2, f[0]+0.5
end
end
live_loop :fader3 do
use_real_time
f = sync "/osc*/1/fader3"
set :fader3, f[0]
if (get(:fader3)<=0.5) then
set :vol3, f[0]*2
print :vol3, f[0]*2
else
set :vol3, f[0]+0.5
print :vol3, f[0]+0.5
end
end
live_loop :fader4 do
use_real_time
f = sync "/osc*/1/fader4"
set :fader4, f[0]
if (get(:fader4)<=0.5) then
set :vol4, f[0]*2
print :vol4, f[0]*2
else
set :vol4, f[0]+0.5
print :vol4, f[0]+0.5
end
end
live_loop :fader5 do
use_real_time
f = sync "/osc*/1/fader5"
set :fader5, f[0]
if (get(:fader5)<=0.5) then
set :vol5, f[0]*2
print :vol5, f[0]*2
else
set :vol5, f[0]+0.5
print :vol5, f[0]+0.5
end
end
and one of the “sound” scripts (don’t mind the silly phrases in french)
BD = "/Users/ltir/Documents/Projets en cours MAC/Blind Dreamers/BD SonicPi/Blind Dreamers Sonic Pi Samples/"
#sample pack, selection de choses enregistrees sur reaper
#note de sandra : le couple est un rubik's, le rubik's couple
#samples :
#00_respirations
#01_chantgorge
#02_grosseimpro (un jeu de nappe de plastique pichtées et avec reverb)
#03_respisJY
#04_rythme (rythme composé dans reaper 8 temps)
#05_submarine
#06_supericeberg
#07_testimpro
#08_bruit blanc
#09_rythme02 (plus long, 32 temps)
#10_reverse sac_01
#11_reverse sac_02
#12_reverse sac_03
#13_respi 01
#14_respi 02
#15_respi 03
#16_respi 04
with_fx :level, amp: 0, amp_slide: 1 do |v|
live_loop :crackscontinuous do
control v, amp: (get (:vol5))
# stop
#sample_duration BD, 6 = 18.56734693877551
if (get(:tog6)>0) then
with_fx :level, amp: 0, amp_slide: [9.25, 18.5].choose do |l|
with_fx :pan, pan: 0, pan_slide: 18.5 do |p|
sample BD, 6, amp: 1
control p, pan: [-1, 1].choose
control l, amp: 3
sleep sample_duration BD, 6
end
end
else
sleep 1
end
end
end
with_fx :level, amp: 0, amp_slide: 1 do |v|
live_loop :cracks do
control v, amp: (get (:vol5))
# stop
#sample_duration BD, 6 = 18.56734693877551
if (get(:tog5)>0) then
if one_in (4)
with_fx :level, amp: 0, amp_slide: [9.25, 18.5].choose do |l|
with_fx :pan, pan: 0, pan_slide: 18.5 do |p|
sample BD, 6, amp: 1
control p, pan: [-1, 1].choose
control l, amp: 3
sleep sample_duration BD, 6
end
end
else
sample BD, 6, amp: 2, onset: pick, pan: rrand(-1, 1)
sleep rrand(5, 7)
end
else
sleep 1
end
end
end
with_fx :level, amp: 0, amp_slide: 1 do |v|
with_fx :lpf, cutoff: 25, mix: 1 do
live_loop :deepnoise do
#stop
control v, amp: (get (:vol4))
if (get(:tog4)>0) then
use_synth :bnoise
play rrand(50, 70), amp: 2, attack: 2, decay: 11
sleep 10
else
sleep 1
end
end
end
end
with_fx :level, amp: 0, amp_slide: 1 do |v|
with_fx :hpf, cutoff: 55, mix: 1 do
live_loop :nicenote do
control v, amp: (get (:vol3))
if (get(:tog3)>0) then
#stop
use_synth :hollow
play [:C5, :Cs5, :C4, :B4, :C3].choose, amp: rrand(0.1, 0.15), attack: 4, decay: 12, pan: rrand(-1, 1)
sleep 8
else
sleep 1
end
end
end
end
with_fx :level, amp: 0, amp_slide: 1 do |v|
with_fx :reverb, room: 1, mix: 1 do
with_fx :bpf, centre: 80, res: 0.9, mix: 0.5 do
with_fx :hpf, cutoff: 55, mix: 1 do
live_loop :highsine do
control v, amp: (get (:vol2))
if (get(:tog2)>0) then
#stop
use_synth :sine
play 48, decay: 8, amp: rrand(0.15, 0.30), attack: 1, pan: -0.1
play 48.5, decay: 9, amp: rrand(0.15, 0.30), attack: 3, pan: 0.1
play 70, decay: 16, amp: rrand(0.01, 0.005), attack: 5, pan: -0.35
play 71, decay: 17, amp: rrand(0.005, 0.010), attack: 7, pan: -0.25
play 87, decay: 32, amp: rrand(0.005, 0.0055), attack: 9, pan: -1
play rrand(100, 200), decay: 33, amp: rrand(0.0005, 0.001), attack: 1, pan: 0.75
sleep 23
else
sleep 1
end
end
end
end
end
end
with_fx :level, amp: 0, amp_slide: 1 do |v|
with_fx :bpf, centre: rrand(40, 90), res: 0.9, mix: 1 do
with_fx :reverb, room: 1, mix: 1 do
with_fx :bitcrusher do
live_loop :abstracttime do
control v, amp: (get (:vol1))
if (get(:tog1)>0) then
#stop
#valeur max de amp : vers 3 ou 4
sample BD, 8, amp: rrand(1, 4), attack: 2, sustain: 10 ,release: 2, pan: rrand(-1, 1), rate: rrand(-1, 3)
sleep rrand_i(1, 10)
#valeur max de amp : 0.5 voir moins ! 0.25 ?
#use_synth :bnoise
sample BD, 8, amp: rrand(0, 3), attack: 2, sustain: 5, pan: rrand(-1, 1), rate: rrand(1, 4)
sleep rrand_i(1, 10)
else
sleep 1
end
end
end
end
end
end