hsc3-0.19.1: Haskell SuperCollider
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.SC3.UGen.Optimise

Description

Optimisations of UGen graphs.

Synopsis

Documentation

c_rand :: Random a => Int -> a -> a -> a Source #

Constant form of rand UGen.

c_irand :: (Num b, RealFrac a, Random a) => Int -> a -> a -> b Source #

Constant form of iRand UGen.

ugen_optimise_ir_rand :: UGen -> UGen Source #

Optimise UGen graph by re-writing rand and iRand UGens that have Constant inputs. This, of course, changes the nature of the graph, it is no longer randomised at the server. It's a useful transformation for very large graphs which are being constructed and sent each time the graph is played.

import Sound.SC3.UGen.Dot {- hsc3-dot -}
let u = sinOsc AR (rand 'a' 220 440) 0 * 0.1
in draw (u + ugen_optimise_ir_rand u)

ugen_optimise_const_operator :: UGen -> UGen Source #

Optimise UGen graph by re-writing binary operators with Constant inputs. The standard graph constructors already do this, however subsequent optimisations, ie. ugen_optimise_ir_rand can re-introduce these sub-graphs, and the Plain graph constructors are un-optimised.

let u = constant
u 5 * u 10 == u 50
u 5 ==* u 5 == u 1
u 5 >* u 4 == u 1
u 5 <=* u 5 == u 1
abs (u (-1)) == u 1
u 5 / u 2 == u 2.5
let {u = lfPulse AR (2 ** rand 'α' (-9) 1) 0 0.5
    ;u' = ugen_optimise_ir_rand u}
in draw (mix (mce [u,u',ugen_optimise_const_operator u']))