Skip to content

Instantly share code, notes, and snippets.

@tn800
Last active January 1, 2016 09:09
Show Gist options
  • Save tn800/8123464 to your computer and use it in GitHub Desktop.
Save tn800/8123464 to your computer and use it in GitHub Desktop.
test code for CoffeeCollider, time signal.
synth = SynthDef (freq, dur=0.25)->
Out.ar(0, SinOsc.ar(freq) * Line.kr(1, 0, dur, doneAction:2))
.add()
Task ->
Infinity.do syncblock (i)->
#console.log i
d = new Date()
sec = d.getSeconds()
console.log sec
switch sec
when 0 then Synth(synth, freq:880, dur:3)
when 57 then Synth(synth, freq:"A4".midicps()) #same as 440 too long?
when 58 then Synth(synth, freq:440)
when 59 then Synth(synth, freq:440)
else console.log sec
1.wait()
.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment