Skip to content

Instantly share code, notes, and snippets.

@infovore
Created April 17, 2024 13:10
Show Gist options
  • Save infovore/845e7eef8ff10f1fb6e94e07b35a8d15 to your computer and use it in GitHub Desktop.
Save infovore/845e7eef8ff10f1fb6e94e07b35a8d15 to your computer and use it in GitHub Desktop.
<<< "", " ChucK Phase " >>>;
<<< "", " 'Piano Phase' by Steve Reich, " >>>;
<<< "", "adapted for ChucK by Tom Armitage" >>>;
SinOsc osc1 => ADSR env1 => NRev rev => dac;
SinOsc osc2 => ADSR env2 => rev; // remember, rev already piped to dac
0.25::second => dur beat;
(1::ms,beat/2,0,1::ms) => env1.set;
(1::ms,beat/2,0,1::ms) => env2.set;
0.25 => osc1.gain => osc2.gain;
0.05 => rev.mix;
64 => int e4;
fun void pianoPhase(Osc osc, ADSR env, dur phaseBeat, int root)
{
[0,2,7,9,10,2,0,9,7,2,10,9] @=> int notes[];
while(true) {
for (0 => int i; i < notes.cap(); i++)
{
Std.mtof(notes[i]+root) => osc.freq;
1 => env.keyOn;
phaseBeat => now;
}
}
}
spork ~ pianoPhase(osc1,env1,0.25::second, e4);
spork ~ pianoPhase(osc2,env2,0.249::second, e4);
1::week => now;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment