Created
March 29, 2021 03:29
-
-
Save interstar/ff98e80dccdeeae12783f582072e49c0 to your computer and use it in GitHub Desktop.
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
# Create Chords in Sonic Pi, to send via MIDI to your other DAW or synth | |
# See https://www.youtube.com/watch?v=qd8SEL_rTNw | |
define :chordSeq do | tonic, mode, degs | | |
majorKeyTriads = [:M,:m,:m,:M,:M,:m,:dim] | |
minorKeyTriads = [:m,:dim,:M,:m,:m,:M,:M] | |
majorKey7s = [:M7,:m7,:m7,:M7,:dom7,:m7,:halfdiminished] | |
minorKey7s = [:m7,:halfdiminished,:M7,:m7,:m7,:M7,:dom7] | |
cs = [] | |
degs.each { | deg | | |
case deg | |
when 1..7 | |
root = degree(deg,tonic,mode) | |
lookup = (mode == "major") ? majorKeyTriads : minorKeyTriads | |
when 71..77 | |
deg = deg - 70 | |
root = degree(deg,tonic,mode) | |
lookup = (mode == "major") ? majorKey7s : minorKey7s | |
end | |
theChord = chord(root,lookup[deg-1]) | |
cs.append [tonic,mode,theChord] | |
} | |
cs | |
end | |
use_bpm 120 | |
live_loop :piano do | |
cs = chordSeq(:C3,"minor",[1,76,4,75, 5,7,74,5, | |
1,76,4,75, 5,7,74,1]) | |
cs.each {| xs | | |
tonic,mode,c = xs | |
c.each {|cn| midi_note_on cn, 60, | |
port: "loopbe_internal_midi_1" } | |
sleep 2 | |
c.each {|cn| midi_note_off cn, | |
port: "loopbe_internal_midi_1"} | |
midi scale(tonic,mode).choose+24, 60, | |
port: "loopbe_internal_midi_1" | |
sleep 1 | |
midi scale(tonic,mode).choose+24, 60, | |
port: "loopbe_internal_midi_1" | |
sleep 1 | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment