Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sequencer Stategies (Sonic Pi and 0-Coast)
# Sequencer Strategies V
#
# Explorations inspired by Lines Thread "Sequencer Strategies",
# https://llllllll.co/t/sequencer-strategies/25375
#
# Manipulations of Musical Patterns
# by Laurie Spiegel
# September, 1981
# http://retiary.org/ls/writings/musical_manip.html
#
use_bpm 120
set :notes, (ring :c5, :r, :c4, :r)
set :notes, (ring :c3, :bb2, :r, :r, :f4, :c2, :bb3, :e4, :g4)
set :notes, (scale :c3, :mixolydian, num_octaves: 3)
set :num, 8
set :rand, (ring 1)
set :quant, (ring 0.25)
set :vel, (ring 0.5)
set :shift, 2
defonce :init do
set(:seq, (ring :r))
end
seq = []
dur = 0.125
# Get Makenoise from soundcard (meaning: Direct Monitor @Focusrite = off)
with_fx :sound_out_stereo, output: 9 do
with_fx :sound_out_stereo, output: 7 do
live_audio :makenoise, stereo: true
end
end
live_loop :beat do
sleep 1
end
# Store original sequence
live_loop :seq0, sync: :beat do
#stop
use_random_seed get(:rand).tick # 1, 1286
get(:num).times do
n = get(:notes).choose
sleep dur
if seq.size < get(:num)
seq.push(n)
end
end
set(:seq, seq.ring)
sleep dur * get(:num)
seq = []
end
# No change
live_loop :original, sync: :seq0 do
stop
get(:num).times do
midi_note_on get(:seq).tick, vel_f: get(:vel).look, channel: 1
sleep get(:quant).look
midi_note_off get(:seq).look, channel: 1
end
end
# Adding an offset of fixed magnitude throughout a pattern.
# This technique has been most noticably applied to pitch patterns in music,
# but can be applied to other aspects, such as amplitude, harmonic richness, or tempo.
# Transposition
live_loop :transposition_pitch, sync: :seq0 do
stop
puts "#{get(:seq)} -------------------"
get(:num).times do
with_transpose 0 do
midi_note_on get(:seq).tick, vel_f: get(:vel).look, channel: 1
sleep get(:quant).look
midi_note_off get(:seq).look, channel: 1
end
end
end
# Reversal
live_loop :reversal, sync: :seq0 do
stop
r = get(:seq).reverse
get(:num).times do
midi_note_on r.tick, vel_f: get(:vel).look, channel: 1
sleep get(:quant).look
midi_note_off r.look, channel: 1
end
end
# Rotate
live_loop :rotate, sync: :seq0 do
#stop
r = get(:seq).rotate(get(:shift))
get(:num).times do
midi_note_on r.tick, vel_f: get(:vel).look, channel: 1
sleep get(:quant).look
midi_note_off r.look, channel: 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment