Exploring code from Repeating Random Loops? - #2 by samaaron
# 230707 0041 Exploring repeating-random-loops post from inthread
# Saved 230707 0041
# https://in-thread.sonic-pi.net/t/repeating-random-loops/7908/2
# Performance https://youtu.be/r2EUfz0tP9E
set_volume! 4
live_loop :use_random_seed___mixer do
tick
/ auto mixer /
kn = 8
mixer = knit(1,kn,2,kn,3,kn,4,kn).look
puts 'Mixer =', mixer if spread(1,kn).look
/ manual mixer /
#mixer = 1
case mixer
when 1
set :use_random_seed_sampleslicer1, 1300 # 1300 2000 2220 2220
set :use_random_seed_sampleslicer2, 4 # 4 3000 3000 2000
when 2
set :use_random_seed_sampleslicer1, 2000
set :use_random_seed_sampleslicer2, 3000
when 3
set :use_random_seed_sampleslicer1, 2220
set :use_random_seed_sampleslicer2, 3000
when 4
set :use_random_seed_sampleslicer1, 2220
set :use_random_seed_sampleslicer2, 2000
end
kni = 32
samples_and_amp = knit(1,kni,2,kni).look
#samples_and_amp = 1
case samples_and_amp
when 1
set :sampleslicer1_samplename1, :loop_tabla
set :sampleslicer1_samplename1_amp, 2
set :sampleslicer2_samplename1, :loop_safari
set :sampleslicer2_samplename1_amp, 2
set :sampleslicer2_samplename2, :loop_weirdo
set :sampleslicer2_samplename2_amp, 0
when 2
set :sampleslicer1_samplename1, :loop_tabla
set :sampleslicer1_samplename1_amp, 2
set :sampleslicer2_samplename1, :loop_safari
set :sampleslicer2_samplename1_amp, 2
set :sampleslicer2_samplename2, :loop_weirdo
set :sampleslicer2_samplename2_amp, 1.5
end
sleep 1
end
live_loop :bass do
tick
use_synth :sine
play :c2 if spread(1,32).look
sleep 0.5
end
live_loop :sampleslicer1 do
use_random_seed get[:use_random_seed_sampleslicer1]
#use_random_seed 2220 # 3000 2000 2220 2220
4.times do
#amp1 = 2
amp1 = get[:sampleslicer1_samplename1_amp]
c = 130
r = [0.8, 0.4].choose
slice = rand_i(8*2)
slice_size = 0.125/2
s = slice * slice_size
f = s + slice_size
s1 = get[:sampleslicer1_samplename1]
sample s1, start: s, finish: f, amp: amp1, cutoff: c, rate: r, pan: [-0.5, 0.5].choose
#sample :loop_tabla, start: s, finish: f, amp: amp1, cutoff: c, rate: r, pan: [-0.5, 0.5].choose
sleep 0.5
end
end
live_loop :sampleslicer2 do
use_random_seed get[:use_random_seed_sampleslicer2]
#use_random_seed 2000 # 3000 3000 3000 2000
4.times do
# amp2 = 2
amp2 = get[:sampleslicer2_samplename1_amp]
amp3 = get[:sampleslicer2_samplename2_amp]
c = 130 #130
r = [0.8, 0.4].choose
slice = rand_i(8*2)
slice_size = 0.125/2
s = slice * slice_size
f = s + slice_size
s1 = get[:sampleslicer2_samplename1]
s2 = get[:sampleslicer2_samplename2]
sample s1, start: s, finish: f, amp: amp2, cutoff: c, rate: r, pan: [-0.75, 0.75].choose
sample s2, start: s, finish: f, amp: amp3, cutoff: c, rate: r, pan: [-0.75, 0.75].choose
sleep 0.5
end
end
# Hydra code
# https://hydra.ojack.xyz/?code=JTJGJTJGczEuaW5pdFNjcmVlbigpJTBBJTIwJTIwJTBBc3JjKHMxKSUwQSUyRiUyRi5waXhlbGF0ZSgzMDAlMkMyMDApJTBBJTBBLm1hc2soc2hhcGUoNCUyQzAuOCkpLnNjYWxlKDEuMjUlMkM5JTJGMTYpJTIwJTBBLm1hc2soc2hhcGUoOTklMkMwLjgpKS5zY2FsZSgxLjI1JTJDOSUyRjE2KSUyMCUwQSUwQS5tdWx0KHNoYXBlKCU1QjIlMkMzJTJDNCUyQzk5JTVELmZhc3QoKSUyQzAuOCkuc2NhbGUoMSUyQzklMkYxNikpJTBBLmRpZmYodm9yb25vaSgxMCUyQzAuNSUyQzIpJTJDb3NjKDIlMkMwLjIpJTJDMjApJTBBLmx1bWEoJTVCMC4yJTJDMC40JTJDMC42JTJDMC44JTJDMC42JTJDMC4zJTJDMC4xJTVELmZhc3QoMC4yKSklMEEudGhyZXNoKCU1QjAuMiUyQzAuNCU1RC5mYXN0KCkpJTBBLnJvdGF0ZSgwJTJDMC4wMSklMEElMkYlMkYubW9kdWxhdGUob3NjKDUlMkMwLjAxKSklMEEubWFzayhzaGFwZSglNUI5OSU1RC5mYXN0KCklMkMwLjgpLnNjYWxlKDElMkM5JTJGMTYpKSUwQS5vdXQobzEpJTBBJTBBc3JjKHMyKS5ibGVuZChvMSkuc2NhbGUoMikudGhyZXNoKDAuMikub3V0KG8yKSUwQXJlbmRlcihvMiklMEElMEElMEElMEE%3D
Hydra
//s1.initScreen() //run 1.time then uncomment
src(s1)
//.pixelate(300,200)
.mask(shape(4,0.8)).scale(1.25,9/16)
.mask(shape(99,0.8)).scale(1.25,9/16)
.mult(shape([2,3,4,99].fast(),0.8).scale(1,9/16))
.diff(voronoi(10,0.5,2),osc(2,0.2),20)
.luma([0.2,0.4,0.6,0.8,0.6,0.3,0.1].fast(0.2))
.thresh([0.2,0.4].fast())
.rotate(0,0.01)
//.modulate(osc(5,0.01))
.mask(shape([99].fast(),0.8).scale(1,9/16))
.out(o1)
src(s2).blend(o1).scale(2).thresh(0.2).out(o2)
render(o2)