Just programmed a little Blues Machine, which plays a simple 12-bar-blues in endless variations:
# Blues mit Chords, Bass, Licks und Drums
# SR 05.04.25
# Sources:
# - Crashkurs Harmonielehre, S. 40ff
# - https://www.youtube.com/watch?v=0XJOnGcOPwk&list=PL-BhQk_3ntXZ-aKy1SM4LVSMNZbKASekp&index=15
#
# File: melody_blues_generator.txt
use_bpm 80
use_random_seed 70
# Die Anzahl Halbtöne wird zum Grundton gezählt
g_chord_diffs = [0, [0,5], 0, 0,
5, 5, 0, 0,
7, 5, 0, [0,7]]
g_licks = {
lick_pause:
[[:r],[4]],
lick_cjamblues_1:
[[3,0,3,0], [0.5,0.5,0.5,2.5]],
lick_cjamblues_2:
[[7,5,3,0],[0.5,0.5,0.5,2.5]],
lick_cjamblues_3:
[[:r, 0],[2,2]],
lick_cjamblues_4:
[[5,3,0,:r],[1,0.5,1.5,1]],
lick_cjamblues_5:
[[-2,-2,0,3,0,-2, 0],[0.5,0.5,1.0,0.5,0.5,0.5,0.5]]
}
g_max = g_licks.length - 1
g_sleep = 4
g_times = 1
g_grundton = :C3
# Achtung, der Ton in dieser globalen Variable wird für alle Loops ausser drums verwendet
g_note = g_grundton
# wenn 1 dann loop spielen
g_loop_chords = 0
# Schlagzeug-Begleitung
with_fx :reverb, room: 0.6, mix: 0.3 do
live_loop :ll_drums do
with_fx :compressor, threshold: 0.2, slope_above: 0.5 do
sample :drum_bass_hard, amp: [1.3,1.5,1.7].choose # Bassdrum
sleep 0.5
p_times = 1
if one_in 4 then
p_times = [1,2,3].choose
end
p_times.times do
sample [:drum_snare_soft, :drum_snare_hard].choose, amp: [1.1,1.4,1.6].choose # Snare
sleep 0.5 / p_times
end
end
end
end
# Chords als Loop über g_chord_diffs
live_loop :ll_chords, delay: 8 do
use_synth :piano
use_synth_defaults decay: g_sleep, amp: 2
g_chord_diffs.each do |p_diff|
# vereinzelt gibt es für Akkorde Alternativen
if p_diff.kind_of?(Array) then
l_diff = p_diff.choose
else
l_diff = p_diff
end
g_note = g_grundton + l_diff
if l_diff == 0 then
l_chord = (chord g_note, '6')
else
l_chord = (chord g_note, '7')
end
g_times.times do
play l_chord
sleep g_sleep
end
end
end
# zufällig ausgewählte Licks
with_fx :reverb, room: 0.6, mix: 0.3 do
live_loop :ll_licks, delay: 8 do
use_synth :pluck
use_synth_defaults amp: 4, coef: [0.2,0.3,0.4].choose, sustain: 0.5
temp_num = rrand_i(0, g_max)
print temp_num
p_lick = g_licks.values[temp_num]
print p_lick
l_notes = p_lick[0].map {|a| a + 12 + note_info(g_note).midi_note}
play_pattern_timed l_notes, p_lick[1]
end
end
# Basslinie passend zur Akkordfolge
live_loop :ll_bass, delay: 4 do
use_synth :bass_foundation
l_note = g_note - 24
play l_note, release: 0.5, amp: 1.5
sleep 0.5
play l_note + 7, release: 0.5, amp: 1.2
sleep 0.5
play l_note + 12, release: 0.5, amp: 1
sleep 0.5
play l_note + 7, release: 0.5, amp: 1.3
sleep 0.5
end