I had a lot of fun using the idea of state machines introduced to me by @nabisco - many thanks again!
Right now I´m trying to combine this approach to improvisation with regularity:
have the state machine start over new every 3 bars, for example.
I manage to approximate this, but not exactly:
use_bpm 120
set :current_state, 0
NOTES = [52, 62, 64, 52, 52, 55, 55]
INTERONSET = [1, 0.25, 0.5, 0.5, 0.25, 0.5, 0.25]
RULES = {
0 => [1],
1 => [2],
2 => [3, 5],
3 => [4],
4 => [5],
5 => [5, 0, 6],
6 => [0]
}
live_loop :reset do
Rst = tick
puts look
if look > 4
tick_reset
end
sleep 1
end
live_loop :update_state do
# get current state value -- 0 on the first run
s = get[:current_state]
play NOTES[s], amp: rrand(0.2, 0.8), release: rrand(0.1, 0.6), pan: 0
# update to next state - or reset to first state
if Rst > 4
set :current_state, 0
else
set :current_state, RULES[s].choose
end
sleep INTERONSET[s]
end
live_loop :drms do
sample :drum_bass_hard
sample :drum_cymbal_open, amp: 0.1
sleep 1
sample :drum_snare_soft
sleep 1
sample :drum_bass_soft
sleep 1
sample :drum_snare_soft
sleep 1
sample :drum_bass_soft
sleep 1
sample :drum_snare_soft
sleep 1
end
The state machine does start new regularly, but delayed, for a sixteenth or an eight note.
Any ideas how to exactly start on the beat each time?