Last active
September 4, 2023 16:37
-
-
Save joshlewis/d137478cb82508cc559d to your computer and use it in GitHub Desktop.
This ChucK program will play the loop heard in Jon Hopkins's song Light Through the Veins (hear it at https://www.youtube.com/results?search_query=light+through+the+veins+jon+hopkins )
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
//Notes in loop | |
392.00 => float G4; | |
440 => float A4; | |
466.16 => float Asharp4; | |
523.25 => float C5; | |
587.33 => float D5; | |
659.25 => float E5; | |
698.46 => float F5; | |
[E5, F5, A4, C5, Asharp4, G4, D5, A4, C5] @=> float notes[]; | |
// run sine wave through envelope | |
SinOsc s => Envelope e => dac; | |
int counter; | |
0 => counter; | |
// infinite loop | |
while( true ) | |
{ | |
// Note attack and fade | |
50::ms => dur t => e.duration; | |
notes[counter] => s.freq; | |
// Play note and silence after the note | |
e.keyOn(); | |
1000::ms => now; | |
e.keyOff(); | |
40::ms => now; | |
if (counter == notes.cap() - 1) { | |
0 => counter; | |
} else { | |
counter++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately when I wrote it out from what I heard in my head, I transposed it half a step up. In Hopkins's version, the high note isn't F5, it's E5. Whoops!