Skip to content

Instantly share code, notes, and snippets.

s = Synth.def (freq=440, amp=1)->
Out.ar(0, SinOsc.ar([freq, freq * 1.05]) * amp)
.play()
l = Task.loop ->
freq = Math.random() * 880 + 220
s.set freq:freq * 1, amp:1
@wait 300
s.set freq:freq * 2, amp:0.25
@wait 300
s = Synth.def (freq)->
Out.ar(0, SinOsc.ar(freq))
.play()
Task.do ->
s.set freq:880
@wait 1000
.play().then ->
Task.do ->
s.set freq:440
@wait 1000
def = Synth.def (freq=440, amp=1)->
amp *= Line.kr(0.75, 0, 10, doneAction:2)
Out.ar(0, SinOsc.ar([freq, freq * 1.25]) * amp)
l = Task.loop ->
freq = Math.random() * 880 + 220
s = def.play()
Task.each [1,4,3,2,8,4,3,2], (x, i)->
s.set freq:freq * x, amp:1-(i/8)
@wait 250
def = Synth.def (freq=440, amp=1)->
amp *= Line.kr(0.75, 0, 2.5)
Out.ar(0, SinOsc.ar([freq, freq * 1.25]) * amp)
Task.loop ->
freq = Math.random() * 880 + 220
s = def.play().on "done", ->
s.stop()
t = Task.each [1,4,3,2,8,4,3,2], (x, i)->
s.set freq:freq * x, amp:1-(i/8)
def = Synth.def (freq=440)->
mod = SinOsc.ar(freq * 3, 0, Line.kr(0, 2, 1, doneAction:2))
amp = Line.kr(1, 0, 1) * 0.5
Out.ar(0, SinOsc.ar(freq, mod) * amp)
Task.loop ->
f = Math.random() * 440 + 220
def.play().set freq:f
def.play().set freq:f * 0.667
@wait 400
s = Synth.def (freq)->
mod = SinOsc.ar(MouseX.kr(8000, 0.5))
Out.ar(0, SinOsc.ar(freq, mod))
.play()
Task.loop ->
t = Task.each [0, 2, 4, 5, 7, 9, 11, 12], (x)->
s.set freq: 440 * Math.pow(2, x/12)
@wait 500
.play()
def = Synth.def (freq=440, amp=1)->
amp *= Line.kr(0.75, 0, 2.5, doneAction:2)
Out.ar(3, SinOsc.ar([freq, freq * 1.25]) * amp)
Synth.def ->
Out.ar(0, CombL.ar(In.ar(3, 2), delaytime:1, decaytime:10))
.play()
Task.loop ->
s = def.play()
buffer = Buffer.read("/files/audio/Grange_Party.mp3")
Synth.def ->
out = PlayBuf.ar(2, buffer, rate:0.5, loop:1)
out = CombC.ar(out, delaytime:0.25, decaytime:25)
Out.ar(0, out)
.play()
Synth.def ->
freq = 440 + MouseButton.kr(0, 440, lag:0)
Out.ar(0, SinOsc.ar(freq, mul:0.5))
.play()
@mohayonao
mohayonao / gist:7119348
Last active December 26, 2015 07:59
mouse
Synth.def ->
freq = MouseY.kr(1760, 220, "exponential")
mod = SinOsc.ar(freq * MouseButton.kr(1, 2, lag:1), mul:MouseX.kr(0, 20, "exponential"))
Out.ar(0, CombL.ar(SinOsc.ar([freq, freq*1.01], phase:mod), decaytime:5))
.play()