hsc3-0.15.1: Haskell SuperCollider

Safe HaskellSafe-Inferred




UGen data structure representation and associated functions.



toUId :: ID a => a -> UGenId Source

ugen_user_name :: String -> Special -> String Source

Lookup operator name for operator UGens, else UGen name.

UGen graph functions

ugenTraverse :: (UGen -> UGen) -> UGen -> UGen Source

Depth first traversal of graph at u applying f to each node.

ugenFoldr :: (UGen -> a -> a) -> a -> UGen -> a Source

Right fold of UGen graph.

Unit generator node constructors

control_f64 :: Rate -> Maybe Int -> String -> Sample -> UGen Source

Control input node constructor.

control :: Rate -> String -> Double -> UGen Source

Control input node constructor.

Note that if the name begins with a t_ prefix the control is not converted to a triggered control. Please see tr_control.

meta_control :: Rate -> String -> Double -> C_Meta' Double -> UGen Source

Variant of control with meta data.

tr_control_f64 :: Maybe Int -> String -> Sample -> UGen Source

Triggered (kr) control input node constructor.

tr_control :: String -> Double -> UGen Source

Triggered (kr) control input node constructor.

control_set :: [UGen] -> [UGen] Source

Set indices at a list of controls.

mrg2 :: UGen -> UGen -> UGen Source

Multiple root graph node constructor.

Multiple channel expansion

mce2 :: UGen -> UGen -> UGen Source

Multiple channel expansion for two inputs.

mce2c :: UGen -> (UGen, UGen) Source

Extract two channels from possible MCE.

mce3 :: UGen -> UGen -> UGen -> UGen Source

Multiple channel expansion for two inputs.

mceMap :: (UGen -> UGen) -> UGen -> UGen Source

Apply a function to each channel at a unit generator.

mceEdit :: ([UGen] -> [UGen]) -> UGen -> UGen Source

Apply UGen list operation on MCE contents.

mceReverse :: UGen -> UGen Source

Reverse order of channels at MCE.

mceChannel :: Int -> UGen -> UGen Source

Obtain indexed channel at MCE.

mceTranspose :: UGen -> UGen Source

Transpose rows and columns, ie. {{a,b},{c,d}} to {{a,c},{b,d}}.

mceSum :: UGen -> UGen Source

Collapse mce by summing (see also mix and mixN).


sep_first :: [t] -> Maybe (t, [t]) Source

Separate first list element.

sep_first "astring" == Just ('a',"string")

sep_last :: [t] -> Maybe ([t], t) Source

Separate last list element.

sep_last "stringb" == Just ("string",'b')

halt_mce_transform' :: (a -> [a]) -> [a] -> [a] Source

Given unmce function make halt mce transform.

halt_mce_transform :: [UGen] -> [UGen] Source

The halt MCE transform, ie. lift channels of last input into list.

halt_mce_transform [1,2,mce2 3 4] == [1,2,3,4]

Multiple root graphs


label :: String -> UGen Source

Lift a String to a UGen label (ie. for poll).

equal_length_p :: [[a]] -> Bool Source

Are lists of equal length?

equal_length_p ["t1","t2"] == True
equal_length_p ["t","t1","t2"] == False

unpackLabel :: UGen -> [UGen] Source

Unpack a label to a length prefixed list of Constants. There is a special case for mce nodes, but it requires labels to be equal length. Properly, poll would not unpack the label, it would be done by the synthdef builder.



ugen_primitive :: UGen -> [Primitive] Source

UGen primitive. Sees through Proxy and MRG, possible multiple primitives for MCE.

primitive_is_pv_rate :: String -> Bool Source

Heuristic based on primitive name (FFT, PV_). Note that IFFT is at control rate, not PV rate.

ugen_is_pv_rate :: UGen -> Bool Source

Variant on primitive_is_pv_rate.

pv_track_buffer :: UGen -> Either String UGen Source

Traverse input graph until an FFT or PV_Split node is encountered, and then locate the buffer input. Biases left at MCE nodes.

import Sound.SC3
let z = soundIn 4
let f1 = fft 10 z 0.5 0 1 0
let f2 = ffta 'a' 1024 z 0.5 0 1 0
pv_track_buffer (pv_BrickWall f1 0.5) == Right 10
pv_track_buffer (pv_BrickWall f2 0.5) == Right (localBuf 'a' 1024 1)

buffer_nframes :: UGen -> UGen Source

Buffer node number of frames. Biases left at MCE nodes. Sees through LocalBuf, otherwise uses bufFrames.

buffer_nframes 10 == bufFrames IR 10
buffer_nframes (control KR "b" 0) == bufFrames KR (control KR "b" 0)
buffer_nframes (localBuf 'α' 2048 1) == 2048