packages feed

hsc3-0.18: Help/UGen/subsampleOffset.help.lhs

> import Sound.OSC {- hosc -}
> import Sound.SC3 {- hsc3 -}

Impulse train that can be moved between samples

> sy_01 =
>     let a = control KR "a" 0
>         i = impulse AR 2000 0 * 0.3
>         d = sampleDur
>         x = 4
>         o = (1 - subsampleOffset) + mouseX KR 0 a Linear 0.1
>         r = delayC i (d * (1 + x)) (d * (o + x))
>     in synthdef "s" (offsetOut 0 r)

Create two pulse trains one sample apart, move one relative to the
other.  When cursor is at the left, the impulses are adjacent, on the
right, they are exactly 1 sample apart.  View this with an
oscilloscope.

> run s = do
>       {_ <- async (d_recv s)
>       ;t <- time
>       ;sr <- serverSampleRateActual
>       ;let {t' = t + 0.2
>            ;dt = 1 / sr
>            ;m n = s_new "s" (-1) AddToTail 1 [("a", n)]}
>        in do {sendBundle (bundle t' [m 3])
>              ;sendBundle (bundle (t' + dt) [m 0]) }}

   > withSC3 (run sy_01)