Hi all
Trying to recreate an old translated Ableton lesson in Sonic Pi.
Trouble: If you rerun code it goes out of sync because of “i=0”
So how can I combine rythm and chord progression and still have the ability to turn on/off mixer?
Kind regards
Relaxnow
# ----------------------------------------------------------------------------------------------------------------------------#
# Trouble: 1) If you rerun code it goes out of sync because of "i=0" #
# ----------------------------------------------------------------------------------------------------------------------------#
# ----------------------------------------------------------------------------------------------------------------------------#
# 220418 13:09
# Trying to recreate: "151102 Deadmau5 udfordring lav en ny melodi"
# from a "how to Deadmau" in Ableton, that I have translated to danish from english from YouTube.
# Original english youtube video is not public anymore.
# My Ableton video https://youtu.be/VMKj7SpBwfg from 0:00-0.08 "part C" is what I try to recreate.
# Notes to "part C" from here https://youtu.be/VMKj7SpBwfg?t=86
use_bpm 120
live_loop :met do
sleep 1
end
# ----------------------------------------------------------------------------------------------------------------------------#
# Mixer - NB not working currently => breaks rythm[i] because of "i=0" #
my_chord = 1 #
drum = 2 # 0 no drum #
# # 1 only kick #
# # 2 kick and snare #
hihat = 1 #
# ----------------------------------------------------------------------------------------------------------------------------#
# ----------------------------------------------------------------------------------------------------------------------------#
# just here to not get error. #I dont understand why yet. Tried defonce, so I could avoid resetting "i=0" on rerun, but that didnt work.
repeat = ""
i=0 # Trouble: if you rerun code it goes out of sync because of i=0
# ----------------------------------------------------------------------------------------------------------------------------#
# ----------------------------------------------------------------------------------------------------------------------------#
# Rythm whole song
rythm = [1,0,0,1, 0,0,1,0, 0,1,0,0, 1,0,0,1, 0,0,1,0]
# array, repeated x times
# Part C 0,1 1,1 2,4 3,4 4,1 5,1 6,1 7,2 8,2 9,5
notes = [:a3, :e4, :c5], [:a3, :e4, :a4], [:a3, :e4, :b4], [:d3, :f4, :c5], [:d3, :f4, :d5], [:f3, :g4, :c5], [:f3, :g4, :a4], [:f3, :g4, :b4], [:f3, :g4, :c5], [:g3, :g4, :b4]
#my improv
#notes = [:a3, :e4, :g5], [:a3, :e4, :d5], [:a3, :e4, :b4], [:d3, :f4, :c5], [:d3, :f4, :d5], [:f3, :g4, :c5], [:f3, :g4, :a4], [:f3, :g4, :b4], [:f3, :g4, :c5], [:g3, :g4, :b4]
# ----------------------------------------------------------------------------------------------------------------------------#
with_fx :reverb do
with_fx :ixi_techno, phase: 80, cutoff_min: 80, cutoff_max: 110, res: 0.3 do
live_loop :chords, sync: :met do
stop if my_chord<1
if rythm[i]==1
#puts "i", i, "rythm[i]=", rythm[i], "repeat=",repeat, "notes=",notes[i]
# Number of repeat on chords
repeat = knit(0,1, 1,1, 2,4, 3,4, 4,1, 5,1, 6,1, 7,2, 8,2, 9,5).tick(:a) # part C
r=rrand(0.15, 0.25)
c= range(90,130, steps: 2.5).mirror.tick(:a1)
# Chords
use_synth :saw
play_chord notes[repeat], attack: 0, release: r, cutoff: c, amp: 2, pan: rrand(-1,1) #if rythm[i] == 1
# Subbass
use_synth :fm
play_chord notes[repeat].take(1), attack: 0, release: r, pitch: 0, cutoff: 90, amp: 1 # if rythm[i] == 1
end
sleep 0.25
# resets "i" which counts the rythm[i] (should "rythm" be a ring instead of an array?)
if i<20 then i=i+1
else
i=0
#cue :kick # tried to fix sync with cue but didnt work - not sure if I did it right
#cue :i # tried to fix sync with cue but didnt work - not sure if I did it right
end
end
end # end fx
end # end fx
# ----------------------------------------------------------------------------------------------------------------------------#
live_loop :hihat, sync: :met do
#stop
stop if hihat<1
use_synth :noise
play :c5, release: rrand(0.01,0.03), amp: ring(0.6,0.8).choose, cutoff: rrand(100,130),
pitch: 36, pan: ring(0,0.35,-0.35).choose if bools(0,0,1,1).tick(:bools1)
sleep 0.25
end
# ----------------------------------------------------------------------------------------------------------------------------#
live_loop :kick, sync: :met do
a=1.5 # amp: 1-2
a_snare = a-0.6
case drum
when 0
sleep 4
when 1
4.times do
sample :bd_haus, cutoff: 80, amp: a, pan: 1
sample :bd_haus, cutoff: 90, amp: a, pan: -1
sleep 1
end
when 2
sample :bd_haus, cutoff: 80, amp: a, pan: 1
sample :bd_haus, cutoff: 90, amp: a, pan: -1
sleep 1
sample :bd_haus, cutoff: 80, amp: a
use_synth :noise
play :c5, release: rrand(0.2,0.25), amp: a_snare
sleep 1
sample :bd_haus, cutoff: 80, amp: a, pan: 1
sample :bd_haus, cutoff: 90, amp: a, pan: -1
sleep 1
sample :bd_haus, cutoff: 80, amp: a
use_synth :noise
play :c5, release: rrand(0.2,0.25), amp: a_snare
sleep 1
end
end
# ----------------------------------------------------------------------------------------------------------------------------#