Skip to content

Instantly share code, notes, and snippets.

@Sciss
Last active December 17, 2015 11:49
Show Gist options
  • Select an option

  • Save Sciss/5605437 to your computer and use it in GitHub Desktop.

Select an option

Save Sciss/5605437 to your computer and use it in GitHub Desktop.
play {
val env = IEnvGen.kr(IEnv(0, Env.Seg(3, 1, linShape) :: Nil, 0), MouseX.kr(0,1))
env.poll(1)
}
/////////
def test(off: Double, dur: Double, fadeIn: Double, fadeOut: Double) {
val x = gui {
val phase = Line.ar(off, dur, dur - off, doneAction = freeSelf)
val env = IEnvGen.ar(IEnv(0,
Env.Seg(fadeIn, 1, linShape) ::
Env.Seg(dur - (fadeIn + fadeOut), 1, stepShape) ::
Env.Seg(fadeOut, 0, linShape) :: Nil, 0), phase)
env * SinOsc.ar(SampleRate.ir/4)
}
x.waveform(duration = dur)
}
test(off = 0, dur = 4, fadeIn = 1.5, fadeOut = 0.5)
test(off = 1, dur = 4, fadeIn = 1.5, fadeOut = 0.5)
test(off = 3.75, dur = 4, fadeIn = 1.5, fadeOut = 0.5)
//////// meaning of offset:
def test(off: Double, dur: Double, fadeIn: Double, fadeOut: Double) {
val x = gui {
val phase = Line.ar(off, dur, dur - off, doneAction = freeSelf)
val env = IEnvGen.ar(IEnv(1,
Env.Seg(fadeOut, 0, linShape) :: Nil, dur - fadeOut), phase)
env * SinOsc.ar(SampleRate.ir/4)
}
x.waveform(duration = dur)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment