Last active
January 30, 2023 05:54
-
-
Save alexglow/f2d3c74731f1f608d29b71cee3db79cd to your computer and use it in GitHub Desktop.
sonic-pi-arpeggidata
This file contains hidden or 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
# arpeggiate a given chord, over a given octave range | |
# easily change the root note & scale while it's running | |
# based on robin.newman, https://in-thread.sonic-pi.net/t/force-random-notes-into-a-scale-after-transposing/4493/2 | |
notes = scale(:c3,:major,num_octaves: 3) # list of 22 notes | |
arp = [0,2,4,7,9,11,14,16,18,21] # note values for arpeggiation, 0-indexed | |
live_loop :test do | |
n=rand_i(10) # number of notes in "arp" list; pick one | |
puts n | |
mynote = arp[n] | |
play notes[mynote] | |
sleep 0.2 | |
end |
This file contains hidden or 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
# fit input data to an arpeggio | |
notes = scale(:c2,:major,num_octaves: 5) # list of 36 notes | |
arp = [0,2,4,7,9,11,14,16,18,21,23,25,28,30,32,35] # note values for arpeggiation, 0-indexed | |
iter = 1 | |
live_loop :test do | |
mynote = arp[iter % 16] # iterate over the sequence – this is where your normalized data go | |
play notes[mynote] | |
iter = iter+1 | |
sleep 0.2 | |
end |
This file contains hidden or 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
# iterate over chords | |
cmaj = scale(:c2,:major,num_octaves: 5) # list of 36 notes | |
emin = scale(:e2,:minor,num_octaves: 5) | |
fmaj = scale(:f2,:major,num_octaves: 5) | |
fmin = scale(:f2,:minor,num_octaves: 5) | |
arp = [0,2,4,7,9,11,14,16,18,21,23,25,28,30,32,35] # note values for arpeggiation, 0-indexed | |
iter = 1 | |
frame = 1 | |
live_loop :test do | |
mynote = arp[iter % 16] # iterate over the sequence – this is where your normalized data go | |
if mynote == (iter % 16) # at the top of the sequence | |
frame = frame+1 | |
end | |
if (frame % 4) == 1 | |
play cmaj[mynote] | |
elsif (frame % 4) == 2 | |
play emin[mynote] | |
elsif (frame % 4) == 3 | |
play fmaj[mynote] | |
elsif (frame % 4) == 0 | |
play fmin[mynote] | |
end | |
iter = iter+1 | |
sleep 0.2 | |
end |
This file contains hidden or 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
# arpeggiate semi-randomly over switchable chord progression | |
# with help from tedward | |
# plus, voices + reverb | |
cmaj = scale(:c2,:major,num_octaves: 5) # list of 36 notes | |
dmaj = scale(:d2,:major,num_octaves: 5) | |
emin = scale(:e2,:minor,num_octaves: 5) | |
fmaj = scale(:f2,:major,num_octaves: 5) | |
fmin = scale(:f2,:minor,num_octaves: 5) | |
gmaj = scale(:g2,:major,num_octaves: 5) | |
amin = scale(:a2,:minor,num_octaves: 5) | |
bmaj = scale(:b2,:major,num_octaves: 5) | |
revtrag = [cmaj, amin, emin, gmaj] | |
lotr = [emin, cmaj, gmaj, dmaj] | |
glass = [emin, cmaj, gmaj, bmaj] | |
wagon = [gmaj, dmaj, emin, cmaj] | |
purty = [cmaj, emin, fmaj, fmin] | |
arp = [0,2,4,7,9,11,14,16,18,21,23,25,28,30,32,35] # note values for arpeggiation, 0-indexed | |
use_synth :blade | |
iter = 1 | |
frame = 0 | |
with_fx :echo do | |
live_loop :test do | |
mynote = arp[iter % 16] # iterate over the sequence – this is where your normalized data go | |
myrand = arp[rand_i(16)] # random value from the arp | |
if ((iter % 16) == 0) # at the end of the sequence | |
frame = frame+1 | |
end | |
if one_in(2) | |
play (wagon[(frame % 4)])[mynote] | |
else | |
play (wagon[(frame % 4)])[myrand] | |
end | |
iter = iter+1 | |
sleep 0.2 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
final results in the hackathon repo here! along with a .wav of the final script, using data from Planet :)