Last active
February 17, 2021 17:01
-
-
Save dorchard/0a18a73b59eed8c0a857b5e6dd7823e1 to your computer and use it in GitHub Desktop.
Sonic Pi Happy Birthday for Nielsons' Festschrift 2016
This file contains 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
# Sonic Pi code used in the intro of my talk on | |
# "Effect Systems Revisited — Control-Flow Algebra and Semantics" (Mycroft, Orchard, Petricek) | |
# https://kar.kent.ac.uk/61623/1/effects-revisited.pdf | |
# for Hanne and Flemming Nielson's Festschrift, January 2016. | |
# Not the prettiest or most modern SonicPi code! | |
use_transpose(6) | |
use_bpm(146) | |
use_synth :piano | |
use_synth_defaults :cutoff => 75 | |
def playn (note, time) | |
play note | |
sleep time | |
end | |
def chordC (len) | |
play :c3 | |
play :e3 | |
play :g2 | |
sleep len | |
end | |
def chordG7 (len) | |
play :g2 | |
play :b2 | |
play :d3 | |
play :f3 | |
sleep len | |
end | |
def chordF (len) | |
play :f2 | |
play :a2 | |
play :c3 | |
sleep len | |
end | |
# Happy Birthday dear Hanne and Flemming | |
in_thread do | |
sleep 1 | |
chordC(3);chordG7(3) | |
chordG7(3);chordC(3) | |
chordC(3);chordF(3) | |
chordG7(3);chordC(3) | |
end | |
in_thread do | |
for line in range(1, 5) do | |
if line == 4 then | |
playn(:f4, 0.75) | |
playn(:f4, 0.25) | |
playn(:e4, 1) | |
playn(:c4, 1) | |
playn(:d4, 1) | |
playn(:c4, 1) | |
else | |
playn(:g3, 0.75) | |
playn(:g3, 0.25) | |
if line == 3 then | |
playn(:g4, 1) | |
playn(:e4, 1) | |
playn(:c4, 1) | |
playn(:b3, 1) | |
playn(:a3, 1) | |
else | |
playn(:a3, 1) | |
playn(:g3, 1) | |
if line == 2 then playn(:d4, 1); playn(:c4, 2) | |
else playn(:c4, 1); playn(:b3, 2); | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment