Created
March 10, 2017 20:11
-
-
Save peter-jung/636bbfffe6ffeaec01a604a0a45a588b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bpm = 200 # Beats Per Minute (BPM) = Schläge pro Minute | |
bptakt = 4 # | |
base = :a4 | |
sc = scale(base, :aeolian) | |
takt_duration = 60.0/bpm*bptakt | |
haenschenklein = [ | |
[ [5,1], [3,1], [3,2] ], | |
[ [4,1], [2,1], [2,2] ], | |
[ [1,1], [2,1], [3,1], [4,1] ], | |
[ [5,1], [5,1], [5,2] ], | |
[ [5,1], [3,1], [3,2] ], | |
[ [4,1], [2,1], [2,2] ], | |
[ [1,1], [3,1], [5,1], [5,1] ], | |
[ [1,4] ] | |
] | |
allemeineentchen = [ | |
[ [1,1], [2,1], [3,1], [4,1] ], | |
[ [5,2], [5,2] ], | |
[ [6,1], [6,1], [6,1], [6,1] ], | |
[ [5,4] ], | |
[ [6,1], [6,1], [6,1], [6,1] ], | |
[ [5,4] ], | |
[ [4,1], [4,1], [4,1], [4,1] ], | |
[ [3,2], [3,2] ], | |
[ [2,1], [2,1], [2,1], [2,1] ], | |
[ [1,4] ] | |
] | |
fuchsduhastdiegansgestohlen = [ | |
[ [1,1], [2,1], [3,1], [4,1] ], | |
[ [5,1], [5,1], [5,1], [5,1] ], | |
[ [6,1], [4,1], [8,1], [6,1] ], | |
[ [5,4] ], | |
[ [6,1], [4,1], [8,1], [6,1] ], | |
[ [5,4] ], | |
[ [5,1], [4,1], [4,1], [4,1] ], | |
[ [4,1], [3,1], [3,1], [3,1] ], | |
[ [3,1], [2,1], [3,1], [2,1] ], | |
[ [1,1], [3,1], [5,2] ], | |
[ [5,1], [4,1], [4,1], [4,1] ], | |
[ [4,1], [3,1], [3,1], [3,1] ], | |
[ [3,1], [2,1], [3,1], [2,1] ], | |
[ [1,4] ] | |
] | |
#melody = haenschenklein.ring | |
melody = allemeineentchen.ring | |
#melody = fuchsduhastdiegansgestohlen.ring | |
#melody = [].ring | |
live_loop :eins do | |
sleep takt_duration | |
end | |
define :mutate_divide_takt_rand do |takt, prob| | |
res = [] | |
takt.each do |note, dur| | |
if (rand < prob) | |
res.concat [[note-1, 0.5*dur]] | |
res.concat [[note+[1,3].choose, 0.5*dur]] | |
else | |
res.concat [[note-1,dur]] | |
end | |
end | |
res | |
end | |
define :mutate_add_takt_rand do |takt, prob| | |
res = [] | |
takt.each do |note, dur| | |
if (rand < prob) | |
res.concat [[note-1, 0.66*dur]] | |
res.concat [[note+[1,3].choose, 0.34*dur]] | |
else | |
res.concat [[note-1,dur]] | |
end | |
end | |
res | |
end | |
live_loop :melodie do | |
with_fx :reverb do | |
use_synth :beep | |
sync :eins | |
takt = melody.tick | |
takt = mutate_divide_takt_rand takt, 0.75 * rand | |
takt.each do |note, dur| | |
tone = sc[note] | |
duration = dur*60.0/bpm | |
play tone, release: duration , amp: rand+0.1 , attack: 0.05*rand/dur, decay: 0.03 | |
sleep duration | |
end | |
end | |
end | |
alle_zwei_takte = [true,false].ring | |
live_loop :eins do | |
sync :melodie | |
if (alle_zwei_takte.tick) | |
len = sample_duration :loop_amen | |
rate = len / takt_duration | |
#sample :loop_amen, rate: rate / 2, amp: 0.5 | |
end | |
end | |
#=begin | |
live_loop :base do | |
sync :eins | |
sample :drum_heavy_kick, amp: (ring 1,2).tick | |
end | |
snare_2 = [false,true].ring | |
live_loop :snare do | |
sync :eins | |
sleep 1.5*60.0/bpm | |
sample :drum_snare_soft, amp: (ring 0,1).tick | |
sleep 0.5*60.0/bpm | |
sample :drum_snare_soft | |
end | |
live_loop :hihat do | |
sync :eins | |
sample [:drum_cymbal_open, :drum_cymbal_pedal].choose | |
sleep 60.0/bpm | |
sample [:drum_cymbal_closed, :drum_cymbal_pedal].choose | |
sleep 60.0/bpm | |
sample [:drum_cymbal_closed, :drum_cymbal_pedal].choose | |
sleep 60.0/bpm | |
sample [:drum_cymbal_closed, :drum_cymbal_pedal].choose | |
end | |
#=end | |
live_loop :hihat do | |
sync :eins | |
sample :elec_wood, amp: 4 * (ring 0.1, 2, 0.1, 1).tick | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment