hsc3-0.11: Help/UGen/Buffer/vOsc.help.lhs
> Sound.SC3.UGen.Help.viewSC3Help "VOsc"
> Sound.SC3.UGen.DB.ugenSummary "VOsc"
> import Sound.SC3
Allocate and fill tables 0 to 7.
> let {square a = a * a
> ;harm i = let {n = square (i + 1)
> ;f j = square ((n - j) / n)}
> in map f [0 .. n - 1]
> ;setup fd i = do {i' <- return (fromIntegral i)
> ;_ <- async fd (b_alloc i 1024 1)
> ;send fd (b_gen i "sine1" (1 + 2 + 4 : harm i'))}}
> in withSC3 (\fd -> mapM_ (setup fd) [0 .. 7])
Oscillator at buffers 0 through 7, mouse selects buffer.
> let x = mouseX' KR 0 7 Linear 0.1
> in audition (out 0 (vOsc AR x (mce [120, 121]) 0 * 0.3))
> import Control.Monad
> import System.Random
Reallocate buffers while oscillator is running.
> let {rrand l r = getStdRandom (randomR (l,r))
> ;rrandl n l r = replicateM n (rrand l r)
> ;resetTable fd i = do {h <- rrandl 12 0 1
> ;send fd (b_gen i "sine1" (1 + 2 + 4 : h))}}
> in withSC3 (\fd -> mapM_ (resetTable fd) [0 .. 7])