packages feed

hsc3 0.16 → 0.21

raw patch · 1455 files changed

Files

+ Help/Graph/adc-bit-reduction.hs view
@@ -0,0 +1,21 @@+-- bit reduction (adc)+let downSample =+      let f = lfNoise2 kr 8+          nh = lfNoise2 kr 3+          src = blip ar (f * 200 + 300) (nh * 10 + 20)+          sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+      in latch src (impulse ar sr 0) * 0.1+    bitSz = mouseY kr 1 24 Exponential 0.2+    bitRedux = roundTo downSample (0.5 ** bitSz)+in mce2 downSample bitRedux++-- bit reduction (adc) ; id+let downSample =+      let f = lfNoise2Id 'α' kr 8+          nh = lfNoise2Id 'β' kr 3+          src = blip ar (f * 200 + 300) (nh * 10 + 20)+          sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+      in latch src (impulse ar sr 0) * 0.1+    bitSz = mouseY kr 1 24 Exponential 0.2+    bitRedux = roundTo downSample (0.5 ** bitSz)+in mce2 downSample bitRedux
+ Help/Graph/adc-down-sample.hs view
@@ -0,0 +1,13 @@+-- down sample (adc)+let f = lfNoise2 kr 8+    nh = lfNoise2 kr 3+    src = blip ar (f * 200 + 300) (nh * 10 + 20)+    sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+in latch src (impulse ar sr 0) * 0.1++-- down sample (adc) ; id+let f = lfNoise2Id 'α' kr 8+    nh = lfNoise2Id 'β' kr 3+    src = blip ar (f * 200 + 300) (nh * 10 + 20)+    sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+in latch src (impulse ar sr 0) * 0.1
+ Help/Graph/adc-kabelscahden.hs view
@@ -0,0 +1,25 @@+-- https://swiki.hfbk-hamburg.de/MusicTechnology/851 march 2003 (adc) / (jrhb)+let freq = 50+    sustain = 1+    amp = 0.5+    hum = let t = dust kr (7 ** lfNoise1 kr 0.3)+              h = toggleFF (coinGate 0.4 t) * rlpf (lfPulse ar freq 0 0.5 + (lfNoise1 kr 2 * 0.5 - 0.5)) 6000 0.15+              n = trig t (tRand 0 0.01 (coinGate 0.4 t)) * whiteNoise ar+              m = trig t (tRand 0 0.01 (coinGate 0.4 t)) * brownNoise ar+              k = trig t (lfNoise1 kr (mce2 4 4.2) * 0.1 + 0.11) * lfClipNoise ar (lfNoise0 kr 7 * 30 + 40)+          in distort (leakDC ((h + n + m + k) * 10) 0.995)+    e = envGen kr 1 1 0 1 RemoveSynth (Envelope [amp,amp,0] [sustain,0] [] Nothing Nothing 0)+in clip2 hum 1 * e * 0.25++-- https://swiki.hfbk-hamburg.de/MusicTechnology/851 march 2003 (adc) / (jrhb) ; id+let freq = 50+    sustain = 1+    amp = 0.5+    hum = let t = dustId 'α' kr (7 ** lfNoise1Id 'β' kr 0.3)+              h = toggleFF (coinGateId 'γ' 0.4 t) * rlpf (lfPulse ar freq 0 0.5 + (lfNoise1Id 'δ' kr 2 * 0.5 - 0.5)) 6000 0.15+              n = trig t (tRandId 'ε' 0 0.01 (coinGateId 'ζ' 0.4 t)) * whiteNoiseId 'η' ar+              m = trig t (tRandId 'θ' 0 0.01 (coinGateId 'ι' 0.4 t)) * brownNoiseId 'κ' ar+              k = trig t (lfNoise1Id 'λ' kr (mce2 4 4.2) * 0.1 + 0.11) * lfClipNoiseId 'μ' ar (lfNoise0Id 'ν' kr 7 * 30 + 40)+          in distort (leakDC ((h + n + m + k) * 10) 0.995)+    e = envGen kr 1 1 0 1 RemoveSynth (Envelope [amp,amp,0] [sustain,0] [] Nothing Nothing 0)+in clip2 hum 1 * e * 0.25
+ Help/Graph/adc-shepard-tones.hs view
@@ -0,0 +1,37 @@+-- shepard tones, alberto de campo (adc)+let interp n l r = let i = (r - l) / n in [l,l + i .. r - i]+    hanning_window n =+      let lp = pi * (-0.5)+          rp = lp + 2 * pi+          hf i = sin i * 0.5 + 0.5+      in map hf (interp n lp rp)+    freq_tbl = let amp_f i = (0.5 ** i) * 20000 in map amp_f (interp 1024 0 10)+    amp_tbl = let square x = x * x in map square (hanning_window 1024)+    b0 = asLocalBuf freq_tbl+    b1 = asLocalBuf amp_tbl+    rate = 0.1+    ratescale = 1024 / 48000 / 10 -- sample-rate+    ph = phasor ar 0 (rate * ratescale) 0 1024 0+    phases = mce (map (\n -> n * 0.1 * 1024 + ph) [0..9])+    freqs = bufRdC 1 ar b0 phases Loop+    amps = bufRdC 1 ar b1 phases Loop+in mix (sinOsc ar freqs 0 * amps) * 0.05++-- shepard tones, alberto de campo (adc) ; id+let interp n l r = let i = (r - l) / n in [l,l + i .. r - i]+    hanning_window n =+      let lp = pi * (-0.5)+          rp = lp + 2 * pi+          hf i = sin i * 0.5 + 0.5+      in map hf (interp n lp rp)+    freq_tbl = let amp_f i = (0.5 ** i) * 20000 in map amp_f (interp 1024 0 10)+    amp_tbl = let square x = x * x in map square (hanning_window 1024)+    b0 = asLocalBufId 'α' freq_tbl+    b1 = asLocalBufId 'β' amp_tbl+    rate = 0.1+    ratescale = 1024 / 48000 / 10 -- sample-rate+    ph = phasor ar 0 (rate * ratescale) 0 1024 0+    phases = mce (map (\n -> n * 0.1 * 1024 + ph) [0..9])+    freqs = bufRdC 1 ar b0 phases Loop+    amps = bufRdC 1 ar b1 phases Loop+in mix (sinOsc ar freqs 0 * amps) * 0.05
+ Help/Graph/bb-microhelix.hs view
@@ -0,0 +1,71 @@+-- batuhan bozkurt 2009 http://www.earslap.com (bb) - mce...........................+let rp = replicate+    ctrigs_ () =+        let i = mce (rp 8 (1/8) +++                     rp 8 (1/4) +++                     [dseq (drand dinf (mce2 1 2)) (mce2 (1/16) (1/16))])+            d = dxrand dinf (mceMap (* 1.25) i)+        in tDuty ar d 0 DoNothing (dwhite dinf 0.5 1) 0+    ctrigs = mce2 (ctrigs_ ()) (ctrigs_ ())+    clicks =+        let n = pinkNoise ar * decay ctrigs (0.001 * abs (lfNoise1 ar 4))+        in fold (bpf n 15000 0.9 * (25 * range 0 1 (lfNoise1 ar 8))) (-1) 1+    snd1 =+        let o = sinOsc ar (midiCps 44) 0 * 0.5 + sinOsc ar (midiCps 90) 0 * 0.6+        in lpf o (midiCps 32) * 2 + hpf (lpf (whiteNoise ar * 0.008) 12000) 2400+    hiNoise =+        let n = whiteNoise ar+            e = decay2 (ctrigs * (lfNoise1 ar 8 * 0.5 + 0.5)) 0.02 0.1 * 0.05+        in bpf (n * e) (tRand 12000 15000 ctrigs) 0.9+    trigMod = roundTo (lfNoise0 ar 8) 1+    bass =+        let t = mceChannel 0 ctrigs * trigMod+            ph = sweep ar t (2 * pi * mce2 52.8 740) + (pi/3)+            ph' = wrap ph (-pi) pi+            mean u = sum (mceChannels u) / fromIntegral (mceDegree_err u)+            o = tanh (mean (sinOsc ar 0 ph' * mce2 2 0.05))+            d = Envelope [0, 0.5, 0.4, 0] [0, 0.2, 0.01] [EnvNum (-5)] Nothing Nothing 0+            e = envGen ar (abs t) 1 0 1 DoNothing d+        in o * e * 0.25+    snd1' =+        let t = mceChannel 0 ctrigs+            d = Envelope [0, 1, 0.6, 0] [0.0001, 0.4, 0.01] [EnvNum (-4)] Nothing Nothing 0+            e = envGen ar (t * lfNoise0 ar 8) 1 0 1 DoNothing d+        in pan2 (snd1 * e) (tRand (-1) 1 t) 1+in limiter (midEQ (clicks + snd1' + hiNoise + bass) 14000 0.7 8) 1 0.01++-- batuhan bozkurt 2009 http://www.earslap.com (bb) - mce...........................+let rp = replicate+    ctrigs_ z =+        let i = mce (rp 8 (1/8) +++                     rp 8 (1/4) +++                     [dseqId (z,'α') (drandId (z,'β') dinf (mce2 1 2)) (mce2 (1/16) (1/16))])+            d = dxrandId (z,'γ') dinf (mceMap (* 1.25) i)+        in tDuty ar d 0 DoNothing (dwhiteId (z,'δ') dinf 0.5 1) 0+    ctrigs = mce2 (ctrigs_ 'a') (ctrigs_ 'a')+    clicks =+        let n = pinkNoiseId 'ε' ar * decay ctrigs (0.001 * abs (lfNoise1Id 'ζ' ar 4))+        in fold (bpf n 15000 0.9 * (25 * range 0 1 (lfNoise1Id 'η' ar 8))) (-1) 1+    snd1 =+        let o = sinOsc ar (midiCps 44) 0 * 0.5 + sinOsc ar (midiCps 90) 0 * 0.6+        in lpf o (midiCps 32) * 2 + hpf (lpf (whiteNoiseId 'θ' ar * 0.008) 12000) 2400+    hiNoise =+        let n = whiteNoiseId 'ι' ar+            e = decay2 (ctrigs * (lfNoise1Id 'κ' ar 8 * 0.5 + 0.5)) 0.02 0.1 * 0.05+        in bpf (n * e) (tRandId 'λ' 12000 15000 ctrigs) 0.9+    trigMod = roundTo (lfNoise0Id 'μ' ar 8) 1+    bass =+        let t = mceChannel 0 ctrigs * trigMod+            ph = sweep ar t (2 * pi * mce2 52.8 740) + (pi/3)+            ph' = wrap ph (-pi) pi+            mean u = sum (mceChannels u) / fromIntegral (mceDegree_err u)+            o = tanh (mean (sinOsc ar 0 ph' * mce2 2 0.05))+            d = Envelope [0, 0.5, 0.4, 0] [0, 0.2, 0.01] [EnvNum (-5)] Nothing Nothing 0+            e = envGen ar (abs t) 1 0 1 DoNothing d+        in o * e * 0.25+    snd1' =+        let t = mceChannel 0 ctrigs+            d = Envelope [0, 1, 0.6, 0] [0.0001, 0.4, 0.01] [EnvNum (-4)] Nothing Nothing 0+            e = envGen ar (t * lfNoise0Id 'ν' ar 8) 1 0 1 DoNothing d+        in pan2 (snd1 * e) (tRandId 'ξ' (-1) 1 t) 1+in limiter (midEQ (clicks + snd1' + hiNoise + bass) 14000 0.7 8) 1 0.01
+ Help/Graph/cr-lucier.hs view
@@ -0,0 +1,78 @@+-- Alvin Lucier, "Music on a Long Thin Wire, Simulated" (Chandrasekhar Ramakrishnan)+let freq = control kr "freq" 60+    blocksize = recip controlRate+    mk_dt f = recip f - blocksize+    string_delay = mk_dt freq+    pk1_pos = 0.1 -- pickup one position+    src_pos = 0.3 -- source position+    pk2_pos = 0.9 -- pickup two postion+    max_delay = 1.0 -- maximum delay time (corresponds to a length = c * s)+    mk_delay i r = lpz1 (delayC i max_delay (r * string_delay))+    mk_allpass i r dt = lpz1 (allpassC i max_delay (r * string_delay) dt)+    drv = localIn 1 ar 0 -- driver (source + data stored in the string)+    pk1_R = mk_delay drv (src_pos - pk1_pos)+    pk1_L = mk_allpass (pk1_R * negate 1) (pk1_pos * 2) (rand 0.001 0.11)+    pk2_L = mk_delay pk1_L (pk2_pos - pk1_pos) * 0.99+    stringL = mk_delay pk2_L (1.0 - pk2_pos)+    pk2_R = mk_allpass (stringL * negate 1) (1.0 - pk2_pos) (2 + rand 0.001 0.11) * 0.99+    stringR = mk_delay pk2_R (pk2_pos - src_pos)+    source =+        let s = sinOsc ar 220 0 * 0.01+            a = amplitude kr drv 0.01 0.01 * 11+            p = pulse ar (60 + a) 0.5 * 0.1+            f = rlpf (s + p) 320 0.05+            e = 1.0 - min (amplitude kr drv 0.01 0.01) 1.0+        in normalizer f 0.7 0.01 * e+    l_out = localOut (source * 0.2 + stringR)+    outL = pk1_L + pk1_R+    outR = pk2_L + pk2_R+in mrg [mce2 outL outR, drv, source, l_out]++-- Alvin Lucier, "Music on a Long Thin Wire, Simulated" (Chandrasekhar Ramakrishnan) ; id+let freq = control kr "freq" 60+    blocksize = recip controlRate+    mk_dt f = recip f - blocksize+    string_delay = mk_dt freq+    pk1_pos = 0.1 -- pickup one position+    src_pos = 0.3 -- source position+    pk2_pos = 0.9 -- pickup two postion+    max_delay = 1.0 -- maximum delay time (corresponds to a length = c * s)+    mk_delay i r = lpz1 (delayC i max_delay (r * string_delay))+    mk_allpass i r dt = lpz1 (allpassC i max_delay (r * string_delay) dt)+    drv = localIn 1 ar 0 -- driver (source + data stored in the string)+    pk1_R =+        let i = drv+            r = src_pos - pk1_pos+        in mk_delay i r+    pk1_L =+        let i = pk1_R * negate 1+            r = pk1_pos * 2+            dt = randId 'α' 0.001 0.11+        in mk_allpass i r dt+    pk2_L =+        let i = pk1_L+            r = pk2_pos - pk1_pos+        in mk_delay i r * 0.99+    stringL =+        let i = pk2_L+            r = 1.0 - pk2_pos+        in mk_delay i r+    pk2_R =+        let i = stringL * negate 1+            r = 1.0 - pk2_pos+            dt = 2 + randId 'β' 0.001 0.11+        in mk_allpass i r dt * 0.99+    stringR =+        let i = pk2_R+            r = pk2_pos - src_pos+        in mk_delay i r+    source =+        let s = sinOsc ar 220 0 * 0.01+            p = pulse ar (60 + amplitude kr drv 0.01 0.01 * 11) 0.5 * 0.1+            f = rlpf (s + p) 320 0.05+            e = 1.0 - min (amplitude kr drv 0.01 0.01) 1.0+        in normalizer f 0.7 0.01 * e+    l_out = localOut (source * 0.2 + stringR)+    outL = pk1_L + pk1_R+    outR = pk2_L + pk2_R+in mrg [mce2 outL outR, drv, source, l_out]
+ Help/Graph/dm-shift-register.hs view
@@ -0,0 +1,55 @@+-- https://sccode.org/1-590 (dm)+let shift_register_f n tr x =+      let buf = localBuf 1 n+          count = pulseCount tr 0+      in mrg2+         (demand tr 0 (mceReverse (dbufrd buf (mceMap (+ count) (mce [1 .. n])) Loop)))+         (demand tr 0 (dbufwr buf count x Loop))+    amp = 0.1+    ip = impulse kr (1/16) 0+    rt = tChoose ip (mce [3,5,10])+    trs = tChoose ip (mce [0,2,-2,7,-5])+    tr1 = trig1 (cuspL ar (rt * 3) 1 1.9 0.0) 0.001+    tr4 = pulseDivider tr1 4 0+    oct = demand tr4 0 (drand dinf (mce [12,-12]))+    note = demand tr1 0 (dseq dinf (mce [42,46,51,54,59,63,66] + oct + trs)) -- scramble+    chord = shift_register_f 5 tr1 (midiCps note)+    sig = pmOsc ar+          (vibrato ar chord 6 0.02 0 0 0.04 0.1 0.0 0.0)+          (urange 1.01 2.01 (lfPulse kr (1/8) 0 0.5) * chord)+          (envGen kr tr1 1 0 1 DoNothing (envelope [3,3,0] [0, 0.2] [EnvNum (-4)]))+          0+    cmp = mix (sig * ampCompA kr chord 0 0.32 1 * amp)+in xFade2+   (mce2 cmp cmp)+   (gVerb (bpf cmp (midiCps 90) 1) 50 8 0.5 0.5 15 0 0.7 0.5 300)+   0.2+   1++-- https://sccode.org/1-590 (dm) ; id+let shift_register_f n tr x =+      let buf = localBufId 'α' 1 n+          count = pulseCount tr 0+      in mrg2+         (demand tr 0 (mceReverse (dbufrdId 'γ' buf (mceMap (+ count) (mce [1 .. n])) Loop)))+         (demand tr 0 (dbufwrId 'β' buf count x Loop))+    amp = 0.1+    ip = impulse kr (1/16) 0+    rt = tChooseId 'δ' ip (mce [3,5,10])+    trs = tChooseId 'ε' ip (mce [0,2,-2,7,-5])+    tr1 = trig1 (cuspL ar (rt * 3) 1 1.9 0.0) 0.001+    tr4 = pulseDivider tr1 4 0+    oct = demand tr4 0 (drandId 'ζ' dinf (mce [12,-12]))+    note = demand tr1 0 (dseqId 'η' dinf (mceMap (+ trs) (mce [42,46,51,54,59,63,66])) + oct) -- scramble+    chord = shift_register_f 5 tr1 (midiCps note)+    sig = pmOsc ar+          (vibratoId 'θ' ar chord 6 0.02 0 0 0.04 0.1 0.0 0.0)+          (urange 1.01 2.01 (lfPulse kr (1/8) 0 0.5) * chord)+          (envGen kr tr1 1 0 1 DoNothing (envelope [3,3,0] [0, 0.2] [EnvNum (-4)]))+          0+    cmp = mix (sig * ampCompA kr chord 0 0.32 1 * amp)+in xFade2+   (mce2 cmp cmp)+   (gVerb (bpf cmp (midiCps 90) 1) 50 8 0.5 0.5 15 0 0.7 0.5 300)+   0.2+   1
+ Help/Graph/ds-sos-bell.hs view
@@ -0,0 +1,45 @@+-- https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/sos_bell.scd (ds)+let f (_,g,_,_,z,o,_,_,p,_,_) =+      let mce_mean x = sum (mceChannels x) / fromIntegral (mceDegree_err x)+          freq = unitCps p / 2+          amp = z * g * 16+          pan = o * 2 - 1+          -- Stretched harmonic series+          s1 = sinOsc ar (mce [2,3,4.1,5.43,6.8,8.21] * freq) 0 * mce [1,0.9,0.8,0.7,0.6,0.5] * 0.1+          s2 = let e_dat = Envelope [0,1,0.3,0.2,0] [0,0.3,0.3,0.3] [] Nothing Nothing 0+               in s1 * envGen ar g 1 0 1 DoNothing e_dat+          -- A bit of FM adds warble+          s3 = s2 * (lfTri ar (X.randN 6 1.0 1.8) 1 * 0.3 + 0.7)+          -- Mix down the partials in the main sound+          s4 = mce_mean s3+          strike = let e_dat = Envelope [0,1,0.2,0.1,0] [0,0.01,0,0.04] [] Nothing Nothing 0+                       e =  envGen ar g 1 0 1 DoNothing e_dat+                   in sinOsc ar (lfNoise1 ar (freq * 36) * 100 + (freq * 8 )) 1 * 0.1 * e+          hum = let e_dat = Envelope [0,0.05,0.05,0] [0.5,0.5,1] [] Nothing Nothing 0+                    e = envGen ar g 1 0 1 DoNothing e_dat+                in mce_mean (sinOsc ar (mce2 (freq * 1.01) (freq * 0.47)) 0 * e)+      in pan2 (s4 + strike + hum) pan amp+in mix (voicer 16 f) * control kr "gain" 1++-- https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/sos_bell.scd (ds) ; id+let f (c,g,_,_,z,o,_,_,p,_,_) =+      let mce_mean x = sum (mceChannels x) / fromIntegral (mceDegree_err x)+          freq = unitCps p / 2+          amp = z * g * 16+          pan = o * 2 - 1+          -- Stretched harmonic series+          s1 = sinOsc ar (mce [2,3,4.1,5.43,6.8,8.21] * freq) 0 * mce [1,0.9,0.8,0.7,0.6,0.5] * 0.1+          s2 = let e_dat = Envelope [0,1,0.3,0.2,0] [0,0.3,0.3,0.3] [] Nothing Nothing 0+               in s1 * envGen ar g 1 0 1 DoNothing e_dat+          -- A bit of FM adds warble+          s3 = s2 * (lfTri ar (X.randNId 6 (c,'α') 1.0 1.8) 1 * 0.3 + 0.7)+          -- Mix down the partials in the main sound+          s4 = mce_mean s3+          strike = let e_dat = Envelope [0,1,0.2,0.1,0] [0,0.01,0,0.04] [] Nothing Nothing 0+                       e =  envGen ar g 1 0 1 DoNothing e_dat+                   in sinOsc ar (lfNoise1Id (c,'β') ar (freq * 36) * 100 + (freq * 8 )) 1 * 0.1 * e+          hum = let e_dat = Envelope [0,0.05,0.05,0] [0.5,0.5,1] [] Nothing Nothing 0+                    e = envGen ar g 1 0 1 DoNothing e_dat+                in mce_mean (sinOsc ar (mce2 (freq * 1.01) (freq * 0.47)) 0 * e)+      in pan2 (s4 + strike + hum) pan amp+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/es-tw-570012853274615808.hs view
@@ -0,0 +1,19 @@+-- https://twitter.com/sluyterrific_sc/status/570012853274615808 (es) ; edit=rd+let dup f = mce2 (f ()) (f ())+    -- this is not (of course) as written but sounds nicely....+    greyhole_no_reorder i = let (p,q) = unmce2 i in X.greyholeRaw p q+    t = dup (\_ -> dust2 ar 9)+    o = 0.1+    a = lfNoise2 ar o * 9 + 9+    s = varSaw ar (tExpRand 9 5000 t) 0 0.5 * decay t 1+in greyhole_no_reorder s a 0 o (lfNoise2 ar 1) (lfNoise2 ar 1 + 1) 2 a++-- https://twitter.com/sluyterrific_sc/status/570012853274615808 (es) ; edit=rd ; id+let dup (z1,z2) f = mce2 (f z1) (f z2)+    -- this is not (of course) as written but sounds nicely....+    greyhole_no_reorder i = let (p,q) = unmce2 i in X.greyholeRaw p q+    t = dup ('α','β') (\z -> dust2Id z ar 9)+    o = 0.1+    a = lfNoise2Id 'γ' ar o * 9 + 9+    s = varSaw ar (tExpRandId 'δ' 9 5000 t) 0 0.5 * decay t 1+in greyhole_no_reorder s a 0 o (lfNoise2Id 'ε' ar 1) (lfNoise2Id 'ζ' ar 1 + 1) 2 a
+ Help/Graph/f0-1-4Q6-p.hs view
@@ -0,0 +1,14 @@+-- http://sccode.org/1-4Q6 (f0)+let f (_,g,_,y,z,o,_,_,p,px,_) =+      let normalise x = map (/ (maximum x)) x+          amps = normalise [1,0.67,1,1.8,2.67,1.67,1.46,1.33,1.33,1,1.33]+          durs = [1,0.9,0.65,0.55,0.325,0.35,0.25,0.2,0.15,0.1,0.075]+          frqs = [0.56,0.56,0.92,0.92,1.19,1.7,2,2.74,3,3.76,4.07]+          dets = [0,1,0,1.7,0,0,0,0,0,0,0]+          fn i =+            let shp = let cv = EnvNum (-4.5)+                      in envPerc_c 0.005 ((y + 1) * 6 * durs!!i) (amps!!i) (cv,cv)+                env = envGen ar g (latch z g) 0 1 DoNothing shp+            in sinOsc ar (midiCps (p * 127 + px) * frqs!!i + dets!!i) 0 * env * g+      in pan2 (mixFill 11 fn) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.75
+ Help/Graph/f0-2012-04-19.hs view
@@ -0,0 +1,7 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg17536.html (f0)+let s0 = lfSaw ar 10 0 * 0.01+    t0 = lfTri ar (mce2 5 6 * 0.1) 0+    t1 = lfTri kr 0.1 0 * 0.05 + 0.05+    s1 = limiter (brf s0 t0 1) 1 0.01+    o = combN s1 0.1 (roundTo t1 0.01) 1+in o * 0.1
+ Help/Graph/f0-pkt-00.hs view
@@ -0,0 +1,9 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let sosc fr = sinOsc ar fr 0+    f0 = mce3 100 200 300 + sosc (mce3 0.11 0.22 0.33)+    ph0 = sosc (mce3 0.1 0.2 0.3) * 2 * pi+    a0 = 0.1 + sosc (mce3 0.01 0.02 0.03) * 0.05+    i = sinOsc ar f0 ph0 * a0+    w = sosc (sosc (sosc 0.13 * 5 + 6) * 8 + 50)+    s = splay i w 0.7 (sosc 1.2 * 0.6) True+in mix (mceTranspose (gVerb s 20 5 1 0.5 25 0 1 1 30))
+ Help/Graph/f0-pkt-07.hs view
@@ -0,0 +1,10 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let param n =+      let f g z = take n (iterate g z)+      in zip4 (f (* 4) 2) (f (/ 2) (1/2)) (f (* 4) 1) (f (* 4) 2)+    gen f0 (m,f1,l,r) = sinOsc ar f0 0 * m + linExp (sinOsc ar f1 0) (-1) 1 l r+    pkt n =+      let c = foldl gen 1 (param n)+          o = sinOsc ar c 0 * 0.1+      in gVerb (leakDC o 0.995) 16 8 0.75 0.5 15 1 0.7 0.5 16 * 0.1+in pkt 12
+ Help/Graph/f0-pkt-26.hs view
@@ -0,0 +1,16 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let n = 8+    pkt i =+      let t = i / constant n+          a = abs (varSaw ar 0.02 t 0.5 * 7.5)+          b = varSaw ar 0.16 t (2/3) * a + 300+          c = varSaw ar 0.064 t 0.5 * 25 + 50+          d = varSaw ar 0.012 t 0.75 * c + 200+          e = varSaw ar 0.024 t 0.25 * 0.475 + 0.5+          f = varSaw ar (100 + i) t e+          g = varSaw ar 0.048 0 0.5 * 25 + 150+          h = varSaw ar ((i + 1) * g) t (1/3) * 150+          o = sinOsc ar h (f * pi) * d + b+          z = leakDC (varSaw ar o t 0.5) 0.995+      in pan2 z (varSaw ar 0.02 t 0.5) 1+in mixFill n pkt * (0.25 / constant n)
+ Help/Graph/f0-pkt-28.hs view
@@ -0,0 +1,18 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let n = 28+    pkt i =+      let a = lfSaw ar ((i + 1) * 5) 0 * 0.5 * pi+          b = sinOsc ar ((i + 1) * 0.001) 0 * 0.5+          c = max (lfSaw ar (0.2 + b) (i / constant n) * 0.4) 0+          d = sinOsc ar 0.03 (i + 1) * 0.5 + 1+          e = sinOsc ar (200 + i) 0 * d+          f = sinOsc ar 0.04 (i + 2) * 0.5 + 1+          g = sinOsc ar (400 + i) 0 * f+          h = sinOsc ar 0.05 (i + 3) * 0.5 + 1+          j = sinOsc ar (800 + i) 0 * h+          k = linExp i 0 (constant n - 1) 70 1500+          z = sinOsc ar k a * c * e * g * j+          l = linLin i 0 (constant n - 1) (-0.925) 0.925+      in pan2 z l (1 / constant n)+    y = limiter (leakDC (mixFill n pkt) 0.995) 1 0.01+in gVerb y 3 5 0.2 0.8 20 0.1 0.7 0.5 300 * 0.2
+ Help/Graph/f0-red-frik.hs view
@@ -0,0 +1,25 @@+-- red_frik (f0)+let red tr n =+      let o1 = fSinOsc kr (tRand 0.3 5 tr) 0 * tRand 0 0.5 tr + tRand 0.49 0.56 tr+          o2 = fSinOsc kr o1 0 * tRand 0.3 0.6 tr + tRand 0.3 0.5 tr+      in rhpf n (tRand 0.3 3 tr) o2 * 0.1+    n = mceFill 2 (\_ -> brownNoise ar)+    tr = impulse kr 0.1 0+in red tr n * 0.1++-- red_frik (f0) ; monad+let red tr n = do+      r1 <- tRandM 0.3 3 tr+      r2 <- tRandM 0.3 5 tr+      r3 <- tRandM 0 0.5 tr+      r4 <- tRandM 0.49 0.56 tr+      r5 <- tRandM 0.3 0.6 tr+      r6 <- tRandM 0.3 0.5 tr+      let o1 = fSinOsc kr r2 0 * r3 + r4+          o2 = fSinOsc kr o1 0 * r5 + r6+      return (rhpf n r1 o2 * 0.1)+    red_frik_m = do+      n <- replicateM 2 (brownNoiseM ar)+      let tr = impulse kr 0.1 0+      red tr (mce n)+in uid_st_eval red_frik_m * 0.1
+ Help/Graph/f0-tw-0454598285861617665.hs view
@@ -0,0 +1,7 @@+-- https://twitter.com/redFrik/status/454598285861617665 (f0)+let b = mce [9,8 .. 1]+    c = lfTri ar (3 ** lfTri ar (1 / b) (b / 9)) 0+    d = lfTri ar (1 / b) 0 `modE` 1 / 9 + 0.01+    f = 2 ** roundE (lfTri ar (b / 99) 0) * 99 * b+    o = grainSin 2 c d f 0 (-1) 512+in splay (tanh o) 1 1 0 True / 2
+ Help/Graph/f0-tw-0456384156159574016.hs view
@@ -0,0 +1,5 @@+-- https://twitter.com/redFrik/status/456384156159574016 (f0)+let a = 1 / mce [3,12,4,1,6,2]+    s = lag3 (sinOsc ar a 0) (abs (sinOsc ar (2.67 ** a) 0)) * 99+    f = ((sinOsc ar ((1 / a) / 9) a `greater_than` 0) * 20 + 99) / a+in splay (sinOsc ar (hpf (ringz s f 1) 440) 0) 1 1 0 True * 0.25
+ Help/Graph/f0-tw-0839296011982024704.hs view
@@ -0,0 +1,7 @@+-- https://twitter.com/redFrik/status/839296011982024704+let a x = lfSaw ar x 0+    t = a (mce [0.5,0.6])+    f = (a 5 * a 0.015 + 1) * 98+    m = (2 ** a 4 `roundTo` 0.5) * 99+    g = grainFM 1 t 16 f m (2 ** a (1 / mce [8,9]) * 8) 0 (-1) 512+in tanh (g / 2) * 0.25
+ Help/Graph/f0-tw-1105496695637454848.hs view
@@ -0,0 +1,12 @@+-- f0 ; https://twitter.com/redFrik/status/1105496695637454848+let b = mce [1 .. 15] / 151+    w = ceil (varSaw kr b b (1 / 5.15) + 1.5)+    s = select ((ceil (varSaw kr (1 / 15) (1 / 5) b * 5) + 5) / 5) (mce [51 * 1.5, 51, 151])+    x = lag s b+    y = varSaw kr (5 + b) 0 0.5+    z = varSaw kr b b b * (b / 5) + mce [1.5, 5, 1]+    m = varSaw kr (5 - b) b b * 5 + 5+    o = varSaw ar ((w * x + y) * z) b ((varSaw kr b 0 0.5 + 5) / 15) * (m `greater_than` 1.515)+    f = 1515 ** (varSaw kr ((1 - b) / 5) 0 0.5 / 15 + 1 + b)+    rq = 1.5 ** varSaw kr b 0 0.5 / 5+in splay (bLowPass o f rq) 1 1 0 True / 5
+ Help/Graph/f0-tw-1125557217086857216.hs view
@@ -0,0 +1,17 @@+-- https://twitter.com/redFrik/status/1125557217086857216 (f0) ; id+let scl = [0, 2.94, 4.98, 7.02, 9.96] -- pythagorean+    a = lfTri+    b = (mce [-7 .. 6] + 0.7) * 2/666+    m = degreeToKey (asLocalBuf scl) ((a kr b b * a kr b 0 * 9 + 9) `modE` 32) 12 + 24+    o = varSaw ar (midiCps m) 0 ((a kr b 0 + 1) / 2) * ampComp kr m 440 (1/3) * a kr b b * b * 9+    s = rlpf o (lag2 m ((1 / b) `modE` 1) * 3) 1+in tanh (splay (allpassN s 0.3 (0.2 - b) 3) 1 1 0 True)++-- https://twitter.com/redFrik/status/1125557217086857216 (f0) ; id+let scl = [0, 2.94, 4.98, 7.02, 9.96] -- pythagorean+    a = lfTri+    b = (mce [-7 .. 6] + 0.7) * 2/666+    m = degreeToKey (asLocalBufId 'α' scl) ((a kr b b * a kr b 0 * 9 + 9) `modE` 32) 12 + 24+    o = varSaw ar (midiCps m) 0 ((a kr b 0 + 1) / 2) * ampComp kr m 440 (1/3) * a kr b b * b * 9+    s = rlpf o (lag2 m ((1 / b) `modE` 1) * 3) 1+in tanh (splay (allpassN s 0.3 (0.2 - b) 3) 1 1 0 True)
+ Help/Graph/f0-tw-1136928201886904320.hs view
@@ -0,0 +1,11 @@+-- https://twitter.com/redFrik/status/1136928201886904320 (f0)+let gt = greater_than+    f a i =+      let b = mce [4,2,1,3,5]+          c = roundTo (a ar (1/b) 0 * b) (a ar (b/9) 0 `gt` 0)+          o = sinOscFB ar (c ** 2 * ((a ar 0.02 i `gt` 0) + 1 * 50)) (a ar (c/9) 0 `modE` 1)+          s = o * max (a ar (1/b * a ar (b/99) i) 0) 0 * a ar 0.01 i+          x = allpassC s 1 (wrap c 0.5 1) 2+          y = bpf x (i * 99 + 400) 0.001 * (a ar 0.04 i + 1 * 9)+      in splay (x + y) 1 1 0 True / 3+in sum (zipWith f [lfTri,lfSaw,lfPar] [0,1,2]) / 3
+ Help/Graph/f0-tw-1138498427241861122.hs view
@@ -0,0 +1,14 @@+-- https://twitter.com/redFrik/status/1138498427241861122 (f0)+let f = sqrt 9+    b = mce2 f 9.999+    e = pitchShift+    a = sinOscFB+    d = max (a ar (b/99) 0) 0+    t1 = ugen_if (a ar (a ar (9/999) 0) 0 `greater_than` a ar (9/99) 0) f (9/b)+    t2 = ugen_if (a ar (9/99) 0 `less_than` a ar (99/9999) 0) (b/9) f+    f1 = lag (9.9 * b * t1 * t2) 0.1+    s1 = a ar f1 d * a ar (b/9) 0 * d+    c = e s1 (9 / b) (9 / sqrt b) (b / 999) (b / 99)+    s2 = gVerb (c * d * d * d) 99 9 (9/999) 0.5 15 1 0.7 0.5 300+    s3 = s2 / 9 + e c (f/9) (f/9) 0 0+in mix (mceTranspose (hpf (splay s3 1 1 0 True) 9 / 9))
+ Help/Graph/f0-tw-1210118661022867458.hs view
@@ -0,0 +1,21 @@+-- f0 ; https://twitter.com/redFrik/status/1210118661022867458+let b = mce (map recip [2 .. 7])+    d = 1 / 48+    g = cos (cos 0)+    l = mce [0,-16,0,-16,0,0,-16,0,-16,0,-16,0,0,0,-16,-16,47,0,-16,0,-16,0,-16,0,0,-16,0,0,-16,0,0,0,0,0,-5,-16,-16,-15]+    f = duty ar b 0 DoNothing (dseq dinf (l + 48))+    o = sinOscFB ar f (max (sinOsc ar d 0) 0) * sin (cos 0)+    c = sinOsc ar 0 (pi ** o)+    p = pitchShift c g (recip b) d d * b+in leakDC (splay (c + p) 1 1 0 True) 0.995 * g++-- f0 ; https://twitter.com/redFrik/status/1210118661022867458 ; id+let b = mce (map recip [2 .. 7])+    d = 1 / 48+    g = cos (cos 0)+    l = mce [0,-16,0,-16,0,0,-16,0,-16,0,-16,0,0,0,-16,-16,47,0,-16,0,-16,0,-16,0,0,-16,0,0,-16,0,0,0,0,0,-5,-16,-16,-15]+    f = duty ar b 0 DoNothing (dseqId 'α' dinf (l + 48))+    o = sinOscFB ar f (max (sinOsc ar d 0) 0) * sin (cos 0)+    c = sinOsc ar 0 (pi ** o)+    p = pitchShift c g (recip b) d d * b+in leakDC (splay (c + p) 1 1 0 True) 0.995 * g
+ Help/Graph/f0-tw-1254441448327479299.hs view
@@ -0,0 +1,57 @@+-- f0 <https://twitter.com/redFrik/status/1254441448327479299>+let b = [1,3,5,8,10]+    e = [3,2/3,4,3/2,2]+    c = 0.021+    d = lfTri ar (mce b / 999) 0 `modE` 1+    m = lfTri ar (mce b * c) 0+    l = m * 7 + 20 + dseq dinf (mce b `modE` m * 5 + 6)+    j = duty ar (mce e / (12 ** m)) 0 DoNothing l+    f = midiCps (degreeToKey (asLocalBuf b) j 12)+    y = decay2 (impulse ar (mce [2/3,1.5,3,1.5,3]) 0) c d * d+    o = sinOscFB ar f ((lfTri ar (c / mce b) 0 + 1) / 3) * y+in freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2++-- f0 <https://twitter.com/redFrik/status/1254441448327479299> ; id+let b = [1,3,5,8,10]+    e = [3,2/3,4,3/2,2]+    c = 0.021+    d = lfTri ar (mce b / 999) 0 `modE` 1+    m = lfTri ar (mce b * c) 0+    l = m * 7 + 20 + dseqId 'α' dinf (mce b `modE` m * 5 + 6)+    j = duty ar (mce e / (12 ** m)) 0 DoNothing l+    f = midiCps (degreeToKey (asLocalBufId 'β' b) j 12)+    y = decay2 (impulse ar (mce [2/3,1.5,3,1.5,3]) 0) c d * d+    o = sinOscFB ar f ((lfTri ar (c / mce b) 0 + 1) / 3) * y+in freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2++-- rd (edit) ; f0 <https://twitter.com/redFrik/status/1254441448327479299>+let b = [1,3,5,8,10]+    e = [3,2/3,4,3/2,2]+    c = 0.021+    d = lfTri ar (mce b / 999) 0 `modE` 1+    m = lfTri ar (mce b * c) 0+    l = m * 7 + 20 + dseq dinf (mce b `modE` m * 5 + 6)+    j = duty ar (mce e / (12 ** m)) 0 DoNothing l+    k = degreeToKey (asLocalBuf b) j 12+    o = sinOscFB ar (midiCps k) (lfTri ar (((c / mce b) + 1) / 3) 1 * d)+    r = freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2+    p = out 90 (a2k k)+in mrg2 r p++-- rd (edit) ; f0 <https://twitter.com/redFrik/status/1254441448327479299> ; id+let b = [1,3,5,8,10]+    e = [3,2/3,4,3/2,2]+    c = 0.021+    d = lfTri ar (mce b / 999) 0 `modE` 1+    m = lfTri ar (mce b * c) 0+    l = m * 7 + 20 + dseqId 'α' dinf (mce b `modE` m * 5 + 6)+    j = duty ar (mce e / (12 ** m)) 0 DoNothing l+    k = degreeToKey (asLocalBufId 'β' b) j 12+    o = sinOscFB ar (midiCps k) (lfTri ar (((c / mce b) + 1) / 3) 1 * d)+    r = freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2+    p = out 90 (a2k k)+in mrg2 r p++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0+UI.ui_sc3_ctl_plot 1200 5 90 1200 (1/25) 5
+ Help/Graph/f0-tw-1338987643057688579.hs view
@@ -0,0 +1,9 @@+-- f0 <https://twitter.com/redFrik/status/1338987643057688579>+let b = mce [8..18]+    x = varSaw ar (mce [18.1,81.8,1.81] + b) 1 (varSaw ar (b/81) 0 0.5)+    t = varSaw ar (8/1.818) (mce [1,8/18]) 0.5+    d = (varSaw ar (b/181.8) 0 0.5 `in_exprange` (1.81/818,1.8/181.8)) `roundTo` (1.81/818)+    c = varSaw ar (1/8) (1/b) 0.5 + 8.18 * 1.8+    z = varSaw ar (1/81.8) 0 0.5 `in_range` (1.8 ** (-1),8.1/8.18)+    p = (pluck x t (1.8/181.8) d c z * (varSaw ar (1.8/b) 0 0.5) / 1.8)+in hpf (splay p 1 1 0 True) (18/1.81)
+ Help/Graph/f0-tw-1343283697840226307.hs view
@@ -0,0 +1,20 @@+-- f0 <https://twitter.com/redFrik/status/1343283697840226307>+let b = mce [2..12] / 12+    f = mce [136.1, 163.3, 181.4, 204.1, 244.9, 272.1, 326.5, 362.8, 408.2, 489.8, 544.2]+    z = mceFill 11 (\_ -> whiteNoise ar) * ((lfTri ar b 0 + 1) / 2) + brownNoise ar+    t = lfTri ar (121 ** lfTri ar ((2 / 121) * b) 0) 0+    d = (lag2 ((1 / 212) `greater_than` lfTri ar (1/212.1) 0) (2 / b) / 12 * 1.2 + 1.2) / f+    p = pluck z t (2 / 121) d (1 / 2 * 12 / 1.2) ((lfTri ar (b/12) 0 + 1) / 2)+in splay (hpf p 12) 1 (1 / 2.1 / 2) 0 True++-- f0 <https://twitter.com/redFrik/status/1343283697840226307> ; id+let b = mce [2..12] / 12+    f = mce [136.1, 163.3, 181.4, 204.1, 244.9, 272.1, 326.5, 362.8, 408.2, 489.8, 544.2]+    z = mceFillInt 11 (\e -> whiteNoiseId ('α',e) ar) * ((lfTri ar b 0 + 1) / 2) + brownNoiseId 'β' ar+    t = lfTri ar (121 ** lfTri ar ((2 / 121) * b) 0) 0+    d = (lag2 ((1 / 212) `greater_than` lfTri ar (1/212.1) 0) (2 / b) / 12 * 1.2 + 1.2) / f+    p = pluck z t (2 / 121) d (1 / 2 * 12 / 1.2) ((lfTri ar (b/12) 0 + 1) / 2)+in splay (hpf p 12) 1 (1 / 2.1 / 2) 0 True++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0
+ Help/Graph/f0-tw-1367808902457397250.hs view
@@ -0,0 +1,14 @@+-- f0 <https://twitter.com/redFrik/status/1367808902457397250>+-- there is a subtle error in this translation i cannot see+-- the only differences appears to be the shared (impulse ar 0 0) node and the ordering at sum3+let rat = [76.1, 76.1, 64, 57, 38.1, 85.4, 32, 114, 42.7, 47.9, 95.9]+    f i =+      let i_ = constant i+          f0 = (rat !! i) * (sinOsc ar (1 / 16) 0 `greater_than` 0 * 2 + 6 - (sinOsc ar (sinOsc ar (1 / 32) i_) 0 / 20))+          z = sinOsc ar f0 0 / 9+          x = varLag_env (floorE (sinOsc ar (1 / 64) 0 * 6 + 6)) 0.1 (EnvNum 0) Nothing+          y = varLag_env (sinOsc ar (sinOsc ar (1 / 4) (i_ / 11 * pi) `less_than` 0 * 2) 0 * 0.1) 0.01 (EnvNum (sinOsc ar 0.01 i_)) Nothing+          dly = (i_ + x) `modE` 11 / 33 + 0.1 + y+          dcy = sinOsc ar (1 / 9) 0 + 1+      in combC z 0.5 dly dcy+in tanh (splay (mce (map f [0 .. 10])) 1 1 0 True)
+ Help/Graph/f0-tw-15eN.hs view
@@ -0,0 +1,5 @@+-- f0 ; https://sccode.org/1-5eN+let s = gbmanN ar (mce2 2300 1150) 1.2 2.1+    f0 = pulse ar 4 (mce2 1 2 / 8) + (lfPulse ar (1/8) 0 0.5 / 5 + 1)+    f1 = lfSaw ar f0 0 + 2+in X.glitchRHPF s f1 1 * 0.05
+ Help/Graph/f0-tw0011.hs view
@@ -0,0 +1,6 @@+-- tw 0011 (f0) ; https://twitter.com/redFrik/status/23182604046+let s o i = sinOsc ar ((mce2 (constant i) (constant i + 0.0001)) ** 2 * f o (i - 1)) (f o (i - 1) * 0.0001) * f o (i - 1)+    f o i = if i > 0 then s o i else o+in f 60 6 / 60++---- note ; this graph has 48 UGens ; c.f. scd graph which has 1950
+ Help/Graph/f0-tw0014.hs view
@@ -0,0 +1,12 @@+-- http://fredrikolofsson.com/f0blog/?q=node/478 (f0)+let a = sinOscFB ar+    k = 1/9+    f i = let a0 = a (i+1) k * 999+              a1 = a k 1 * k+              a2 = a a0 k * a1+              a3 = a 0.1 3+              a4 = a a2 a3 * ((i+2) * 999)+              a5 = a k k+          in a a4 a5 * k+    s = sum (map f [0..9])+in mce2 s s * 0.1
+ Help/Graph/f0-tw0020.hs view
@@ -0,0 +1,12 @@+-- http://fredrikolofsson.com/f0blog/?q=node/478 (f0)+let a n = lfPulse ar n 0 0.5+    b = mce [1..4]+    a1 = (a (b/32) + 1) / 8+    a2 = (a a1 + 1) * b+    a3 = a (b/64)+    a4 = a (a (b/8)) * 2 + b+    a5 = a (4/b)+    a6 = a a2+    a7 = a ((a6 + ((mix a3 + a5) * a4)) * 100)+    s = mix a7 / 8+in mce2 s s * 0.1
+ Help/Graph/f0-tw0028.hs view
@@ -0,0 +1,22 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0) ; slow to start...+let fib = 0 : scanl (+) 1 fib+    sc3_fib k = take k (drop 1 fib)+    n = map ((* 99) . (`mod` 8)) (sc3_fib 16)+    p = dseq dinf (dshuf 8 (mce (map fromInteger n)))+    q = combN (duty ar (1/8) 0 DoNothing p) 4 4 16+    o = lfTri ar q 0 / 4+    f = lfTri kr (1/16) 0 * 2e3 + 3e3+in pan2 (moogFF o f 2 0) 0 0.5++-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0) ; slow to start... ; id+let fib = 0 : scanl (+) 1 fib+    sc3_fib k = take k (drop 1 fib)+    n = map ((* 99) . (`mod` 8)) (sc3_fib 16)+    p = dseqId 'α' dinf (dshufId 'β' 8 (mce (map fromInteger n)))+    q = combN (duty ar (1/8) 0 DoNothing p) 4 4 16+    o = lfTri ar q 0 / 4+    f = lfTri kr (1/16) 0 * 2e3 + 3e3+in pan2 (moogFF o f 2 0) 0 0.5++---- ;+sc3_fib 16 == [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987]
+ Help/Graph/f0-tw0030.hs view
@@ -0,0 +1,6 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let a i j k l = lfPar ar i j * k + l+    f = a 1 0 5 (a (mce2 0.05 0.04) 0 50 160 `roundTo` 50)+    w = a 0.2 0 0.5 (a 3 0 0.2 0.5)+    o = varSaw ar f 0 w / 8+in gVerb o 80 3 0.5 0.5 15 1 0.7 0.5 300 * 0.1
+ Help/Graph/f0-tw0033.hs view
@@ -0,0 +1,17 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let f = roundE (lfPar ar (1/14) 0) * 20 + 80+    a = pulse ar (mce [1..4]) 0.35+    n = mceFill 4 (\_ -> brownNoise ar) * a+    z i = mce2 ((i + 1) * f) ((i * f) + (i + 1 / 3))+    o = lfPar ar (mce (map z [0..3])) 0+    (s1,s2) = unmce2 (splay ((o `greater_than` n) / 3) 1 1 0 True)+in (s1 + s2) * 0.1++-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0) ; id+let f = roundE (lfPar ar (1/14) 0) * 20 + 80+    a = pulse ar (mce [1..4]) 0.35+    n = mce (map (flip brownNoiseId ar) ['α','β','γ','δ']) * a+    z i = mce2 ((i + 1) * f) ((i * f) + (i + 1 / 3))+    o = lfPar ar (mce (map z [0..3])) 0+    (s1,s2) = unmce2 (splay ((o `greater_than` n) / 3) 1 1 0 True)+in (s1 + s2) * 0.1
+ Help/Graph/f0-tw0041.hs view
@@ -0,0 +1,5 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let s = sweep ar (localIn' 6 ar) 1+    i = impulse ar (mce [1,0.749,6,12,3,4]) 0+    o = sinOsc ar (1 / runningMax s i) 0+in mrg [tanh (splay o 1 1 0 True) * 0.05,localOut o]
+ Help/Graph/f0-tw0045.hs view
@@ -0,0 +1,6 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let a i j k l = sinOsc ar i j * k + l+    f = a (a 0.11 0 1 0) 0 1 0+    p_f = a (95 * a 0.01 0 1 1) 0 (a 0.005 0 50 0) 100+    p = a p_f (a (mce2 98 97) 0 1 0) (pi + a 0.0005 0 1 0) 0+in tanh (a f p 1 0) * 0.1
+ Help/Graph/f0-tw0049.hs view
@@ -0,0 +1,7 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg18379.html (f0)+let t = 0+    o0 = lfSaw ar 3 0 * 9 + 99+    s0 = sweep ar t (mce [3..9]) `modE` o0+    s1 = sweep ar t (mce [33,32..3]) `modE` 128 .&. s0+    o1 = sinOsc ar (midiCps (s1 + 33)) 0 * pi+in splay (sinOsc ar 9 o1) 1 1 0 True / 12
+ Help/Graph/f0-tw0051.hs view
@@ -0,0 +1,8 @@+-- http://sccode.org/1-4Qy (f0)+let ascii_u = mce . map (constant . fromEnum)+    i = a (ascii_u "sunday")+    f = a (9 / ascii_u "slow") * 400 + 500+    w = a (7 / ascii_u "coding") + 1.1+    a = saw ar+    l = splay (bBandPass i f w / 5) 1 1 0 True+in gVerb l 10 3 0.5 0.5 15 1 0.7 0.5 300 * 0.2
+ Help/Graph/f0-tw0077.hs view
@@ -0,0 +1,7 @@+-- http://sccode.org/1-4Qy (f0)+let a = sinOsc ar+    f = a (1 / mce2 5 6) 0 + mce2 798 912+    p = (a (1 / 16) 0 * 19 + 99) * a (mce2 9 8) 0+    m = a (a 6 0 * a 0.009 0) 0+    b = a f p * m+in tanh (a (mce2 201 301) b) * 0.1
+ Help/Graph/f0-tw0084.hs view
@@ -0,0 +1,6 @@+-- http://sccode.org/1-4Qy (f0)+let a = saw ar+    f = a (mce [5,7..15] * 19) * 99 + 199+    g = a (mce [1,3..13] * 29) * 199 + 299+    w = a (mce [3,5..11] * (a 3 * 2 + 3)) * 299 + 399+in splay (formant ar f g w) 1 1 0 True / 9
+ Help/Graph/f0-tw0120.hs view
@@ -0,0 +1,8 @@+-- http://sccode.org/1-4Qy (f0)+let a = lfTri+    z = a kr (1 / mce2 7 8) 0 * a kr (1 / 9) 0 * 99+    l = midiCps (mce [60 .. 79])+    f = select z l+    w = a kr (1 / mce2 3 4) 0 `modE` 1+    o = varSaw ar f 0 w+in combN o 1 (1 / mce2 5 6) 8 / 8
+ Help/Graph/f0-tw0121.hs view
@@ -0,0 +1,7 @@+-- http://sccode.org/1-4Qy (f0)+let a = sinOsc+    z = a kr (1 / mce2 8 7) 0 * a kr (1 / 30) 0 * 9+    l = midiCps (mce [56,62 .. 98])+    m = a ar (1 / mce2 4 3) 0+    o = a ar (select z l) 0 * m+in tanh (combN o 1 (1 / mce2 6 5) 9) * 0.1
+ Help/Graph/f0-tw0125.hs view
@@ -0,0 +1,9 @@+-- http://sccode.org/1-4Qy (f0)+let g = control kr "amp" 0.15+    a = sinOsc ar+    f = a (1 / mce [8,9]) 0 * 4 + mce [400,202]+    u = (a (1/9) 0 + 1) / 88+    d = (a (1/8) 0 + 1) / 99+    i = inFeedback 1 (mce [1,0])+    p = combC (lagUD i u d) 1 0.08 9+in a f p * g
+ Help/Graph/f0-tw0134.hs view
@@ -0,0 +1,12 @@+-- http://sccode.org/1-4Qy (f0) (requires -w 512)+let mean l = sum l / fromIntegral (length l)+    a = lfSaw ar+    n' = 50+    n = constant n'+    z i = let o1 = a ((i + 1) / mce [3,4]) 0+              o2 = a ((i + 1) / 8) 0 + 1+              f0 = o1 `greater_than` o2 * (n / 2) + n+              m = a ((i + 1) / n) (i / (n / 2))+              o3 = blip ar f0 (i + mce [2,3]) * m+          in ringz o3 ((i + 1) * (n * 2 - 1)) 0.1+in mean (map z [0 .. n']) / 10
+ Help/Graph/f0-tw0220.hs view
@@ -0,0 +1,13 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0)+let c = inFeedback 1 0+    b = clearBuf (localBuf 1 90000)+    g = tGrains 2 (sinOsc ar 3 0) b (c + 3) 2 12 0 0.1 4+    r = recordBuf ar b 0 1 0 1 Loop 1 DoNothing c+in mrg2 (hpf (sinOsc ar 99 (c * 6) / 9 + g) 9 * 0.75) r++-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0) ; id+let c = inFeedback 1 0+    b = clearBuf (localBufId 'α' 1 90000)+    g = tGrains 2 (sinOsc ar 3 0) b (c + 3) 2 12 0 0.1 4+    r = recordBuf ar b 0 1 0 1 Loop 1 DoNothing c+in mrg2 (hpf (sinOsc ar 99 (c * 6) / 9 + g) 9 * 0.75) r
+ Help/Graph/f0-tw0224.hs view
@@ -0,0 +1,13 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0)+let c = 200000+    b = clearBuf (localBuf 2 c)+    d = bufRd 2 ar b (sinOsc ar (mce2 2 3 * 9) 0 * c) NoLoop LinearInterpolation+    w = bufWr b (abs (sinOsc ar (mce2 99 145) 0) * c) Loop (sinOsc ar (3 / mce2 2 3) 0 / 3)+in mrg2 (d * 0.1) w++-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0) ; id+let c = 200000+    b = clearBuf (localBufId 'α' 2 c)+    d = bufRd 2 ar b (sinOsc ar (mce2 2 3 * 9) 0 * c) NoLoop LinearInterpolation+    w = bufWr b (abs (sinOsc ar (mce2 99 145) 0) * c) Loop (sinOsc ar (3 / mce2 2 3) 0 / 3)+in mrg2 (d * 0.1) w
+ Help/Graph/f0-tw0225.hs view
@@ -0,0 +1,5 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0)+let b = mce [1..8] * 99+    o = blip ar (b / 2 + lfSaw kr ((-8) / b) 1 * 99) (b / 4 + (lfSaw kr (1 / b) 1 * 99))+    c = combN (o * sinOsc ar (8 / b) (lfSaw ar (99 / b) 0)) 0.2 0.2 1+in sin (splay c 1 1 0 True) * 0.1
+ Help/Graph/jar-1-4Qx.hs view
@@ -0,0 +1,6 @@+-- http://sccode.org/1-4Qx (jar)+let f = lfCub kr 9.1 0 * 100 + mce [200,300,400,500]+    g = lfCub kr (1 / mce [2,3,5,7]) 0 * 0.5 + lfCub kr 9 0+    h = lfCub kr (1/2) 0 * 0.4 + 0.5+    s = lfCub ar f 0 * lag (g `greater_than` h) 0.1+in splay s 1 0.075 0 True
+ Help/Graph/jar-rk_20120422.hs view
@@ -0,0 +1,19 @@+-- rukano; Apr 22, 2012; Re: Epic Pads (jar)+let freq_f _ = midiCps (lchoose [60,64,65,67]) * (lfNoise2 kr 1 * 0.011 + 1)+    freq = mceFill 24 freq_f+    gen = lfSaw ar freq 0 * 0.1+    fmod = lfCub kr (1/12) 0 `in_range` (1,mouseX kr 2 16 Linear 0.2)  -- modulate filter with mouse+    rqmod = lfNoise2 kr (1/8) `in_range` (0.1,1)+    sig = rlpf gen (freq * fmod) rqmod+    amp = mouseY kr 0 0.25 Linear 0.2+in splay sig 1 1 0 True * amp++-- rukano; Apr 22, 2012; Re: Epic Pads (jar) ; id+let freq_f z = midiCps (lchooseId z [60,64,65,67]) * (lfNoise2Id z kr 1 * 0.011 + 1)+    freq = mce (map freq_f (take 24 ['α'..]))+    gen = lfSaw ar freq 0 * 0.1+    fmod = lfCub kr (1/12) 0 `in_range` (1,mouseX kr 2 16 Linear 0.2)  -- modulate filter with mouse+    rqmod = lfNoise2Id 'β' kr (1/8) `in_range` (0.1,1)+    sig = rlpf gen (freq * fmod) rqmod+    amp = mouseY kr 0 0.25 Linear 0.2+in splay sig 1 1 0 True * amp
+ Help/Graph/jh-4157.hs view
@@ -0,0 +1,27 @@+-- jh ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157>+mix (sinOsc ar (300 * mce (map (4 **) (take 200 [0, 0.002 ..]))) 0 * 0.02)++-- jh ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; doppler+splay (sinOsc ar (120 * mce (map (2 **) (take 100 [0, 0.002 ..]))) 0) 1 0.1 0 True++-- jh ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; doppler-formants+splay (saw ar (120 * mce (map (2 **) (take 100 [0, 0.002 ..])))) 1 0.1 0 True++-- sinosc ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; rd (edit)+let k = 100 -- 200 ; c.f. 12 25 50 100 200 400 600 800+    b = 2 -- 4 ; c.f. 2, 3, 4+    n = 0.02 -- 0.002 ; c.f. 0.002 0.004 0.01 0.05 0.1 0.125+    f0 = 120 -- 300 ; c.f. 120 180 240+    fMul = map (b **) (take k [0, n ..])+in splay (sinOsc ar (mce fMul * f0) 0) 1 0.1 0 True++-- sinosc ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; rd (edit)+let k = 160+    t = impulse ar 0.1 0+    sinosc f = sin (phasor ar t (f * sampleDur) 0 1 0 * 2 * pi)+    b = tRand 2 2.25 t+    n = tRand 0.002 0.02 t+    f0 = tRand 90 180 t+    fMul = map (b **) (take k [0, n ..])+    e = envGen ar t 1 0 1 DoNothing (envPerc 1 10)+in splay (sinosc (mce fMul * f0)) 1 0.1 0 True * e
+ Help/Graph/jl-1-9.hs view
@@ -0,0 +1,13 @@+-- http://sccode.org/1-9 (jl)+let n = 956 -- 0+    k = 99 -- 1+    a = hpf (pinkNoise ar * 0.005) 10 * line kr 0 1 9 DoNothing+    f i = ringz (a * lfNoise1 kr (0.05 + rand 0 0.1)) (55 * (i + n) + 60) 0.2+in tanh (gVerb (mixFill k f) 70 99 0.5 0.5 15 1 0.7 0.5 300)++-- http://sccode.org/1-9 (jl) ; id+let n = 956 -- 0+    k = 98 -- 1+    a = hpf (pinkNoiseId 'α' ar * 0.005) 10 * line kr 0 1 9 DoNothing+    f (z,i) = ringz (a * lfNoise1Id z kr (0.05 + randId z 0 0.1)) (55 * (i + n) + 60) 0.2+in tanh (gVerb (sum (map f (zip ['β' ..] [0 .. k]))) 70 99 0.5 0.5 15 1 0.7 0.5 300)
+ Help/Graph/jl-bitwise.hs view
@@ -0,0 +1,7 @@+-- bitwise ; a0f253ff89f6b244ea29a1e431dd9e5df5571a8b (jl)+let t = pulseCount (impulse ar 8e3 0) 0+    s = ((((t * 15) .&. (t .>>. 5)) .|.+          ((t *  5) .&. (mce2 (t .>>. 3) (t .>>. 4))) .|.+          ((t *  2) .&. (t .>>. 9)) .|.+          ((t *  8) .&. (t .>>. 11))) - 3) `modE` 256+in tanh (hpf (((s / 127) - 1) * 3) 20) * 0.02
+ Help/Graph/jl-dark-sea-horns.hs view
@@ -0,0 +1,15 @@+-- http://sccode.org/1-j#c51 (jl)+let n = lfNoise1+    x = localIn' 2 ar+    a = tanh (sinOsc ar 65 (x * lfNoise1 ar 0.1 * 3) * lfNoise1 ar 3 * 6)+    f i = allpassN i 0.3 (X.randN 2 0.1 0.3) 5+    o = tanh (iter 9 f a)+in mrg2 (o * 0.2) (localOut o)++-- http://sccode.org/1-j#c51 (jl) ; id+let n = lfNoise1Id+    x = localIn' 2 ar+    a = tanh (sinOsc ar 65 (x * n 'α' ar 0.1 * 3) * n 'β' ar 3 * 6)+    f z i = allpassN i 0.3 (X.randNId 2 (z,'γ') 0.1 0.3) 5+    o = tanh (useqId 'δ' 9 f a)+in mrg2 (o * 0.2) (localOut o)
+ Help/Graph/jl-jl-1-Z.hs view
@@ -0,0 +1,8 @@+-- http://sccode.org/1-Z (jl)+let a = lag (impulse kr 8 0) 0.1+    b = crackle ar (lag (abs (lfSaw kr 3 0)) 0.1 * 1.8)+    c = a * b+    d = lag (impulse kr 2 0 + impulse kr 4 0.5) 0.1+    e = blip ar 4.9 7 * 0.4+    f = d * e+in tanh (c + gVerb f 1 1 0.5 0.5 15 1 0.7 0.5 300 * 5) * 0.5
+ Help/Graph/jl-pwm-crossfade.hs view
@@ -0,0 +1,15 @@+-- http://sccode.org/1-L (jl)+let urangeMce u = let [u0,u1] = mceChannels u in urange u0 u1+    n = mce [400,500,450,376,600]+    d = 1/20+    f = demand (impulse kr d (mce2 0 0.5)) 0 (dseq dinf n)+    f_ = urangeMce f (lfPulse kr 8 0 (range 0 1 (lfTri kr d 1)))+in lpf (saw ar (max 376 f_ * mce2 1 0.99) * 0.5) 8000 * 0.1++-- http://sccode.org/1-L (jl) ; id+let urangeMce u = let [u0,u1] = mceChannels u in urange u0 u1+    n = mce [400,500,450,376,600]+    d = 1/20+    f = demand (impulse kr d (mce2 0 0.5)) 0 (dseqId 'α' dinf n)+    f_ = urangeMce f (lfPulse kr 8 0 (range 0 1 (lfTri kr d 1)))+in lpf (saw ar (max 376 f_ * mce2 1 0.99) * 0.5) 8000 * 0.1
+ Help/Graph/jl-rain-thunder.hs view
@@ -0,0 +1,23 @@+-- http://sccode.org/1-e (jl)+let d0 = lpf (dust2 ar (lfNoise1 kr 0.2 `in_range` (40,50))) 7000+    n0 = pinkNoise ar * (0.08 + lfNoise1 kr 0.3 * 0.02) + d0+    e0 = line kr 0 1 10 DoNothing+    p0 = tanh (3 * gVerb (hpf n0 400) 250 100 0.25 0.5 15 0.3 0.7 0.5 300 * e0)+    lfNoise1C r f = clip (lfNoise1 r f) 0 1+    n1 = pinkNoise ar * ((lfNoise1C kr 3 * lfNoise1C kr 2) ** 1.8)+    f1 = linExp (lfNoise1 kr 1) (-1) 1 100 2500+    e1 = line kr 0 0.7 30 DoNothing+    p1 = gVerb (tanh (lpf (10 * hpf n1 20) f1)) 270 30 0.7 0.5 15 0.5 0.7 0.5 300 * e1+in limiter (p0 + p1) 1 0.01 * 0.2++-- http://sccode.org/1-e (jl) ; id+let d0 = lpf (dust2Id 'γ' ar (lfNoise1Id 'δ' kr 0.2 `in_range` (40,50))) 7000+    n0 = pinkNoiseId 'α' ar * (0.08 + lfNoise1Id 'β' kr 0.3 * 0.02) + d0+    e0 = line kr 0 1 10 DoNothing+    p0 = tanh (3 * gVerb (hpf n0 400) 250 100 0.25 0.5 15 0.3 0.7 0.5 300 * e0)+    lfNoise1C e r f = clip (lfNoise1Id e r f) 0 1+    n1 = pinkNoiseId 'ε' ar * ((lfNoise1C 'ζ' kr 3 * lfNoise1C 'η' kr 2) ** 1.8)+    f1 = linExp (lfNoise1Id 'θ' kr 1) (-1) 1 100 2500+    e1 = line kr 0 0.7 30 DoNothing+    p1 = gVerb (tanh (lpf (10 * hpf n1 20) f1)) 270 30 0.7 0.5 15 0.5 0.7 0.5 300 * e1+in limiter (p0 + p1) 1 0.01 * 0.2
+ Help/Graph/jmcc-aleatoric-quartet.hs view
@@ -0,0 +1,38 @@+-- aleatoric quartet (jmcc) #7+let base_mn = 66 -- control kr "note" 66+    amp = 0.07 -- control kr "amp" 0.07+    density = mouseX kr 0.01 1 Linear 0.1+    dmul = recip density * 0.5 * amp+    dadd = amp - dmul+    rapf i = allpassN i 0.05 (mce2 (rand 0 0.05) (rand 0 0.05)) 1+    mk_f _ = let m = lfNoise0 kr (lchoose [1, 0.5, 0.25]) * 7 + base_mn + rand (-30) 30+             in midiCps (lag (roundTo m 1) 0.2)+    mk_s n = let x = pinkNoise ar * max 0 (lfNoise1 kr 8 * dmul + dadd)+             in pan2 (combL x 0.02 (recip (mk_f n)) 3) (rand2 1) 1+    g = iter 5 rapf (mixFill 4 mk_s)+in leakDC g 0.995++-- aleatoric quartet (jmcc) #7 ; monadic+let aleatoric_quartet_m = do+      let base_mn = 66 -- control kr "note" 66+          amp = 0.07 -- control kr "amp" 0.07+          density = mouseX kr 0.01 1 Linear 0.1+          dmul = recip density * 0.5 * amp+          dadd = amp - dmul+          rapf i = do r <- replicateM 2 (randM 0 0.05)+                      return (allpassN i 0.05 (mce r) 1)+          mk_f = do r0 <- lchooseM [1, 0.5, 0.25]+                    r1 <- randM (-30) 30+                    n0 <- lfNoise0M kr r0+                    let m = n0 * 7 + base_mn + r1+                        m' = lag (roundTo m 1) 0.2+                    return (midiCps m')+          mk_s = do f <- fmap recip mk_f+                    r <- randM (-1) 1+                    x <- do n0 <- pinkNoiseM ar+                            n1 <- lfNoise1M kr 8+                            return (n0 * max 0 (n1 * dmul + dadd))+                    return (pan2 (combL x 0.02 f 3) r 1)+      g <- chainM 5 rapf =<< fmap sum (sequence (replicate 4 mk_s))+      return (leakDC g 0.995)+in uid_st_eval aleatoric_quartet_m
+ Help/Graph/jmcc-alien-froggies.hs view
@@ -0,0 +1,20 @@+-- alien froggies (jmcc) #1 ; texture=overlap,0.25,0.5,5,inf+let alien_froggies_n r =+      let r' = fold (r * exp (linRand (-0.2) 0.2 0)) 1 30+          o = formant ar r' (expRand 200 3000) (rand 0 9 * r' + r')+      in o * 0.05+in alien_froggies_n 11++-- alien froggies (jmcc) #1 ; texture=overlap,0.25,0.5,5,inf ; id+let alien_froggies_n r =+      let r' = fold (r * exp (linRandId 'α' (-0.2) 0.2 0)) 1 30+          o = formant ar r' (expRandId 'β' 200 3000) (randId 'γ' 0 9 * r' + r')+      in o * 0.05+in alien_froggies_n 11++-- alien froggies (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let r = fold (11 * exp (x * 0.4 - 0.2)) 1 30+          s = formant ar r (linExp y 0 1 200 3000) (rx * 9 * r + r)+      in pan2 s (o * 2 - 1) (0.5 * z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-alien-meadow.hs view
@@ -0,0 +1,9 @@+-- alien meadow (jmcc) #6 ; texture=overlap,2,6,6,inf+let b = rand 0 5000+    f = sinOsc ar (rand 0 20) 0 * b * 0.1 + b+in pan2 (sinOsc ar f 0) (rand2 1) (sinOsc ar (rand 0 20) 0 * 0.05 + 0.05)++-- alien meadow (jmcc) #6 ; texture=overlap,2,6,6,inf ; id+let b = randId 'α' 0 5000+    f = sinOsc ar (randId 'β' 0 20) 0 * b * 0.1 + b+in pan2 (sinOsc ar f 0) (randId 'γ' (-1) 1) (sinOsc ar (randId 'δ' 0 20) 0 * 0.05 + 0.05)
+ Help/Graph/jmcc-analog-bubbles-mouse.hs view
@@ -0,0 +1,17 @@+-- analog bubbles with mouse control (jmcc) #3+let y = mouseY kr 0.1 10 Exponential 0.2 {- lfo 1 rate -}+    x = mouseX kr 2 40 Exponential 0.2  {- lfo 2 rate -}+    o2 = lfSaw kr x 0 * (-3) + 80 {- depth & offset in semitones -}+    o1 = lfSaw kr y 0 * 24 + o2 {- depth in semitones, offset is lfo_2 -}+    f = midiCps o1 {- convert to frequency -}+    s = sinOsc ar f 0 * 0.04+in combN s 0.2 0.2 4 {- echoing sine wave -}++-- analog bubbles (jmcc) #1 ; C-cC-v c.f. hsc3-ui-region+let f1 = control_m kr "f1" 0.4 (0.1,16,"exp")+    f2 = control_m kr "f2" 8.0 (0.1,16,"exp")+    dt = control_m kr "dt" 0.90375 (0.5,2,"lin")+    o = lfSaw kr (mce2 f2 (f2 * dt)) 0 * 3 + 80+    f = lfSaw kr f1 0 * 24 + o+    s = sinOsc ar (midiCps f) 0 * 0.04+in combN s 0.2 0.2 4
+ Help/Graph/jmcc-analog-bubbles.hs view
@@ -0,0 +1,5 @@+-- analog bubbles (jmcc) #1+let o = lfSaw kr (mce2 8 7.23) 0 * 3 + 80+    m = lfSaw kr 0.4 0 * 24 + o+    s = sinOsc ar (midiCps m) 0 * 0.04+in combN s 0.2 0.2 4 * 0.1
+ Help/Graph/jmcc-analogue-daze.hs view
@@ -0,0 +1,33 @@+-- ; analogue daze (jmcc) #3+let dsequ s tr = demand tr 0 (dseq dinf (mce s))+    patternList = [55,63,60,63,57,65,62,65]+    f octave clockRate pwmrate fltrate =+        let trg = impulse kr clockRate 0+            freq = map (midiCps .  (+ (12 * octave))) patternList+            sq = dsequ freq trg+            pwm = sinOsc kr pwmrate (rand 0 (2 * pi)) * 0.4 + 0.5+            cf = sinOsc kr fltrate (rand 0 (2 * pi)) * 1400 + 2000+        in rlpf (lfPulse ar (lag sq 0.05) 0 pwm * 0.1) cf (1/15)+    a = lfNoise0 ar (lfNoise1 kr 0.3 * 6000 + 8000) * (mce2 0.07 0.08)+    x = decay (impulse ar 2 0) 0.15 * a+    g = mce [f 1 8 0.31 0.2,f 0 2 0.13 0.11] + x+    z = 0.4 * (combN g 0.375 0.375 5 + mceReverse g)+    e = envLinen 2 56 2 1+in z * envGen kr 1 1 0 1 RemoveSynth e++-- ; analogue daze (jmcc) #3 ; id+let dsequId k s tr = demand tr 0 (dseqId k dinf (mce s))+    patternList = [55,63,60,63,57,65,62,65]+    f k octave clockRate pwmrate fltrate =+        let trg = impulse kr clockRate 0+            freq = map (midiCps .  (+ (12 * octave))) patternList+            sq = dsequId 'α' freq trg+            pwm = sinOsc kr pwmrate (randId (k,'β') 0 (2 * pi)) * 0.4 + 0.5+            cf = sinOsc kr fltrate (randId (k,'γ') 0 (2 * pi)) * 1400 + 2000+        in rlpf (lfPulse ar (lag sq 0.05) 0 pwm * 0.1) cf (1/15)+    a = lfNoise0Id 'δ' ar (lfNoise1Id 'ε' kr 0.3 * 6000 + 8000) * (mce2 0.07 0.08)+    x = decay (impulse ar 2 0) 0.15 * a+    g = mce [f 'ζ' 1 8 0.31 0.2,f 'η' 0 2 0.13 0.11] + x+    z = 0.4 * (combN g 0.375 0.375 5 + mceReverse g)+    e = envLinen 2 56 2 1+in z * envGen kr 1 1 0 1 RemoveSynth e
+ Help/Graph/jmcc-babbling-brook.hs view
@@ -0,0 +1,18 @@+-- babbling brook (jmcc) #Sc3+let b f m a g _ = let n3 = lpf (brownNoise ar) f * m + a+                      n4 = onePole (brownNoise ar) 0.99+                  in rhpf n4 n3 0.03 * g+    x = mceFill 2 (b 14 400 500 0.006)+    y = mceFill 2 (b 20 800 1000 0.010)+in x + y++-- babbling brook (jmcc) #Sc3+uid_st_eval (do+  let b f m a g = do n1 <- brownNoiseM ar+                     n2 <- brownNoiseM ar+                     let n3 = lpf n2 f * m + a+                         n4 = onePole n1 0.99+                     return (rhpf n4 n3 0.03 * g)+  x <- replicateM 2 (b 14 400 500 0.006)+  y <- replicateM 2 (b 20 800 1000 0.010)+  return (mce x + mce y))
+ Help/Graph/jmcc-bach-prelude.hs view
@@ -0,0 +1,16 @@+-- jmcc <https://soundcloud.com/soundaspureform/bach-prelude>+let p1 = [[60,64,67,72,76],[60,62,69,74,77],[59,62,67,74,77],[60,64,67,72,76]+         ,[60,64,69,76,81],[60,62,66,69,74],[59,62,67,74,79],[59,60,64,67,72]+         ,[57,60,64,67,72],[50,57,62,66,72],[55,59,62,67,71],[55,58,64,67,73]+         ,[53,57,62,69,74],[53,56,62,65,71],[52,55,60,67,72],[52,53,57,60,65]+         ,[50,53,57,60,65],[43,50,55,59,65],[48,52,55,60,64],[48,55,58,60,64]+         ,[41,53,57,60,64],[42,48,57,60,63],[44,53,59,60,62],[43,53,55,59,62]+         ,[43,52,55,60,64],[43,50,55,60,65],[43,50,55,59,65],[43,51,57,60,66]+         ,[43,52,55,60,67],[43,50,55,60,65],[43,50,55,59,65],[36,48,55,58,64]]+    p2 = [[36,48,53,57,60,65,60,57,60,57,53,57,53,50,53,50]+         ,[36,47,67,71,74,77,74,71,74,71,67,71,62,65,64,62]+         ,replicate 16 60]+    p = concatMap (concat . replicate 2 . (\x -> x ++ drop 2 x)) p1 ++ concat p2+    tr = impulse kr 5 0+    freq = demand tr 0 (dseq 1 (mce (map midiCps p)))+in pan2 (freeVerb (lpf (saw ar (lag freq 0.03)) 1000) 0.3 0.5 0.35) 0 0.2
+ Help/Graph/jmcc-berlin-1977.hs view
@@ -0,0 +1,47 @@+-- berlin 1977 (jmcc) #4+let dsequ sq tr = demand tr 0 (dseq dinf (mce sq))+    dsequR sq tr = demand tr 0 (dshuf dinf (mce sq))+    clock_rate = mouseX kr 5 20 Exponential 0.2 {- mouse x controls clock rate -}+    clock_time = 1 / clock_rate+    clock = impulse kr clock_rate 0 {- sequencer trigger -}+    patternList = [55,60,63,62,60,67,63,58]+    note = dsequ patternList clock {- midi note pattern sequencer -}+    clock_16 = pulseDivider clock 16 0 {- divide clock by 16 -}+    note' = dsequR [-12,-7,-5,0,2,5] clock_16 + note {- transpose somewhat randomly -}+    freq = midiCps note' {- convert midi note to cycles per second -}+    env = decay2 clock (0.05 * clock_time) (2 * clock_time)+    amp = env * 0.1 + 0.02 {- amplitude envelope -}+    filt = env * (fSinOsc kr 0.17 0 * 800) + 1400 {- filter frequency -}+    pw = sinOsc kr 0.08 (mce2 0 (0.5 * pi)) * 0.45 + 0.5 {- pulse width LFO(s) -}+    s = pulse ar freq pw * amp+in combN (rlpf s filt 0.15) 0.2 (mce2 0.2 0.17) 1.5++-- berlin 1977 (jmcc) #4 ; id+let dsequId z sq tr = demand tr 0 (dseqId z dinf (mce sq))+    dsequRId z sq tr = demand tr 0 (dshufId z dinf (mce sq))+    clock_rate = mouseX kr 5 20 Exponential 0.2 {- mouse x controls clock rate -}+    clock_time = 1 / clock_rate+    clock = impulse kr clock_rate 0 {- sequencer trigger -}+    patternList = [55,60,63,62,60,67,63,58]+    note = dsequId 'α' patternList clock {- midi note pattern sequencer -}+    clock_16 = pulseDivider clock 16 0 {- divide clock by 16 -}+    note' = dsequRId 'β' [-12,-7,-5,0,2,5] clock_16 + note {- transpose somewhat randomly -}+    freq = midiCps note' {- convert midi note to cycles per second -}+    env = decay2 clock (0.05 * clock_time) (2 * clock_time)+    amp = env * 0.1 + 0.02 {- amplitude envelope -}+    filt = env * (fSinOsc kr 0.17 0 * 800) + 1400 {- filter frequency -}+    pw = sinOsc kr 0.08 (mce2 0 (0.5 * pi)) * 0.45 + 0.5 {- pulse width LFO(s) -}+    s = pulse ar freq pw * amp+in combN (rlpf s filt 0.15) 0.2 (mce2 0.2 0.17) 1.5++-- berlin 1977 (jmcc) #4 ; event-control+let f (_,w,_,y,z,_,_,_,p,_,_) =+      let freq = unitCps p+          env = decay2 (trig w controlDur) (0.05 * y) (2 * y)+          amp = env * z + 0.02+          filt = env * (fSinOsc kr 0.17 0 * 800) + 1400 {- filter frequency -}+          pw = sinOsc kr 0.08 (mce2 0 (0.5 * pi)) * 0.45 + 0.5 {- pulse width LFO(s) -}+          s = pulse ar freq pw * amp+      in combN (rlpf s filt 0.15) 0.2 (mce2 0.2 0.17) 1.5 * lagUD w 0 (2 + y)+in mix (voicer 16 f) * control kr "gain" 1+
+ Help/Graph/jmcc-birdies.hs view
@@ -0,0 +1,17 @@+-- birdies (jmcc) #6 ; texture=overlap,7,4,4,inf+let p1 = lfPulse kr (0.4 + rand 0 1) 0 (rand 0 0.8 + 0.1) * (rand 0 3 + 4) + 2+    p2 = lfPulse kr (0.4 + rand 0 1) 0 (rand 0 0.8 + 0.1) * (rand 0 3 + 4)+    p3 = lfPulse kr (0.2 + rand 0 0.5) 0 0.4 * 0.02+    sw = lfSaw kr (p1 + p2) 0 * (- (1000 + rand 0 800)) + (4000 + rand2 1200)+    freq = lag sw 0.05+    amp = lag p3 0.3+in pan2 (sinOsc ar freq 0 * amp) (rand2 1) 1++-- birdies (jmcc) #6 ; texture=overlap,7,4,4,inf ; id+let p1 = lfPulse kr (0.4 + randId 'α' 0 1) 0 (randId 'β' 0 0.8 + 0.1) * (randId 'γ' 0 3 + 4) + 2+    p2 = lfPulse kr (0.4 + randId 'δ' 0 1) 0 (randId 'ε' 0 0.8 + 0.1) * (randId 'ζ' 0 3 + 4)+    p3 = lfPulse kr (0.2 + randId 'η' 0 0.5) 0 0.4 * 0.02+    sw = lfSaw kr (p1 + p2) 0 * (- (1000 + randId 'θ' 0 800)) + (4000 + rand2Id 'ι' 1200)+    freq = lag sw 0.05+    amp = lag p3 0.3+in pan2 (sinOsc ar freq 0 * amp) (rand2Id 'κ' 1) 1
+ Help/Graph/jmcc-birds.hs view
@@ -0,0 +1,30 @@+-- birds (jmcc)+let node _ = let f = rand 94.0 102.0 + lag (lfSaw ar (7 + rand2 1.5) (rand 0 1) * rand 11 15) 0.1+                 a = lfPulse kr (1.0 / rand 12 15.6) (rand 0 1) 0.16 * 0.05+                 b = sinOsc ar (midiCps f) (rand 0 1) * a+             in rotate2 b (silent 1) (rand2 1)+    apfr i = allpassL i 0.07 (rand 0 0.06) (rand 0.7 2.0)+    d = mixFill 6 node+    w = iter 12 apfr d+in d * 0.7 + w * 0.3++-- birds (jmcc) ; monad+uid_st_eval (do+  let node = do r1 <- randM 94.0 102.0+                r2 <- randM (-1.5) 1.5+                r3 <- randM 0.0 1.0+                r4 <- randM 11.0 15.0+                r5 <- randM 0.0 1.0+                r6 <- randM 12.0 15.6+                r7 <- randM 0.0 1.0+                r8 <- randM (-1.0) 1.0+                let f = r1 + lag (lfSaw ar (7 + r2) r3 * r4) 0.1+                    a = lfPulse kr (1.0 / r6) r7 0.16 * 0.05+                    b = sinOsc ar (midiCps f) r5 * a+                return (rotate2 b (silent 1) r8)+      apf_r i = do r1 <- randM 0.0 0.06+                   r2 <- randM 0.7 2.0+                   return (allpassL i 0.07 r1 r2)+  d <- return . sum =<< sequence (replicate 6 node)+  w <- chainM 12 apf_r d+  return (d * 0.7 + w * 0.3))
+ Help/Graph/jmcc-blips.hs view
@@ -0,0 +1,21 @@+-- blips 001 (jmcc) #Sc3d1.5 ; texture=overlap,2,1,12,inf+let mk _ =+      let f = xLine kr (expRand 0.25 400) (expRand 0.25 400) 4 DoNothing+          nh = xLine kr (expRand 2 100) (expRand 2 100) 4 DoNothing+      in blip ar f nh+    pp = iter 6 (\x -> allpassN x 0.05 (mce2 (rand 0 0.05) (rand 0 0.05)) 4) . distort+in pp (rand 0 1 <** 0.8 * pan2 (mk () * mk ()) (line kr (rand2 1) (rand2 1) 4 DoNothing) 0.3)++-- blips 001 (jmcc) #Sc3d1.5 ; texture=overlap,2,1,12,inf ; id+let mk z =+      let f = xLine kr (expRandId (z,'α') 0.25 400) (expRandId (z,'β') 0.25 400) 4 DoNothing+          nh = xLine kr (expRandId (z,'γ') 2 100) (expRandId (z,'δ') 2 100) 4 DoNothing+      in blip ar f nh+    s =+      let c = randId 'ε' 0 1 <** 0.8+          o = mk 'ζ' * mk 'η'+      in c * pan2 o (line kr (rand2Id 'θ' 1) (rand2Id 'ι' 1) 4 DoNothing) 0.3+    pp =+      let f z x = allpassN x 0.05 (mce2 (randId (z,'κ') 0 0.05) (randId (z,'λ') 0 0.05)) 4+      in Sound.Sc3.Common.Base.compose_l (map f (id_seq 6 'μ')) . distort+in pp s
+ Help/Graph/jmcc-bouncing-objects.hs view
@@ -0,0 +1,25 @@+-- bouncing objects (jmcc) #2 ; texture=spawn,1,inf+let imp_frq = xLine kr (5 + rand (-2) 2) 600 4 DoNothing+    imp_amp = xLine kr 0.09 0.000009 4 DoNothing+    imp = impulse ar imp_frq 0 * imp_amp+    exc = decay imp 0.001+    flt_frq = X.randN 4 400 8400+    flt_amp = X.randN 4 0 1+    flt_rtm = X.randN 4 0.01 0.11+    flt = klank exc 1 0 1 (klankSpec_mce flt_frq flt_amp flt_rtm)+    loc = pan2 flt (rand (-1) 1) 1+    e = Envelope [1,1,0] [3,0.001] (replicate 2 EnvLin) Nothing Nothing 0+in loc * envGen kr 1 1 0 1 RemoveSynth e++-- bouncing objects (jmcc) #2 ; texture=spawn,1,inf ; id+let imp_frq = xLine kr (5 + randId 'α' (-2) 2) 600 4 DoNothing+    imp_amp = xLine kr 0.09 0.000009 4 DoNothing+    imp = impulse ar imp_frq 0 * imp_amp+    exc = decay imp 0.001+    flt_frq = X.randNId 4 'β' 400 8400+    flt_amp = X.randNId 4 'γ' 0 1+    flt_rtm = X.randNId 4 'δ' 0.01 0.11+    flt = klank exc 1 0 1 (klankSpec_mce flt_frq flt_amp flt_rtm)+    loc = pan2 flt (randId 'ε' (-1) 1) 1+    e = Envelope [1,1,0] [3,0.001] (replicate 2 EnvLin) Nothing Nothing 0+in loc * envGen kr 1 1 0 1 RemoveSynth e
+ Help/Graph/jmcc-bowed-string.hs view
@@ -0,0 +1,57 @@+-- bowed string (jmcc) ; texture=overlap,5,2,12,inf+let root = 5+    scale = map (+ root) [0,2,4,5,7,9,11]+    oct = [24,36,48,60,72,84]+    f = midiCps (lchoose scale + lchoose oct)+    x = mce2 (brownNoise ar) (brownNoise ar) * 0.007 * max 0 (lfNoise1 kr (expRand 0.125 0.5) * 0.6 + 0.4)+    geom n i z = mce (take n (iterate (* z) i))+    iota n i z = mce (take n (iterate (+ z) i))+    d = klankSpec_mce (iota 12 f f) (geom 12 1 (rand 0.7 0.9)) (X.randN 12 1.0 3.0)+    k = klank x 1 0 1 d+in softClip (k * 0.1)++-- bowed string (jmcc) ; texture=overlap,5,2,12,inf ; monad+uid_st_eval (do+  let root = 5+      scale = map (+ root) [0,2,4,5,7,9,11]+      oct = [24,36,48,60,72,84]+  n0 <- replicateM 2 (brownNoiseM ar)+  r0 <- expRandM 0.125 0.5+  r1 <- randM 0.7 0.9+  r2 <- X.randNM 12 1.0 3.0+  f <- midiCps `fmap` (Control.Monad.liftM2 (+) (lchooseM scale) (lchooseM oct))+  n1 <- lfNoise1M kr r0+  let x = mce n0 * 0.007 * max 0 (n1 * 0.6 + 0.4)+      geom n i z = mce (take n (iterate (* z) i))+      iota n i z = mce (take n (iterate (+ z) i))+      d = klankSpec_mce (iota 12 f f) (geom 12 1 r1) r2+      k = klank x 1 0 1 d+  return (softClip (k * 0.1)))++-- bowed string (jmcc) ; event control+let f (_,g,_,y,z,_,_,_,p,_,_) =+      let n0 = mce2 (brownNoise ar) (brownNoise ar)+          r0 = expRand 0.125 0.5+          r1 = rand 0.7 0.9+          r2 = X.randN 12 1.0 3.0+          fq = unitCps p+          exc = n0 * 0.005 * z * lagUD g (y * 0.1) (y * 4)+          geom n i m = mce (take n (iterate (* m) i))+          iota n i m = mce (take n (iterate (+ m) i))+          d = klankSpec_mce (iota 12 fq fq) (geom 12 1 r1) r2+      in softClip (dynKlank exc 1 0 1 d)+in mix (voicer 16 f) * control kr "gain" 0.75++-- bowed string (jmcc) ; event control ; id+let f (c,g,_,y,z,_,_,_,p,_,_) =+      let n0 = mce2 (brownNoiseId (c,'α') ar) (brownNoiseId (c,'β') ar)+          r0 = expRandId (c,'γ') 0.125 0.5+          r1 = randId (c,'δ') 0.7 0.9+          r2 = X.randNId 12 (c,'ε') 1.0 3.0+          fq = unitCps p+          exc = n0 * 0.005 * z * lagUD g (y * 0.1) (y * 4)+          geom n i m = mce (take n (iterate (* m) i))+          iota n i m = mce (take n (iterate (+ m) i))+          d = klankSpec_mce (iota 12 fq fq) (geom 12 1 r1) r2+      in softClip (dynKlank exc 1 0 1 d)+in mix (voicer 16 f) * control kr "gain" 0.75
+ Help/Graph/jmcc-clustered-sines.hs view
@@ -0,0 +1,19 @@+-- clustered sines (jmcc) #2 ; texture=xfade,4,4,inf+let cs _ =+      let n = 80+          f1 = rand 100 1100+          f2 = 4 * f1+          sp = let y = mceFill n (\_ -> f1 + rand 0 f2)+               in klangSpec_mce y (mceMap (f1 /) y) (mceFill n (const 0))+      in klang ar 1 0 sp * (0.3 / fromIntegral n)+in mceFill 2 cs++-- clustered sines (jmcc) #2 ; texture=xfade,4,4,inf ; id+let cs z =+      let n = 80+          f1 = randId 'α' 100 1100+          f2 = 4 * f1+          sp = let y = map (\zz -> f1 + randId (z,zz) 0 f2) (id_seq n 'β')+               in klangSpec y (map (f1 /) y) (replicate n 0)+      in klang ar 1 0 sp * (0.3 / fromIntegral n)+in mce (map cs (id_seq 2 'δ'))
+ Help/Graph/jmcc-coolant.hs view
@@ -0,0 +1,13 @@+-- coolant (jmcc) #2 ; texture=overlap,4,4,2,inf+let p = 10+    spec freq = let n = mceFill p (const 1) in klankSpec_mce freq n n+    gen _ = klank (onePole (brownNoise ar * 0.0015) 0.95) 1 0 1 (spec (X.randN p 40 2400))+in mceFill 2 gen++-- coolant (jmcc) #2 ; texture=overlap,4,4,2,inf ; id+let p = 10+    s = onePole (mceFillId 'α' 2 (\z _ -> brownNoiseId z ar * 0.0015)) 0.95+    n = mceFill p (const 1)+    s1 = klankSpec_mce (X.randNId p 'β' 40 2400) n n+    s2 = klankSpec_mce (X.randNId p 'γ' 40 2400) n n+in klank s 1 0 1 (mceTranspose (mce2 s1 s2))
+ Help/Graph/jmcc-cymbalism-accelerando.hs view
@@ -0,0 +1,25 @@+-- cymbalism accelerando (jmcc) #2 ; texture=overlap,4,4,4,inf+let y _ = let f1 = rand 500 2500+              f = mceFill 15 (\_ -> rand f1 (f1 + rand 0 8000))+              rt = mceFill 15 (\_ -> rand 1 5)+        in klankSpec_mce f (mceFill 15 (const 1)) rt+    z = mceFill 2 y+    w = whiteNoise ar * 0.02+    tf = xLine kr (linRand 0.5 4.5 0) (rand 0.5 35.5) 12 DoNothing+    t = impulse ar tf 0+    s = decay t 0.004 * w+in klank s 1 0 1 (mceTranspose z)++-- cymbalism accelerando (jmcc) #2 ; texture=overlap,4,4,4,inf ; id+let enumFromN e i = let j = fromEnum e in [j .. j + i]+    y n = let f1 = randId n 500 2500+              f2 = randId n 0 8000+              f = map (\e -> randId e f1 (f1 + f2)) (enumFromN n 15)+              rt = map (\e -> randId e 1 5) (enumFromN n 15)+        in klankSpec f (replicate 15 1) rt+    z = mce2 (y 'α') (y 'β')+    w = whiteNoiseId 'γ' ar * 0.02+    tf = xLine kr (linRandId 'δ' 0.5 4.5 0) (randId 'ε' 0.5 35.5) 12 DoNothing+    t = impulse ar tf 0+    s = decay t 0.004 * w+in klank s 1 0 1 (mceTranspose z)
+ Help/Graph/jmcc-cymbalism.hs view
@@ -0,0 +1,52 @@+-- cymbalism (jmcc) #2 ; texture=overlap,3,6,6,inf+let p = 15+    spec _ = let f1 = rand 500 2500+                 f = mceFill p (\_ -> rand f1 (f1 + rand 0 8000))+                 rt = mceFill p (\_ -> rand 1 5)+             in klankSpec_mce f (mceFill p (const 1)) rt+    t = impulse ar (rand 0.5 3.5) 0+    s = whiteNoise ar * decay t 0.004 * 0.03+in mceFill 2 (\n -> klank s 1 0 1 (spec n))++-- cymbalism (jmcc) #2 ; texture=overlap,3,6,6,inf ; monad+uid_st_eval (do+  let p = replicate 15+  f1 <- randM 500 2500+  f2 <- randM 0 8000+  let y = do f <- sequence (p (randM f1 (f1 + f2)))+             rt <- sequence (p (randM 1 5))+             return (klankSpec f (p 1) rt)+  z <- replicateM 2 y+  n <- fmap (* 0.03) (whiteNoiseM ar)+  tf <- randM 0.5 3.5+  let t = impulse ar tf 0+      s = decay t 0.004 * n+  return (klank s 1 0 1 (mceTranspose (mce z))))++-- cymbalism (jmcc) #2 ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+      let mk_spc _ =+            let f1 = x * 2000 + 500+                f3 = mceFill 15 (\_ -> tRand f1 (f1 + rand 0 8000) g)+                rt = mceFill 15 (\_ -> tRand 1 5 g)+            in klankSpec_mce f3 (mceFill 15 (const 1)) rt+          spc = mceFill 2 mk_spc+          whn = whiteNoise ar * z * 0.1+          sig = decay (trig g controlDur) (y * 0.01) * whn+      in dynKlank sig 1 0 1 (mceTranspose spc)+in mix (voicer 16 f) * control kr "gain" 1++-- cymbalism (jmcc) #2 ; event control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+      let enumFromN e i = let j = fromEnum e in [j .. j + i]+          mk_spc n =+            let f1 = x * 2000 + 500+                f2 = randId (c,n) 0 8000+                f3 = map (\e -> tRandId (c,e) f1 (f1 + f2) g) (enumFromN n 15)+                rt = map (\e -> tRandId (c,e) 1 5 g) (enumFromN n 15)+            in klankSpec f3 (replicate 15 1) rt+          spc = mce2 (mk_spc 'α') (mk_spc 'β')+          whn = whiteNoiseId (c,'γ') ar * z * 0.1+          sig = decay (trig g controlDur) (y * 0.01) * whn+      in dynKlank sig 1 0 1 (mceTranspose spc)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-data-space.hs view
@@ -0,0 +1,26 @@+-- data space (jmcc) #2 ; texture=overlap,1,6,4,inf+let p0 = lfPulse kr (rand0 200) 0 (rand0 1)+    p1 = lfPulse kr (rand0 40) 0 (rand0 1) * rand0 8000 + rand0 2000+    p2 = lfPulse kr (rand0 20) 0 (rand0 1)+    p3 = lfPulse kr (rand0 4) 0 (rand0 1) * rand0 8000 + rand0 2000+    p4 = lfPulse kr (rand0 20) 0 (rand0 1)+    p5 = lfPulse kr (rand0 4) 0 (rand0 1) * rand0 8000 + rand0 2000+    f = p0 * p1 + p2 * p3 + p4 * p5+    dt = rand 0.15 0.35+    o = lfPulse ar f 0 0.5 * 0.04+    l = lfNoise0 kr (rand0 3) * 0.8+in combL (pan2 o l 1) dt dt 3++-- data space (jmcc) #2 ; texture=overlap,1,6,4,inf ; id+let r e = randId e 0+    p0 = lfPulse kr (r 'α' 200) 0 (r 'β' 1)+    p1 = lfPulse kr (r 'γ' 40) 0 (r 'δ' 1) * r 'ε' 8000 + r 'ζ' 2000+    p2 = lfPulse kr (r 'η' 20) 0 (r 'θ' 1)+    p3 = lfPulse kr (r 'ι' 4) 0 (r 'κ' 1) * r 'λ' 8000 + r 'μ'  2000+    p4 = lfPulse kr (r 'ν' 20) 0 (r 'ξ' 1)+    p5 = lfPulse kr (r 'ο' 4) 0 (r 'π' 1) * r 'ρ' 8000 + r 'σ'  2000+    f = p0 * p1 + p2 * p3 + p4 * p5+    dt = randId 'τ' 0.15 0.35+    o = lfPulse ar f 0 0.5 * 0.04+    l = lfNoise0Id 'υ' kr (r 'φ' 3) * 0.8+in combL (pan2 o l 1) dt dt 3
+ Help/Graph/jmcc-deep-trip.hs view
@@ -0,0 +1,21 @@+-- deep trip (jmcc) #9 ; texture=overlap,4,12,4,inf+let f = midiCps (lfNoise1 kr (rand 0 0.3) * 60 + 70)+    a'' = sinOsc kr (rand 0 40) 0 * 0.1+    a' = max 0 (lfNoise1 kr (rand 0 8) * a'')+    a = lfNoise2 ar (f * rand 0 0.5) * a'+    z = sinOsc ar f 0 * a+    s = pan2 z (lfNoise1 kr (rand 0 5)) 1+    c0 = combN s 0.5 (X.randN 2 0.3 0.5) 20+    c1 = combN s 0.5 (X.randN 2 0.3 0.5) 20+in s + c0 + c1++-- deep trip (jmcc) #9 ; texture=overlap,4,12,4,inf ; id+let f = midiCps (lfNoise1Id 'α' kr (randId 'β' 0 0.3) * 60 + 70)+    a'' = sinOsc kr (randId 'γ' 0 40) 0 * 0.1+    a' = max 0 (lfNoise1Id 'δ' kr (randId 'ε' 0 8) * a'')+    a = lfNoise2Id 'ζ' ar (f * randId 'η' 0 0.5) * a'+    z = sinOsc ar f 0 * a+    s = pan2 z (lfNoise1Id 'θ' kr (randId 'ι' 0 5)) 1+    c0 = combN s 0.5 (X.randNId 2 'κ' 0.3 0.5) 20+    c1 = combN s 0.5 (X.randNId 2 'λ' 0.3 0.5) 20+in s + c0 + c1
+ Help/Graph/jmcc-demanding-studies.hs view
@@ -0,0 +1,23 @@+-- demanding studies (jmcc)+let s1 = drand dinf (mce [72, 75, 79, 82])+    s2 = drand 1 (mce [82, 84, 86])+    s3 = dseq dinf (mce [72, 75, 79, s2])+    x = mouseX kr 5 13 Linear 0.2+    tr = impulse kr x 0+    f = demand tr 0 (mce2 (midiCps (s1 - 12)) (midiCps s3))+    o1 = sinOsc ar (f + mce2 0 0.7) 0+    o2 = saw ar (f + mce2 0 0.7) * 0.3+    o3 = cubed (distort (log (distort (o1 + o2))))+in o3 * 0.1++-- demanding studies (jmcc) ; id+let s1 = drandId 'α' dinf (mce [72, 75, 79, 82])+    s2 = drandId 'β' 1 (mce [82, 84, 86])+    s3 = dseqId 'γ' dinf (mce [72, 75, 79, s2])+    x = mouseX kr 5 13 Linear 0.2+    tr = impulse kr x 0+    f = demand tr 0 (mce2 (midiCps (s1 - 12)) (midiCps s3))+    o1 = sinOsc ar (f + mce2 0 0.7) 0+    o2 = saw ar (f + mce2 0 0.7) * 0.3+    o3 = cubed (distort (log (distort (o1 + o2))))+in o3 * 0.1
+ Help/Graph/jmcc-filter-input.hs view
@@ -0,0 +1,5 @@+-- filter input (jmcc) #5 ; warning=feedback+let rQ = mouseY kr 0.01 1 Exponential 0.2 {- bandwidth ratio = 1/Q -}+    cf = mouseX kr 100 12000 Exponential 0.2 {- cutoff freq -}+    sg = soundIn (mce2 0 1) * 0.4 * sqrt rQ {- attenuate to offset resonance -}+in rlpf sg cf rQ
+ Help/Graph/jmcc-harmonic-swimming.hs view
@@ -0,0 +1,21 @@+-- harmonic swimming (jmcc) #1+let a = 0.02+    f = 50+    p = 20+    l = line kr 0 (- a) 60 DoNothing+    o h = let r = X.randN 2 2 8+              n = lfNoise1 kr r+              e = max 0 (n * a + l)+          in fSinOsc ar (f * (h + 1)) 0 * e+in mixFill p o++-- harmonic swimming (jmcc) #1 ; id+let a = 0.02+    f = 50+    p = 20::Int+    l = line kr 0 (- a) 60 DoNothing+    o h = let r = X.randNId 2 h 2 8+              n = lfNoise1Id h kr r+              e = max 0 (n * a + l)+          in fSinOsc ar (f * (fromIntegral h + 1)) 0 * e+in sum (map o [0 .. p - 1])
+ Help/Graph/jmcc-harmonic-tumbling.hs view
@@ -0,0 +1,19 @@+-- harmonic tumbling (jmcc) #1+let f = 80+    p = 10+    t = xLine kr (mce2 10 11) 0.1 60 DoNothing+    o h = let n = dust kr t+              r = rand 0.25 0.5+              e = decay2 (n * 0.02) 0.005 r+          in fSinOsc ar (f * (h + 1)) 0 * e+in mixFill p o++-- harmonic tumbling (jmcc) #1 ; id+let f = 80+    p = 10::Int+    t = xLine kr (mce2 10 11) 0.1 60 DoNothing+    o z = let n = dustId z kr t+              r = randId z 0.25 0.5+              e = decay2 (n * 0.02) 0.005 r+          in fSinOsc ar (f * (constant z + 1)) 0 * e+in sum (map o [0 .. p])
+ Help/Graph/jmcc-hell-is-busy.hs view
@@ -0,0 +1,16 @@+-- hell is busy (jmcc) #1 ; texture=overlap,4,4,8,inf+let o = fSinOsc ar (400 + rand 0 2000) 0+    a = lfPulse kr (1 + rand 0 10.0) 0 (rand 0 0.7) * 0.04+in pan2 (o * a) (rand (-1) 1) 1++-- hell is busy (jmcc) #1 ; texture=overlap,4,4,8,inf ; id+let o = fSinOsc ar (400 + randId 'α' 0 2000) 0+    a = lfPulse kr (1 + randId 'β' 0 10.0) 0 (randId 'γ' 0 0.7) * 0.04+in pan2 (o * a) (randId 'δ' (-1) 1) 1++-- hell is busy (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let s1 = fSinOsc ar (400 + x * 2000) 0+          s2 = lfPulse kr (1 + y * 10) 0 (rx * 0.7)+      in pan2 (s1 * s2 * 0.35) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-impulse-sequencer.hs view
@@ -0,0 +1,25 @@+-- impulse sequencer (jmcc) SC2+let dsequ s tr = demand tr 0 (dseq dinf (mce s))+    t = impulse ar 8 0 {- single sample impulse as trigger -}+    c_sq = dsequ [1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0] t * t {- clave rhythm -}+    c = decay2 c_sq 0.001 0.3 * fSinOsc ar 1700 0 * 0.1+    d_sq = dsequ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0] t * t+    d = decay2 d_sq 0.001 0.3 * fSinOsc ar 2400 0 * 0.04+    n_sq = dsequ [1.0, 0.1, 0.1, 1.0, 0.1, 1.0, 0.1, 0.1] t * t {- noise drum -}+    n = decay2 n_sq 0.001 0.25 * brownNoise ar * 0.1+    b_sq = dsequ [1,0,0.2,0,0.2,0,0.2,0] t * t {- bass drum -}+    b = decay2 b_sq 0.001 0.5 * fSinOsc ar 100 0 * 0.2+in c + d + n + b++-- impulse sequencer (jmcc) SC2 ; id+let dsequId z s tr = demand tr 0 (dseqId z dinf (mce s))+    t = impulse ar 8 0 {- single sample impulse as trigger -}+    c_sq = dsequId 'α' [1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0] t * t {- clave rhythm -}+    c = decay2 c_sq 0.001 0.3 * fSinOsc ar 1700 0 * 0.1+    d_sq = dsequId 'β' [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0] t * t+    d = decay2 d_sq 0.001 0.3 * fSinOsc ar 2400 0 * 0.04+    n_sq = dsequId 'γ' [1.0, 0.1, 0.1, 1.0, 0.1, 1.0, 0.1, 0.1] t * t {- noise drum -}+    n = decay2 n_sq 0.001 0.25 * brownNoiseId 'δ' ar * 0.1+    b_sq = dsequId 'ε' [1,0,0.2,0,0.2,0,0.2,0] t * t {- bass drum -}+    b = decay2 b_sq 0.001 0.5 * fSinOsc ar 100 0 * 0.2+in c + d + n + b
+ Help/Graph/jmcc-landon-rose.hs view
@@ -0,0 +1,27 @@+-- landon rose (jmcc) #8+let nt =+      [[32,43,54, 89]+      ,[10,34,80,120]+      ,[67,88,90,100]+      ,[76,88,99,124]]+    fr = map (map midi_to_cps) nt+    nd e f =+      let p = klankSpec f (replicate 4 1) (replicate 4 3)+          x = e * pinkNoise ar * mce2 0.0011 0.0012+      in klank x 1 0 1 p+    env i = abs (sinOsc ar (1 / 8) ((i / 2) * pi))+in sum (zipWith nd (map env [0 .. 3]) fr)++-- landon rose (jmcc) #8 ; id+let nt =+      [[32,43,54, 89]+      ,[10,34,80,120]+      ,[67,88,90,100]+      ,[76,88,99,124]]+    fr = map (map midi_to_cps) nt+    nd z e f =+      let p = klankSpec f (replicate 4 1) (replicate 4 3)+          x = e * pinkNoiseId z ar * mce2 0.0011 0.0012+      in klank x 1 0 1 p+    env i = abs (sinOsc ar (1 / 8) ((constant i / 2) * pi))+in sum (zipWith3 nd "αβγδ" (map env [0 .. 3]) fr)
+ Help/Graph/jmcc-lfo-modulation.hs view
@@ -0,0 +1,5 @@+-- lfo modulation (jmcc) #1+let o = fSinOsc kr 0.05 0 * 80 + 160+    p = fSinOsc kr (mce2 0.6 0.7) 0 * 3600 + 4000+    s = rlpf (lfPulse ar o 0 0.4 * 0.05) p 0.2+in combL s 0.3 (mce2 0.2 0.25) 2
+ Help/Graph/jmcc-lots-o-sines.hs view
@@ -0,0 +1,15 @@+-- lots-o-sins (jmcc) #2 ; texture=xfade,4,4,inf+let n = 60 {- n sines in each channel (twice as many during cross-fade) -}+    mk_k x = mceFill n (const x)+    o1 = klang ar 1 0 (klangSpec_mce (X.randN n 40 10000) (mk_k 1) (mk_k 0))+    o2 = klang ar 1 0 (klangSpec_mce (X.randN n 40 10000) (mk_k 1) (mk_k 0))+in mce2 o1 o2 * (0.1 / constant n)++-- lots-o-sins (jmcc) #2 ; texture=xfade,4,4,inf ; id+let n = 60 {- n sines in each channel (twice as many during cross-fade) -}+    f0 = X.randNId n 'α' 40 10000+    f1 = X.randNId n 'β' 40 10000+    mk_k x = mce (replicate n x)+    o1 = klang ar 1 0 (klangSpec_mce f0 (mk_k 1) (mk_k 0))+    o2 = klang ar 1 0 (klangSpec_mce f1 (mk_k 1) (mk_k 0))+in mce2 o1 o2 * (0.1 / constant n)
+ Help/Graph/jmcc-metal-plate.hs view
@@ -0,0 +1,35 @@+-- metal plate (jmcc) #4+let+    sr = 48000+    n = 4 {- number of delay lines -}+    maxdt = ceiling (sr * 0.03) {- maximum delay time -}+    buf = mceFill n (\_ -> clearBuf (localBuf 1 maxdt)) {- buffers for delay lines -}+    tap_tm = mceFill n (\_ -> rand 0.015 0.03) {- random tap times -}+    exc_freq = mouseY kr 10 8000 Linear 0.2+    exc_trig = impulse ar 0.5 0 * 0.2+    exc = decay2 exc_trig 0.01 0.2 * lfNoise2 ar exc_freq {- excitation -}+    del = tap 1 ar buf tap_tm {- delay line taps -}+    flt_freq = mouseX kr 10 5000 Linear 0.2+    flt = lpf del flt_freq * 0.98 {- tap filters -}+    wr = recordBuf ar buf 0 1 0 1 Loop 1 DoNothing (mce1 (flt + exc)) {- write to delay lines -}+in mrg2 (mix flt) wr++-- metal plate (jmcc) #4 ; id+let+    enumFromN e i = let j = fromEnum e in [j .. j + i]+    sr = 48000+    n = 4 :: Int {- number of delay lines -}+    maxdt = ceiling (sr * 0.03) {- maximum delay time -}+    mk_buf k = clearBuf (localBufId k 1 maxdt)+    buf = map mk_buf [0 .. n - 1] {- buffers for delay lines -}+    tap_tm = map (\z -> randId ('α',z) 0.015 0.03) (enumFromN 'β' n) {- random tap times -}+    exc_freq = mouseY kr 10 8000 Linear 0.2+    exc_trig = impulse ar 0.5 0 * 0.2+    exc = decay2 exc_trig 0.01 0.2 * lfNoise2Id 'γ' ar exc_freq {- excitation -}+    del = zipWith (tap 1 ar) buf tap_tm {- delay line taps -}+    flt_freq = mouseX kr 10 5000 Linear 0.2+    flt = map (\i -> lpf i flt_freq * 0.98) del {- tap filters -}+    wr_f b f = recordBuf ar b 0 1 0 1 Loop 1 DoNothing (f + exc)+    wr = zipWith wr_f buf flt {- write to delay lines -}+in mrg2 (sum flt) (mce wr)+
+ Help/Graph/jmcc-modal-space.hs view
@@ -0,0 +1,77 @@+-- modal space (jmcc) #8 ; local buffer+let ms1 n r =+      let b = asLocalBuf [0,2,3.2,5,7,9,10] {- dorian scale -}+          x = mouseX kr 0 15 Linear 0.1 {- mouse indexes into scale -}+          k = degreeToKey b x 12 {- 12 notes per octave -}+          o = sinOsc ar (midiCps (r + k + n * 0.04)) 0 * 0.1+          t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+          f = midiCps (sinOsc kr 0.1 0 * 10 + r)+          d = rlpf t f 0.1 * 0.1+          m = o + d+      in combN m 0.31 0.31 2 + m+in ms1 (lfNoise1 kr 3) 48 + ms1 (lfNoise1 kr 3) 72 * 0.25++-- modal space (jmcc) #8 ; local buffer ; id+let ms1 n r =+      let b = asLocalBufId 'α' [0,2,3.2,5,7,9,10] {- dorian scale -}+          x = mouseX kr 0 15 Linear 0.1 {- mouse indexes into scale -}+          k = degreeToKey b x 12 {- 12 notes per octave -}+          o = sinOsc ar (midiCps (r + k + n * 0.04)) 0 * 0.1+          t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+          f = midiCps (sinOsc kr 0.1 0 * 10 + r)+          d = rlpf t f 0.1 * 0.1+          m = o + d+      in combN m 0.31 0.31 2 + m+in ms1 (lfNoise1Id 'β' kr 3) 48 + ms1 (lfNoise1Id 'γ' kr 3) 72 * 0.25++-- modal space (jmcc) #8 ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+      let ms1 n r =+            let b = asLocalBuf [0,2,3.2,5,7,9,10] {- dorian scale -}+                k = degreeToKey b (x * 25) 12 {- 12 notes per octave -}+                o = sinOsc ar (midiCps (r + k + n * y * 0.08)) 0 * 0.1+                t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+                d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+                m = o + d+            in combN m 0.31 0.31 2 + m+          ms = ms1 (lfNoise1 kr 3) 48 + ms1 (lfNoise1 kr 3) 72+      in ms * z * lagUD g 0.2 2+in mix (voicer 16 f) * control kr "gain" 1++-- modal space (jmcc) #8 ; event control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+      let ms1 n r =+            let b = asLocalBufId 'α' [0,2,3.2,5,7,9,10] {- dorian scale -}+                k = degreeToKey b (x * 25) 12 {- 12 notes per octave -}+                o = sinOsc ar (midiCps (r + k + n * y * 0.08)) 0 * 0.1+                t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+                d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+                m = o + d+            in combN m 0.31 0.31 2 + m+          ms = ms1 (lfNoise1Id (c,'β') kr 3) 48 + ms1 (lfNoise1Id (c,'γ') kr 3) 72+      in ms * z * lagUD g 0.2 2+in mix (voicer 16 f) * control kr "gain" 1++-- modal space (jmcc) #8 ; event control ; modeless+let f (_,g,_,y,z,_,_,_,p,_,_) =+      let ms1 n r =+            let o = sinOsc ar (midiCps (p * 127 + r + n * y * 0.08)) 0 * 0.1+                t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+                d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+                m = o + d+            in combN m 0.31 0.31 2 + m+          ms = ms1 (lfNoise1 kr 3) 0 + ms1 (lfNoise1 kr 3) 24+      in ms * z * lagUD g (y * 0.05 + 0.01) (y * 2 + 1)+in mix (voicer 16 f) * control kr "gain" 1++-- modal space (jmcc) #8 ; event control ; modeless ; id+let f (c,g,_,y,z,_,_,_,p,_,_) =+      let ms1 n r =+            let o = sinOsc ar (midiCps (p * 127 + r + n * y * 0.08)) 0 * 0.1+                t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+                d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+                m = o + d+            in combN m 0.31 0.31 2 + m+          ms = ms1 (lfNoise1Id (c,'β') kr 3) 0 + ms1 (lfNoise1Id (c,'γ') kr 3) 24+      in ms * z * lagUD g (y * 0.05 + 0.01) (y * 2 + 1)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-moto-rev.hs view
@@ -0,0 +1,4 @@+-- moto rev (jmcc) #1+let f = sinOsc kr 0.2 0 * 10 + 21+    s = lfPulse ar f (mce2 0 0.1) 0.1+in clip2 (rlpf s 100 0.1) 0.4
+ Help/Graph/jmcc-narrow-band-filtered-crackle-noise.hs view
@@ -0,0 +1,27 @@+-- narrow band filtered crackle noise (jmcc) #2 ; texture=spawn,2,inf+let e = envLinen 2 5 2 1+    rf1 = rand 0 2000 + 80+    rf2 = rf1 + (rand2 0.2 * rf1)+    rf = xLine kr rf1 rf2 9 DoNothing+    c = crackle ar (1.97 + rand 0 0.03) * 0.15+in pan2 (resonz c rf 0.2) (rand2 1) (envGen ar 1 1 0 1 RemoveSynth e)++-- narrow band filtered crackle noise (jmcc) #2 ; texture=spawn,2,inf ; id+let e = envLinen 2 5 2 1+    rf1 = randId 'α' 0 2000 + 80+    rf2 = rf1 + (rand2Id 'β' 0.2 * rf1)+    rf = xLine kr rf1 rf2 9 DoNothing+    c = crackle ar (1.97 + randId 'γ' 0 0.03) * 0.15+in pan2 (resonz c rf 0.2) (rand2Id 'δ' 1) (envGen ar 1 1 0 1 RemoveSynth e)++-- narrow band filtered crackle noise (jmcc) #2 ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let cr = crackle ar (1.97 + rand 0 0.03)+      in pan2 (resonz cr (unitCps p) (0.2 - y * 0.2)) (o * 2 - 1) (z * 10 * g)+in mix (voicer 16 f) * control kr "gain" 1++-- narrow band filtered crackle noise (jmcc) #2 ; event control ; id+let f (c,g,_,y,z,o,_,_,p,_,_) =+      let cr = crackle ar (1.97 + randId (c,'γ') 0 0.03)+      in pan2 (resonz cr (unitCps p) (0.2 - y * 0.2)) (o * 2 - 1) (z * 10 * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-noise-burst-sweep.hs view
@@ -0,0 +1,15 @@+-- noise burst sweep (jmcc) #6 ; texture=overlap,4,2,4,inf+let n = mce2 (whiteNoise ar) (whiteNoise ar)+    lfoRate = rand (-1) 1 + mouseX kr 10 60 Exponential 0.2+    amp = max 0 (lfSaw kr lfoRate (-1))+    cfreq = mouseY kr 400 8000 Exponential 0.2+    freq = sinOsc kr 0.2 0 * cfreq + (1.05 * cfreq)+in resonz (n * amp) freq 0.1++-- noise burst sweep (jmcc) #6 ; texture=overlap,4,2,4,inf ; id+let n = mce2 (whiteNoiseId 'α' ar) (whiteNoiseId 'β' ar)+    lfoRate = randId 'γ' (-1) 1 + mouseX kr 10 60 Exponential 0.2+    amp = max 0 (lfSaw kr lfoRate (-1))+    cfreq = mouseY kr 400 8000 Exponential 0.2+    freq = sinOsc kr 0.2 0 * cfreq + (1.05 * cfreq)+in resonz (n * amp) freq 0.1
+ Help/Graph/jmcc-phase-modulation.hs view
@@ -0,0 +1,16 @@+-- phase modulation with slow beats (jmcc) #6 texture=overlap,4,4,4,inf+let x = mouseX kr 100 6000 Exponential 0.2 {- random freq of new events -}+    y = mouseY kr 0 2 Linear 0.2 {- modulation index -}+    ph = iter 3 (\i -> let f = rand 0 x in fSinOsc ar (mce [f,f + rand2 1]) 0 * y + i) 0+    freq = rand 0 x+in sinOsc ar (mce [freq, freq + rand2 1]) ph * 0.1++-- phase modulation with slow beats (jmcc) #6 texture=overlap,4,4,4,inf ; id+let nrec n f st = if n > 0 then nrec (n - 1) f (f st) else st+    x = mouseX kr 100 6000 Exponential 0.2 {- random freq of new events -}+    y = mouseY kr 0 2 Linear 0.2 {- modulation index -}+    o (e,a) = let f = randId e 0 x+              in (succ e,fSinOsc ar (mce [f,f + rand2Id 'α' 1]) 0 * y + a)+    ph = snd (nrec 3 o ('β',0))+    freq = randId 'γ' 0 x+in sinOsc ar (mce [freq, freq + rand2Id 'δ' 1]) ph * 0.1
+ Help/Graph/jmcc-plucked-strings.hs view
@@ -0,0 +1,31 @@+-- plucked strings (jmcc)+let dt _ = 1 / midiCps (floorE (rand 60 90))+    i _ = let s0 = impulse ar (rand 2 2.2) 0 * 0.3+              s1 = dust ar 0.5 * 0.3+              s2 = impulse ar (sinOsc kr (rand 0.05 0.15) (rand 0 (pi * 2)) * 5 + 5.2) 0 * 0.3+          in select (iRand 0 2) (mce [s0,s1,s2])+    s n = let dt' = dt n+              t = decay (i n) 0.1 * pinkNoise ar * 0.1+          in pan2 (combL t dt' dt' 4) (rand2 1) 1+in mixFill 5 s++-- plucked strings (jmcc) ; monad+uid_st_eval (do+  let dt = do r0 <- randM 60 90+              return (1 / midiCps (floorE r0))+      i = do r0 <- randM 2 2.2+             n0 <- dustM ar 0.5+             r1 <- randM 0.05 0.15+             r2 <- randM 0 (pi * 2)+             r3 <- iRandM 0 2+             let s0 = impulse ar r0 0 * 0.3+                 s1 = n0 * 0.3+                 s2 = impulse ar (sinOsc kr r1 r2 * 5 + 5.2) 0 * 0.3+             return (select r3 (mce [s0,s1,s2]))+      s = do n0 <- pinkNoiseM ar+             r1 <- randM (-1) 1+             im <- i+             dt' <- dt+             let t = decay im 0.1 * n0 * 0.1+             return (pan2 (combL t dt' dt' 4) r1 1)+  fmap sum (sequence (replicate 5 s)))
+ Help/Graph/jmcc-police-state.hs view
@@ -0,0 +1,23 @@+-- police state (jmcc) #2+let nd _ = let f = sinOsc kr (rand 0.02 0.12) (rand 0 (pi * 2)) * rand 0 600 + rand 700 1300+           in pan2 (sinOsc ar f 0 * lfNoise2 ar (rand 80 120) * 0.1) (rand2 1) 1+    e = lfNoise2 ar (mceFill 2 (\_ -> lfNoise2 kr 0.4) * 90 + 620) * lfNoise2 kr (mce2 0.3 0.301) * 0.15 + 0.18+in combL (mixFill 4 nd + e) 0.3 0.3 3++-- police state (jmcc) #2 ; monad+uid_st_eval (do+  let nd = do r0 <- randM 0.02 0.12+              r1 <- randM 0 (pi * 2)+              r2 <- randM 0 600+              r3 <- randM 700 1300+              r4 <- randM (-1) 1+              r5 <- randM 80 120+              n0 <- lfNoise2M ar r5+              let f = sinOsc kr r0 r1 * r2 + r3+              return (pan2 (sinOsc ar f 0 * n0 * 0.1) r4 1)+  ns <- replicateM 4 nd+  n0 <- replicateM 2 (lfNoise2M kr 0.4)+  n1 <- lfNoise2M ar (mce n0 * 90 + 620)+  n2 <- lfNoise2M kr (mce2 0.3 0.301)+  let e = n1 * (n2 * 0.15 + 0.18)+  return (combL (mix (mce ns) + e) 0.3 0.3 3))
+ Help/Graph/jmcc-pond-life.hs view
@@ -0,0 +1,27 @@+-- pond life (jmcc) #1 ; texture=overlap,8,8,4,inf+let f0 = 20 + rand 0 30+    f1 = fSinOsc kr f0 0 * rand 100 400 + linRand 500 2500 0+    a = lfPulse kr (3 / rand 1 9) 0 (rand 0.2 0.5) * 0.04+in pan2 (sinOsc ar f1 0 * a) (rand (-1) 1) 0.5++-- pond life (jmcc) #1 ; texture=overlap,8,8,4,inf ; id+let f0 = 20 + randId 'α' 0 30+    f1 = fSinOsc kr f0 0 * randId 'β' 100 400 + linRandId 'γ' 500 2500 0+    a = lfPulse kr (3 / randId 'δ' 1 9) 0 (randId 'ε' 0.2 0.5) * 0.04+in pan2 (sinOsc ar f1 0 * a) (randId 'ζ' (-1) 1) 0.5++-- pond life (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let f0 = 20 + tRand 0 (rx * 30) g+          f1 = fSinOsc kr f0 0 * linLin x 0 1 100 400 + linLin y 0 1 500 2500+          a = lfPulse kr (3 / linLin ry 0 1 1 9) 0 (rand 0.2 0.5)+      in pan2 (sinOsc ar f1 0 * a * 0.25) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1++-- pond life (jmcc) #1 ; event control ; id+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+      let f0 = 20 + tRandId 'α' 0 (rx * 30) g+          f1 = fSinOsc kr f0 0 * linLin x 0 1 100 400 + linLin y 0 1 500 2500+          a = lfPulse kr (3 / linLin ry 0 1 1 9) 0 (randId (c,'β') 0.2 0.5)+      in pan2 (sinOsc ar f1 0 * a * 0.25) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-pulsing-bottles.hs view
@@ -0,0 +1,15 @@+-- pulsing bottles (jmcc) #2 ; texture=overlap,4,4,4,maxBound+let r _ = resonz (whiteNoise ar * lfPulse kr (rand 4 14) 0 0.25 * rand 0 0.7) (rand 400 7400) 0.01+    s _ = sinOsc kr (rand 0.1 0.5) (rand 0 (pi * 2))+  in mixFill 6 (\n -> pan2 (r n) (s n) 1)++-- pulsing bottles (jmcc) #2 ; texture=overlap,4,4,4,maxBound ; id+let r z = let n = whiteNoiseId z ar+              r0 = randId z 4 14+              r1 = randId z 0 0.7+              r2 = randId z 400 7400+          in resonz (n * lfPulse kr r0 0 0.25 * r1) r2 0.01+    s z = let f = randId z 0.1 0.5+              p = randId z 0 (pi * 2)+          in sinOsc kr f p+in sum (zipWith3 pan2 (map r (id_seq 6 'α')) (map s (id_seq 6 'β')) (repeat 1))
+ Help/Graph/jmcc-rails.hs view
@@ -0,0 +1,21 @@+-- rails (jmcc) #2 ; texture=overlap,3,2,4,inf+let n = 20 {- resonant modes -}+    e = dust ar 100 * 0.04 {- excitation -}+    f = xLine kr 3000 300 8 DoNothing {- sweep filter down -}+    l = line kr (rand2 1) (rand2 1) 8 DoNothing {- sweep pan -}+    r = X.linRandN n 200 3200 0+    a = mceFill n (const 1)+    t = X.randN n 0.2 1.2 {- ring times -}+    k = klank (resonz e f 0.2) 1 0 1 (klankSpec_mce r a t)+in pan2 k l 1++-- rails (jmcc) #2 ; texture=overlap,3,2,4,inf ; id+let n = 20 {- resonant modes -}+    e = dustId 'α' ar 100 * 0.04 {- excitation -}+    f = xLine kr 3000 300 8 DoNothing {- sweep filter down -}+    l = line kr (rand2Id 'β' 1) (rand2Id 'γ' 1) 8 DoNothing {- sweep pan -}+    r = map (\z -> 200 + linRandId z 0 3000 0) (id_seq n 'δ')+    a = replicate n 1+    t = map (\z -> 0.2 + randId z 0 1) (id_seq n 'ε')  {- ring times -}+    k = klank (resonz e f 0.2) 1 0 1 (klankSpec r a t)+in pan2 k l 1
+ Help/Graph/jmcc-random-panning-sines.hs view
@@ -0,0 +1,13 @@+-- random panning sines (jmcc) #4 ; texture=overlap,8,8,2,inf+let nd _ = pan2 (fSinOsc ar (linRand 80 2000 0) 0) (lfNoise1 kr (rand 0.8 1.2)) (lfNoise1 kr (rand 0.82 0.98))+in mixFill 8 nd * (0.4 / 8)++-- random panning sines (jmcc) #4 ; texture=overlap,8,8,2,inf ; monad+uid_st_eval (do+  let nd = do r0 <- linRandM 80 2000 0+              let o = fSinOsc ar r0 0+              l <- lfNoise1M kr =<< randM 0.8 1.2+              a <- lfNoise1M kr =<< randM 0.82 0.98+              return (pan2 o l a)+  r <- replicateM 8 nd+  return (mix (mce r) * (0.4 / 8)))
+ Help/Graph/jmcc-random-pulsations.hs view
@@ -0,0 +1,22 @@+-- random pulsations (jmcc) #1 ; texture=spawn,1.25,inf+let e = envLinen 2 5 2 0.02+    o1 = fSinOsc ar (rand 0 2000) 0 * envGen kr 1 1 0 1 DoNothing e+    o2 = sinOsc ar (linRand 8 88 0) 0+    o3 = sinOsc kr (rand 0.3 0.8) (rand 0 (2 * pi)) * 0.7+in pan2 (o1 `amClip` o2) o3 1++-- random pulsations (jmcc) #1 ; texture=spawn,1.25,inf ; id+let e = envLinen 2 5 2 0.02+    o1 = fSinOsc ar (randId 'α' 0 2000) 0 * envGen kr 1 1 0 1 DoNothing e+    o2 = sinOsc ar (linRandId 'β' 8 88 0) 0+    o3 = sinOsc kr (randId 'γ' 0.3 0.8) (randId 'δ' 0 (2 * pi)) * 0.7+in pan2 (o1 `amClip` o2) o3 1++-- random pulsations (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let e = envLinen 2 5 2 0.02+          o1 = fSinOsc ar (x * 2000) 0 * envGen kr g 1 0 1 DoNothing e+          o2 = sinOsc ar (y * 80 + 8) 0+          o3 = sinOsc kr (o * 0.5 + 0.3) (rx * 2 * pi) * 0.7+      in pan2 (o1 `amClip` o2) o3 (z * 5 * lagUD g 0 12)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-random-sine-waves.hs view
@@ -0,0 +1,14 @@+-- random sine waves (jmcc) #1 ; texture=overlap,2,5,12,inf+let o = fSinOsc ar (rand 0 2000) 0 * 0.02+in pan2 o (rand2 1) 1++-- random sine waves (jmcc) #1 ; texture=overlap,2,5,12,inf ; id+let f = randId 'α' 0 2000+    o = fSinOsc ar f 0 * 0.02+in pan2 o (randId 'β' (-1) 1) 1++-- random sine waves (jmcc) #1 ; event control+let f (_,g,x,_,z,o,_,_,_,_,_) =+      let s = fSinOsc ar (x * 2000) 0+      in pan2 s (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Graph/jmcc-resonant-dust.hs view
@@ -0,0 +1,13 @@+-- resonant dust (jmcc) #2 ; texture=overlap,5,2,9,inf+let rf = let st = rand 80 2080+             en = st + (rand2 0.5 * st)+         in xLine kr st en 9 DoNothing+    d = dust ar (rand 50 850) * 0.3+in pan2 (resonz d rf 0.1) (rand (-1) 1) 1++-- resonant dust (jmcc) #2 ; texture=overlap,5,2,9,inf ; id+let rf = let st = randId 'α' 80 2080+             en = st + (randId 'β' (-0.5) 0.5 * st)+         in xLine kr st en 9 DoNothing+    d = dustId 'γ' ar (randId 'δ' 50 850) * 0.3+in pan2 (resonz d rf 0.1) (randId 'ε' (-1) 1) 1
+ Help/Graph/jmcc-resonators-harmonic-series.hs view
@@ -0,0 +1,57 @@+-- resonators harmonic series (jmcc) #2 ; texture=xfade,1,7,inf+let nharm = 12+    spec _ = let rat = [1.0,1.125,1.25,1.333,1.5,1.667,1.875,2.0,2.25,2.5,2.667,3.0,3.333,3.75,4.0]+                 freq = lchoose rat * 120+                 series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+             in klankSpec_mce+                (mce (series nharm freq freq) + X.randN nharm (-0.5) 0.5)+                (mceFill nharm (\i -> 1 / (i + 1)))+                (X.randN nharm 0.5 4.5)+    gen n = klank (brownNoise ar * 0.001) 1 0 1 (spec n)+in mceFill 2 gen++-- resonators harmonic series (jmcc) #2 ; texture=xfade,1,7,inf ; id+let series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+    enumFromN e i = let j = fromEnum e in [j .. j + i]+    nharm = 12+    noise = brownNoiseId 'α' ar * 0.001+    rat = [1.0,1.125,1.25,1.333,1.5,1.667,1.875,2.0,2.25,2.5,2.667,3.0,3.333,3.75,4.0]+    freq = lchooseId 'β' rat * 120+    resFreqs = zipWith (+)+               (series nharm freq freq)+               (map (\z -> rand2Id ('γ',z) 0.5) (enumFromN 'δ' nharm))+    spec = klankSpec+           resFreqs+           (map (\i -> 1 / (constant i + 1)) [0 .. nharm - 1])+           (map (\z -> randId ('ε',z) 0.5 4.5) (enumFromN 'ζ' nharm))+in Protect.uclone_all 'η' 2 (klank noise 1 0 1 spec)++-- resonators harmonic series (jmcc) #2 ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+      let nharm = 12+          spec _ = let freq = unitCps p+                       series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+                   in klankSpec_mce+                      (mce (series nharm freq freq) + (X.randN nharm (-0.5) 0.5) * rx)+                      (mceFill nharm (\i -> 1 / (i + (2 * y))))+                      (X.randN nharm 0.5 4.5)+          gen n = dynKlank (brownNoise ar * 0.001) 1 0 1 (spec n)+      in pan2 (mceFill 2 gen)  (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1++-- resonators harmonic series (jmcc) #2 ; event control ; id+let f (c,g,_,y,z,o,rx,ry,p,_,_) =+      let series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+          enumFromN e i = let j = fromEnum e in [j .. j + i]+          nharm = 12+          noise = brownNoiseId (c,'α') ar * 0.001+          freq = unitCps p+          resFreqs = zipWith (+)+                     (series nharm freq freq)+                     (map (\k -> rand2Id (c,'γ',k) 0.5 * rx) (enumFromN 'δ' nharm))+          spec = klankSpec+            resFreqs+            (map (\i -> 1 / (constant i + (2 * y))) [0 .. nharm - 1])+            (map (\k -> randId (c,'ε',k) 0.5 4.5 * (0.5 + ry)) (enumFromN 'ζ' nharm))+      in pan2 (Protect.uclone_all 'η' 2 (dynKlank noise 1 0 1 spec)) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-reverberated-sine-percussion.hs view
@@ -0,0 +1,23 @@+-- reverberated sine percussion (jmcc) #3+let s = mixFill 6 (\_ -> resonz (dust ar (2 / 6) * 50) (200 + rand 0 3000) 0.003)+    y = mix (combL (delayN s 0.048 0.48) 0.1 (lfNoise1 kr (X.randN 5 0 0.1) * 0.04 + 0.05) 15)+    x = iter 4 (\i -> allpassN i 0.05 (X.randN 2 0 0.05) 1) y+in s + x * 0.2++-- reverberated sine percussion (jmcc) #3 ; monad+uid_st_eval (do+  let d = 6+      c = 5+      a = 4+      s_ = do n <- dustM ar (2 / constant d)+              r <- randM 0 3000+              return (resonz (n * 50) (200 + r) 0.003)+      x_ i = do r <- X.randNM 2 0 0.05+                return (allpassN i 0.05 r 1)+  s <- fmap sum (sequence (replicate d s_))+  y <- do let z = delayN s 0.048 0.48+          r <- X.randNM c 0 0.1+          n <- lfNoise1M kr r+          return (mix (combL z 0.1 (n * 0.04 + 0.05) 15))+  x <- chainM a x_ y+  return (s + x * 0.2))
+ Help/Graph/jmcc-ring-modulated-klank.hs view
@@ -0,0 +1,17 @@+-- ring modulated klank (jmcc) #2 ; texture=overlap,4,4,4,inf+let p = 8+    k = let sp = klankSpec_mce (X.randN p 100 10000)+                               (mceFill p (const 1))+                               (X.randN p 0.2 1)+        in klank (dust ar 20 * 0.02) 1 0 1 sp+    f = lfNoise2 kr (rand 0.1 0.4) * 200 + rand 350 400+in pan2 (sinOsc ar f 0 * k) (rand (-1) 1) 1++-- ring modulated klank (jmcc) #2 ; texture=overlap,4,4,4,inf ; id+let p = 8+    k = let sp = klankSpec_mce (X.randNId p 'α' 100 10000)+                               (mce (replicate p 1))+                               (X.randNId p 'α' 0.2 1)+        in klank (dustId 'α' ar 20 * 0.02) 1 0 1 sp+    f = lfNoise2Id 'α' kr (randId 'α' 0.1 0.4) * 200 + randId 'α' 350 400+in pan2 (sinOsc ar f 0 * k) (randId 'α' (-1) 1) 1
+ Help/Graph/jmcc-sample-and-hold-liquidities.hs view
@@ -0,0 +1,26 @@+-- sample and hold liquidities (jmcc) #4+let r = mouseX kr 1 200 Exponential 0.1+    t = recip r+    c = impulse kr r 0 * 0.4+    cf = mouseY kr 100 8000 Exponential 0.1+    f = latch (whiteNoise kr * cf * 0.5 + cf) c+    p = latch (whiteNoise kr) c+    i = pan2 (sinOsc ar f 0 * decay2 c (t * 0.1) (t * 0.9)) p 1+in combN i 0.3 0.3 2++-- sample and hold liquidities (jmcc) #4 ; id+let r = mouseX kr 1 200 Exponential 0.1+    t = recip r+    c = impulse kr r 0 * 0.4+    cf = mouseY kr 100 8000 Exponential 0.1+    f = latch (whiteNoiseId 'α' kr * cf * 0.5 + cf) c+    p = latch (whiteNoiseId 'β' kr) c+    i = pan2 (sinOsc ar f 0 * decay2 c (t * 0.1) (t * 0.9)) p 1+in combN i 0.3 0.3 2++-- sample and hold liquidities (jmcc) #4 ; event control+let f (_,g,_,y,z,o,_,_,p,px,_) =+      let env = decay2 (trig g controlDur * z * 2) (0.01 + y * 0.1) (0.5 + y * 0.4)+          sig = pan2 (sinOsc ar (midiCps (p * 127 + px)) 0 * env) (o * 2 - 1) 1+      in sig + combN sig 0.3 0.3 2+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-saucer-base.hs view
@@ -0,0 +1,14 @@+-- saucer base (jmcc) #6 ; texture=overlap,2,6,4,inf+let b = rand 0 1000+    c = rand 0 5000+    o = sinOsc ar (sinOsc ar (rand 0 20) 0 * b + (1.1 * b)) 0 * c + (1.1 * c)+in pan2 (sinOsc ar o 0 * 0.1) (rand2 1) 1++-- saucer base (jmcc) #6 ; texture=overlap,2,6,4,inf ; id+let a = randId 'α' 0 20+    b = randId 'β' 0 1000+    c = randId 'γ' 0 5000+    p = randId 'δ' (-1) 1+    o = sinOsc ar a 0 * b + (1.1 * b)+    o' = sinOsc ar o 0 * c + (1.1 * c)+in pan2 (sinOsc ar o' 0 * 0.1) p 1
+ Help/Graph/jmcc-sawed-cymbals.hs view
@@ -0,0 +1,14 @@+-- sawed cymbals (jmcc) #9 ; texture=overlap,4,4,6,inf+let y _ = let f1 = rand 500 2500+              f = mceFill 15 (\_ -> rand f1 (f1 + rand 0 8000))+          in klankSpec_mce f (mceConst 15 1) (X.randN 15 2 6)+    fS = xLine kr (rand 0 600) (rand 0 600) 12 DoNothing+in klank (lfSaw ar fS 0 * 0.0005) 1 0 1 (mceTranspose (mceFill 2 y))++-- sawed cymbals (jmcc) #9 ; texture=overlap,4,4,6,inf ; id+let y z _ = let f1 = randId (z,'α') 500 2500+                f = listFillId 'γ' 15 (\z' _ -> randId (z','δ') f1 (f1 + randId (z','β') 0 8000))+                rt = listFillId 'ε' 15 (\z' _ -> randId (z','ζ') 2 6)+            in klankSpec f (replicate 15 1) rt+    fS = xLine kr (randId 'θ' 0 600) (randId 'ι' 0 600) 12 DoNothing+in klank (lfSaw ar fS 0 * 0.0005) 1 0 1 (mceTranspose (mceFillId 'η' 2 y))
+ Help/Graph/jmcc-scratchy.hs view
@@ -0,0 +1,7 @@+-- scratchy (jmcc) #1+let n = mceFill 2 (\_ -> brownNoise ar * 0.5 - 0.49)+in rhpf (max n 0 * 20) 5000 1++-- scratchy (jmcc) #1 ; id+let n = mce (map (\z -> brownNoiseId z ar * 0.5 - 0.49) (id_seq 2 'α'))+in rhpf (max n 0 * 20) 5000 1
+ Help/Graph/jmcc-sidereal-time.hs view
@@ -0,0 +1,21 @@+-- sidereal time (jmcc) #9 ; texture=overlap,4,4,6,inf+let p = 15+    i = let y _ = klankSpec_mce (X.expRandN p 100 6000) (mceConst p 1) (X.randN p 2 6)+        in mceFill 2 y+    f = xLine kr (expRand 40 300) (expRand 40 300) 12 DoNothing+    t = let e = lfNoise2 kr (rand 0 8)+        in lfPulse ar f 0 (rand 0.1 0.9) * 0.002 * max 0 e+    o = distort (klank t 1 0 1 (mceTranspose i)) * 0.1+in combN o 0.6 (rand 0.1 0.6) 8 + mceReverse o++-- sidereal time (jmcc) #9 ; texture=overlap,4,4,6,inf ; id+let p = 15+    i = let y z _ = let fr = X.expRandNId p (z,'β') 100 6000+                        rt = X.randNId p (z,'δ') 2 6+                    in klankSpec_mce fr (mceConst p 1) rt+        in mceFillId 'ε' 2 y+    f = xLine kr (expRandId 'ζ' 40 300) (expRandId 'η' 40 300) 12 DoNothing+    t = let e = lfNoise2Id 'θ' kr (randId 'ι' 0 8)+        in lfPulse ar f 0 (randId 'κ' 0.1 0.9) * 0.002 * max 0 e+    o = distort (klank t 1 0 1 (mceTranspose i)) * 0.1+in combN o 0.6 (randId 'λ' 0.1 0.6) 8 + mceReverse o
+ Help/Graph/jmcc-snare-909.hs view
@@ -0,0 +1,37 @@+-- snare-909 (jmcc)+let x = mouseX kr 1 4 Linear 0.2+    y = mouseY kr 0.25 0.75 Exponential 0.2+    tr = impulse kr (3 * x) 0+    n = whiteNoise ar+    v = tRand 0.25 1.0 tr+    e a b = envGen ar tr 1 0 1 DoNothing (envPerc a b)+    e1 = e 0.0005 0.055+    e2 = e 0.0005 0.075+    e3 = e 0.0005 0.4+    e4 = e 0.0005 0.283+    t1 = lfTri ar 330 0+    t2 = lfTri ar 185 0+    x1 = lpf n 7040 * 0.1 + v+    x2 = hpf x1 523+    m1 = t1 * e1 * 0.25 + t2 * e2 * 0.25+    m2 = x1 * e3 * 0.20 + x2 * e4 * 0.20+in pan2 (m1 + m2) 0 y++-- snare-909 (jmcc) ; id+let x = mouseX kr 1 4 Linear 0.2+    y = mouseY kr 0.25 0.75 Exponential 0.2+    tr = impulse kr (3 * x) 0+    n = whiteNoiseId 'α' ar+    v = tRandId 'β' 0.25 1.0 tr+    e a b = envGen ar tr 1 0 1 DoNothing (envPerc a b)+    e1 = e 0.0005 0.055+    e2 = e 0.0005 0.075+    e3 = e 0.0005 0.4+    e4 = e 0.0005 0.283+    t1 = lfTri ar 330 0+    t2 = lfTri ar 185 0+    x1 = lpf n 7040 * 0.1 + v+    x2 = hpf x1 523+    m1 = t1 * e1 * 0.25 + t2 * e2 * 0.25+    m2 = x1 * e3 * 0.20 + x2 * e4 * 0.20+in pan2 (m1 + m2) 0 y
+ Help/Graph/jmcc-spe.hs view
@@ -0,0 +1,28 @@+-- spe (jmcc)+let rapf i = allpassN i 0.05 (X.randN 2 0 0.05) 4+    src = let t = impulse kr 9 0+              e = envGen kr t 0.1 0 1 DoNothing (envPerc 0.1 1)+              s = mce [00,03,02,07+                      ,08,32,16,18+                      ,00,12,24,32]+              f = midiCps (demand t 0 (dseq dinf s) + 32)+              rq = midiCps (lfNoise1 kr 1 * 36 + 110)+          in rlpf (lfSaw ar f 0 * e) rq 0.1+in iter 4 rapf src++-- spe (jmcc) ; monad+uid_st_eval (do+  let rapf i = do r <- replicateM 2 (randM 0 0.05)+                  return (allpassN i 0.05 (mce r) 4)+      src = do let t = impulse kr 9 0+                   e = envGen kr t 0.1 0 1 DoNothing (envPerc 0.1 1)+                   s = mce [00,03,02,07+                           ,08,32,16,18+                           ,00,12,24,32]+               n <- lfNoise1M kr 1+               m <- dseqM dinf s+               let f = midiCps (demand t 0 m + 32)+                   o = lfSaw ar f 0 * e+                   rq = midiCps (n * 36 + 110)+               return (rlpf o rq 0.1)+  chainM 4 rapf =<< src)
+ Help/Graph/jmcc-sprinkler-mouse.hs view
@@ -0,0 +1,11 @@+-- sprinkler mouse (jmcc) #1+let n = whiteNoise ar+    f = mouseX kr 0.2 50 Linear 0.2+    t = lfPulse kr f 0 0.25 * 0.1+in bpz2 (n * t)++-- sprinkler mouse (jmcc) #1 ; id+let n = whiteNoiseId 'α' ar+    f = mouseX kr 0.2 50 Linear 0.2+    t = lfPulse kr f 0 0.25 * 0.1+in bpz2 (n * t)
+ Help/Graph/jmcc-sprinkler.hs view
@@ -0,0 +1,12 @@+-- sprinkler (jmcc) #1+let f = lfPulse kr 0.09 0 0.16 * 10 + 7+    t = lfPulse kr f 0 0.25 * 0.1+    n = whiteNoise ar+in bpz2 (n * t)++-- sprinkler (jmcc) #1 ; id+let f = lfPulse kr 0.09 0 0.16 * 10 + 7+    t = lfPulse kr f 0 0.25 * 0.1+    n = whiteNoiseId 'α' ar+in bpz2 (n * t)+
+ Help/Graph/jmcc-strummable-guitar.hs view
@@ -0,0 +1,45 @@+-- strummable guitar (jmcc) #11+let strummable_guitar_str sc ix =+      let k = constant ix+          x = mouseX kr 0 1 Linear 0.2+          t = abs (hpz1 (x `greater_than` (0.25 + k * 0.1)))+          e = decay t 0.05+          n = pinkNoise ar * e+          dt = 1 / midiCps sc+          s = combL n dt dt 4+      in pan2 s (k * 0.2 - 0.5) 1+    scale = [52,57,62,67,71,76]+    strs = sum (zipWith strummable_guitar_str scale [0..])+in leakDC (lpf strs 12000) 0.995++-- strummable guitar (jmcc) #11 ; id+let strummable_guitar_str sc (ix,z) =+      let k = constant ix+          x = mouseX kr 0 1 Linear 0.2+          t = abs (hpz1 (x `greater_than` (0.25 + k * 0.1)))+          e = decay t 0.05+          n = pinkNoiseId z ar * e+          dt = 1 / midiCps sc+          s = combL n dt dt 4+      in pan2 s (k * 0.2 - 0.5) 1+    scale = [52,57,62,67,71,76]+    strs = sum (zipWith strummable_guitar_str scale (zip [0..] ['α'..]))+in leakDC (lpf strs 12000) 0.995++-- strummable guitar (jmcc) #11 ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let e = decay (trig g controlDur) 0.05+          n = pinkNoise ar * e+          dt = 1 / unitCps p+          s = combL n dt dt ((y + 1) * 3)+      in pan2 s (o * 2 - 1) (0.5 + latch z g)+in leakDC (lpf (mix (voicer 16 f)) 12000) 0.995 * control kr "gain" 1++-- strummable guitar (jmcc) #11 ; event control ; id+let f (c,g,_,y,z,o,_,_,p,_,_) =+      let e = decay (trig g controlDur) 0.05+          n = pinkNoiseId c ar * e+          dt = 1 / unitCps p+          s = combL n dt dt ((y + 1) * 3)+      in pan2 s (o * 2 - 1) (0.5 + latch z g)+in leakDC (lpf (mix (voicer 16 f)) 12000) 0.995 * control kr "gain" 1
+ Help/Graph/jmcc-strummable-silk.hs view
@@ -0,0 +1,53 @@+-- strummable silk (jmcc) #11+let x = mouseX kr 0 1 Linear 0.2+    strummable_guitar_str ix =+      let n = 15+          k = constant ix+          tr = abs (hpz1 (x `greater_than` (0.25 + k * 0.07)))+          e = decay (impulse ar 14 0 * lag (trig tr 1) 0.2 * 0.01) 0.04+          freq0 = midiCps (([-2,0,3,5,7,10,12,15] !! ix) + 60)+          freq = mce (map ((*) freq0) [1 .. constant n + 1])+          param = klankSpec_mce freq (mce (replicate n 1)) (X.randN n 0.3 1)+      in pan2 (klank (pinkNoise ar * e) 1 0 1 param) (k * 0.2 - 0.5) 1+    strs = sum (map strummable_guitar_str [0..7])+    r_allpass i = allpassN i 0.1 (X.randN 2 0 0.05) 4+in iter 6 r_allpass (leakDC (lpf strs 12000) 0.995)++-- strummable silk (jmcc) #11 ; id+let x = mouseX kr 0 1 Linear 0.2+    strummable_guitar_str (ix,z) =+      let n = 15+          k = constant ix+          tr = abs (hpz1 (x `greater_than` (0.25 + k * 0.07)))+          e = decay (impulse ar 14 0 * lag (trig tr 1) 0.2 * 0.01) 0.04+          freq0 = midiCps (([-2,0,3,5,7,10,12,15] !! ix) + 60)+          freq = mce (map ((*) freq0) [1 .. constant n + 1])+          param = klankSpec_mce freq (mce (replicate n 1)) (X.randNId n z 0.3 1)+      in pan2 (klank (pinkNoiseId z ar * e) 1 0 1 param) (k * 0.2 - 0.5) 1+    strs = sum (map strummable_guitar_str (zip [0..7] ['α'..]))+    r_allpass z i = allpassN i 0.1 (X.randNId 2 (z,'ζ') 0 0.05) 4+    rev = useqId 'λ' 6 r_allpass+in rev (leakDC (lpf strs 12000) 0.995)++-- strummable silk (jmcc) #11 ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let n = 15+          e = decay (impulse ar (linExp y 0 1 11 19) 0 * (z * 2 + lag (trig g 1) 0.2) * 0.04) 0.04+          plk = pinkNoise ar * e+          freq = mce (map ((*) (unitCps p)) [1 .. constant n + 1])+          param = klankSpec_mce freq (mce (replicate n 1)) (X.randN n 0.3 1)+      in pan2 (dynKlank plk 1 0 1 param) (o * 2 - 1) z+    r_allpass i = allpassN i 0.1 (X.randN 2 0 0.05) 4+in iter 6 r_allpass (leakDC (lpf (mix (voicer 16 f)) 12000) 0.995) * control kr "gain" 1++-- strummable silk (jmcc) #11 ; event control ; id+let f (c,g,_,y,z,o,_,_,p,_,_) =+      let n = 15+          e = decay (impulse ar (linExp y 0 1 11 19) 0 * (z * 2 + lag (trig g 1) 0.2) * 0.04) 0.04+          plk = pinkNoiseId c ar * e+          freq = mce (map ((*) (unitCps p)) [1 .. constant n + 1])+          param = klankSpec_mce freq (mce (replicate n 1)) (X.randNId n c 0.3 1)+      in pan2 (dynKlank plk 1 0 1 param) (o * 2 - 1) z+    r_allpass z i = allpassN i 0.1 (X.randNId 2 (z,'ζ') 0 0.05) 4+    rev = useqId 'λ' 6 r_allpass+in rev (leakDC (lpf (mix (voicer 16 f)) 12000) 0.995) * control kr "gain" 1
+ Help/Graph/jmcc-sweepy-noise.hs view
@@ -0,0 +1,15 @@+-- sweepy noise (jmcc) #6+let n = mce2 (whiteNoise ar) (whiteNoise ar)+    lfoDepth = mouseY kr 200 8000 Exponential 0.1+    lfoRate = mouseX kr 4 60 Exponential 0.1+    freq = lfSaw kr lfoRate 0 * lfoDepth + (lfoDepth * 1.2)+    filtered = rlpf (n * 0.03) freq 0.1+in combN filtered 0.3 0.3 2 + filtered++-- sweepy noise (jmcc) #6 ; id+let n = mce2 (whiteNoiseId 'α' ar) (whiteNoiseId 'β' ar)+    lfoDepth = mouseY kr 200 8000 Exponential 0.1+    lfoRate = mouseX kr 4 60 Exponential 0.1+    freq = lfSaw kr lfoRate 0 * lfoDepth + (lfoDepth * 1.2)+    filtered = rlpf (n * 0.03) freq 0.1+in combN filtered 0.3 0.3 2 + filtered
+ Help/Graph/jmcc-swept-resonant-noise.hs view
@@ -0,0 +1,55 @@+-- swept resonant noise (jmcc) #2 ; texture=overlap,4,5,5,inf+let flt src _ =+      let p = 10+          spec = klankSpec_mce+                 (X.linRandN p 80 10080 0)+                 (mce (replicate p 1))+                 (X.randN p 0.5 2.5)+      in klank src 1 0 1 spec+    n = whiteNoise ar * 0.007+    f = midiCps (fSinOsc kr (rand 0.1 0.3) 0 * rand 0 24 + rand 36 84)+    sw = resonz n f 0.1+in mceFill 2 (flt sw)++-- swept resonant noise (jmcc) #2 ; texture=overlap,4,5,5,inf ; id+let flt src z =+      let p = 10+          spec = klankSpec_mce+                 (X.linRandNId p z 80 10080 0)+                 (mce (replicate p 1))+                 (X.randNId p z 0.5 2.5)+      in klank src 1 0 1 spec+    n = whiteNoiseId 'α' ar * 0.007+    f = midiCps (fSinOsc kr (randId 'β' 0.1 0.3) 0 * randId 'γ' 0 24 + randId 'δ' 36 84)+    sw = resonz n f 0.1+in mce (map (flt sw) ['ε','ζ'])++-- swept resonant noise (jmcc) #2 ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+      let flt src _ =+            let np = 10+                spec = klankSpec_mce+                  ((x + 0.5) * X.linRandN np 80 10080 0)+                  (mce (replicate np 1))+                  (X.randN np 0.5 2.5)+            in dynKlank src 1 0 1 spec+          f0 = (0.25 + y) * rand 0.1 0.3+          f1 = midiCps (fSinOsc kr f0 0 * rand 0 24 + rand 36 84)+          sw = resonz (whiteNoise ar * 0.007) f1 0.1+      in mceFill 2 (flt sw) * z * lag g 0.1+in mix (voicer 16 f) * control kr "gain" 1++-- swept resonant noise (jmcc) #2 ; event control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+      let flt src k =+            let np = 10+                spec = klankSpec_mce+                  ((x + 0.5) * X.linRandNId np (c,k) 80 10080 0)+                  (mce (replicate np 1))+                  (X.randNId np (c,k) 0.5 2.5)+            in dynKlank src 1 0 1 spec+          f0 = (0.25 + y) * randId (c,'β') 0.1 0.3+          f1 = midiCps (fSinOsc kr f0 0 * randId (c,'γ') 0 24 + randId (c,'δ') 36 84)+          sw = resonz (whiteNoiseId (c,'α') ar * 0.007) f1 0.1+      in mce (map (flt sw) ['ε','ζ']) * z * lag g 0.1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-synthetic-piano.hs view
@@ -0,0 +1,45 @@+-- synthetic piano (jmcc) #3 ; texture=overlap,6,0,6,inf+let n = iRand 36 90+    s = impulse ar (rand 0.1 0.5) (rand 0 1) * 0.1+    e = decay2 s 0.008 0.04+    c o = let n0 = lfNoise2 ar 3000+              dt = 1 / midiCps (n + o)+          in combL (n0 * e) dt dt 6+    l = ((n - 36) / 27) - 1+    c_ = sum_opt (map c [-0.05,0,0.04])+in pan2 c_ l 1++-- synthetic piano (jmcc) #3 ; texture=overlap,6,0,6,inf ; id+let n = iRandId 'α' 36 90+    f = randId 'β' 0.1 0.5+    ph = randId 'γ' 0 1+    s = impulse ar f ph * 0.1+    e = decay2 s 0.008 0.04+    c z o = let n0 = lfNoise2Id z ar 3000+                dt = 1 / midiCps (n + o)+            in combL (n0 * e) dt dt 6+    l = ((n - 36) / 27) - 1+    c_ = sum_opt (zipWith c ['δ'..] [-0.05,0,0.04])+in pan2 c_ l 1++-- synthetic piano (jmcc) #3 ; event-control+let f (_,g,_,y,z,_,_,_,p,_,_) =+      let e = decay2 (trig g controlDur) 0.008 (linLin y 0 1 0.02 0.06) * z * 2+          cmb o = let n0 = lfNoise2 ar 3000+                      dt = 1 / midiCps (p * 127 + o)+                  in combL (n0 * e) dt dt 6+          l = ((p * 127 - 36) / 27) - 1+          cmb_ = sum_opt (map cmb [-0.05,0,0.04])+      in pan2 cmb_ l (1 + z)+in mix (voicer 16 f) * control kr "gain" 1++-- synthetic piano (jmcc) #3 ; event-control ; id+let f (c,g,_,y,z,_,_,_,p,_,_) =+      let e = decay2 (trig g controlDur) 0.008 (linLin y 0 1 0.02 0.06) * z * 2+          cmb k o = let n0 = lfNoise2Id (c,k) ar 3000+                        dt = 1 / midiCps (p * 127 + o)+                    in combL (n0 * e) dt dt 6+          l = ((p * 127 - 36) / 27) - 1+          cmb_ = sum_opt (zipWith cmb ['δ'..] [-0.05,0,0.04])+      in pan2 cmb_ l (1 + z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-tank.hs view
@@ -0,0 +1,91 @@+-- tank (jmcc) ; http://create.ucsb.edu/pipermail/sc-users/2004-April/009692.html+let s1 _ =+      let d = dust ar 0.2+          f = expRand 300 2200+          p = rand (-1) 1+      in pan2 (decay2 d 0.1 0.5 * 0.1 * cubed (fSinOsc ar f 0)) p 1+    s2 =+      let d = dust ar 0.01+          n = brownNoise ar+      in pan2 (decay2 d 0.04 0.3 * n) 0 1+    rev_f i =+      let l0 = localIn 2 ar (mce2 0 0) * 0.98+          l1 = onePole l0 0.33+          (l1l,l1r) = unmce2 l1+          l2 = rotate2 l1l l1r 0.23+          l3 = allpassN l2 0.05 (X.randN 2 0.01 0.05) 2+          l4 = delayN l3 0.3 (mce2 0.17 0.23)+          l5 = allpassN l4 0.05 (X.randN 2 0.03 0.15) 2+          l6 = leakDC l5 0.995+          l7 = l6 + i+      in mrg [l7,localOut l7]+    r_allpass i = allpassN i 0.03 (X.randN 2 0.005 0.02) 1+    s3 = s2 + mixFill 8 s1+in rev_f (iter 4 r_allpass s3)++-- tank (jmcc) ; http://create.ucsb.edu/pipermail/sc-users/2004-April/009692.html ; id+let s1 z _ =+      let d = dustId (z,'α') ar 0.2+          f = expRandId (z,'β') 300 2200+          p = randId (z,'γ') (-1) 1+      in pan2 (decay2 d 0.1 0.5 * 0.1 * cubed (fSinOsc ar f 0)) p 1+    s2 =+      let d = dustId 'δ' ar 0.01+          n = brownNoiseId 'ε' ar+      in pan2 (decay2 d 0.04 0.3 * n) 0 1+    rev_f i =+      let l0 = localIn 2 ar (mce2 0 0) * 0.98+          l1 = onePole l0 0.33+          (l1l,l1r) = unmce2 l1+          l2 = rotate2 l1l l1r 0.23+          l3 = allpassN l2 0.05 (X.randNId 2 'θ' 0.01 0.05) 2+          l4 = delayN l3 0.3 (mce2 0.17 0.23)+          l5 = allpassN l4 0.05 (X.randNId 2 'ι' 0.03 0.15) 2+          l6 = leakDC l5 0.995+          l7 = l6 + i+      in mrg [l7,localOut l7]+    r_allpass z i = allpassN i 0.03 (X.randNId 2 (z,'ζ') 0.005 0.02) 1+    s3 = s2 + mixFillId 'κ' 8 s1+in rev_f (useqId 'λ' 4 r_allpass s3)++-- tank (jmcc) ; event control+let s1 =+      let f (_,g,x,y,z,o,_,_,_,_,_) =+            let tr = trig g controlDur+                freq = linExp x 0 1 300 2200+            in pan2 (decay2 tr 0.1 (0.5 + y * 0.5) * 0.2 * cubed (fSinOsc ar freq 0)) (o * 2 - 1) z+      in mix (voicer 16 f) * control kr "gain" 1+    rev_f i =+      let l0 = localIn 2 ar (mce2 0 0) * 0.98+          l1 = onePole l0 0.33+          (l1l,l1r) = unmce2 l1+          l2 = rotate2 l1l l1r 0.23+          l3 = allpassN l2 0.05 (X.randN 2 0.01 0.05) 2+          l4 = delayN l3 0.3 (mce2 0.17 0.23)+          l5 = allpassN l4 0.05 (X.randN 2 0.03 0.15) 2+          l6 = leakDC l5 0.995+          l7 = l6 + i+      in mrg [l7,localOut l7]+    r_allpass i = allpassN i 0.03 (X.randN 2 0.005 0.02) 1+in rev_f (iter 4 r_allpass s1)++-- tank (jmcc) ; event control ; id+let s1 =+      let f (_,g,x,y,z,o,_,_,_,_,_) =+            let tr = trig g controlDur+                freq = linExp x 0 1 300 2200+            in pan2 (decay2 tr 0.1 (0.5 + y * 0.5) * 0.2 * cubed (fSinOsc ar freq 0)) (o * 2 - 1) z+      in mix (voicer 16 f) * control kr "gain" 1+    rev_f i =+      let l0 = localIn 2 ar (mce2 0 0) * 0.98+          l1 = onePole l0 0.33+          (l1l,l1r) = unmce2 l1+          l2 = rotate2 l1l l1r 0.23+          l3 = allpassN l2 0.05 (X.randNId 2 'θ' 0.01 0.05) 2+          l4 = delayN l3 0.3 (mce2 0.17 0.23)+          l5 = allpassN l4 0.05 (X.randNId 2 'ι' 0.03 0.15) 2+          l6 = leakDC l5 0.995+          l7 = l6 + i+      in mrg [l7,localOut l7]+    r_allpass z i = allpassN i 0.03 (X.randNId 2 (z,'ζ') 0.005 0.02) 1+in rev_f (useqId 'λ' 4 r_allpass s1)
+ Help/Graph/jmcc-theremin.hs view
@@ -0,0 +1,16 @@+-- theremin (jmcc) ; mouse control+let m = 7+    detune = 0+    x = mouseX kr 0 0.6 Linear 0.2+    y = mouseY kr 4000 200 Exponential 0.8+    f = y + detune+    f' = f + f * sinOsc ar m 0 * 0.02+    a = sinOsc ar f' 0 * x+in pan2 a 0 1++-- theremin (jmcc) ; event control+let f (_,w,x,y,z,o,rx,_,_,_,_) =+      let freq = lag (linExp y 0 1 4000 200) 0.8+          a = sinOsc ar (freq + freq * sinOsc ar (4 + 3 * rx) 0 * 0.02) 0 * x * 0.6 * lag w 0.2+      in pan2 a (o * 0.25) (0.5 + z)+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Graph/jmcc-tremulate.hs view
@@ -0,0 +1,33 @@+-- tremulate (jmcc) #1 ; texture=xfade,0.5,2,inf+let f = rand 500 900+    o = fSinOsc ar (f * mce [1,1.2,1.5,1.8]) 0+    r = X.randN 4 30 90+    a = max 0 (lfNoise2 kr r) * 0.1+    l = X.randN 4 (-1) 1+in mix (pan2 o l a)++-- tremulate (jmcc) #1 ; texture=xfade,0.5,2,inf ; id+let f = randId 'α' 500 900+    o = fSinOsc ar (f * mce [1,1.2,1.5,1.8]) 0+    r = X.randNId 4 'β' 30 90+    a = max 0 (lfNoise2Id 'γ' kr r) * 0.1+    l = X.randNId 4 'δ' (-1) 1+in mix (pan2 o l a)++-- tremulate (jmcc) #1 ; event control+let f (_,w,x,_,z,o,rx,ry,_,_,_) =+      let s = fSinOsc ar ((x * 400 + 500) * mce [1,1.2,1.5,1.8]) 0+          r = X.randN 4 30 90+          a = max 0 (lfNoise2 kr (r * (0.75 + rx))) * z+          l = X.randN 4 (-1) 1+      in mix (pan2 s (l + (o * 2 - 1)) (a * lagUD w 0 (ry * 2)))+in combN (mix (voicer 16 f) * control kr "gain" 0.5) 0.1 0.1 1++-- tremulate (jmcc) #1 ; event control ; id+let f (_,g,x,_,z,o,rx,ry,_,_,_) =+      let s = fSinOsc ar ((x * 400 + 500) * mce [1,1.2,1.5,1.8]) 0+          r = X.randNId 4 'β' 30 90+          a = max 0 (lfNoise2Id 'γ' kr (r * (0.75 + rx))) * z+          l = X.randNId 4 'δ' (-1) 1+      in mix (pan2 s (l + (o * 2 - 1)) (a * lagUD g 0 (ry * 2)))+in combN (mix (voicer 16 f) * control kr "gain" 0.5) 0.1 0.1 1
+ Help/Graph/jmcc-uplink.hs view
@@ -0,0 +1,18 @@+-- uplink (jmcc) #2 ; texture=overlap,4,1,5,inf+let f _ = let p0 = lfPulse kr (rand0 20) 0 (rand0 1)+              p1 = lfPulse kr (rand0 4) 0 (rand0 1) * rand0 8000 + rand0 2000+          in p0 * p1+in pan2 (lfPulse ar (mixFill 2 f) 0 0.5 * 0.04) (rand (-0.8) 0.8) 1++-- uplink (jmcc) #2 ; texture=overlap,4,1,5,inf ; id+let f z _ = let p0 = lfPulse kr (rand0Id (z,'α') 20) 0 (rand0Id (z,'β') 1)+                p1 = lfPulse kr (rand0Id (z,'γ') 4) 0 (rand0Id (z,'δ') 1) * rand0Id (z,'ε') 8000 + rand0Id (z,'ζ') 2000+            in p0 * p1+in pan2 (lfPulse ar (mixFillId 'η' 2 f) 0 0.5 * 0.04) (randId 'θ' (-0.8) 0.8) 1++-- uplink (jmcc) #2 ; texture=overlap,4,1,5,inf ; id+let r = rand0Id+    p0 = lfPulse kr (r 'α' 20) 0 (r 'β' 1)+    p1 = lfPulse kr (r 'γ' 4) 0 (r 'δ' 1) * r 'ε' 8000 + r 'ζ' 2000+    f = mix (Protect.uclone_all 'η' 2 (p0 * p1))+in pan2 (lfPulse ar f 0 0.5 * 0.04) (randId 'θ' (-0.8) 0.8) 1
+ Help/Graph/jmcc-what-was-i-thinking.hs view
@@ -0,0 +1,25 @@+-- what was i thinking? (jmcc) #2+let p = pulse ar f (lfNoise1 kr 0.157 * 0.4 + 0.5) * 0.04+    i = lfPulse ar 0.1 0 0.05 * impulse ar 8 0 * 500+    d = decay i 2+    f = max (sinOsc kr 4 0 + 80) d+    z = rlpf p (lfNoise1 kr 0.2 * 2000 + 2400) 0.2+    c x _ = combL (x * 0.6) 0.06 (lfNoise1 kr (rand 0 0.3) * 0.025 + 0.035) 1+in z + mce [mixFill 2 (c z),mixFill 2 (c z)]++-- what was i thinking? (jmcc) #2 ; monad+uid_st_eval (do+  n0 <- lfNoise1M kr 0.2+  n1 <- lfNoise1M kr 0.157+  let p = pulse ar f (n1 * 0.4 + 0.5) * 0.04+      i = lfPulse ar 0.1 0 0.05 * impulse ar 8 0 * 500+      d = decay i 2+      f = max (sinOsc kr 4 0 + 80) d+      z = rlpf p (n0 * 2000 + 2400) 0.2+      c x = do r <- randM 0 0.3+               n <- lfNoise1M kr r+               return (combL x 0.06 (n * 0.025 + 0.035) 1)+      y = z * 0.6+  z0 <- replicateM 2 (c y)+  z1 <- replicateM 2 (c y)+  return (z + mce [sum z0,sum z1]))
+ Help/Graph/jmcc-why-supercollider.hs view
@@ -0,0 +1,12 @@+-- why supercollider (jmcc) #0+let s = mixFill 10 (\_ -> resonz (dust ar 0.2 * 50) (rand 200 3200) 0.003)+    y = mixFill 7 (\_ -> combL (delayN s 0.048 0.048) 0.1 (lfNoise1 kr (rand 0 0.1) * 0.04 + 0.05) 15)+    f i = allpassN i 0.05 (X.randN 2 0 0.05) 1+in s + 0.2 * iter 4 f y++-- why supercollider (jmcc) #0 ; id+let s = mixFillId 'α' 10 (\z _ -> resonz (dustId z ar 0.2 * 50) (randId z 200 3200) 0.003)+    y = mixFillId 'β' 7 (\z _ -> combL (delayN s 0.048 0.048) 0.1 (lfNoise1Id z kr (randId z 0 0.1) * 0.04 + 0.05) 15)+    f z i = allpassN i 0.05 (mce2 (randId (z,'γ') 0 0.05) (randId (z,'δ') 0 0.05)) 1+    x = foldl (&) y (map f (id_seq 4 'ε'))+in s + 0.2 * x
+ Help/Graph/jmcc-wind-metals.hs view
@@ -0,0 +1,67 @@+-- wind metals (jmcc) ; texture=overlap,5,2,12,inf+let n = 6+    base = expRand 60 4000+    exc = mceFill 2 (\_ -> brownNoise ar) * 0.007 * max 0 (lfNoise1 kr (expRand 0.125 0.5) * 0.75 + 0.25)+    k = klankSpec_mce (mceFill n (\_ -> rand base (base + rand 500 8000))) (mceConst n 1) (mceFill n (\_ -> rand 0.1 2))+in softClip (klank exc 1 0 1 k * 0.1)++-- wind metals (jmcc) ; texture=overlap,5,2,12,inf ; monad+uid_st_eval (do+  let n = 6+  base <- expRandM 60 4000+  rng <- randM 500 8000+  n0 <- replicateM 2 (brownNoiseM ar)+  r0 <- expRandM 0.125 0.5+  n1 <- lfNoise1M kr r0+  f <- sequence (replicate n (randM base (base + rng)))+  dt <- sequence (replicate n (randM 0.1 2))+  let exc = mce n0 * 0.007 * max 0 (n1 * 0.75 + 0.25)+      k = klankSpec f (replicate n 1) dt+      s = klank exc 1 0 1 k+  return (softClip (s * 0.1)))++-- wind metals (jmcc) ; texture=overlap,5,2,12,inf ; id+let n = 6+    base = expRandId 'α' 60 4000+    rng = randId 'β' 500 8000+    n0 = mce2 (brownNoiseId 'γ' ar) (brownNoiseId 'δ' ar)+    r0 = expRandId 'ε' 0.125 0.5+    n1 = lfNoise1Id 'ζ' kr r0+    f = X.randNId n 'η' base (base + rng)+    dt = X.randNId n 'θ' 0.1 2+    exc = n0 * 0.007 * max 0 (n1 * 0.75 + 0.25)+    k = klankSpec_mce f (mce (replicate n 1)) dt+    s = klank exc 1 0 1 k+in softClip (s * 0.1)++-- wind metals (jmcc) ; event-control+let f (c,g,x,y,z,_,_,_,_,_,_) =+      let n = 6+          base = linExp x 0 1 60 4000+          rng = tRand 500 8000 g+          n0 = mce2 (brownNoise ar) (brownNoise ar)+          r0 = tExpRand 0.125 0.5 g+          n1 = lfNoise1 kr r0+          fq = X.tRandN n base (base + rng) g+          dt = X.tRandN n 0.1 2 g+          exc = n0 * 0.01 * z * lagUD g y 2+          k = klankSpec_mce fq (mce (replicate n 1)) dt+          s = dynKlank exc 1 0 1 k+      in softClip (dynKlank exc 1 0 1 k)+in mix (voicer 16 f) * control kr "gain" 1++-- wind metals (jmcc) ; event-control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+      let n = 6+          base = linExp x 0 1 60 4000+          rng = tRandId (c,'β') 500 8000 g+          n0 = mce2 (brownNoiseId (c,'γ') ar) (brownNoiseId (c,'δ') ar)+          r0 = tExpRandId 'ε' 0.125 0.5 g+          n1 = lfNoise1Id 'ζ' kr r0+          fq = X.tRandNId n 'η' base (base + rng) g+          dt = X.tRandNId n 'θ' 0.1 2 g+          exc = n0 * 0.01 * z * lagUD g y 2+          k = klankSpec_mce fq (mce (replicate n 1)) dt+          s = dynKlank exc 1 0 1 k+      in softClip (dynKlank exc 1 0 1 k)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-zizle.hs view
@@ -0,0 +1,39 @@+-- zizle (jmcc) #Sc3d1.5 ; texture=overlap,4,4,12,inf+let a f = let fm = mce2 (rand 0.7 1.3) 1+              ph = mce2 (rand 0 two_pi) (rand 0 two_pi)+          in mix (sinOsc ar (f * fm) ph * 0.1)+    a1 = max (a (expRand 0.3 8)) 0+    a2 = abs (a (expRand 6 24))+    o = sinOsc ar (midiCps (rand 24 108)) (rand 0 two_pi)+in pan2 (o * a1 * a2) (rand2 1) 1++-- zizle (jmcc) #Sc3d1.5 ; texture=overlap,4,4,12,inf ; id+let a z f = let fm = mce2 (randId (z,'α') 0.7 1.3) 1+                ph = mce2 (randId (z,'β') 0 two_pi) (randId (z,'γ') 0 two_pi)+            in mix (sinOsc ar (f * fm) ph * 0.1)+    a1 = max (a 'δ' (expRandId 'ε' 0.3 8)) 0+    a2 = abs (a 'ζ' (expRandId 'η' 6 24))+    o = sinOsc ar (midiCps (randId 'θ' 24 108)) (randId 'ι' 0 two_pi)+in pan2 (o * a1 * a2) (rand2Id 'κ' 1) 1++-- zizle (jmcc) #Sc3d1.5 ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let a f0 = let fm = mce2 (tRand 0.7 1.3 g) 1+                     ph = mce2 (tRand 0 two_pi g) (tRand 0 two_pi g)+                 in mix (sinOsc ar (f0 * fm) ph)+          a1 = max (a (tExpRand 0.3 8 g)) 0+          a2 = abs (a (tExpRand 6 24 g))+          sig = sinOsc ar (midiCps (x * 84 + 24)) (tRand 0 two_pi g)+      in pan2 (sig * a1 * a2) (o * 2 - 1) (z * lagUD g (y * 0.01) (y * 2))+in mix (voicer 16 f) * control kr "gain" 1++-- zizle (jmcc) #Sc3d1.5 ; event control ; id+let f (c,g,x,y,z,o,_,_,_,_,_) =+      let a e f0 = let fm = mce2 (tRandId (e,'α') 0.7 1.3 g) 1+                       ph = mce2 (tRandId (e,'β') 0 two_pi g) (tRandId (e,'γ') 0 two_pi g)+                   in mix (sinOsc ar (f0 * fm) ph)+          a1 = max (a (c,'δ') (tExpRandId (c,'ε') 0.3 8 g)) 0+          a2 = abs (a (c,'ζ') (tExpRandId (c,'η') 6 24 g))+          sig = sinOsc ar (midiCps (x * 84 + 24)) (tRandId 'ι' 0 two_pi g)+      in pan2 (sig * a1 * a2) (o * 2 - 1) (z * lagUD g (y * 0.01) (y * 2))+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jp-record-scratcher.hs view
@@ -0,0 +1,14 @@+-- record scratcher (jp) ; requires=buf+let (buf, nc) = (control kr "buf" 0, 2)+    dup a = mce2 a a+    d = Envelope [0, 1, 0] [0.1, 0.1] [EnvSin] (Just 1) (Just 0) 0+    e = envGen kr 1 0.5 0 1 RemoveSynth d+    x = mouseX kr (-10) 10 Linear 0.2+    dx = x - delayN x 0.1 0.1+    bdx = mouseButton kr 1 0 0.3 + dx+    bdxr = bdx * bufRateScale kr buf+    scr = playBuf nc ar buf bdxr 0 0 Loop DoNothing+in dup (scr * e)++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Graph/ljp-one-line.hs view
@@ -0,0 +1,6 @@+-- one-line (ljp)+let lfs = lfSaw ar (mce2 1 0.99) (mce2 0 0.6) * 2000 + 2000+    lfs_t = trunc lfs (mce2 400 600) * mce2 1 (-1)+    f = onePole (mix lfs_t) 0.98+in pan2 (sinOsc ar f 0) 0 0.1+
+ Help/Graph/lkp-chaos-engine.hs view
@@ -0,0 +1,5 @@+-- http://sccode.org/1-5aJ -- chaos engine hum+let o1 = sinOsc kr 101 (saw kr 0.12345 * 678 + 9) * 0.2 + 0.8+    o2 = pulse kr (mce2 25 25.5) 0.25 * 0.125 - 0.25+    o3 = sinOsc kr (mce2 50 51) 0 * o1 + o2+in sinOsc ar (10 + 50 * o3) 0 * 0.5
+ Help/Graph/mn-k2ws.hs view
@@ -0,0 +1,21 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21341.html (mn)+let fc = 400 + (lfNoise2 ar (mce2 1 2) `in_range` (100,200))+    fm = lfNoise0 ar 5 `in_range` (100,200)+    i = lfNoise1 ar 10 `in_range` (1,20)+    x = sinOsc ar (fc + (sinOsc ar fm 0 * i * fm)) 0 * 0.5+    rf = sinOsc ar (lfNoise1 ar 1 `in_range` (0.1,1)) 0 `in_range` (1000,2000)+    rq = lfNoise1 ar 1 `in_range` (0.5,10)+    a = rlpf x rf rq+    ph = a * (lfNoise1 ar 0.1 `in_range` (1.0,4.0)) * 4 * pi+in sinOsc ar 0.2 ph * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21341.html (mn) ; id+let fc = 400 + (lfNoise2Id 'α' ar (mce2 1 2) `in_range` (100,200))+    fm = lfNoise0Id 'β' ar 5 `in_range` (100,200)+    i = lfNoise1Id 'γ' ar 10 `in_range` (1,20)+    x = sinOsc ar (fc + (sinOsc ar fm 0 * i * fm)) 0 * 0.5+    rf = sinOsc ar (lfNoise1Id 'δ' ar 1 `in_range` (0.1,1)) 0 `in_range` (1000,2000)+    rq = lfNoise1Id 'ε' ar 1 `in_range` (0.5,10)+    a = rlpf x rf rq+    ph = a * (lfNoise1Id 'ζ' ar 0.1 `in_range` (1.0,4.0)) * 4 * pi+in sinOsc ar 0.2 ph * 0.1
+ Help/Graph/mp-rm-octaver.hs view
@@ -0,0 +1,7 @@+-- rm-octaver (miller puckette) ; http://crca.ucsd.edu/~msp/techniques/latest/book-html/node77.html+let defaultPitch x = pitch x 440 60 4000 100 16 1 0.01 0.5 1 0+    rm_octaver i =+      let p = defaultPitch i+          [f,tr] = mceChannels p+      in lag3 tr 0.1 * sinOsc ar (f * 0.5) 0 * i + i+in rm_octaver (soundIn (control kr "in" 0))
+ Help/Graph/my-mouse.hs view
@@ -0,0 +1,6 @@+-- https://mohayonao.github.io/CoffeeCollider/#mouse.coffee (mohayonao) http://the.mohayonao.com/+let freq = mouseY kr 100 1000 Exponential 0.1+    freq1 = freq * mouseX kr 2 0.5 Linear 2.5+    freq2 = freq * mouseX kr 0.5 2 Linear 2.5+    feedback = mouseButton kr 0 pi 5+in sinOscFB ar (mce2 freq1 freq2) feedback * 0.1
+ Help/Graph/np-pebble-beach.hs view
@@ -0,0 +1,47 @@+-- pebble beach (np) ; http://sccode.org/1-u ; requires 'scsynth -u 57110 -m 32768'+let bg_f k =+      let sc = 0.4 + (k * 0.07)+          fr = range 3100 4900 (lag (lfNoise0 kr 21.8) 0.7) * sc+          am = range 0 1 (lag (lfNoise1 kr 5.227) 5.374)+      in bpf (pinkNoise ar * 0.4) fr 0.1 * am+    fg_f df tf _ =+      let d = dust ar (df * rand 0.8 1.2) * 50+          l = exprange 800 900 (sinOsc kr 2.2 0)+          r = exprange 2600 2900 (sinOsc kr 5.228 0)+          z = resonz d (tRand l r d) (tRand 0.03 0.08 d)+          t = lagUD (range 2 0.5 (saw kr tf)) 0.6 2.8+          o = z * t+      in o + combL o 0.8 (rand 0.2 0.8) (lchoose [-4,4])+    pebble_beach _ =+      let bg' = let am = range 0 1 (lag (lfNoise0 kr 34) 1.4)+                in brownNoise ar * 0.06 * am+          bg = bg' + mixFill 20 bg_f * 0.6+          tf = range 0.122 0.24 (sinOsc kr 0.17 0)+          df = exprange 1 700 (lfTri kr tf 0) * exprange 1 0.2 (lfTri kr tf 0)+          fg = mixFill 50 (fg_f df tf) * 0.2+      in (bg + fg) * line kr 0 1 1.2 DoNothing+in mce2 (pebble_beach ()) (pebble_beach ())++-- pebble beach (np) ; http://sccode.org/1-u ; requires 'scsynth -u 57110 -m 32768' ; id+let bg_f k =+      let sc = 0.4 + (k * 0.07)+          fr = range 3100 4900 (lag (lfNoise0Id 'α' kr 21.8) 0.7) * sc+          am = range 0 1 (lag (lfNoise1Id 'α' kr 5.227) 5.374)+      in bpf (pinkNoiseId 'α' ar * 0.4) fr 0.1 * am+    fg_f df tf =+      let d = dustId 'α' ar (df * randId 'α' 0.8 1.2) * 50+          l = exprange 800 900 (sinOsc kr 2.2 0)+          r = exprange 2600 2900 (sinOsc kr 5.228 0)+          z = resonz d (tRandId 'α' l r d) (tRandId 'α' 0.03 0.08 d)+          t = lagUD (range 2 0.5 (saw kr tf)) 0.6 2.8+          o = z * t+      in o + combL o 0.8 (randId 'α' 0.2 0.8) (lchooseId 'α' [-4,4])+    pebble_beach j =+      let bg' = let am = range 0 1 (lag (lfNoise0Id 'α' kr 34) 1.4)+                in brownNoiseId 'α' ar * 0.06 * am+          bg = bg' + sum (Protect.uprotect_seq (const False) j (map bg_f [0..19])) * 0.6+          tf = range 0.122 0.24 (sinOsc kr 0.17 0)+          df = exprange 1 700 (lfTri kr tf 0) * exprange 1 0.2 (lfTri kr tf 0)+          fg = mix (Protect.uclone_all j 50 (fg_f df tf)) * 0.2+      in (bg + fg) * line kr 0 1 1.2 DoNothing+in mce2 (pebble_beach 'α') (pebble_beach 'β')
+ Help/Graph/nv-ml-2014-06-03.hs view
@@ -0,0 +1,7 @@+-- sc-users, 2014-06-03 (nv) ; https://twitter.com/headcube/status/474064500564324352 (nv)+let y = mouseY kr 1 100 Linear 0.2+    x = mouseX kr 50 400 Exponential 0.2+    i = decay (impulse ar 0.5 0) 0.1+    i' = sin (bpf (i * y) 50 1)+    repl n = mce . replicate n+in repl 2 (pluck i' (lfSaw ar 10000 0) 0.1 (1 / x) 4 0.5)
+ Help/Graph/nv-tw-01.hs view
@@ -0,0 +1,15 @@+-- http://sccode.org/1-V (nv) L1+let a = mceFill 2 (\_ -> pinkNoise ar)+    nd i =+        let n = lfNoise1 kr (rand 0 0.05)+            f = linExp n (-1) 1 40 15000+        in bBandStop i f (expRand 0.1 2)+in lpf (iter 50 nd a) 100000++-- http://sccode.org/1-V (nv) L1 ; id+let a = mce2 (pinkNoiseId 'α' ar) (pinkNoiseId 'β' ar)+    nd z i =+        let n = lfNoise1Id (z,'γ') kr (randId (z,'δ') 0 0.05)+            f = linExp n (-1) 1 40 15000+        in bBandStop i f (expRandId (z,'ε') 0.1 2)+in lpf (useqId 'ζ' 50 nd a) 100000
+ Help/Graph/nv-tw-2013-01-11.hs view
@@ -0,0 +1,21 @@+-- https://twitter.com/headcube/status/289761321065541633 (nv)+let nc = 80+    i = inFeedback nc 20+    n = mceFill nc (\_ -> lfNoise1 kr 0.001 + 1) / constant nc+    j = combL (lpf i 2000) 1 n 0.05+    d = mceFill nc (\_ -> dust2 ar 0.01)+    x = sin (j + d)+in mceConcat [splay x 1 1 0 True+             ,mce (replicate 18 0)+             ,(x - mceRotate 1 x) / 2]++-- https://twitter.com/headcube/status/289761321065541633 (nv) ; id+let nc = 80+    i = inFeedback nc 20+    n = mceFillInt nc (\z -> lfNoise1Id z kr 0.001 + 1) / constant nc+    j = combL (lpf i 2000) 1 n 0.05+    d = mceFillInt nc (\z -> dust2Id z ar 0.01)+    x = sin (j + d)+in mceConcat [splay x 1 1 0 True+             ,mce (replicate 18 0)+             ,(x - mceRotate 1 x) / 2]
+ Help/Graph/nv-tw-2013-12-04.hs view
@@ -0,0 +1,10 @@+-- https://twitter.com/headcube/status/408145586970324992 (nv)+let mean l = sum l / fromIntegral (length l)+    f j =+      let i = j + 1+          a = saw ar ((1 / i + 1) / 6)+          p = pluck a a 1 (1 / i / (3 - lfPulse ar (1 / i) 0 0.5) / 30) 9 (0.9 / i)+          x = (0.5 ** i) * p+          o = sinOsc ar 2 0 + mce2 4 9+      in combC x 1 (o * 0.001) 0 - x+in mean (map f [0 .. 8]) / 9
+ Help/Graph/nv-tw-2014-02-21.hs view
@@ -0,0 +1,16 @@+-- nv ; https://twitter.com/headcube/status/437094206767513600+let x = impulse ar 0.05 0+    f i =+      let n = lfNoise2 kr+          a = allpassL (leakDC i 0.995) 4 ((8 ** n 0.1) / 2) 8 * 1.2+      in tanh (lpf a ((8 ** n (mce2 (rand 0 0.1) (rand 0 0.1))) * 2500))+in ugen_optimise_ir_rand (mixFill 4 (\_ -> iter 20 f x * 5))++-- nv ; https://twitter.com/headcube/status/437094206767513600 ; id+let x = impulse ar 0.05 0+    f i =+      let n e = lfNoise2Id e kr+          a = allpassL (leakDC i 0.995) 4 ((8 ** n 'α' 0.1) / 2) 8 * 1.2+      in tanh (lpf a ((8 ** n 'β' (mce2 (randId 'γ' 0 0.1) (randId 'δ' 0 0.1))) * 2500))+    y z = Protect.useq_all z 20 f x * 5+in ugen_optimise_ir_rand (mix (mceFillInt 4 y))
+ Help/Graph/nv-tw-40.hs view
@@ -0,0 +1,18 @@+-- http://sccode.org/1-V (nv) [Line 40]+let nd i =+        let t = (0.6 ** i) * 40 * impulse ar ((2 ** i) / 32) (1/2)+            f = (4 ** lfNoise0 kr (1/16)) * 300+        in sin (rlpf t f 5e-3)+    x = splay (mceFill 8 nd) 1 1 0 True+    r u = let (p,q) = mce2c u in freeVerb2 p q 0.1 1 1+in r (r x)++-- http://sccode.org/1-V (nv) [Line 40] ; id+let nd z =+        let i = constant z+            t = (0.6 ** i) * 40 * impulse ar ((2 ** i) / 32) (1/2)+            f = (4 ** lfNoise0Id z kr (1/16)) * 300+        in sin (rlpf t f 5e-3)+    x = splay (mce (map nd [0::Int .. 7])) 1 1 0 True+    r u = let (p,q) = mce2c u in freeVerb2 p q 0.1 1 1+in r (r x)
+ Help/Graph/nv-tw-41.hs view
@@ -0,0 +1,15 @@+-- https://swiki.hfbk-hamburg.de/MusicTechnology/899 (nv) [Line 41]+let n i =+      let f = 1.9 ** i / 128+          p = mceFill 2 (\_ -> pinkNoise ar)+          b = 4 ** lfNoise2 kr (1.2 ** i / 16)+      in bpf p (b * 300) 0.15 * (5 ** lfNoise2 ar f / (i + 8) * 20)+in splay (mixFill 15 n) 1 0.5 0 True++-- https://swiki.hfbk-hamburg.de/MusicTechnology/899 (nv) [Line 41] ; id+let n z i =+      let f = 1.9 ** i / 128+          p = mce2 (pinkNoiseId (z,'α') ar) (pinkNoiseId (z,'β') ar)+          b = 4 ** lfNoise2Id z kr (1.2 ** i / 16)+      in bpf p (b * 300) 0.15 * (5 ** lfNoise2Id z ar f / (i + 8) * 20)+in splay (mixFillId 'γ' 15 n) 1 0.5 0 True
+ Help/Graph/nv-tw-43.hs view
@@ -0,0 +1,8 @@+-- https://swiki.hfbk-hamburg.de/MusicTechnology/899 (nv) L43+let k = 2+    o = lfSaw ar (mce2 102 101) 0+    f i =+      let x = impulse ar 1 (i / 10) + impulse ar 0 0+          d = latch (((1.015 ** sweep ar 0 1 * 64) `modE` 1 + 1) * 200) x+      in pluck o x 1 (1 / d) 4 0.2+in mceMean (mceFill k f) * 0.25
+ Help/Graph/nv-tw-52.hs view
@@ -0,0 +1,24 @@+-- nv 52 https://swiki.hfbk-hamburg.de/MusicTechnology/899+let y = [[256,144],[128,72],[256,144],[128,162],[256,144],[128,450],[256,144],[128,648],[256,144],[216,72],[256,144],[216,162],[256,144],[216,450],[256,144],[216,648],[256,144],[320,72],[256,144],[320,162],[256,144],[320,450],[256,144],[320,648],[256,144],[432,72],[256,144],[432,162],[256,144],[432,450],[256,144],[432,648],[256,243],[128,72],[256,243],[128,162],[256,243],[128,450],[256,243],[128,648],[256,243],[216,72],[256,243],[216,162],[256,243],[216,450],[256,243],[216,648],[256,243],[320,72],[256,243],[320,162],[256,243],[320,450],[256,243],[320,648],[256,243],[432,72],[256,243],[432,162],[256,243],[432,450],[256,243],[432,648],[256,360],[128,72],[256,360],[128,162],[256,360],[128,450],[256,360],[128,648],[256,360],[216,72],[256,360],[216,162],[256,360],[216,450],[256,360],[216,648],[256,360],[320,72],[256,360],[320,162],[256,360],[320,450],[256,360],[320,648],[256,360],[432,72],[256,360],[432,162],[256,360],[432,450],[256,360],[432,648],[256,486],[128,72],[256,486],[128,162],[256,486],[128,450],[256,486],[128,648],[256,486],[216,72],[256,486],[216,162],[256,486],[216,450],[256,486],[216,648],[256,486],[320,72],[256,486],[320,162],[256,486],[320,450],[256,486],[320,648],[256,486],[432,72],[256,486],[432,162],[256,486],[432,450],[256,486],[432,648],[324,144],[128,72],[324,144],[128,162],[324,144],[128,450],[324,144],[128,648],[324,144],[216,72],[324,144],[216,162],[324,144],[216,450],[324,144],[216,648],[324,144],[320,72],[324,144],[320,162],[324,144],[320,450],[324,144],[320,648],[324,144],[432,72],[324,144],[432,162],[324,144],[432,450],[324,144],[432,648],[324,243],[128,72],[324,243],[128,162],[324,243],[128,450],[324,243],[128,648],[324,243],[216,72],[324,243],[216,162],[324,243],[216,450],[324,243],[216,648],[324,243],[320,72],[324,243],[320,162],[324,243],[320,450],[324,243],[320,648],[324,243],[432,72],[324,243],[432,162],[324,243],[432,450],[324,243],[432,648],[324,360],[128,72],[324,360],[128,162],[324,360],[128,450],[324,360],[128,648],[324,360],[216,72],[324,360],[216,162],[324,360],[216,450],[324,360],[216,648],[324,360],[320,72],[324,360],[320,162],[324,360],[320,450],[324,360],[320,648],[324,360],[432,72],[324,360],[432,162],[324,360],[432,450],[324,360],[432,648],[324,486],[128,72],[324,486],[128,162],[324,486],[128,450],[324,486],[128,648],[324,486],[216,72],[324,486],[216,162],[324,486],[216,450],[324,486],[216,648],[324,486],[320,72],[324,486],[320,162],[324,486],[320,450],[324,486],[320,648],[324,486],[432,72],[324,486],[432,162],[324,486],[432,450],[324,486],[432,648],[128,96],[160,96],[128,96],[160,216],[128,96],[160,600],[128,96],[160,864],[128,96],[270,96],[128,96],[270,216],[128,96],[270,600],[128,96],[270,864],[128,96],[400,96],[128,96],[400,216],[128,96],[400,600],[128,96],[400,864],[128,96],[540,96],[128,96],[540,216],[128,96],[540,600],[128,96],[540,864],[128,162],[160,96],[128,162],[160,216],[128,162],[160,600],[128,162],[160,864],[128,162],[270,96],[128,162],[270,216],[128,162],[270,600],[128,162],[270,864],[128,162],[400,96],[128,162],[400,216],[128,162],[400,600],[128,162],[400,864],[128,162],[540,96],[128,162],[540,216],[128,162],[540,600],[128,162],[540,864],[128,240],[160,96],[128,240],[160,216],[128,240],[160,600],[128,240],[160,864],[128,240],[270,96],[128,240],[270,216],[128,240],[270,600],[128,240],[270,864],[128,240],[400,96],[128,240],[400,216],[128,240],[400,600],[128,240],[400,864],[128,240],[540,96],[128,240],[540,216],[128,240],[540,600],[128,240],[540,864],[128,324],[160,96],[128,324],[160,216],[128,324],[160,600],[128,324],[160,864],[128,324],[270,96],[128,324],[270,216],[128,324],[270,600],[128,324],[270,864],[128,324],[400,96],[128,324],[400,216],[128,324],[400,600],[128,324],[400,864],[128,324],[540,96],[128,324],[540,216],[128,324],[540,600],[128,324],[540,864],[162,96],[160,96],[162,96],[160,216],[162,96],[160,600],[162,96],[160,864],[162,96],[270,96],[162,96],[270,216],[162,96],[270,600],[162,96],[270,864],[162,96],[400,96],[162,96],[400,216],[162,96],[400,600],[162,96],[400,864],[162,96],[540,96],[162,96],[540,216],[162,96],[540,600],[162,96],[540,864],[162,162],[160,96],[162,162],[160,216],[162,162],[160,600],[162,162],[160,864],[162,162],[270,96],[162,162],[270,216],[162,162],[270,600],[162,162],[270,864],[162,162],[400,96],[162,162],[400,216],[162,162],[400,600],[162,162],[400,864],[162,162],[540,96],[162,162],[540,216],[162,162],[540,600],[162,162],[540,864],[162,240],[160,96],[162,240],[160,216],[162,240],[160,600],[162,240],[160,864],[162,240],[270,96],[162,240],[270,216],[162,240],[270,600],[162,240],[270,864],[162,240],[400,96],[162,240],[400,216],[162,240],[400,600],[162,240],[400,864],[162,240],[540,96],[162,240],[540,216],[162,240],[540,600],[162,240],[540,864],[162,324],[160,96],[162,324],[160,216],[162,324],[160,600],[162,324],[160,864],[162,324],[270,96],[162,324],[270,216],[162,324],[270,600],[162,324],[270,864],[162,324],[400,96],[162,324],[400,216],[162,324],[400,600],[162,324],[400,864],[162,324],[540,96],[162,324],[540,216],[162,324],[540,600],[162,324],[540,864]]+    f = duty ar (1/5) 0 DoNothing (dseq 1 (mce (map mce y)))+    s = varSaw ar f 0 0.9 * lfPulse ar 5 0 0.5+in gVerb (mix s) 99 5 0.5 0.5 15.0 1.0 0.7 0.5 300.0 / 10++-- nv 52 https://swiki.hfbk-hamburg.de/MusicTechnology/899 ; id+let y = [[256,144],[128,72],[256,144],[128,162],[256,144],[128,450],[256,144],[128,648],[256,144],[216,72],[256,144],[216,162],[256,144],[216,450],[256,144],[216,648],[256,144],[320,72],[256,144],[320,162],[256,144],[320,450],[256,144],[320,648],[256,144],[432,72],[256,144],[432,162],[256,144],[432,450],[256,144],[432,648],[256,243],[128,72],[256,243],[128,162],[256,243],[128,450],[256,243],[128,648],[256,243],[216,72],[256,243],[216,162],[256,243],[216,450],[256,243],[216,648],[256,243],[320,72],[256,243],[320,162],[256,243],[320,450],[256,243],[320,648],[256,243],[432,72],[256,243],[432,162],[256,243],[432,450],[256,243],[432,648],[256,360],[128,72],[256,360],[128,162],[256,360],[128,450],[256,360],[128,648],[256,360],[216,72],[256,360],[216,162],[256,360],[216,450],[256,360],[216,648],[256,360],[320,72],[256,360],[320,162],[256,360],[320,450],[256,360],[320,648],[256,360],[432,72],[256,360],[432,162],[256,360],[432,450],[256,360],[432,648],[256,486],[128,72],[256,486],[128,162],[256,486],[128,450],[256,486],[128,648],[256,486],[216,72],[256,486],[216,162],[256,486],[216,450],[256,486],[216,648],[256,486],[320,72],[256,486],[320,162],[256,486],[320,450],[256,486],[320,648],[256,486],[432,72],[256,486],[432,162],[256,486],[432,450],[256,486],[432,648],[324,144],[128,72],[324,144],[128,162],[324,144],[128,450],[324,144],[128,648],[324,144],[216,72],[324,144],[216,162],[324,144],[216,450],[324,144],[216,648],[324,144],[320,72],[324,144],[320,162],[324,144],[320,450],[324,144],[320,648],[324,144],[432,72],[324,144],[432,162],[324,144],[432,450],[324,144],[432,648],[324,243],[128,72],[324,243],[128,162],[324,243],[128,450],[324,243],[128,648],[324,243],[216,72],[324,243],[216,162],[324,243],[216,450],[324,243],[216,648],[324,243],[320,72],[324,243],[320,162],[324,243],[320,450],[324,243],[320,648],[324,243],[432,72],[324,243],[432,162],[324,243],[432,450],[324,243],[432,648],[324,360],[128,72],[324,360],[128,162],[324,360],[128,450],[324,360],[128,648],[324,360],[216,72],[324,360],[216,162],[324,360],[216,450],[324,360],[216,648],[324,360],[320,72],[324,360],[320,162],[324,360],[320,450],[324,360],[320,648],[324,360],[432,72],[324,360],[432,162],[324,360],[432,450],[324,360],[432,648],[324,486],[128,72],[324,486],[128,162],[324,486],[128,450],[324,486],[128,648],[324,486],[216,72],[324,486],[216,162],[324,486],[216,450],[324,486],[216,648],[324,486],[320,72],[324,486],[320,162],[324,486],[320,450],[324,486],[320,648],[324,486],[432,72],[324,486],[432,162],[324,486],[432,450],[324,486],[432,648],[128,96],[160,96],[128,96],[160,216],[128,96],[160,600],[128,96],[160,864],[128,96],[270,96],[128,96],[270,216],[128,96],[270,600],[128,96],[270,864],[128,96],[400,96],[128,96],[400,216],[128,96],[400,600],[128,96],[400,864],[128,96],[540,96],[128,96],[540,216],[128,96],[540,600],[128,96],[540,864],[128,162],[160,96],[128,162],[160,216],[128,162],[160,600],[128,162],[160,864],[128,162],[270,96],[128,162],[270,216],[128,162],[270,600],[128,162],[270,864],[128,162],[400,96],[128,162],[400,216],[128,162],[400,600],[128,162],[400,864],[128,162],[540,96],[128,162],[540,216],[128,162],[540,600],[128,162],[540,864],[128,240],[160,96],[128,240],[160,216],[128,240],[160,600],[128,240],[160,864],[128,240],[270,96],[128,240],[270,216],[128,240],[270,600],[128,240],[270,864],[128,240],[400,96],[128,240],[400,216],[128,240],[400,600],[128,240],[400,864],[128,240],[540,96],[128,240],[540,216],[128,240],[540,600],[128,240],[540,864],[128,324],[160,96],[128,324],[160,216],[128,324],[160,600],[128,324],[160,864],[128,324],[270,96],[128,324],[270,216],[128,324],[270,600],[128,324],[270,864],[128,324],[400,96],[128,324],[400,216],[128,324],[400,600],[128,324],[400,864],[128,324],[540,96],[128,324],[540,216],[128,324],[540,600],[128,324],[540,864],[162,96],[160,96],[162,96],[160,216],[162,96],[160,600],[162,96],[160,864],[162,96],[270,96],[162,96],[270,216],[162,96],[270,600],[162,96],[270,864],[162,96],[400,96],[162,96],[400,216],[162,96],[400,600],[162,96],[400,864],[162,96],[540,96],[162,96],[540,216],[162,96],[540,600],[162,96],[540,864],[162,162],[160,96],[162,162],[160,216],[162,162],[160,600],[162,162],[160,864],[162,162],[270,96],[162,162],[270,216],[162,162],[270,600],[162,162],[270,864],[162,162],[400,96],[162,162],[400,216],[162,162],[400,600],[162,162],[400,864],[162,162],[540,96],[162,162],[540,216],[162,162],[540,600],[162,162],[540,864],[162,240],[160,96],[162,240],[160,216],[162,240],[160,600],[162,240],[160,864],[162,240],[270,96],[162,240],[270,216],[162,240],[270,600],[162,240],[270,864],[162,240],[400,96],[162,240],[400,216],[162,240],[400,600],[162,240],[400,864],[162,240],[540,96],[162,240],[540,216],[162,240],[540,600],[162,240],[540,864],[162,324],[160,96],[162,324],[160,216],[162,324],[160,600],[162,324],[160,864],[162,324],[270,96],[162,324],[270,216],[162,324],[270,600],[162,324],[270,864],[162,324],[400,96],[162,324],[400,216],[162,324],[400,600],[162,324],[400,864],[162,324],[540,96],[162,324],[540,216],[162,324],[540,600],[162,324],[540,864]]+    f = duty ar (1/5) 0 DoNothing (dseqId 'α' 1 (mce (map mce y)))+    s = varSaw ar f 0 0.9 * lfPulse ar 5 0 0.5+in gVerb (mix s) 99 5 0.5 0.5 15.0 1.0 0.7 0.5 300.0 / 10++---- ; calculation+import Data.List.Split {- split -}+import Sound.Sc3.Lang.Collection {- hsc3-lang -}+x = [[4, 4.5], [2, 3, 5, 6]]+mul_ext p q = take (max (length p) (length q)) (zipWith (*) (cycle p) (cycle q))+dot_x f p q = [f m n | m <- p, n <- q]+mul_dot_x = dot_x mul_ext+chunksOf 2 (map (* 4) (concat (mul_dot_x x (allTuples (mul_dot_x x x)))))++-- Local Variables:+-- truncate-lines:t+-- End:
+ Help/Graph/or-gong.hs view
@@ -0,0 +1,60 @@+-- or ; https://recarteblog.wordpress.com/2021/05/05/gongfm_sc+let ratio1 = rand 0.49 1.11 -- 0.9+    ratio2 = rand 0.17 0.55 -- 0.55+    ratio3 = rand 0.34 1.35 -- 1.03+    index2 = rand 1.33 2 -- 2+    index3 = rand 3.29 5.06 -- 4+    amp = 0.1+    dur = rand 3 9 -- 7+    pan = 0+    mnn = mce [67, 70, 74]+    g = 1+    mk_env l t = envGen kr g 1 0 1 RemoveSynth (envelope l t [])+    env3 = mk_env [0, 1, 1, 0] [0.4, 0.3, dur]+    env2 = mk_env [0, 1, 1, 0] [0, 0.3, dur]+    env1 = mk_env [0, 1, 1, 0] [0.003, 0.3, dur - 0.5]+    op3 = sinOsc ar (midiCps mnn * ratio3) 0 * midiCps mnn * ratio3 * index3 * env3+    op2 = sinOsc ar (midiCps mnn * ratio2 + op3) 0 * midiCps mnn * ratio2 * index2 * env2+    op1 = sinOsc ar (midiCps mnn * ratio1 + op2) 0+in splay (op1 * env1 * amp) 1 1 0 True++-- or ; https://recarteblog.wordpress.com/2021/05/05/gongfm_sc ; id+let ratio1 = randId 'α' 0.49 1.11 -- 0.9+    ratio2 = randId 'β' 0.17 0.55 -- 0.55+    ratio3 = randId 'γ' 0.34 1.35 -- 1.03+    index2 = randId 'δ' 1.33 2 -- 2+    index3 = randId 'ε' 3.29 5.06 -- 4+    amp = 0.1+    dur = randId 'ζ' 3 9 -- 7+    pan = 0+    mnn = mce [67, 70, 74]+    g = 1+    mk_env l t = envGen kr g 1 0 1 RemoveSynth (envelope l t [])+    env3 = mk_env [0, 1, 1, 0] [0.4, 0.3, dur]+    env2 = mk_env [0, 1, 1, 0] [0, 0.3, dur]+    env1 = mk_env [0, 1, 1, 0] [0.003, 0.3, dur - 0.5]+    op3 = sinOsc ar (midiCps mnn * ratio3) 0 * midiCps mnn * ratio3 * index3 * env3+    op2 = sinOsc ar (midiCps mnn * ratio2 + op3) 0 * midiCps mnn * ratio2 * index2 * env2+    op1 = sinOsc ar (midiCps mnn * ratio1 + op2) 0+in splay (op1 * env1 * amp) 1 1 0 True++-- or ; https://recarteblog.wordpress.com/2021/05/05/gongfm_sc ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let ratio1 = x `in_range` (0.49,1.11)+          ratio2 = y `in_range` (0.15,0.55)+          ratio3 = o `in_range` (0.34,1.35)+          index2 = rx `in_range` (1.33,2)+          index3 = ry `in_range` (3.29,5.06)+          amp = latch z g+          dur = y * 6 + 3+          pan = 0+          mnn = mce [67, 70, 74] * (0.5 + x)+          mk_env l t = envGen kr g 1 0 1 DoNothing (envelope l t [])+          env3 = mk_env [0, 1, 1, 0] [0.4, 0.3, dur]+          env2 = mk_env [0, 1, 1, 0] [0, 0.3, dur]+          env1 = mk_env [0, 1, 1, 0] [0.003, 0.3, dur - 0.5]+          op3 = sinOsc ar (midiCps mnn * ratio3) 0 * midiCps mnn * ratio3 * index3 * env3+          op2 = sinOsc ar (midiCps mnn * ratio2 + op3) 0 * midiCps mnn * ratio2 * index2 * env2+          op1 = sinOsc ar (midiCps mnn * ratio1 + op2) 0+      in splay (op1 * env1 * amp) 1 1 0 True+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Graph/pc-thx.hs view
@@ -0,0 +1,29 @@+-- http://ccrma-mail.stanford.edu/pipermail/stk/2007-January/000327.html (pc)+let t4 = 7.9365079365+    rvb i =+      let d = mce [0.0297, 0.0371, 0.0411, 0.0437]+          c = mix (combN i 0.05 d t4 * 0.25)+          f = (allpassN c 0.01 0.005 0.096835)+      in allpassN f 0.01 0.0017 0.032924+    mk_env z0 t0 z1 t1 t2 z2 t3 c =+      let z = [z0, z1, z1, z2, z2]+          t = [t0, t1, t2, t3]+          e = Envelope z t [c, c, c] Nothing Nothing 0+      in envGen kr 1 1 0 1 RemoveSynth e+    mk_saw f0 f1 l =+      let f = mk_env f0 t0 f0 t1 t2 f1 (t3 + t4 + t5 + t5) EnvLin+          g = mk_env 0 t0 0.1 (t1 + t2 + t3) t4 0.0 (t5 + t5) EnvLin+          s = saw ar f+          t0 = 0.035+          t1 = 0.2267573696+          t2 = 2.2675736061+          t3 = 6.8027210884+          t5 = 1.75+      in pan2 s l g+    sig =+      let n = 30+          l = mceChannels (X.randN n (-1) 1)+          f0 = mceChannels (X.randN n 200 800)+          f1 = take n (cycle [29, 87.5, 116, 175, 233, 350, 524, 880, 1048, 1760])+      in sum (zipWith3 mk_saw f0 f1 l)+in rvb sig
+ Help/Graph/pj-forest-sounds-m.hs view
@@ -0,0 +1,14 @@+-- sc-users, 2007-04-06 (pj) [paul jones]+let insects _ =+      let o = sinOsc kr (lfNoise2 kr 50 * 50 + 50) 0 * 100 + 2000+      in bpf (brownNoise ar) o 0.001 * 10+in mceFill 2 insects++-- sc-users, 2007-04-06 (pj) [paul jones] ; monad+uid_st_eval (do+  let insects_m = do+        n1 <- brownNoiseM ar+        n2 <- lfNoise2M kr 50+        let o = sinOsc kr (n2 * 50 + 50) 0 * 100 + 2000+        return (bpf n1 o 0.001 * 10)+  fmap mce (replicateM 2 insects_m))
+ Help/Graph/pmi.hs view
@@ -0,0 +1,12 @@+-- pmi ; texture=overlap,1,2,7,inf+let pm = line kr 0 (rand 0 12) (rand 1 12) DoNothing+in linPan2 (pmOsc ar (rand 0 2000) (rand 0 800) pm 0) (rand2 1) 0.05++-- pmi ; texture=overlap,1,2,7,inf ; id+let n = randId 'α' 1 12+    cf = randId 'β' 0 2000+    mf = randId 'γ' 0 800+    pme = randId 'δ' 0 12+    l = randId 'ε' (-1) 1+    pm = line kr 0 pme n DoNothing+in linPan2 (pmOsc ar cf mf pm 0) l 0.05
+ Help/Graph/rb-hh-808.hs view
@@ -0,0 +1,21 @@+-- hh-808 (rb) - http://www.create.ucsb.edu/pipermail/sc-users/2007-August/036131.html+let time = 250+    fr = [205.35,304.41,369.64,522.71,540.54,812.21]+    env i j k = Envelope i j k Nothing Nothing 0+    pulseEnv = let e = env [1.0,0.6] [time] [EnvNum (-0.5)]+               in envGen ar 1 1 0 (1/1000) DoNothing e+    s = mix (lfPulse ar (mce (map (* 4.09) fr)) 0 0.5)+    f = [\a -> ((a `equal_to` 6.0) * 0.6) ++               ((a `equal_to` 2.0) * 0.2) ++               ((a `equal_to` 1.0) * 0.9)+        ,\a -> (a * pulseEnv) + (mix (lfPulse ar (mce fr) 0 0.55)) * 0.9+        ,\a -> rlpf a 7000 0.6+        ,\a -> rhpf a 6800 1.5+        ,\a -> rhpf a 6800 1.5+        ,\a -> rhpf a 1200 1.5+        ,\a -> a + freeVerb a 0.33 0.5 0.5+        ,\a -> let c = map EnvNum [0,-0.5,0,-50]+                   e = env [0,1,0.4,0,0] [2,time,50,500] c+               in a * envGen ar 1 1 0 (1/1000) RemoveSynth e+        ,\a -> mce [a,delayN a 0.005 0.005]]+in foldl1 (flip (.)) f s * 2
+ Help/Graph/rd-20060909.hs view
@@ -0,0 +1,38 @@+-- diffraction (rd, 2006-09-09)+let diffraction_p _ =+      let x = mouseX kr 0.001 0.02 Exponential 0.1+          y = mouseY kr 120 400 Exponential 0.1+          f = mce2 32 64 * lfNoise0 kr 4+          s = pulse ar f (x * lfNoise0 kr 32)+      in resonz s (y + 0.1 * lfNoise0 kr 2) (lfNoise0 kr 6 * 0.4 + 0.8) * 0.5+    diffraction_q = combN (diffraction_p ()) 0.2 (lfNoise0 kr 128 * 0.1 + 0.1) 3+    diffraction_r =+        let x = mouseX kr 0.75 1.25 Exponential 0.1+            y = mouseY kr 0.25 1 Exponential 0.1+            f _ = sinOsc ar (x * rand 50 59) 0 * y * rand 0.04 0.16+        in mce2 (mixFill 16 f) (mixFill 12 f)+in sum [diffraction_p (),diffraction_q,diffraction_r]++-- diffraction (rd, 2006-09-09) ; monad+uid_st_eval (do+  let diffraction_p = do+        let x = mouseX kr 0.001 0.02 Exponential 0.1+            y = mouseY kr 120 400 Exponential 0.1+        f <- fmap (* mce2 32 64) (lfNoise0M kr 4)+        w <- fmap (* x) (lfNoise0M kr 32)+        z <- fmap (* 0.1) (lfNoise0M kr 2)+        m <- lfNoise0M kr 6+        let s = pulse ar f w+        return (resonz s (y + z) (m * 0.4 + 0.8) * 0.5)+      diffraction_q = do+        n <- lfNoise0M kr 128+        s <- diffraction_p+        return (combN s 0.2 (n * 0.1 + 0.1) 3)+      diffraction_r =+        let x = mouseX kr 0.75 1.25 Exponential 0.1+            y = mouseY kr 0.25 1 Exponential 0.1+            f _ = do fr <- fmap (* x) (randM 50 59)+                     am <- fmap (* y) (randM 0.04 0.16)+                     return (sinOsc ar fr 0 * am)+        in liftM2 mce2 (mixFillM 16 f) (mixFillM 12 f)+  fmap sum (sequence [diffraction_p,diffraction_q,diffraction_r]))
+ Help/Graph/rd-20060910.hs view
@@ -0,0 +1,20 @@+-- rzblp-u (rd)+let lfn f l r = range l r (lfNoise0 kr f)+    hpb q =+      let g _ = let f = lfn q 1330 1395+                    a = lfn q 0.001 0.007+                in blip ar f 24 * a+      in mixFill 2 g+    mk d =+      let q = lfn 5.2 5.2 5.21+          a = d dinf (mce [1,3,2,7,8])+          tr = impulse kr q 0+          freq = demand tr 0 a * 30 + 340+      in sum [blip ar freq 3 * lfn q 0.001 0.01+             ,resonz (impulse ar q (mce2 0 0))+               (lfn 5 30 640)+               (lfn q 0.1 0.5)+               * lfn q 0.01 1.8+             ,hpb q * lfn q 1.2 1.8+             ,blip ar (lfn q 16 36) 3 * mce2 0.03 0.09]+in mk drand + mk dxrand
+ Help/Graph/rd-20060911.hs view
@@ -0,0 +1,21 @@+-- cut-outs (rd, 2006-09-11)+let t = impulse ar 22 0 * (sinOsc kr 0.5 0 + 1)+    x = mouseX kr 0.005 0.12 Exponential 0.1+    y = mouseY kr 0.01 0.52 Exponential 0.1+    n _ = ringz (coinGate (0.05 + lfNoise0 kr 2 + y * 0.4 + t * 0.5) (t * 0.5)) (tExpRand (mce2 500 900) 1600 t) x+    s = mixFill 3 n+    b = tRand 0 1 (dust kr 8)+in mrg [clip2 s (in' 1 kr 0) * 0.25,out 0 b]++-- cut-outs (rd, 2006-09-11) ; monad+uid_st_eval (do+  let t = impulse ar 22 0 * (sinOsc kr 0.5 0 + 1)+      x = mouseX kr 0.005 0.12 Exponential 0.1+      y = mouseY kr 0.01 0.52 Exponential 0.1+      n = do n1 <- lfNoise0M kr 2+             n2 <- coinGateM (0.05 + n1 + y * 0.4 + t * 0.5) (t * 0.5)+             n3 <- tExpRandM (mce2 500 900) 1600 t+             return (ringz n2 n3 x)+  s <- fmap sum (sequence (replicate 3 n))+  b <- tRandM 0 1 =<< dustM kr 8+  return (mrg [clip2 s (in' 1 kr 0) * 0.25,out 0 b]))
+ Help/Graph/rd-20060914.hs view
@@ -0,0 +1,30 @@+-- chrd (rd, 2006-09-14)+let chrd _ =+      let m = mce [60, 65, 72, 77, 79, 84]+          d = mce (map (* 3) [5, 4, 5, 7, 4, 5])+          f = midiCps (xLine kr m (m + rand 0.05 0.5) d DoNothing)+          z = envTrapezoid 0 (rand 0.15 0.35) d (rand 0.005 0.01)+          e = envGen kr 1 1 0 1 DoNothing z+          p = xLine kr (rand2 1) (rand2 1) d DoNothing+      in mix (pan2 (fSinOsc ar f 0) p e)+in mixFill 9 chrd++-- chrd (rd, 2006-09-14) ; monad+uid_st_eval (do+  let chrd_m = do+        r0 <- randM 0.05 0.5+        r1 <- randM (-1) 1+        r2 <- randM (-1) 1+        r3 <- randM 0.15 0.35+        r4 <- randM 0.005 0.01+        let m = mce [60, 65, 72, 77, 79, 84]+            ds = 3+            d = mce (map (* ds) [5, 4, 5, 7, 4, 5])+            f = midiCps (xLine kr m (m + r0) d DoNothing)+            z = envTrapezoid 0 r3 d r4+            e = envGen kr 1 1 0 1 DoNothing z+            p = xLine kr r1 r2 d DoNothing+            o = fSinOsc ar f 0+        return (mix (pan2 o p e))+  chrd_9 <- replicateM 9 chrd_m+  return (sum chrd_9))
+ Help/Graph/rd-20060918.hs view
@@ -0,0 +1,45 @@+-- shifting pulses (rd, 2006-09-18)+let prt a f =+      let f' = f * linLin_b (sinOsc kr (rand 0.2 0.9) 0) 1 1.01 * rand 0.95 1.05+      in sinOsc ar (mce2 f f') 0 * a * mceFill 2 (\_ -> rand 0.95 1.05)+    prts n f a = sum (map (prt a) [f,f + f .. f * n])+    fmt = formant ar (mce2 20 21) (linLin_b (lfNoise2 kr 2) 10 100) 200 * 0.35+    pulses =+      let t = dust kr 0.75+          warp i = linLin i (-1) 1+          p = pulse ar (warp (mceFill 2 (\_ -> brownNoise kr)) 2 (mce2 11 15)) 0.01 * 0.1+          f = warp (mceFill 2 (\_ -> brownNoise kr)) 90 300+          rq = warp (mceFill 2 (\_ -> brownNoise kr)) 2 9+      in mrg2 (latch t t * rlpf p f rq) (sendTrig t 0 t)+in prts 2 900 0.008 + prts 9 40 0.022 + fmt + pulses++-- shifting pulses (rd, 2006-09-18) ; monad+uid_st_eval (do+  let prt a f = do+        r0 <- randM 0.2 0.9+        r1 <- randM 0.95 1.05+        r2 <- replicateM 2 (randM 0.95 1.05)+        let f' = f * linLin_b (sinOsc kr r0 0) 1 1.01 * r1+            a' = a * mce r2+            o = sinOsc ar (mce2 f f') 0+        return (o * a')+  let prts n f a = fmap sum (mapM (prt a) [f,f + f .. f * n])+  let fmt = do+        n <- lfNoise2M kr 2+        return (formant ar (mce2 20 21) (linLin_b n 10 100) 200 * 0.35)+  let pulses = do+        n0 <- replicateM 2 (brownNoiseM kr)+        n1 <- replicateM 2 (brownNoiseM kr)+        n2 <- replicateM 2 (brownNoiseM kr)+        t <- dustM kr 0.75+        let warp i = linLin i (-1) 1+            l = latch t t+            p = pulse ar (warp (mce n0) 2 (mce2 11 15)) 0.01 * 0.1+            f = warp (mce n1) 90 300+            rq = warp (mce n2) 2 9+        return (mrg2 (l * rlpf p f rq) (sendTrig t 0 t))+  p1 <- prts 2 900 0.008+  p2 <- prts 9 40 0.022+  f <- fmt+  s <- pulses+  return (p1 + p2 + f + s))
+ Help/Graph/rd-20060921.hs view
@@ -0,0 +1,37 @@+-- wial (rd, 2006-09-21)+let pls c d f = let t = pulseDivider c d 0+                    e = decay2 t 0.05 0.75+                    o = sinOsc ar (toggleFF t * f + f * 2) 0+                in o * e * tiRand 0 1 t * 0.5+    smpl f = [(4,6,f,0.0075)+             ,(2,6,f * 2,0.0175)+             ,(1,2,f * 16,0.025)+             ,(1,5,f * 64,0.005)+             ,(1,4,f * 128,0.035)+             ,(1,3,f * 256,0.15)+             ,(2,3,f * 512,0.35)]+    plss c (d0,d1,f,a) = pls c (mce2 d0 d1) f * a+    clk = impulse ar 16 0+    f = tWChoose (dust kr 2) (mce2 (20 * 0.66) 20) (mce2 0.25 0.75) 0+in sum (map (plss clk) (smpl f))++-- wial (rd, 2006-09-21) ; monad+let wial_m = do+      let pls c d f = do let t = pulseDivider c d 0+                             e = decay2 t 0.05 0.75+                             o = sinOsc ar (toggleFF t * f + f * 2) 0+                         n0 <- tiRandM 0 1 t+                         return (o * e * n0 * 0.5)+          smpl f = [(4,6,f,0.0075)+                   ,(2,6,f * 2,0.0175)+                   ,(1,2,f * 16,0.025)+                   ,(1,5,f * 64,0.005)+                   ,(1,4,f * 128,0.035)+                   ,(1,3,f * 256,0.15)+                   ,(2,3,f * 512,0.35)]+          plss c (d0,d1,f,a) = fmap (* a) (pls c (mce2 d0 d1) f)+          clk = impulse ar 16 0+      n0 <- dustM kr 2+      f <- tWChooseM n0 (mce2 (20 * 0.66) 20) (mce2 0.25 0.75) 0+      fmap sum (mapM (plss clk) (smpl f))+in uid_st_eval wial_m
+ Help/Graph/rd-20060925.hs view
@@ -0,0 +1,31 @@+-- mouse clatter (rd, 2006-09-25)+let x = mouseX kr 100 12000 Linear 0.1+    y = mouseY kr 0.01 0.15 Linear 0.1+    n1 = lfNoise0 kr (mce [3,3.25])+    t = impulse kr (n1 * 16 + 18) 0+    n2 = tRand 0.005 y t+    n3 = whiteNoise ar+    n4 = tRand 10 x t+    n5 = tRand 0 1 t+    n6 = tExpRand 0.15 1 t+    o = let e = decay2 t 0.01 n2+        in bpf (n3 * e) n4 n5+    c = X.pv_SplitAlloc (fftAlloc 2048 o 0.5 0 1 0)+    n7 = pv_RandComb c n6 t+in mix (o * 0.05 + ifft n7 0 0)++-- mouse clatter (rd, 2006-09-25) ; id+let x = mouseX kr 100 12000 Linear 0.1+    y = mouseY kr 0.01 0.15 Linear 0.1+    n1 = lfNoise0Id 'α' kr (mce [3,3.25])+    t = impulse kr (n1 * 16 + 18) 0+    n2 = tRandId 'β' 0.005 y t+    n3 = whiteNoiseId 'γ' ar+    n4 = tRandId 'δ' 10 x t+    n5 = tRandId 'ε' 0 1 t+    n6 = tExpRandId 'ζ' 0.15 1 t+    o = let e = decay2 t 0.01 n2+        in bpf (n3 * e) n4 n5+    c = X.pv_SplitAllocId 'η' (fftAllocId 'θ' 2048 o 0.5 0 1 0)+    n7 = pv_RandCombId 'ι' c n6 t+in mix (o * 0.05 + ifft n7 0 0)
+ Help/Graph/rd-20060928.hs view
@@ -0,0 +1,35 @@+-- f-lets (rd. 2006-09-28)+let f_let t g j n f =+      let pd = pulseDivider t j 0+      in formlet pd (f * tiRand (mce2 2 1) n pd) (tRand 0.01 0.04 pd) (tRand 0.05 0.10 pd) * g+    mk_n t =+      sum [f_let t 0.15 2 9 (mce2 200 400)+          ,f_let t 0.25 2 9 (mce2 (200 + tRand 0 1 t) (400 + tRand 0 1 t))+          ,f_let t 0.05 4 5 (mce2 25 50)+          ,f_let t 0.15 4 5 (mce2 (25 + tRand 0 1 t) (50 + tRand 0 1 t))+          ,f_let t 0.5 1 16 (mce2 300 600) * latch (coinGate 0.2 t) t]+in mk_n (impulse ar 24 0) * (lfNoise0 kr 2 * 0.25 + 0.25)++-- f-lets (rd. 2006-09-28) ; monad+uid_st_eval (do+  let f_let t g j n f = do+           let pd = pulseDivider t j 0+           r0 <- tiRandM (mce2 2 1) n pd+           r1 <- tRandM 0.01 0.04 pd+           r2 <- tRandM 0.05 0.10 pd+           return (formlet pd (f * r0) r1 r2 * g)+      mk_n t = do+           r0 <- tRandM 0 1 t+           r1 <- tRandM 0 1 t+           r2 <- tRandM 0 1 t+           r3 <- tRandM 0 1 t+           r4 <- coinGateM 0.2 t+           sequence [f_let t 0.15 2 9 (mce2 200 400)+                    ,f_let t 0.25 2 9 (mce2 (200 + r0) (400 + r1))+                    ,f_let t 0.05 4 5 (mce2 25 50)+                    ,f_let t 0.15 4 5 (mce2 (25 + r2) (50 + r3))+                    ,let lr = fmap (* latch r4 t)+                     in lr (f_let t 0.5 1 16 (mce2 300 600))]+      tr = impulse ar 24 0+  n <- lfNoise0M kr 2+  return . (* (n * 0.25 + 0.25)) . sum =<< mk_n tr)
+ Help/Graph/rd-20061007.hs view
@@ -0,0 +1,23 @@+-- ccomb (rd, 2006-10-07)+let lwr = 48+    spart t _ = let n = range lwr 72.0 (lfNoise2 kr 0.1)+                    e = decay2 t 0.01 (tRand 0.05 0.75 t)+                    x = e * whiteNoise ar+                    f = lag (midiCps n) 0.25+                in combC x (recip (midiCps lwr)) (recip f) (range 1 8 (lfNoise2 kr 0.1))+    t = dust kr (mce2 0.75 0.35)+in mixFill 12 (spart t) * 0.01++-- ccomb (rd, 2006-10-07) ; monad+uid_st_eval (do+  let lwr = 48+      flwr = midiCps lwr+      spart t = do n <- fmap (range lwr 72.0) (lfNoise2M kr 0.1)+                   e <- fmap (decay2 t 0.01) (tRandM 0.05 0.75 t)+                   x <- fmap (* e) (whiteNoiseM ar)+                   m <- lfNoise2M kr 0.1+                   let f = lag (midiCps n) 0.25+                       m' = range 1 8 m+                   return (combC x (recip flwr) (recip f) m')+  t <- dustM kr (mce2 0.75 0.35)+  return . (* 0.01) . sum =<< sequence (replicate 12 (spart t)))
+ Help/Graph/rd-20061008.hs view
@@ -0,0 +1,31 @@+-- s-chirp (rd, 2006-10-08)+let x = mouseX kr 15 0 Linear 0.1+    y = mouseY kr 15 27 Linear 0.1+    t = dust kr 9+    b = tChoose t (mce [36,48,60,72])+    n = lfNoise1 kr (mce2 3 3.05) * 0.04+    d = tiRand x y t+    e = decay2 t 0.005 (tRand 0.02 0.15 t)+    k = degreeToKey (asLocalBuf [0,2,3.2,5,7,9,10]) d 12+    f = midiCps (b + k + n)+    m = e * sinOsc ar f 0 * 0.2+    u = pulseDivider t 9 0+    r0 = tRand 0.0075 0.125 u+    r1 = tRand 0.05 0.15 u+in m * 0.5 + allpassC m 0.15 r0 r1++-- s-chirp (rd, 2006-10-08) ; id+let x = mouseX kr 15 0 Linear 0.1+    y = mouseY kr 15 27 Linear 0.1+    t = dustId 'α' kr 9+    b = tChooseId 'β' t (mce [36,48,60,72])+    n = lfNoise1Id 'γ' kr (mce2 3 3.05) * 0.04+    d = tiRandId 'δ' x y t+    e = decay2 t 0.005 (tRandId 'ε' 0.02 0.15 t)+    k = degreeToKey (asLocalBufId 'a' [0,2,3.2,5,7,9,10]) d 12+    f = midiCps (b + k + n)+    m = e * sinOsc ar f 0 * 0.2+    u = pulseDivider t 9 0+    r0 = tRandId 'ζ' 0.0075 0.125 u+    r1 = tRandId 'η' 0.05 0.15 u+in m * 0.5 + allpassC m 0.15 r0 r1
+ Help/Graph/rd-20061015.hs view
@@ -0,0 +1,33 @@+-- discretion (rd, 2006-10-15)+let mkls bp t = envGen kr 1 1 0 1 RemoveSynth (envCoord bp t 1 EnvLin)+    part _ = let t = 21+                 f = mkls [(0,X.randN 2 50 55),(0.33,X.randN 2 50 65),(1,X.randN 2 50 55)] t+                 a = mkls [(0,0),(0.33,X.randN 2 0.01 0.035),(1,0)] t+             in (saw ar f * a)+in mixFill 8 part++-- discretion (rd, 2006-10-15) ; id+let mkls bp t = envGen kr 1 1 0 1 RemoveSynth (envCoord bp t 1 EnvLin)+    part z _ = let f1 = X.randNId 2 (z,'α') 50 55+                   f2 = X.randNId 2 (z,'β') 50 65+                   f3 = X.randNId 2 (z,'γ') 50 55+                   a = X.randNId 2 (z,'δ') 0.01 0.035+                   t = 21+                   f_ = mkls [(0,f1),(0.33,f2),(1,f3)] t+                   a_ = mkls [(0,0),(0.33,a),(1,0)] t+               in (saw ar f_ * a_)+in mixFillId 'ε' 8 part++-- discretion (rd, 2006-10-15) ; monad+uid_st_eval (do+  let clone n = fmap mce . replicateM n+      mkls bp t = envGen kr 1 1 0 1 RemoveSynth (envCoord bp t 1 EnvLin)+      part = do f1 <- clone 2 (randM 50 55)+                f2 <- clone 2 (randM 50 65)+                f3 <- clone 2 (randM 50 55)+                a <- clone 2 (randM 0.01 0.035)+                let t = 21+                    f_ = mkls [(0,f1),(0.33,f2),(1,f3)] t+                    a_ = mkls [(0,0),(0.33,a),(1,0)] t+                return (saw ar f_ * a_)+  fmap mix (clone 8 part))
+ Help/Graph/rd-20061017.hs view
@@ -0,0 +1,328 @@+-- crotale (rd, 2006-10-17) ; id+let crotale_data =+      ([35.45+       ,128.59+       ,346.97+       ,483.55+       ,1049.24+       ,1564.02+       ,1756.33+       ,3391.66+       ,3451.80+       ,3497.26+       ,3596.89+       ,3696.73+       ,3835.23+       ,3845.95+       ,4254.85+       ,4407.53+       ,4415.26+       ,4552.86+       ,5538.07+       ,5637.73+       ,5690.29+       ,5728.00+       ,5764.27+       ,5824.41+       ,6377.60+       ,6544.35+       ,6807.14+       ,6994.97+       ,7026.84+       ,7144.58+       ,7269.61+       ,7393.67+       ,7897.25+       ,8040.45+       ,8157.77+       ,8225.01+       ,9126.15+       ,9488.52+       ,9916.40+       ,10155.59+       ,11715.95+       ,12111.83+       ,12339.99+       ,12417.66+       ,12459.28+       ,12618.33+       ,13116.49+       ,13201.12+       ,13297.83+       ,13533.75]+      ,[0.001282+       ,0.000804+       ,0.017361+       ,0.004835+       ,0.004413+       ,0.004110+       ,0.000333+       ,0.003614+       ,0.006919+       ,0.000322+       ,0.000603+       ,0.066864+       ,0.000605+       ,0.003602+       ,0.000283+       ,0.015243+       ,0.020536+       ,0.016677+       ,0.000924+       ,0.202050+       ,0.001254+       ,0.012705+       ,0.000252+       ,0.000486+       ,0.000642+       ,0.000776+       ,0.208116+       ,0.002491+       ,0.001934+       ,0.005231+       ,0.006924+       ,0.001203+       ,0.205002+       ,0.040604+       ,0.003834+       ,0.002189+       ,0.180560+       ,0.002192+       ,0.006516+       ,0.009982+       ,0.004745+       ,0.046154+       ,0.000510+       ,0.001890+       ,0.001978+       ,0.006729+       ,0.002342+       ,0.002400+       ,0.035155+       ,0.001408]+      ,[5.203680+       ,1.703434+       ,40.165168+       ,27.282501+       ,0.895052+       ,42.847427+       ,2.660366+       ,15.767886+       ,6.848367+       ,3.232500+       ,1.734338+       ,2.020241+       ,4.727905+       ,9.400103+       ,0.710251+       ,37.494625+       ,36.248794+       ,29.172658+       ,3.891019+       ,4.757885+       ,3.851426+       ,20.907810+       ,3.732874+       ,2.383410+       ,10.443285+       ,8.795611+       ,20.985643+       ,18.011800+       ,25.297883+       ,14.819819+       ,42.391899+       ,2.948513+       ,11.043763+       ,49.551651+       ,29.882694+       ,10.527188+       ,23.557245+       ,26.555616+       ,45.099605+       ,22.550390+       ,36.461261+       ,11.826201+       ,16.818185+       ,14.903121+       ,32.811138+       ,43.138904+       ,12.289558+       ,11.498942+       ,10.465788+       ,24.931695])+    (cf,ca,cd) = crotale_data+    ps = mce [-12,-5,0,2,4,5,7,12]+    t = dust kr 3+    fs = select (tiRand 0 7 t) ps+    s = decay2 t 0.06 0.01 * pinkNoise ar * tRand 0 1 t+    ks = klankSpec_k cf ca (map recip cd)+    k = dynKlank s (midiRatio fs) (tRand 0 1 t) (tRand 2 7 t) ks+in pan2 k (tRand (-1) 1 t) 1++-- crotale (rd, 2006-10-17) ; id+let crotale_data =+      ([35.45+       ,128.59+       ,346.97+       ,483.55+       ,1049.24+       ,1564.02+       ,1756.33+       ,3391.66+       ,3451.80+       ,3497.26+       ,3596.89+       ,3696.73+       ,3835.23+       ,3845.95+       ,4254.85+       ,4407.53+       ,4415.26+       ,4552.86+       ,5538.07+       ,5637.73+       ,5690.29+       ,5728.00+       ,5764.27+       ,5824.41+       ,6377.60+       ,6544.35+       ,6807.14+       ,6994.97+       ,7026.84+       ,7144.58+       ,7269.61+       ,7393.67+       ,7897.25+       ,8040.45+       ,8157.77+       ,8225.01+       ,9126.15+       ,9488.52+       ,9916.40+       ,10155.59+       ,11715.95+       ,12111.83+       ,12339.99+       ,12417.66+       ,12459.28+       ,12618.33+       ,13116.49+       ,13201.12+       ,13297.83+       ,13533.75]+      ,[0.001282+       ,0.000804+       ,0.017361+       ,0.004835+       ,0.004413+       ,0.004110+       ,0.000333+       ,0.003614+       ,0.006919+       ,0.000322+       ,0.000603+       ,0.066864+       ,0.000605+       ,0.003602+       ,0.000283+       ,0.015243+       ,0.020536+       ,0.016677+       ,0.000924+       ,0.202050+       ,0.001254+       ,0.012705+       ,0.000252+       ,0.000486+       ,0.000642+       ,0.000776+       ,0.208116+       ,0.002491+       ,0.001934+       ,0.005231+       ,0.006924+       ,0.001203+       ,0.205002+       ,0.040604+       ,0.003834+       ,0.002189+       ,0.180560+       ,0.002192+       ,0.006516+       ,0.009982+       ,0.004745+       ,0.046154+       ,0.000510+       ,0.001890+       ,0.001978+       ,0.006729+       ,0.002342+       ,0.002400+       ,0.035155+       ,0.001408]+      ,[5.203680+       ,1.703434+       ,40.165168+       ,27.282501+       ,0.895052+       ,42.847427+       ,2.660366+       ,15.767886+       ,6.848367+       ,3.232500+       ,1.734338+       ,2.020241+       ,4.727905+       ,9.400103+       ,0.710251+       ,37.494625+       ,36.248794+       ,29.172658+       ,3.891019+       ,4.757885+       ,3.851426+       ,20.907810+       ,3.732874+       ,2.383410+       ,10.443285+       ,8.795611+       ,20.985643+       ,18.011800+       ,25.297883+       ,14.819819+       ,42.391899+       ,2.948513+       ,11.043763+       ,49.551651+       ,29.882694+       ,10.527188+       ,23.557245+       ,26.555616+       ,45.099605+       ,22.550390+       ,36.461261+       ,11.826201+       ,16.818185+       ,14.903121+       ,32.811138+       ,43.138904+       ,12.289558+       ,11.498942+       ,10.465788+       ,24.931695])+    (cf,ca,cd) = crotale_data+    ps = mce [-12,-5,0,2,4,5,7,12]+    n = pinkNoiseId 'α' ar+    t = dustId 'β' kr 3+    fs = select (tiRandId 'γ' 0 7 t) ps+    g = tRandId 'δ' 0 1 t+    fo = tRandId 'ε' 0 1 t+    ds = tRandId 'ζ' 2 7 t+    p = tRandId 'η' (-1) 1 t+    s = decay2 t 0.06 0.01 * n * g+    ks = klankSpec_k cf ca (map recip cd)+    k = dynKlank s (midiRatio fs) fo ds ks+in pan2 k p 1++
+ Help/Graph/rd-20061022.hs view
@@ -0,0 +1,27 @@+-- seqr (rd)+let nrand n l = mceChannels . X.randN n l+    nfreq n l r = map (midiCps . floorE) (nrand n l r)+    seqr_f f e =+      let n = constant (length e `div` 2)+      in select (lfSaw kr f 0 * n + n) (mce e)+    seqr n =+      let f = rand 9 18 / constant n+          fr = mce2 (seqr_f f (nfreq n 72 96)) (seqr_f f (nfreq n 72 84))+          nh = mce2 (seqr_f f (nrand n 1 3)) (seqr_f f (nrand n 3 6))+      in blip ar fr nh * mce2 (seqr_f f (nrand n 0.05 0.10)) (seqr_f f (nrand n 0.05 0.15))+in seqr 12++-- seqr (rd) ; id+let nrand n e l = mceChannels . X.randNId n e l+    nfreq z n l r = map (midiCps . floorE) (nrand n z l r)+    seqr_f f e =+      let n = constant (length e `div` 2)+      in select (lfSaw kr f 0 * n + n) (mce e)+    seqr n =+      let f = randId 'α' 9 18 / constant n+          fr = mce2 (seqr_f f (nfreq 'β' n 72 96)) (seqr_f f (nfreq 'γ' n 72 84))+          nh = mce2 (seqr_f f (nrand n 'δ' 1 3)) (seqr_f f (nrand n 'ε' 3 6))+          b = blip ar fr nh+          a = mce2 (seqr_f f (nrand n 'ζ' 0.05 0.10)) (seqr_f f (nrand n 'η' 0.05 0.15))+      in b * a+in seqr 12
+ Help/Graph/rd-20061028.hs view
@@ -0,0 +1,25 @@+-- xy-interference (rd, 2006-10-28)+let x = mouseX kr 20 22000 Linear (mce2 0.005 0.025)+    y = mouseY kr 20 22000 Linear (mce2 0.005 0.075)+    nd _ = sinOsc ar (x + lfNoise0 kr (mce2 5 9)) 0 * sinOsc ar y 0+in mixFill 3 nd * 0.5++-- xy-interference (rd, 2006-10-28) ; monad+let xy_interference_m = do+      let x = mouseX kr 20 22000 Linear (mce2 0.005 0.025)+          y = mouseY kr 20 22000 Linear (mce2 0.005 0.075)+          nd = do n <- lfNoise0M kr (mce2 5 9)+                  let a = sinOsc ar (x + n) 0+                      b = sinOsc ar y 0+                  return (a * b)+      fmap sum_opt (sequence (replicate 3 nd))+in uid_st_eval xy_interference_m * 0.5++-- xy-interference (rd, 2006-10-28) ; id+let x = mouseX kr 20 22000 Linear (mce2 0.005 0.025)+    y = mouseY kr 20 22000 Linear (mce2 0.005 0.075)+    nd z _ = let n = lfNoise0Id (z,'α') kr (mce2 5 9)+                 a = sinOsc ar (x + n) 0+                 b = sinOsc ar y 0+             in a * b+in mixFillId 'β' 3 nd
+ Help/Graph/rd-20061030.hs view
@@ -0,0 +1,33 @@+-- three-cpsw (rd, 2006-10-30)+let t = dust kr (mce2 12 18)+    f0 = tRand 1 64 t+    f1 = lfNoise0 kr f0+    a = tRand 0.0 0.5 t+    dt = tRand 0.975 1.025 t+    dh = tRand 0.750 0.7505 t+    f = f1 * mce2 9000 12000 + 9500+    o = saw ar f + saw ar (f * dh) + saw ar (f * dt)+in clip2 (o * a) 0.75 * 0.15++-- three-cpsw (rd, 2006-10-30) ; id+let t = dustId 'α' kr (mce2 12 18)+    f0 = tRandId 'β' 1 64 t+    f1 = lfNoise0Id 'γ' kr f0+    a = tRandId 'δ' 0.0 0.5 t+    dt = tRandId 'ε' 0.975 1.025 t+    dh = tRandId 'ζ' 0.750 0.7505 t+    f = f1 * mce2 9000 12000 + 9500+    o = saw ar f + saw ar (f * dh) + saw ar (f * dt)+in clip2 (o * a) 0.75 * 0.15++-- three-cpsw (rd, 2006-10-30) ; monad+uid_st_eval (do+  t <- dustM kr (mce2 12 18)+  f0 <- tRandM 1 64 t+  f1 <- lfNoise0M kr f0+  a <- tRandM 0.0 0.5 t+  dt <- tRandM 0.975 1.025 t+  dh <- tRandM 0.750 0.7505 t+  let f = f1 * mce2 9000 12000 + 9500+      o = saw ar f + saw ar (f * dh) + saw ar (f * dt)+  return (clip2 (o * a) 0.75 * 0.15))
+ Help/Graph/rd-20070423.hs view
@@ -0,0 +1,39 @@+-- eggcrate (rd, 2007-04-23)+let cosu = cos . (* pi)+    sinu = sin . (* pi)+    eggcrate_f u v = cosu u * sinu v+    p = mce [64,72,96,128,256,6400,7200,8400,9600]+    dup f = (f (),f ())+    (x,y) = dup (\_ -> brownNoise kr)+    t = dust kr 2.4+    (f0,f1) = dup (\_ -> tChoose t p)+    f = linLin_b (eggcrate_f x y) f0 f1+    a = linLin_b x 0 0.1+in pan2 (mix (sinOsc ar f 0)) y a++-- eggcrate (rd, 2007-04-23) ; id+let cosu = cos . (* pi)+    sinu = sin . (* pi)+    eggcrate_f u v = cosu u * sinu v+    p = mce [64,72,96,128,256,6400,7200,8400,9600]+    bimap f (i,j) = (f i,f j)+    (x,y) = bimap (`brownNoiseId` kr) ('α','β')+    t = dustId 'γ' kr 2.4+    (f0,f1) = bimap (\z -> tChooseId z t p) ('δ','ε')+    f = linLin_b (eggcrate_f x y) f0 f1+    a = linLin_b x 0 0.1+in pan2 (mix (sinOsc ar f 0)) y a++-- eggcrate (rd, 2007-04-23) ; monad+uid_st_eval (do+  let cosu = cos . (* pi)+      sinu = sin . (* pi)+      eggcrate_f u v = cosu u * sinu v+      p = mce [64,72,96,128,256,6400,7200,8400,9600]+      clone2 x = x >>= \y1 -> x >>= \y2 -> return (y1,y2)+  (x,y) <- clone2 (brownNoiseM kr)+  t <- dustM kr 2.4+  (f0,f1) <- clone2 (tChooseM t p)+  let f = linLin_b (eggcrate_f x y) f0 f1+      a = linLin_b x 0 0.1+  return (pan2 (mix (sinOsc ar f 0)) y a))
+ Help/Graph/rd-lg-timed.hs view
@@ -0,0 +1,29 @@+-- lg-timed (rd)+let timed r y p =+      let t = tDuty ar (dcons 0 (dser r p)) 0 RemoveSynth (dser r y) 1+      in latch t t+    lg u = lag u 0.03+    n = mce [52,76,66,67,68,69]+    a = mce [0.35,0.15,0.04,0.05,0.16,0.07]+    d = mce [0.1,0.5,0.09,0.08,0.07,0.3]+    x = mouseX kr 0.5 1.25 Linear 0.2+    tn = lg (timed dinf n (d * x))+    ta = lg (timed dinf a (d * x))+in sinOsc ar (midiCps tn) 0 * ta++-- lg-timed (rd) ; monad+uid_st_eval (do+  let timed r y p =+          do d0 <- dserM r p+             d1 <- dconsM 0 d0+             d2 <- dserM r y+             let t = tDuty ar d1 0 RemoveSynth d2 1+             return (latch t t)+      lg u = return (lag u 0.03)+      n = mce [52,76,66,67,68,69]+      a = mce [0.35,0.15,0.04,0.05,0.16,0.07]+      d = mce [0.1,0.5,0.09,0.08,0.07,0.3]+      x = mouseX kr 0.5 1.25 Linear 0.2+  tn <- lg =<< timed dinf n (d * x)+  ta <- lg =<< timed dinf a (d * x)+  return (sinOsc ar (midiCps tn) 0 * ta))
+ Help/Graph/rd-tgrn.hs view
@@ -0,0 +1,24 @@+-- tgrn (rd)+let b = control kr "buf" 0+    trate = mouseY kr 2 120 Exponential 0.1+    dur = 1.2 / trate+    clk = impulse ar trate 0+    pos = mouseX kr 0 (bufDur kr b) Linear 0.1+    pan = whiteNoise kr * 0.6+    n = roundTo (whiteNoise kr * 3) 1+    rate = shiftLeft 1.2 n+in tGrains 2 clk b rate pos dur pan 0.5 2++-- tgrn (rd) ; id+let b = control kr "buf" 0+    trate = mouseY kr 2 120 Exponential 0.1+    dur = 1.2 / trate+    clk = impulse ar trate 0+    pos = mouseX kr 0 (bufDur kr b) Linear 0.1+    pan = whiteNoiseId 'α' kr * 0.6+    n = roundTo (whiteNoiseId 'β' kr * 3) 1+    rate = shiftLeft 1.2 n+in tGrains 2 clk b rate pos dur pan 0.5 2++---- ; load sndfile+withSc3 (async (b_allocRead 0 "/home/rohan/sw/hsc3-graphs/snd/2006-10-05.snd" 0 0))
+ Help/Graph/rd-trmlo.hs view
@@ -0,0 +1,73 @@+-- trmlo-u (rd)+let mWrp i l r = linLin_b i (midiCps l) (midiCps r)+    mWrp1 i m = mWrp i m (m + 1)+    mWrpN i m n = mWrp i m (m + n)+    o1 = let f = 5+             d = 3+             s = envSine d 0.1+             e = envGen kr 1 1 0 1 DoNothing s+             n = 65+             m = sinOsc kr f 0+         in pan2 (sinOsc ar (mWrp1 m n) 0) m e+    o2 = let f = iRand 5 9+             d = iRand 5 9+             s = envSine d (rand 0.1 0.2)+             e = envGen kr 1 1 0 1 DoNothing s+             n = iRand 69 72+             m = sinOsc kr f 0+         in pan2 (sinOsc ar (mWrp1 m n) 0) m e+    o3 = let f = iRand 5 9+             d = iRand 9 12+             s = envSine d (rand 0.1 0.2)+             e = envGen kr 1 1 0 1 DoNothing s+             n = iRand 69 72+             m = sinOsc kr f 0+             l = line kr 0 (iRand 1 5) d DoNothing+         in pan2 (blip ar (mWrp1 m (n + l)) (linLin_b m 1 2)) m e+    o4 = let f = iRand 5 18+             d = iRand 12 15+             s = envSine d (rand 0.1 0.2)+             e = envGen kr 1 5e-2 0 1 DoNothing s+             n = iRand 69 72+             m = sinOsc kr f 0+             l = line kr 0 (iRand 1 5) d RemoveSynth+             fr = mWrpN m (n + l) (iRand 1 5)+         in pan2 (blip ar fr (linLin_b m 1 (iRand 2 24))) m e+in o1 + o2 + o3 + o4++-- trmlo ; id+let mWrp i l r = linLin_b i (midiCps l) (midiCps r)+    mWrp1 i m = mWrp i m (m + 1)+    mWrpN i m n = mWrp i m (m + n)+    o1 = let f = 5+             d = 3+             s = envSine d 0.1+             e = envGen kr 1 1 0 1 DoNothing s+             n = 65+             m = sinOsc kr f 0+         in pan2 (sinOsc ar (mWrp1 m n) 0) m e+    o2 = let f = iRandId 'α' 5 9+             d = iRandId 'β' 5 9+             s = envSine d (randId 'γ' 0.1 0.2)+             e = envGen kr 1 1 0 1 DoNothing s+             n = iRandId 'δ' 69 72+             m = sinOsc kr f 0+         in pan2 (sinOsc ar (mWrp1 m n) 0) m e+    o3 = let f = iRandId 'ε' 5 9+             d = iRandId 'ζ' 9 12+             s = envSine d (randId 'η' 0.1 0.2)+             e = envGen kr 1 1 0 1 DoNothing s+             n = iRandId 'θ' 69 72+             m = sinOsc kr f 0+             l = line kr 0 (iRandId 'ι' 1 5) d DoNothing+         in pan2 (blip ar (mWrp1 m (n + l)) (linLin_b m 1 2)) m e+    o4 = let f = iRandId 'κ' 5 18+             d = iRandId 'λ' 12 15+             s = envSine d (randId 'μ' 0.1 0.2)+             e = envGen kr 1 5e-2 0 1 DoNothing s+             n = iRandId 'ν' 69 72+             m = sinOsc kr f 0+             l = line kr 0 (iRandId 'ξ' 1 5) d RemoveSynth+             fr = mWrpN m (n + l) (iRandId 'ο' 1 5)+         in pan2 (blip ar fr (linLin_b m 1 (iRandId 'π' 2 24))) m e+in o1 + o2 + o3 + o4
+ Help/Graph/sc-bottle-m.hs view
@@ -0,0 +1,33 @@+-- bottle (sc) ; texture=overlap,2,0,4,inf ; id+let freq = rand 220 880+    perc = envPerc 0.1 0.6+    ex = envGen kr 1 1 0 1 DoNothing perc * whiteNoise ar * 0.02+    flute = ringz ex freq 0.3+    r = resonz (pinkNoise ar) (5 + (freq / 2)) 0.1+    breath = envGen kr 1 1 0 1 DoNothing perc * r+    rapf i = i + allpassN i 0.1 (linRand 0.001 0.1 (-1)) 1.0 * 0.5+    cls i = let en = let c = EnvNum (-4) in (c,c,c)+                l = envLinen_c 0.01 3.0 1.0 1 en+                z = (breath + i) * envGen kr 1 1 0 1 RemoveSynth l+            in mce2 z z+in cls (iter 2 rapf flute)++-- bottle (sc) ; texture=overlap,2,0,4,inf+let bottle_m = do+      freq <- randM 220 880+      wn <- whiteNoiseM ar+      pn <- pinkNoiseM ar+      let perc = envPerc 0.1 0.6+          ex = envGen kr 1 1 0 1 DoNothing perc * wn * 0.02+          flute = ringz ex freq 0.3+          r = resonz pn (5 + (freq / 2)) 0.1+          breath = envGen kr 1 1 0 1 DoNothing perc * r+          rapf i = do x <- linRandM 0.001 0.1 (-1)+                      return (i + allpassN i 0.1 x 1.0 * 0.5)+          cls i = let en = let c = EnvNum (-4) in (c,c,c)+                      l = envLinen_c 0.01 3.0 1.0 1 en+                      z = (breath + i) * envGen kr 1 1 0 1 RemoveSynth l+                  in mce2 z z+      f <- chainM 2 rapf flute+      return (cls f)+in uid_st_eval bottle_m
+ Help/Graph/sp-insects-m.hs view
@@ -0,0 +1,19 @@+-- insects (sp)+let insect _ =+      let a = sinOsc kr (rand 1 10) 0 * 0.5 + 0.5+          o = sinOsc ar (rand 2000 3000 + lfNoise2 kr (rand 0.05 0.1 * 50 + 50)) (rand 0.05 0.1) * 0.005 * a+      in pan2 o (lfNoise2 kr (rand 0.05 0.1)) 1+in mixFill 60 insect++-- insects (sp) ; monad+let insect_m = do+      r1 <- randM 2000 3000+      r2 <- randM 0.05 0.1+      n1 <- lfNoise2M kr (r2 * 50 + 50)+      r4 <- randM 1 10+      r5 <- randM 0.05 0.1+      n2 <- lfNoise2M kr r5+      let a = sinOsc kr r4 0 * 0.5 + 0.5+          o = sinOsc ar (r1 + n1) r2 * 0.005 * a+      return (pan2 o n2 1)+in uid_st_eval (fmap sum (replicateM 60 insect_m))
+ Help/Graph/tb-1-4Tw.hs view
@@ -0,0 +1,6 @@+-- http://sccode.org/1-4Tw (tb)+let im = mix (impulse ar (mce3 1 (1/3) (1/5)) (mce3 0 0.133 0.5))+    f i = tDuty ar (max 0.25 (timer i)) 0 DoNothing 1 0+    g n i = sinOsc ar ((4000 + (i * 500))) 0 * decay2 n 0.01 0.2+    nd = zipWith g (iterate f im) [0..9]+in splay (mce nd) 1 1 0 True
+ Help/Graph/tm-drummer.hs view
@@ -0,0 +1,21 @@+-- drummer (tm)+let n = whiteNoise ar+    tempo = 4+    tr = impulse ar tempo 0+    tr_2 = pulseDivider tr 4 2+    tr_4 = pulseDivider tr 4 0+    snare = n * decay2 tr_2 0.005 0.5+    bass = sinOsc ar 60 0 * decay2 tr_4 0.005 0.5+    hihat = hpf n 10000 * decay2 tr 0.005 0.5+in pan2 (snare + bass + hihat) 0 0.4++-- drummer (tm) ; id+let n = whiteNoiseId 'α' ar+    tempo = 4+    tr = impulse ar tempo 0+    tr_2 = pulseDivider tr 4 2+    tr_4 = pulseDivider tr 4 0+    snare = n * decay2 tr_2 0.005 0.5+    bass = sinOsc ar 60 0 * decay2 tr_4 0.005 0.5+    hihat = hpf n 10000 * decay2 tr 0.005 0.5+in pan2 (snare + bass + hihat) 0 0.4
+ Help/Graph/tm-tw-463992770596577280.hs view
@@ -0,0 +1,13 @@+-- https://twitter.com/thormagnusson/status/463992770596577280 (tm) ; texture=overlap,60,15,3,inf+let f i =+      let x = constant i + 1+          e = lfNoise2 ar 0.5 * line ar 0 0.1 (rand 1 99) DoNothing / (x * 0.2)+      in sinOsc ar (30 * x + lfNoise2 ar 0.1 * 2) 0 * e+in mceFill 2 (\_ -> mixFill 24 f)++-- https://twitter.com/thormagnusson/status/463992770596577280 (tm) ; texture=overlap,60,15,3,inf ; id+let f z i =+      let x = constant i + 1+          e = lfNoise2Id z ar 0.5 * line ar 0 0.1 (randId z 1 99) DoNothing / (x * 0.2)+      in sinOsc ar (30 * x + lfNoise2Id z ar 0.1 * 2) 0 * e+in mceFillId 'α' 2 (\z _ -> mixFillId z 24 f)
+ Help/Graph/tw-tw-01.hs view
@@ -0,0 +1,6 @@+-- tim walters ; <https://swiki.hfbk-hamburg.de/MusicTechnology/899>+let f k i =+      let x = impulse kr ((0.5 ** i) / k) 0+      in sinOsc ar i (sinOsc ar ((i + k) ** i) 0 / (decay x (mce2 i (i + 1)) * k))+    s = mixFill 16 (\k -> mixFill 6 (f k))+in mix (mceTranspose (gVerb s 1 3 0.5 0.5 15 1 0.7 0.5 300 / 512))
+ Help/Graph/tw-tw-02.hs view
@@ -0,0 +1,14 @@+-- tim walters ; <https://swiki.hfbk-hamburg.de/MusicTechnology/899>+let mk k =+      let x f m j = sinOsc ar (f + (m * 4 * j)) m * (lfNoise1 ar (((j + 1) / f) * 4)) / 2+          pp y i = x (i * k * mce2 4 8) y i+      in foldl pp (x 0.1 0 8) [0 .. 8]+in sum (map mk [0 .. 7]) / 4++-- tim walters ; <https://swiki.hfbk-hamburg.de/MusicTechnology/899> ; id+let mk (z0,k) =+      let x z f m j = sinOsc ar (f + (m * 4 * j)) m * (lfNoise1Id (z0,z) ar (((j + 1) / f) * 4)) / 2+          pp y (z,i) = x z (i * k * mce2 4 8) y i+          y0 = x 'α' 0.1 0 8+      in foldl pp y0 (zip ['β' ..] [0 .. 8])+in sum (map mk (zip ['γ'..] [0 .. 7])) / 4
+ Help/Graph/unk-laser-bubble.hs view
@@ -0,0 +1,24 @@+-- laser bubble ; https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html+let n = 8+    laser_bubble _ =+      let xr = dxrand dinf (mce [0.1,0.2,0.3,0.4,0.5])+          lf = dstutter 2 xr+          du = duty ar lf 0 DoNothing lf+          tr = abs (hpz1 du) `greater_than` 0+          ph = sweep ar tr (1 / du)+      in linExp ph 0 1 (rand 50 100) (rand 500 2000)+    [s0,s1] = mceChannels (splay (sinOsc ar (mceFill n laser_bubble) 0) 1 1 0 True)+in limiter (rotate2 s0 s1 (lfSaw kr 0.1 0)) 1 0.01 * 0.25++-- laser bubble ; https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html ; id+let n = 8+    laser_bubble_f z =+      let xr = dxrandId z dinf (mce [0.1,0.2,0.3,0.4,0.5])+          lf = dstutterId z 2 xr+          du = duty ar lf 0 DoNothing lf+          tr = abs (hpz1 du) `greater_than` 0+          ph = sweep ar tr (1/du)+      in linExp ph 0 1 (randId z 50 100) (randId z 500 2000)+    f = mce (map laser_bubble_f (take n ['α'..]))+    [s0,s1] = mceChannels (splay (sinOsc ar f 0) 1 1 0 True)+in limiter (rotate2 s0 s1 (lfSaw kr 0.1 0)) 1 0.01 * 0.25
+ Help/Graph/unk-m21360.hs view
@@ -0,0 +1,41 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21360.html+let k_sr = 48000+    b = mce2 (localBuf 1 k_sr) (localBuf 1 k_sr)+    del = mce [0.2,0.3,0.4,0.5] * rand 0.15 0.35+    loc = mce [-1,-0.7,0.6,1]+    hpp = mce [rand 300 600,rand 900 1200]+    avg = mce [8000,14000]+    sdt = mce [300,400]+    lpp = mce [rand 4300 4500,rand 4000 4200]+    sr = sampleRate+    local = localIn' 2 ar+    wn = line kr 0 1 0.1 DoNothing * whiteNoise ar * 0.03+    ph = delTapWr b (wn + local)+    fb = delTapRd b ph del 1+    p_fb = mix (pan2 fb loc 1)+    h_fb = hpf p_fb hpp+    ao = X.averageOutput (abs h_fb) (impulse kr (recip (avg / sr)) 0) -- RFWUGens+    n_fb = h_fb * (0.02 / clip (lag ao (sdt / sr)) 0.0001 1)+    l_fb = lpf n_fb lpp+in mrg [localOut l_fb,out 0 l_fb]++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21360.html ; id+let k_sr = 48000+    b = mce2 (localBufId 'α' 1 k_sr) (localBufId 'β' 1 k_sr)+    del = mce [0.2,0.3,0.4,0.5] * randId 'γ' 0.15 0.35+    loc = mce [-1,-0.7,0.6,1]+    hpp = mce [randId 'δ' 300 600,randId 'ε' 900 1200]+    avg = mce [8000,14000]+    sdt = mce [300,400]+    lpp = mce [randId 'ζ' 4300 4500,randId 'η' 4000 4200]+    sr = sampleRate+    local = localIn' 2 ar+    wn = line kr 0 1 0.1 DoNothing * whiteNoiseId 'θ' ar * 0.03+    ph = delTapWr b (wn + local)+    fb = delTapRd b ph del 1+    p_fb = mix (pan2 fb loc 1)+    h_fb = hpf p_fb hpp+    ao = X.averageOutput (abs h_fb) (impulse kr (recip (avg / sr)) 0) -- RFWUGens+    n_fb = h_fb * (0.02 / clip (lag ao (sdt / sr)) 0.0001 1)+    l_fb = lpf n_fb lpp+in mrg [localOut l_fb,out 0 l_fb]
+ Help/Graph/unk-no-input-fft.hs view
@@ -0,0 +1,21 @@+-- no input fft ; https://www.listarc.bham.ac.uk/liasts/sc-users/msg63383.html+let e_01 = envelope [0.0001,1,0.0001,0.01,0.0001] (map (* 512) (normalizeSum [1,2,2,50])) [EnvExp]+    e_ix e n = constant (envelope_at e (fromIntegral n))+    fft_size = 1024+    fft_f _ = fft (localBuf 1 (constant fft_size)) (dc ar 0) 0.5 0 1 0+    bin_f _mag phase bin =+      (e_ix e_01 bin * range 10 50 (sinOsc kr (rand 0 0.05) (rand 0 (2 * pi)))+      ,phase)+    gen_f n = pvcollect (fft_f n) fft_size bin_f 0 511 0+in ifft (mceFill 2 gen_f) 1 0++-- no input fft ; https://www.listarc.bham.ac.uk/liasts/sc-users/msg63383.html ; id+let e_01 = envelope [0.0001,1,0.0001,0.01,0.0001] (map (* 512) (normalizeSum [1,2,2,50])) [EnvExp]+    e_ix e n = constant (envelope_at e (fromIntegral n))+    fft_size = 1024+    fft_f z = fft (localBufId z 1 (constant fft_size)) (dc ar 0) 0.5 0 1 0+    bin_f z _mag phase bin =+      (e_ix e_01 bin * range 10 50 (sinOsc kr (randId (z,bin) 0 0.05) (randId (z,bin) 0 (2 * pi)))+      ,phase)+    gen_f z = pvcollect (fft_f z) fft_size (bin_f z) 0 511 0+in ifft (mce2 (gen_f 'α') (gen_f 'β')) 1 0
+ Help/Graph/unk-sin-gliss.hs view
@@ -0,0 +1,7 @@+-- sin gliss (unk)+let t = 60+    ln (x0,x1) = xLine kr x0 x1 t DoNothing+    m = [(0.5,0.5),(0.5,1),(1,1.19),(1.19,1.56),(1.56,2),(2.51,2),(3.01,2.66),(4.1,3.01),(4.1,4.1)]+    a = mce [0.25,0.25,1,0.8,0.5,0.9,0.4,0.3,0.6,0.1,0.1]+    f = mce (map ln m)+in splay (sinOsc ar (500 * f) 0 * 0.1 * a) 1 1 0 True
+ Help/Graph/unk-train.hs view
@@ -0,0 +1,38 @@+-- http://www.create.ucsb.edu/pipermail/sc-users/2007-August/035957.html+let time = 24+    steam =+      let piston = lfSaw ar (xLine ar 1 7 time DoNothing) 0+          air = lpf (whiteNoise ar * piston + pinkNoise ar * piston) 5000+          e = envGen ar 1 1 0 1 DoNothing (envSine time 9)+      in bpf air 600 (1 + e)+    whistle =+      let s = klankSpec [800,600,1200,990] [1,1,1,1] [1,1,1,1]+          t = [0,0,1,1,0,0,1,1,0,0,1,0]+          l = [2,0,0.2,0,0.2,0,0.8,0,4,0,3]+          d = Envelope t l (repeat EnvLin) Nothing Nothing 0+          e = envGen ar 1 1 0 (time / 10) DoNothing d+      in klank (whiteNoise ar * 0.004) 1 0 1 s * e+    loc = let e = Envelope [-0.8,0.8] [time + 2] [EnvSin,EnvSin] Nothing Nothing 0+          in envGen ar 1 1 0 1 RemoveSynth e+in pan2 (steam + whistle) loc 1++-- http://www.create.ucsb.edu/pipermail/sc-users/2007-August/035957.html ; id+let time = 24+    steam =+      let n1 = whiteNoiseId 'α' ar+          n2 = pinkNoiseId 'β' ar+          piston = lfSaw ar (xLine ar 1 7 time DoNothing) 0+          air = lpf (n1 * piston + n2 * piston) 5000+          e = envGen ar 1 1 0 1 DoNothing (envSine time 9)+      in bpf air 600 (1 + e)+    whistle =+      let n3 = whiteNoiseId 'γ' ar+          s = klankSpec [800,600,1200,990] [1,1,1,1] [1,1,1,1]+          t = [0,0,1,1,0,0,1,1,0,0,1,0]+          l = [2,0,0.2,0,0.2,0,0.8,0,4,0,3]+          d = Envelope t l (repeat EnvLin) Nothing Nothing 0+          e = envGen ar 1 1 0 (time / 10) DoNothing d+      in klank (n3 * 0.004) 1 0 1 s * e+    loc = let e = Envelope [-0.8,0.8] [time + 2] [EnvSin,EnvSin] Nothing Nothing 0+          in envGen ar 1 1 0 1 RemoveSynth e+in pan2 (steam + whistle) loc 1
+ Help/Notes/mul-add.help.hs view
@@ -0,0 +1,23 @@+---- ; mulAdd ; optimisations++The order of the multiplier inputs is significant regards multi-rate inputs.++sclang re-orders these if required.++hsc3 does not.++The graph below will crash scsynth.++    mulAdd 0.1 (sinOsc ar 440 0) 0.05++c.f.++    MulAdd.new(in: 0.1, mul: SinOsc.ar(freq: 440, phase: 0), add: 0.05)++Note: mulAdd with i-rate at input 0 and k-rate thereafter crashes scsynth.++    sinOsc ar (mulAdd (control ir "x" 110) (control kr "y" 2) (control ir "z" 110)) 0 * 0.1++c.f.++    0.05 + (0.1 * SinOsc.ar(freq: 440, phase: 0))
+ Help/Notes/sample-accuracy.help.hs view
@@ -0,0 +1,54 @@+---- ;++Phase cancellation, the `offsetOut` at bus 0 should cancel, the `out` at+bus 1 doesn't (or at least is exceedingly unlikely to).++sy_01 sr =+    let f = sr / 100+        o = sinOsc AR (constant f) 0 * 0.2+    in synthdef "sy_01" (mrg [offsetOut 0 o,out 1 o])++bnd_01 sr t =+    let latency = 0.2+        c = 100 / sr {- recip f -}+        m = s_new "sy_01" (-1) AddToHead 1 []+        p = bundle (t + latency) [m]+        q = bundle (t + latency + c/2) [m]+    in [p,q]++proc_01 :: Transport m => m ()+proc_01 = do+  sr <- serverSampleRateActual+  _ <- async (d_recv (sy_01 sr))+  t <- time+  mapM_ sendBundle (bnd_01 sr t)++withSc3 proc_01++The cancellation isn't completely reliable though.  In supercollider language it seems+to be better, though these _should_ be equivalent...++    Routine(+    {var sr = s.actualSampleRate+    ;var f = sr / 100+    ;var c = 1 / f+    ;var g = {var o = SinOsc.ar(f,0) * 0.2; OffsetOut.ar(0,o); Out.ar(1,o)}+    ;var sy = SynthDef("g",g)+    ;var m = ["/s_new", "g", -1, 0, 1]+    ;var latency = 0.2+    ;sy.send(s)+    ;s.sync+    ;s.sendBundle(latency,m)+    ;s.sendBundle(latency + (c/2),m)}).play++To see/hear scheduler clock and sample clock drift:++    Routine(+    {var g = {OffsetOut.ar(0,Saw.ar(400) * EnvGen.kr(Env.perc, doneAction: 2) * 0.2)}+    ;var h = {OffsetOut.ar(1,Saw.ar(800) * Decay2.ar(Impulse.ar(1)) * 0.2)}+    ;var t_delay = 0.25+    ;SynthDef("g",g).send(s)+    ;SynthDef("h",h).send(s)+    ;s.sync+    ;s.sendBundle(t_delay,["/s_new", "h", -1, 0, 1])+    ;inf.do({s.sendBundle(t_delay,["/s_new", "g", -1, 0, 1]); 1.0.wait})}).play
+ Help/Notes/signal-effect-group.help.hs view
@@ -0,0 +1,7 @@+-- decay ; ordinary graph ; ordinary key bindings place at head of group one+let d = dustId 'α' ar 1+    n = whiteNoiseId 'β' ar+in decay (d * 0.5) 0.2 * n++---- ; signal/effect model using separate group, operating at the same bus+withSc3 (playAt (-1, AddToTail, 2, []) (replaceOut 0 (combC (in' 1 ar 0) 0.2 0.2 3)))
+ Help/Nrt/nrt.02.hs view
@@ -0,0 +1,16 @@+import Sound.Osc.Packet {- hosc3 -}+import Sound.Sc3 {- hsc3 -}++sy :: Synthdef+sy = synthdef "sin" (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.2))++b0,b1,b2,b3 :: Bundle+b0 = bundle 0.0 [g_new [(1, AddToTail, 0)], d_recv sy]+b1 = bundle 0.5 [s_new "sin" 1001 AddToHead 1 []]+b2 = bundle 3.0 [n_free [1001]]+b3 = bundle 3.5 [nrt_end]++main :: IO ()+main = do+  writeNrt "/tmp/nrt.02.osc" (Nrt [b0,b1,b2,b3])+  nrt_exec_plain ("/tmp/nrt.02.osc",("_",0),("/tmp/nrt.02.wav",1),48000,PcmInt16,[])
+ Help/Server/b_alloc.help.hs view
@@ -0,0 +1,23 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_alloc"++Buffer indices are not restricted by the number of available buffers+at the server.  Below allocates a buffer at index 2 ^ 15.  Note the+b_alloc_setn1, which adds a b_set completion message to the b_alloc+message, is still asynchronous.++> import Sound.Sc3 {- hsc3 -}++> b0 :: Num n => n+> b0 = 2 ^ 15++> m0 = b_alloc_setn1 b0 0 [0,3,7,10]++    b0 == 2 ^ 15+    withSc3 (async m0)+    withSc3 (b_getn1_data b0 (0,4))++> g0 =+>     let x = mouseX KR 0 9 Linear 0.1+>         k = degreeToKey b0 x 12+>     in sinOsc AR (midiCps (48 + k)) 0 * 0.1
− Help/Server/b_alloc.help.lhs
@@ -1,18 +0,0 @@-    Sound.SC3.Server.Help.viewServerHelp "/b_alloc"--Buffer indices are not restricted by the number of available buffers-at the server.  Below allocates a buffer at index 2 ^ 15.--> import Sound.SC3 {- hsc3 -}--> b0 :: Num n => n-> b0 = 2 ^ 15--> m0 = b_alloc_setn1 b0 0 [0,3,7,10]--    withSC3 (async m0)--> g0 =->     let x = mouseX KR 0 9 Linear 0.1->         k = degreeToKey b0 x 12->     in sinOsc AR (midiCPS (48 + k)) 0 * 0.1
+ Help/Server/b_allocRead.help.hs view
@@ -0,0 +1,62 @@+---- ;help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_allocRead"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++Read an audio file into a buffer.++> f_00 = sfResolve "jonchaies.wav"+> m_00 = b_allocRead 0 f_00 0 0++    withSc3 (async m_00)++Audio data is loaded in IEEE 32-bit form, so in-memory storage can be+greater than on-disk storage.++$ sndfile-info data/audio/xenakis/jonchaies.wav+Sample Rate : 44100+Frames      : 42271320+Duration    : 00:15:58.533+$ du -h data/audio/xenakis/jonchaies.wav+162M    data/audio/xenakis/jonchaies.wav+$++    round ((16 * 60 * 44100 * 4 * 2) / (1024 * 1024)) == 323+    round ((42271320 * 2 * 4) / (1024 * 1024)) == 323++Query buffer.++> q_00 :: Connection UDP ()+> q_00 = do+>   sendMessage (b_query [0])+>   r <- waitReply "/b_info"+>   liftIO (print r)++    withSc3 q_00++Play buffer.++> g_00 =+>   let bufnum = 257+>       s = bufRateScale KR bufnum+>   in playBuf 1 AR bufnum s 1 0 NoLoop RemoveSynth++Re-read file into buffer with the same identifier.  The existing+buffer is freed but not before further memory is allocated,+intermediate in-memory use is greater than final memory use.++    withSc3 (async (b_allocRead 0 fn 0 0))++Free buffer.  Memory is immediately made free.++    withSc3 (async (b_free 0))++Small sample buffer++> f_01 = sfResolve "metal.wav"++    withSc3 (async m_01)++> m_01 :: Message+> m_01 = b_allocRead 0 f_01 0 0
− Help/Server/b_allocRead.help.lhs
@@ -1,51 +0,0 @@-    Sound.SC3.Server.Help.viewServerHelp "/b_allocRead"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--Read a large audio file into a buffer.--> fn = "/home/rohan/data/audio/xenakis/jonchaies.wav"--    withSC3 (async (b_allocRead 0 fn 0 0))--Audio data is loaded in IEEE 32-bit form, so in-memory storage can be-greater than on-disk storage.--$ sndfile-info data/audio/xenakis/jonchaies.wav-Sample Rate : 44100-Frames      : 42271320-Duration    : 00:15:58.533-$ du -h data/audio/xenakis/jonchaies.wav-162M    data/audio/xenakis/jonchaies.wav-$--    round ((16 * 60 * 44100 * 4 * 2) / (1024 * 1024)) == 323-    round ((42271320 * 2 * 4) / (1024 * 1024)) == 323--Query buffer.--> q0 :: Connection UDP ()-> q0 = do->      sendMessage (b_query [0])->      r <- waitReply "/b_info"->      liftIO (print r)--    withSC3 q0--Play buffer.--> g0 =->     let n = 257->         s = bufRateScale KR n->     in playBuf 1 AR n s 1 0 NoLoop RemoveSynth--Re-read file into buffer with the same identifier.  The existing-buffer is freed but not before further memory is allocated,-intermediate in-memory use is greater than final memory use.--    withSC3 (async (b_allocRead 0 fn 0 0))--Free buffer.  Memory is immediately made free.--    withSC3 (async (b_free 0))
+ Help/Server/b_allocReadChannel.help.hs view
@@ -0,0 +1,34 @@+---- ;help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_allocReadChannel"++> import Data.List {- base -}+> import Data.List.Split {- split -}+> import Sound.Sc3 {- hsc3 -}++Read an audio file with many channels (here 1024)++> fn_00 = "/home/rohan/sw/hsc3-sf/data/au/mc-10-1024.au"++> m_00 = b_allocRead 0 fn_00 0 0++    > withSc3 (async_ m_00)++Query buffer++    > withSc3 (b_query1_unpack 0)++Read only specified channels++> m_01 = b_allocReadChannel 0 fn_00 0 0 [0 .. 7]++    > withSc3 (async_ m_01)++Query buffer++    > withSc3 (b_query1_unpack 0)++Examine buffer++    > let (nf,nc) = (10,8)+    > d <- withSc3 (b_getn1_data_segment 128 0 (0,nf * nc))+    > (putStrLn . unlines . transpose . chunksOf nc . map (\n -> if n > 0 then '1' else '0')) d
− Help/Server/b_allocReadChannel.help.lhs
@@ -1,29 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_allocReadChannel"--> import Sound.SC3--Read an audio file with many channels (here 2000)--> let fn = "/home/rohan/sw/hsc3-sf/au/mc-12-2000.au"--> withSC3 (async (b_allocRead 0 fn 0 0))--Query buffer--> withSC3 (b_query1_unpack 0)--Read only specified channels--> withSC3 (async (b_allocReadChannel 0 fn 0 0 [0..1023]))--Query buffer--> withSC3 (b_query1_unpack 0)--Examine buffer--> import Data.List {- base -}-> import Data.List.Split {- split -}-> let (nf,nc) = (12,1024)-> d <- withSC3 (b_getn1_data_segment 128 0 (0,nf * nc))-> (putStrLn . unlines . transpose . chunksOf nc . map (\n -> if n > 0 then '1' else '0')) d
+ Help/Server/b_close.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_close"
− Help/Server/b_close.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_close"
+ Help/Server/b_fill.help.hs view
@@ -0,0 +1,1 @@+     Sound.Sc3.Lang.Help.viewServerHelp "/b_fill"
− Help/Server/b_fill.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_fill"
+ Help/Server/b_free.help.hs view
@@ -0,0 +1,11 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_free"++> import Sound.Sc3 {- hsc3 -}++It is safe to free un-allocated buffers.++    withSc3 (async (b_free (2 ^ 15)))++There is no multiple buffer form.++    withSc3 (mapM_ (\k -> async (b_free k)) [0..256])
− Help/Server/b_free.help.lhs
@@ -1,11 +0,0 @@-    Sound.SC3.Server.Help.viewServerHelp "/b_free"--> import Sound.SC3 {- hsc3 -}--It is safe to free un-allocated buffers.--    withSC3 (async (b_free (2 ^ 15)))--There is no multiple buffer form.--    withSC3 (mapM_ (\k -> async (b_free k)) [0..256])
+ Help/Server/b_gen.help.hs view
@@ -0,0 +1,32 @@+---- ; function to generate wavetable buffer using b_gen_cheby+mk_cheby a =+  let tbl_f = [Normalise, Wavetable, Clear]+      msg = [b_alloc 10 512 1, b_gen_cheby 10 tbl_f a]+  in withSc3 (mapM_ async msg)++---- ; generate various wavetables+mk_cheby [1, 0, 1, 1, 0, 1]+mk_cheby [0.25, 0.5, 0.25]+mk_cheby [1, 0, 1, 1, 0, 1, 0.5, 0, 0.25, 0, 0.75, 1]++---- ; generate sin table ; not wavetable+withSc3 (mapM_ maybe_async [b_alloc 10 256 1,b_gen_sine1 10 [Normalise, Clear] [1, 1/2, 1/3, 1/4, 1/5]])++---- ; plot wavetable (as in-buffer layout, as plain wavetable)+import Sound.Sc3.Plot {- hsc3-plot -}+withSc3 (Sound.Sc3.Plot.plot_buffer1 10)+withSc3 (Sound.Sc3.Plot.plot_wavetable1 10)++---- ; fetch generated buffer data ; compare to haskell generated buffer+withSc3 (b_fetch1 512 10)+Gen.sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]++---- ; generate tables in haskell+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [1, 0, 1, 1, 0, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [0.25, 0.5, 0.25]]+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [1, 0, 1, 1, 0, 1, 0.5, 0, 0.25, 0, 0.75, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1, 0.5, 0, 0.25, 0, 0.75, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]]++----- ; open remote scdoc help+Sound.Sc3.Common.Help.sc3_scdoc_help_server_command_open False "/b_gen"
− Help/Server/b_gen.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_gen"
+ Help/Server/b_get.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_get"
− Help/Server/b_get.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_get"
+ Help/Server/b_getn.help.hs view
@@ -0,0 +1,45 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_getn"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}+> import Sound.Sc3.Plot {- hsc3-plot -}++Allocate and generate wavetable buffer (256 frames)++> x_00 :: DuplexOSC m => m ()+> x_00 = do+>   async_ (b_alloc 0 256 1)+>   let f = [Normalise,Clear]+>   sendMessage (b_gen_sine1 0 f [1,1/2,1/3,1/4,1/5])++    > withSc3 x_00++Run simple read...++    > d0 <- withSc3 (b_getn1_data 0 (0,255))++and draw buffer++    > plotTable [d0]++Load sound file++> fn_00 = "/tmp/dx7.wav"++> m_00 = b_allocRead 1 fn_00 0 0++    > withSc3 (async_ m_00)++Run segmented read (n-frames of data in m-frame segments)...++> x_01 :: DuplexOSC m => m [Double]+> x_01 = do+>   let m = 155+>       n = m * 3+>   b_getn1_data_segment m 1 (0,n)++    > d1 <- withSc3 x_01++and draw buffer++    > plotImpulses [d1]
− Help/Server/b_getn.help.lhs
@@ -1,32 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_getn"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.Plot {- hsc3-plot -}--Allocate and generate wavetable buffer (256 frames)--> withSC3 (do {_ <- async (b_alloc 0 256 1)->             ;let f = [Normalise,Clear]->              in send (b_gen_sine1 0 f [1,1/2,1/3,1/4,1/5])})--Run simple read...--> d0 <- withSC3 (b_getn1_data 0 (0,255))--and draw buffer--> plotTable [d0]--Load sound file--> let fn = "/home/rohan/data/audio/pf-c5.aif"-> in withSC3 (async (b_allocRead 1 fn 0 0))--Run segmented read (2^15 frames in 1024 frame segments)...--> d1 <- withSC3 (b_getn1_data_segment 1024 1 (0,2^15))--and draw buffer--> plotTable [d1]
+ Help/Server/b_info.help.hs view
@@ -0,0 +1,3 @@+/b_info is the message returned by scsynth in response to /b_query.++Fields are: buffer-id:int num-frames:int num-channels:int sample-rate:float
+ Help/Server/b_query.help.hs view
@@ -0,0 +1,48 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_query"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++Allocate and generate wavetable buffer++> mk_b :: Transport m => m ()+> mk_b = do+>   _ <- async (b_alloc 0 256 1)+>   let f = [Normalise,Wavetable,Clear]+>   sendMessage (b_gen_sine1 0 f [1,1/2,1/3,1/4,1/5])++    withSc3 mk_b++Query buffer++> qr_b :: Transport m => m ()+> qr_b = do+>   sendMessage (b_query [0])+>   r <- waitReply "/b_info"+>   liftIO (print r)++    withSc3 qr_b++Variant that unpacks the result.++Query is of (buffer-id/int,#-frames/int,#-channels/int,sample-rate/float).++    withSc3 (b_query1_unpack 0)++Play buffer++> g_01 = osc AR 0 220 0 * 0.1++Free buffer++    withSc3 (async (b_free 0))++Query multiple un-allocated buffers++> qr_unalloc :: Transport m => m ()+> qr_unalloc = do+>   sendMessage (b_query [2^14,2^15])+>   r <- waitReply "/b_info"+>   liftIO (print r)++    withSc3 qr_unalloc
− Help/Server/b_query.help.lhs
@@ -1,36 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_query"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--Allocate and generate wavetable buffer--> withSC3 (do {_ <- async (b_alloc 0 256 1)->             ;let f = [Normalise,Wavetable,Clear]->              in send (b_gen_sine1 0 f [1,1/2,1/3,1/4,1/5])})--Query buffer--> withSC3 (do {send (b_query [0])->             ;r <- waitReply "/b_info"->             ;liftIO (print r)})--Variant that unpacks the result.--Query is of (buffer-id/int,#-frames/int,#-channels/int,sample-rate/float).--> withSC3 (b_query1_unpack 0)--Play buffer--> audition (out 0 (osc AR 0 220 0 * 0.1))--Free buffer--> withSC3 (async (b_free 0))--Query multiple un-allocated buffers--> withSC3 (do {send (b_query [2^14,2^15])->             ;r <- waitReply "/b_info"->             ;liftIO (print r)})
+ Help/Server/b_read.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_read"
− Help/Server/b_read.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_read"
+ Help/Server/b_readChannel.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_readChannel"
− Help/Server/b_readChannel.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_readChannel"
+ Help/Server/b_set.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_set"
− Help/Server/b_set.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_set"
+ Help/Server/b_setn.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_setn"
− Help/Server/b_setn.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_setn"
+ Help/Server/b_write.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_write"
− Help/Server/b_write.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_write"
+ Help/Server/b_zero.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/b_zero"
− Help/Server/b_zero.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/b_zero"
+ Help/Server/c_fill.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/c_fill"
− Help/Server/c_fill.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/c_fill"
+ Help/Server/c_get.help.hs view
@@ -0,0 +1,14 @@+     Sound.Sc3.Lang.Help.viewServerHelp "/c_get"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> g_01 = out 0 (tRand 'α' 220 2200 (dust 'β' KR 1))++> x_01 :: Transport m => m ()+> x_01 = do+>   sendMessage (c_get [0])+>   r <- waitReply "/c_set"+>   liftIO (print r)++    > withSc3 x_01
− Help/Server/c_get.help.lhs
@@ -1,10 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/c_get"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--> audition (out 0 (tRand 'α' 220 2200 (dust 'β' KR 1)))--> withSC3 (do {send (c_get [0])->             ;r <- waitReply "/c_set"->             ;liftIO (print r)})
+ Help/Server/c_getn.help.hs view
@@ -0,0 +1,19 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/c_getn"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++Get control bus data.++> get_c :: Transport m => m ()+> get_c = do+>   sendMessage (c_getn [(0,3)])+>   r <- waitReply "/c_setn"+>   liftIO (print r)++    withSc3 (sendMessage (c_setn [(0,[1,880,0.5])]))+    withSc3 get_c++Function to get and unpack control bus data.++    withSc3 (c_getn1_data (0,3))
− Help/Server/c_getn.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/c_getn"
+ Help/Server/c_set.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/c_set"
− Help/Server/c_set.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/c_set"
+ Help/Server/c_setn.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/c_setn"
− Help/Server/c_setn.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/c_setn"
+ Help/Server/clearSched.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/clearSched"
− Help/Server/clearSched.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/clearSched"
+ Help/Server/d_free.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/d_free"
− Help/Server/d_free.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/d_free"
+ Help/Server/d_load.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/d_load"
− Help/Server/d_load.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/d_load"
+ Help/Server/d_loadDir.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/d_loadDir"
− Help/Server/d_loadDir.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/d_loadDir"
+ Help/Server/d_recv.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/d_recv"
− Help/Server/d_recv.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/d_recv"
+ Help/Server/dumpOSC.help.hs view
@@ -0,0 +1,15 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/dumpOSC"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> ex_01 :: Transport m => m ()+> ex_01 = do+>   sendMessage (dumpOSC TextPrinter)+>   play (out 0 (sinOsc AR (rand 'α' 440 880) 0 * 0.1))+>   pauseThread 1.0+>   reset+>   sendMessage (dumpOSC NoPrinter)++    withSc3 ex_01+    withSc3 (sendMessage (dumpOSC TextPrinter))
− Help/Server/dumpOSC.help.lhs
@@ -1,15 +0,0 @@-    Sound.SC3.Server.Help.viewServerHelp "/dumpOSC"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--> ex_01 :: Transport m => m ()-> ex_01 = do->   sendMessage (dumpOSC TextPrinter)->   play (out 0 (sinOsc AR (rand 'α' 440 880) 0 * 0.1))->   pauseThread 1.0->   reset->   sendMessage (dumpOSC NoPrinter)--    withSC3 ex_01-    withSC3 (sendMessage (dumpOSC TextPrinter))
+ Help/Server/g_deepFree.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/g_deepFree"
− Help/Server/g_deepFree.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/g_deepFree"
+ Help/Server/g_freeAll.help.hs view
@@ -0,0 +1,8 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/g_freeAll"++> import Sound.OSC+> import Sound.Sc3++> m1 = g_freeAll [0]++     > withSc3 (sendMessage m1)
− Help/Server/g_freeAll.help.lhs
@@ -1,8 +0,0 @@-    > Sound.SC3.Server.Help.viewServerHelp "/g_freeAll"--> import Sound.OSC-> import Sound.SC3--> m1 = g_freeAll [0]--     > withSC3 (sendMessage m1)
+ Help/Server/g_head.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/g_head"
− Help/Server/g_head.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/g_head"
+ Help/Server/g_new.help.hs view
@@ -0,0 +1,12 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/g_new"++The root node of the synthesiser tree is a group with ID zero.++By convention there is a group with ID one at the root group, but+this is only a convention.  We need to make the group.++> import Sound.Sc3 {- hsc3 -}++> m_01 = g_new [(1,AddToTail,0)]++    > withSc3 (send m_00)
− Help/Server/g_new.help.lhs
@@ -1,10 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/g_new"--The root node of the synthesiser tree is a group with ID zero.--By convention there is a group with ID one at the root group, but-this is only a convention.  We need to make the group.--> import Sound.SC3--> withSC3 (send (g_new [(1,AddToTail,0)]))
+ Help/Server/g_queryTree.help.hs view
@@ -0,0 +1,43 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/g_queryTree"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}+> import qualified Data.Tree as T {- containers -}++    withSc3 serverTree >>= mapM_ putStrLn++> g_00 =+>   let f = control KR "freq" 440+>   in saw AR f * 0.05++> d_01 = synthdef "saw" (out 0 g_00)++> m_02 = [d_recv d_01,g_new [(100,AddToTail,1)],s_new0 "saw" 1000 AddToTail 100]++    > withSc3 (mapM_ maybe_async m_02)++> run_query_tree = withSc3 (g_queryTree1_unpack 0)++    > qt <- run_query_tree+    > print qt+    > withSc3 (sendMessage (g_dumpTree [(0,True)]))+    > queryNode_to_group_seq qt++There is support for extracting the node tree into the standard haskell+tree data type.++    > r_tr = queryTree_rt qt+    > putStrLn (unlines ["::TREE::",T.drawTree (fmap query_node_pp r_tr)])++> q_03 =+>   [int32 1,int32 0,int32 2,int32 1,int32 1+>   ,int32 100,int32 1+>   ,int32 1000,int32 (-1),string "saw"+>   ,int32 1,string "freq",float 440.0+>   ,int32 2,int32 0]++> t_04 = queryTree q_03++> t_05 = queryTree_rt t_04++    >> putStrLn (unlines ["::TREE::",T.drawTree (fmap query_node_pp t_05)])
− Help/Server/g_queryTree.help.lhs
@@ -1,27 +0,0 @@-    > Sound.SC3.Server.Help.viewServerHelp "/g_queryTree"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}-> import qualified Data.Tree as T {- containers -}--> d_0 =->     let f = control KR "freq" 440->         o = saw AR f * 0.05->     in synthdef "saw" (out 0 o)--> m_0 = [d_recv d_0,g_new [(100,AddToTail,1)],s_new0 "saw" 1000 AddToTail 100]--    > withSC3 (mapM_ maybe_async m_0)--> run_query_tree = withSC3 (g_queryTree1_unpack 0)--    > qt <- run_query_tree-    > print qt-    > withSC3 (sendMessage (g_dumpTree [(0,True)]))-    > queryNode_to_group_seq qt--There is support for extracting the node tree into the standard haskell-tree data type.--    > r_tr = queryTree_rt qt-    > putStrLn (unlines ["::TREE::",T.drawTree (fmap query_node_pp r_tr)])
+ Help/Server/g_tail.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/g_tail"
− Help/Server/g_tail.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/g_tail"
+ Help/Server/n_after.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_after"
− Help/Server/n_after.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_after"
+ Help/Server/n_before.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_before"
− Help/Server/n_before.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_before"
+ Help/Server/n_fill.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_fill"
− Help/Server/n_fill.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_fill"
+ Help/Server/n_free.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_free"
− Help/Server/n_free.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_free"
+ Help/Server/n_map.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_map"
− Help/Server/n_map.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_map"
+ Help/Server/n_mapn.help.hs view
@@ -0,0 +1,31 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_mapn"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> f_01 nm def ix = control_f64 KR (Just ix) nm def+> g_01 = out (f_01 "bus" 0 0) (sinOsc AR (f_01 "freq" 440 1) 0 * f_01 "amp" 0.1 2)+> s_01 = synthdef "sin" g_01+> m_01 = d_recv s_01+> m_02 = s_new "sin" 1001 AddToHead 1 []+> m_03 = n_mapn 1001 [(0,0,3)]++    withSc3 (async (d_recv s_01) >> mapM_ sendMessage [m_02,m_03])++    withSc3 (sendMessage (n_mapn 1001 [(0,0,3)]))+    withSc3 (sendMessage (c_setn [(0,[1,880,0.2])]))+    withSc3 (sendMessage (c_setn [(0,[0,220,0.3])]))++    withSc3 (sendMessage (n_set1 1001 "bus" 1))+    withSc3 (sendMessage (n_set1 1001 "freq" 440))+    withSc3 (sendMessage (n_set1 1001 "amp" 0.2))+    withSc3 (sendMessage (n_setn 1001 [(0,[1,880,0.2])]))++n_mapn and n_setn only work if the control is given as an index and not as a name.++s.sendMsg("/n_mapn",1001,"bus",0,3);+s.sendMsg("/c_setn",0,3,0,880,0.1);++s.sendMsg("/n_mapn",1001,0,0,3);+s.sendMsg("/c_setn",0,3,0,880,0.1);+s.sendMsg("/c_setn",0,3,1,220,0.3);
− Help/Server/n_mapn.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_mapn"
+ Help/Server/n_query.help.hs view
@@ -0,0 +1,21 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_query"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> d_00 =+>   let f = control KR "freq" 440+>       o = saw AR f * 0.1+>   in synthdef "saw" (out 0 o)++> m_00 = s_new0 "saw" 1000 AddToTail 1++   > withSc3 (async_ (d_recv d_00) >> sendMessage m_00)++> x_01 :: Transport m => m Message+> x_01 = withNotifications $ do+>   sendMessage (n_query [1000])+>   waitReply "/n_info"++    > r <- withSc3 x_01+    > print r
− Help/Server/n_query.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_query"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--> let d = let {f = control KR "freq" 440->             ;o = saw AR f * 0.1}->         in synthdef "saw" (out 0 o)--> withSC3 (async (d_recv d) >> send (s_new0 "saw" 1000 AddToTail 1))--> r <- withSC3 (withNotifications (send (n_query [1000]) >> waitReply "/n_info"))--> print r
+ Help/Server/n_run.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_run"
− Help/Server/n_run.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_run"
+ Help/Server/n_set.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/n_set"
− Help/Server/n_set.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_set"
+ Help/Server/n_setn.help.hs view
@@ -0,0 +1,5 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/n_setn"++At some point /n_setn was broken at scsynth, it no longer behaves as specified.++/n_setn only works correctly with <int> indices, and not when the index is given as a <string>.
− Help/Server/n_setn.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_setn"
+ Help/Server/n_trace.help.hs view
@@ -0,0 +1,13 @@+     Sound.Sc3.Lang.Help.viewServerHelp "/n_trace"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> m_01 =+>   [d_recv defaultSynthdef+>   ,s_new "default" 100 AddToHead 1 []]++> m_02 = n_trace [1,100]++    > withSc3 (mapM_ maybe_async m_01)+    > withSc3 (sendMessage m_02)
− Help/Server/n_trace.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/n_trace"
+ Help/Server/notify.help.hs view
@@ -0,0 +1,17 @@+     Sound.Sc3.Lang.Help.viewServerHelp "/notify"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> g_01 = sinOsc AR (rand 'α' 440 880) 0 * 0.1++> s_01 = synthdef "g" (out 0 g_01)++> m_01 = s_new "g" (-1) AddToHead 1 []++> f_01 :: DuplexOSC m => m Message+> f_01 = do+>   async_ (d_recv s_01)+>   withNotifications (sendMessage m_01 >> waitReply "/n_go")++    withSc3 (f_01 >>= \r -> liftIO (print r))
− Help/Server/notify.help.lhs
@@ -1,17 +0,0 @@-     Sound.SC3.Server.Help.viewServerHelp "/notify"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--> g_01 = sinOsc AR (rand 'α' 440 880) 0 * 0.1--> s_01 = synthdef "g" (out 0 g_01)--> m_01 = s_new "g" (-1) AddToHead 1 []--> f_01 :: DuplexOSC m => m Message-> f_01 = do->   async_ (d_recv s_01)->   withNotifications (sendMessage m_01 >> waitReply "/n_go")--    withSC3 (f_01 >>= \r -> liftIO (print r))
+ Help/Server/quit.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/quit"
− Help/Server/quit.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/quit"
+ Help/Server/s_get.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/s_get"
− Help/Server/s_get.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/s_get"
+ Help/Server/s_getn.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/s_getn"
− Help/Server/s_getn.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/s_getn"
+ Help/Server/s_new.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/s_new"
− Help/Server/s_new.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/s_new"
+ Help/Server/s_noid.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/s_noid"
− Help/Server/s_noid.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/s_noid"
+ Help/Server/status.help.hs view
@@ -0,0 +1,5 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/status"++> import Sound.Sc3 {- hsc3 -}++    withSc3 serverStatus >>= mapM putStrLn
− Help/Server/status.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/status"
+ Help/Server/sync.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/sync"
− Help/Server/sync.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/sync"
+ Help/Server/tr.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/tr"
− Help/Server/tr.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/tr"
+ Help/Server/u_cmd.help.hs view
@@ -0,0 +1,1 @@+    Sound.Sc3.Lang.Help.viewServerHelp "/u_cmd"
− Help/Server/u_cmd.help.lhs
@@ -1,1 +0,0 @@-> Sound.SC3.Server.Help.viewServerHelp "/u_cmd"
− Help/UGen/abs.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.abs"-    > :t abs--> import Sound.SC3 {- hsc3 -}->-> g_01 = abs (syncSaw AR 100 440 * 0.1)
− Help/UGen/absDif.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.absdif"-    > :t absDif--> import Sound.SC3 {- hsc3 -}--Finding the magnitude of the difference of two values is a common operation.--> g_01 =->     let p = fSinOsc AR 440 0->         q = fSinOsc AR 2 0 * 0.5->     in p * 0.2 `absDif` q
− Help/UGen/add.help.lhs
@@ -1,13 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.+"-    > :t (+)--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = fSinOsc AR 800 0->         n = pinkNoise 'α' AR->     in (o + n) * 0.1--DC offset.--> g_02 = fSinOsc AR 440 0 * 0.1 + 0.5
− Help/UGen/allpassC.help.lhs
@@ -1,1 +0,0 @@-See allPassN
− Help/UGen/allpassL.help.lhs
@@ -1,1 +0,0 @@-See allPassN
− Help/UGen/allpassN.help.lhs
@@ -1,44 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "AllpassN"-    > Sound.SC3.UGen.DB.ugenSummary "AllpassN"--> import Sound.SC3 {- hsc3 -}--Since the allpass delay has no audible effect as a resonator on steady-state sound ...--> g_01 =->     let dly = xLine KR 0.0001 0.01 20 RemoveSynth->         n = whiteNoise 'α' AR->     in allpassC (n * 0.1) 0.01 dly 0.2--...these examples add the input to the effected sound so that you-can hear the effect of the phase comb.--> g_02 =->     let n = whiteNoise 'β' AR->         dly = xLine KR 0.0001 0.01 20 RemoveSynth->     in (n + allpassN (n * 0.1) 0.01 dly 0.2) * 0.1--Linear variant--> g_03 =->     let n = whiteNoise 'γ' AR->         dly = xLine KR 0.0001 0.01 20 RemoveSynth->     in (n + allpassL (n * 0.1) 0.01 dly 0.2) * 0.1--Cubic variant--> g_04 =->     let n = whiteNoise 'δ' AR->         dly = xLine KR 0.0001 0.01 20 RemoveSynth->     in (n + allpassC (n * 0.1) 0.01 dly 0.2) * 0.1--Used as an echo - doesn't really sound different than Comb, but it-outputs the input signal immediately (inverted) and the echoes are-lower in amplitude.--> g_05 =->     let n = whiteNoise 'ε' AR->         d = dust 'ζ' AR 1->         src = decay (d * 0.5) 0.2 * n->     in allpassN src 0.2 0.2 3
− Help/UGen/amClip.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.amclip"-    > :t amClip--> import Sound.SC3 {- hsc3 -}->-> g_01 = amClip (whiteNoise 'α' AR) (fSinOsc KR 1 0 * 0.2)
− Help/UGen/ampComp.help.lhs
@@ -1,39 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "AmpComp"-    > Sound.SC3.UGen.DB.ugenSummary "AmpComp"--> import Sound.SC3 {- hsc3 -}--mouse X axis frequency control--> x_freq = mouseX KR 300 1500 Exponential 0.2--> ampComp' :: Bool -> Rate -> UGen -> UGen -> UGen -> UGen-> ampComp' use_comp r fr rt ex = if use_comp then ampComp r fr rt ex else 1--> f_01 use_comp = sinOsc AR x_freq 0 * 0.1 * ampComp' use_comp KR x_freq 300 0.3333--without amplitude compensation--> g_01 = f_01 False--with amplitude compensation--> g_02 = f_01 True--modified exponent--> g_03 = pulse AR x_freq 0.5 * 0.1 * ampComp KR x_freq 300 1.3--in frequency modulation--> f_02 use_comp =->     let freq = x_freq * sinOsc AR (mouseY KR 3 200 Exponential 0.2) 0 * 0.5 + 1->     in sinOsc AR freq 0 * 0.1 * ampComp' use_comp KR freq 300 0.3333--with amplitude compensation--> g_04 = f_02 True--without amplitude compensation--> g_05 = f_02 False
− Help/UGen/amplitude.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Amplitude"-    > Sound.SC3.UGen.DB.ugenSummary "Amplitude"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let s = soundIn 0->         a = amplitude KR s 0.01 0.01->     in pulse AR 90 0.3 * a->-> g_02 =->     let s = soundIn 0->         f = amplitude KR s 0.5 0.5 * 1200 + 400->     in sinOsc AR f 0 * 0.1->-> g_03 =->     let s = soundIn 0->         a = amplitude AR s 0.5 0.05->     in s * a
− Help/UGen/atan2.help.lhs
@@ -1,18 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.atan2"-    > :t atan2--> import Sound.SC3 {- hsc3 -}--Add a pan to the hypot doppler examples by using atan2 to find the-azimuth, or direction angle, of the sound source.  Assume speakers-at +/- 45 degrees and clip the direction to between those.--> g_01 =->     let x = 10->         y = lfSaw KR (1 / 6) 0 * 100->         d = hypot x y->         a = 40 / (squared d)->         s = rlpf (fSinOsc AR 200 0 * lfPulse AR 31.3 0 0.4) 400 0.3->         z = atan2E y x->         l = clip2 (z / (pi / 2)) 1->     in pan2 (delayL s (110 / 344) (d / 344)) l a
− Help/UGen/atari2600.help.lhs
@@ -1,79 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Atari2600"-    > Sound.SC3.UGen.DB.ugenSummary "Atari2600"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.Lang.Pattern {- hsc3-lang -}--> gr_00 = atari2600 1 2 3 4 5 5 1--> gr_01 = atari2600 2 3 10 10 5 5 1--> gr_02 =->     let x = mouseX KR 0 15 Linear 0.1->         y = mouseY KR 0 15 Linear 0.1->     in atari2600 x y 10 10 5 5 1--> gr_03 =->     let x = mouseX KR 0 31 Linear 0.1->         y = mouseY KR 0 31 Linear 0.1->     in atari2600 2 3 x y 5 5 1--> gr_04 =->     let x = mouseX KR 0 15 Linear 0.1->         y = mouseY KR 0 15 Linear 0.1->     in atari2600 2 3 10 10 x y 1--> gr_05 =->     let x = mouseX KR 0 15 Linear 0.1->         o1 = sinOsc KR 0.35 0 * 7.5 + 7.5->         y = mouseY KR 0 31 Linear 0.1->         o2 = sinOsc KR 0.3 0 * 5.5 + 5.5->     in atari2600 x o1 10 y o2 5 1--> ati_syn =->     let gate' = control KR "gate" 1->         tone0 = control KR "tone0" 5->         tone1 = control KR "tone1" 8->         freq0 = control KR "freq0" 10->         freq1 = control KR "freq1" 20->         rate = control KR "rate" 1->         amp = control KR "amp" 1->         pan = control KR "pan" 0->         e = envASR 0.01 amp 0.05 (EnvNum (-4))->         eg = envGen KR gate' 1 0 1 RemoveSynth e->         z = atari2600 tone0 tone1 freq0 freq1 15 15 rate->         o = out 0 (pan2 (z * eg) pan 1)->     in synthdef "atari2600" o--> p_01 =->     [(K_instr,psynth ati_syn)->     ,(K_dur,0.125)->     ,(K_amp,0.5)->     ,(K_param "tone0",pseq [pn 3 64,pn 2 128,pn 10 8] inf)->     ,(K_param "tone1",pseqn [32,12] [8,pwhite 'α' 0 15 inf] inf)->     ,(K_param "freq0",pseqn [17,4,3] [10,prand 'β' [1,2,3] inf,10] inf)->     ,(K_param "freq1",pseq1 [10,3,pwrand 'γ' [20,1] [0.6,0.4] inf] inf)]--    paudition (pbind p_01)--> p_02 =->     [(K_instr,psynth ati_syn)->     ,(K_dur,pseq [0.25,0.25,0.25,0.45] inf)->     ,(K_amp,0.5)->     ,(K_param "tone0",pseq [pseq [2,5] 32,pseq [3,5] 32] inf)->     ,(K_param "tone1",14)->     ,(K_param "freq0",pseq [pbrown 'α' 28 31 1 32,pbrown 'β' 23 26 3 32] inf)->     ,(K_param "freq1",pseq [pn 10 16,pn 11 16] inf)]--    paudition (pbind p_03)--> p_03 =->     [(K_instr,psynth ati_syn)->     ,(K_dur,pbrown 'α' 0.1 0.15 0.1 inf)->     ,(K_amp,0.5)->     ,(K_param "tone0",1)->     ,(K_param "tone1",2)->     ,(K_param "freq0",pseqn [2,1] [24,pwrand 'β' [20,23] [0.6,0.4] inf] inf)->     ,(K_param "freq1",pseqn [1,1,1] [1,3,pwrand 'γ' [2,1] [0.6,0.4] inf] inf)]--    paudition (pbind p_03)
− Help/UGen/atsNoiSynth.help.lhs
@@ -1,36 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "AtsNoiSynth"-    Sound.SC3.UGen.DB.ugenSummary "AtsNoiSynth"--> import System.IO.Unsafe {- base -}-> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.Data.ATS {- hsc3-data -}->-> ats_fn_0 = "/home/rohan/data/audio/pf-c5.4.ats"-> ats_fn_1 = "/home/rohan/cvs/tn/tn-56/ats/metal.ats"--load ATS file at scsynth--    > ats_load_sc3 0 ats_fn_0-    > withSC3 (b_query1_unpack 0)--read ATS header--> ats_hdr_0 = unsafePerformIO (fmap ats_header (ats_read ats_fn_0))-> ats_hdr_1 = unsafePerformIO (fmap ats_header (ats_read ats_fn_1))--    > putStrLn $ ats_header_pp ats_hdr_0-    > putStrLn $ ats_header_pp ats_hdr_1--run re-synthesis--> g_01 =->     let np = constant (ats_n_partials ats_hdr_0)->         ptr = lfSaw KR (constant (1 / ats_analysis_duration ats_hdr_0)) 1 * 0.5 + 0.5->     in atsNoiSynth 0 np 0 1 ptr 1 0.1 1 0 25 0 1--> g_02 =->     let x = mouseX KR 0.0 1.0 Linear 0.2->         y = mouseY KR 0.0 1.0 Linear 0.2->         np = constant (ats_n_partials ats_hdr_0)->     in atsNoiSynth 0 np 0 1 x (1 - y) y 1 0 25 0 1-
− Help/UGen/atsSynth.help.lhs
@@ -1,29 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "AtsSynth"-    Sound.SC3.UGen.DB.ugenSummary "AtsSynth"--> import System.IO.Unsafe {- base -}-> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.Data.ATS {- hsc3-data -}--> ats_fn_0 = "/home/rohan/data/audio/pf-c5.4.ats"-> ats_fn_1 = "/home/rohan/cvs/tn/tn-56/ats/metal.ats"--    > ats_load_sc3 0 ats_fn-    > withSC3 (b_query1_unpack 0)--read file--> ats_hdr_0 = unsafePerformIO (fmap ats_header (ats_read ats_fn_0))-> ats_hdr_1 = unsafePerformIO (fmap ats_header (ats_read ats_fn_1))--show header--    > putStrLn $ ats_header_pp ats_hdr_0--simple re-synthesiser, ATS data is at buffer 0--> g_01 =->     let x = mouseX KR 0.0 1.0 Linear 0.2->         y = mouseY KR 0.75 1.25 Linear 0.2->         np = constant (ats_n_partials ats_hdr_0)->     in atsSynth 0 np 0 1 x y 0
− Help/UGen/ay.help.lhs
@@ -1,34 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "AY"-    Sound.SC3.UGen.DB.ugenSummary "AY"--> import Sound.SC3 {- hsc3 -}->-> g_01 = ay 1777 1666 1555 1 7 15 15 15 4 1 0->-> g_02 =->     let tonea = mouseY KR 10 3900 Exponential 0.2->         toneb = mouseX KR 10 3900 Exponential 0.2->         ctl = 3->         vola = 14->         volb = 14->         volc = 0->         s = ay tonea toneb 1555 1 ctl vola volb volc 4 1 0->     in pan2 s 0 0.25->-> g_03 =->     let rate = mouseX KR 0.1 10 Linear 0.2->         rng l r i = linLin i (-1) 1 l r->         mk_ctl e l r = rng l r (lfdNoise3 e KR rate)->         mk_ctl_0 e l r = rng l r (lfdNoise0 e KR rate)->         tonea = mk_ctl 'α' 10 3900->         toneb = mk_ctl 'β' 10 3900->         tonec = mk_ctl 'γ' 10 3900->         n = mk_ctl 'δ' 0 31->         ctl = mk_ctl_0 'ε' 0 31->         vola = mk_ctl 'ζ' 0 15->         volb = mk_ctl 'η' 0 15->         volc = mk_ctl 'θ' 0 15->         efreq = mk_ctl 'ι' 0 4095->         estyle = mk_ctl 'κ' 0 15->         s = ay tonea toneb tonec n ctl vola volb volc efreq estyle 0->     in pan2 s 0 0.5
− Help/UGen/bBandPass.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BBandPass"-    Sound.SC3.UGen.DB.ugenSummary "BBandPass"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = soundIn 4->         f = mouseX KR 20 20000 Exponential 0.2->         bw = mouseY KR 0 10 Linear 0.2->     in bBandPass i f bw
− Help/UGen/bBandStop.help.lhs
@@ -1,16 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BBandStop"-    Sound.SC3.UGen.DB.ugenSummary "BBandStop"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = soundIn (mce2 0 1)->         f = mouseX KR 20 20000 Exponential 0.2->         bw = mouseY KR 0 10 Linear 0.2->     in bBandStop i f bw--> g_02 =->     let i = sinOsc AR 1000 (mce2 0 0)->         f = mouseX KR 800 1200 Exponential 0.2->         bw = mouseY KR 0 10 Linear 0.2->     in bBandStop i f bw
− Help/UGen/bHiPass.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BHiPass"-    Sound.SC3.UGen.DB.ugenSummary "BHiPass"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = whiteNoise 'α' AR {- soundIn (mce2 0 1) -}->         f = mouseX KR 10 20000 Exponential 0.2->         rq = mouseY KR 0 1 Linear 0.2->     in bHiPass i f rq
− Help/UGen/bHiShelf.help.lhs
@@ -1,16 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BHiShelf"-    Sound.SC3.UGen.DB.ugenSummary "BHiShelf"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = soundIn 0->         f = mouseX KR 2200 18000 Exponential 0.2->         db = mouseY KR 18 (-18) Linear 0.2->     in bHiShelf i f 1 db--> g_02 =->     let i = soundIn 4->         f = mouseX KR 2200 18000 Exponential 0.2->         rs = mouseY KR 0.1 1 Linear 0.2->     in bHiShelf i f rs 6
− Help/UGen/bLowPass.help.lhs
@@ -1,27 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BLowPass"-    > Sound.SC3.UGen.DB.ugenSummary "BLowPass"-    > :t bLowPassCoef--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let i = soundIn (mce2 0 1)->         f = mouseX KR 10 20000 Exponential 0.2->         rq = mouseY KR 0 1 Linear 0.2->     in bLowPass i f rq->-> g_02 =->     let i = mix (saw AR (mce [0.99, 1, 1.01] * 440) * 0.3)->         f = mouseX KR 100 20000 Exponential 0.2->         rq = mouseY KR 0.1 1 Linear 0.2->     in bLowPass i f rq--Calculate coefficients and use sos.--> g_03 =->     let i = mix (saw AR (mce [0.99, 1, 1.01] * 440) * 0.3)->         f = mouseX KR 100 20000 Exponential 0.2->         rq = mouseY KR 0.1 1 Linear 0.2->         (a0, a1, a2, b1, b2) = bLowPassCoef sampleRate f rq->         flt ip = sos ip a0 a1 a2 b1 b2->     in flt (flt i)
− Help/UGen/bLowShelf.help.lhs
@@ -1,18 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BLowShelf"-    Sound.SC3.UGen.DB.ugenSummary "BLowShelf"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = soundIn (mce2 0 1)->         freq = mouseX KR 40 6000 Exponential 0.2->         rs = 1->         db = mouseY KR 24 (-24) Linear 0.2->     in bLowShelf i freq rs db--> g_02 =->     let i = soundIn (mce2 0 1)->         freq = mouseX KR 20 6000 Exponential 0.2->         rs = mouseY KR 0.1 1 Linear 0.2->         db = 6->     in bLowShelf i freq rs db
− Help/UGen/bPeakEQ.help.lhs
@@ -1,16 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BPeakEQ"-    Sound.SC3.UGen.DB.ugenSummary "BPeakEQ"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = soundIn 0->         freq = mouseX KR 2200 18000 Exponential 0.2->         db = mouseY KR 12 (-12) Linear 0.2->     in bPeakEQ i freq 0.8 db--> g_02 =->     let i = soundIn 0->         freq = mouseX KR 2200 18000 Exponential 0.2->         rq = mouseY KR 10 0.4 Linear 0.2->     in bPeakEQ i freq rq 6
− Help/UGen/balance2.help.lhs
@@ -1,43 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Balance2"-    Sound.SC3.UGen.DB.ugenSummary "Balance2"--> import Sound.SC3 {- hsc3 -}--{Balance2.ar(LFSaw.ar(44),Pulse.ar(33),FSinOsc.kr(0.5),0.1)}.play--> g_01 =->     let l = lfSaw AR 44 0->         r = pulse AR 33 0.5->         p = fSinOsc KR 0.5 0->     in balance2 l r p 0.1--{var s=SinOsc.ar([440,550]);Balance2.ar(s[0],s[1],LFNoise0.kr(4),0.3)}.play--> g_02 =->     let [s0,s1] = mceChannels (sinOsc AR (mce2 440 550) 0)->         n = lfNoise0 'α' KR 4->     in balance2 s0 s1 n 0.3--{var s=SinOsc.ar(440);Out.ar(0,0.2*Balance2.ar(s,s,SinOsc.kr(0.2)))}.play--> g_03 =->     let s = sinOsc AR 440 0->         p = sinOsc KR 0.2 0->     in balance2 s s p 1 * 0.2--{var s=SinOsc.ar(440);Out.ar(0,Balance2.ar(s,s,SinOsc.kr(0.2),0.2))}.play--> g_04 =->     let s = sinOsc AR 440 0->         p = sinOsc KR 0.2 0->     in balance2 s s p 0.2--    > withSC3 (send (n_trace [-1]))--{var s=SinOsc.ar(440);Out.ar(0,Balance2.ar(s,s,MouseX.kr(-1,1),0.2))}.play--> g_05 =->     let s0 = sinOsc AR 440 0->         s1 = sinOsc AR 550 0->         x = mouseX KR (-1) 1 Linear 0.2->     in balance2 s0 s1 x 0.2
− Help/UGen/beatTrack.help.lhs
@@ -1,17 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BeatTrack"-    Sound.SC3.UGen.DB.ugenSummary "BeatTrack"--> import Sound.SC3 {- hsc3 -}--    > withSC3 (async (b_alloc 10 1024 1))--> g_01 =->     let i = soundIn 0->         x = mouseX KR (-1) 1 Linear 0.2->         [b, h, q, t] = mceChannels (beatTrack KR (fft' 10 i) x)->         f = mce [440, 660, 880]->         a = mce [0.4, 0.2, 0.1]->         s = mix (sinOsc AR f 0 * a * decay (mce [b, h, q]) 0.05)->     in i + 2--
− Help/UGen/blip.help.lhs
@@ -1,32 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Blip"-    Sound.SC3.UGen.DB.ugenSummary "Blip"--> import Sound.SC3 {- hsc3 -}--> g_01 = blip AR 440 200 * 0.1--Modulate frequency--> g_02 = let f = xLine KR 20000 200 6 RemoveSynth in blip AR f 100 * 0.1--Modulate number of harmonics.--> g_03 = let nh = line KR 1 100 20 RemoveSynth in blip AR 200 nh * 0.2--Self-modulation at control rate.--> g_04 =->     let fr = blip KR 0.25 3 * 300 + 500->         nh = blip KR 0.15 2 * 20 + 21->     in blip AR fr nh * 0.2--Drawings--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (blip AR 1000 20)--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.1 (blip AR 1000 20)--![](sw/hsc3/Help/SVG/blip.0.svg)-![](sw/hsc3/Help/SVG/blip.1.svg)
− Help/UGen/blitB3Saw.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BlitB3Saw"-    Sound.SC3.UGen.DB.ugenSummary "BlitB3Saw"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = xLine KR 1000 20 10 DoNothing->     in blitB3Saw AR f 0.99 * 0.1--aliasing suddenly appears for very high frequencies--> g_02 =->     let f = mouseX KR 10 10000 Exponential 0.2->         c = mouseY KR 0.01 0.99 Linear 0.2->     in blitB3Saw AR f c * 0.1--comparison--> g_03 = mce2 (saw AR 20) (blitB3Saw AR 20 0.99) * 0.1
− Help/UGen/blitB3Square.help.lhs
@@ -1,26 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BlitB3Square"-    Sound.SC3.UGen.DB.ugenSummary "BlitB3Square"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = xLine KR 1000 20 10 DoNothing->     in blitB3Square AR f 0.99 * 0.1--aliasing suddenly appears for very high frequencies--> g_02 =->     let f = mouseX KR 20 10000 Exponential 0.2->         c = mouseY KR 0.001 0.999 Linear 0.2->     in blitB3Square AR f c * 0.1--difference in CPU usage (excessive wire use,-w 1024)--> g_03 sqr_osc =->     let f z = midiCPS (range 36 72 (lfNoise0 z KR (rand z 2 3)))->         l z = rand z (-1) 1->         o z = pan2 (sqr_osc AR (f z) * 0.1) (l z) 0.1->     in sum (map o [0::Int .. 99])--> g_04 = g_03 (\rt f -> blitB3Square rt f 0.99)-> g_05 = g_03 (\rt f -> pulse rt f 0.5)
− Help/UGen/blitB3Tri.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BlitB3Tri"-    Sound.SC3.UGen.DB.ugenSummary "BlitB3Tri"--> import Sound.SC3 {- hsc3 -}--> g_01 = blitB3Tri AR (xLine KR 1000 20 10 DoNothing) 0.99 0.99 * 0.1--unfortunately, aliasing returns at higher frequencies-(over 5000Hz or so) with a vengence--> g_02 = let x = mouseX KR 20 8000 Exponential 0.2->            y = mouseY KR 0.001 0.99 Linear 0.2->        in blitB3Tri AR x 0.99 y--more efficient, some aliasing from 3000, but not so scary over 5000-Duller sound (less high harmonics included for lower fundamentals)--> g_03 = let x = mouseX KR 20 8000 Exponential 0.2->        in lfTri AR x 0
− Help/UGen/bpf.help.lhs
@@ -1,27 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BPF"-    Sound.SC3.UGen.DB.ugenSummary "BPF"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000->     in bpf (saw AR 200 * 0.5) f 0.3--> g_02 =->     let x = mouseX KR 100 10000 Exponential 0.2->     in bpf (saw AR 200 * 0.5) x 0.3--> g_03 =->     let n = whiteNoise 'α' AR->         x = mouseX KR 220 440 Exponential 0.1->         y = mouseY KR 0.01 0.2 Linear 0.1->     in bpf n (mce [x, 550 - x]) y--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.05 (bpf (whiteNoise 'α' AR) 440 0.01)--BPF on control signals:--> g_04 =->     let vib = bpf (pinkNoise 'α' KR) (mouseX KR 1 100 Exponential 0.2) 0.3 * 10->     in sinOsc AR (vib * 200 + 600) 0 * 0.1
− Help/UGen/bpz2.help.lhs
@@ -1,8 +0,0 @@-   Sound.SC3.UGen.Help.viewSC3Help "BPZ2"-   Sound.SC3.UGen.DB.ugenSummary "BPZ2"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let n = whiteNoise 'α' AR->     in bpz2 (n * 0.25)
− Help/UGen/brf.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BRF"-    Sound.SC3.UGen.DB.ugenSummary "BRF"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = saw AR 200 * 0.1->         freq = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3800 + 4000->         rq = 0.3->     in brf i freq rq
− Help/UGen/brownNoise.help.lhs
@@ -1,21 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BrownNoise"-    Sound.SC3.UGen.DB.ugenSummary "BrownNoise"--> import Sound.SC3 {- hsc3 -}->-> g_01 = brownNoise 'α' AR * 0.1->-> g_02 =->     let n = brownNoise 'α' KR->     in sinOsc AR (linExp n (-1) 1 64 9600) 0 * 0.1--Drawing--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (brownNoise 'γ' AR)--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.1 (brownNoise 'γ' AR)--![](sw/hsc3/Help/SVG/brownNoise.0.svg)-![](sw/hsc3/Help/SVG/brownNoise.1.svg)
− Help/UGen/bufAllpassC.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufAllpassC"-    > Sound.SC3.UGen.DB.ugenSummary "BufAllpassC"--> import Sound.SC3 {- hsc3 -}--Allocate buffer--    > withSC3 (async (b_alloc 0 44100 1))--Filtered decaying noise bursts--> g_01 =->     let d = dust 'α' AR 1->         n = whiteNoise 'β' AR->         x = decay d 0.2 * n * 0.25->     in bufAllpassC 0 x 0.25 6
− Help/UGen/bufAllpassL.help.lhs
@@ -1,1 +0,0 @@-See bufAllpassC
− Help/UGen/bufAllpassN.help.lhs
@@ -1,1 +0,0 @@-See bufAllpassC
− Help/UGen/bufChannels.help.lhs
@@ -1,2 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "BufChannels"-> Sound.SC3.UGen.DB.ugenSummary "BufChannels"
− Help/UGen/bufCombC.help.lhs
@@ -1,32 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufCombC"-    > Sound.SC3.UGen.DB.ugenSummary "BufCombC"--> import Sound.SC3 {- hsc3 -}--Allocate buffer zero (required for examples below)--    > withSC3 (async (b_alloc 0 44100 1))--Comb filter as resonator. The resonant fundamental is equal to-reciprocal of the delay time.--> g_01 =->     let n = whiteNoise 'α' AR->         dt = xLine KR 0.0001 0.01 20 RemoveSynth->     in bufCombC 0 (n * 0.1) dt 0.2--With negative feedback--> g_02 =->     let n = whiteNoise 'α' AR->         dt = xLine KR 0.0001 0.01 20 RemoveSynth->     in bufCombC 0 (n * 0.1) dt (-0.2)--Used as an echo (filtered decaying noise bursts)--> g_03 =->     let d = dust 'α' AR 1->         n = whiteNoise 'β' AR->         i = decay (d * 0.5) 0.2 * n->     in bufCombC 0 i 0.2 3-
− Help/UGen/bufCombL.help.lhs
@@ -1,1 +0,0 @@-See bufCombC
− Help/UGen/bufCombN.help.lhs
@@ -1,1 +0,0 @@-See bufCombC
− Help/UGen/bufDelayC.help.lhs
@@ -1,26 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufDelayC"-    > Sound.SC3.UGen.DB.ugenSummary "BufDelayC"--> import Sound.SC3 {- hsc3 -}--Allocate buffer zero (required for examples below)--    > withSC3 (async (b_alloc 0 44100 1))--Dust randomly triggers Decay to create an exponential decay envelope-for the WhiteNoise input source.  The input is mixed with the delay.--> g_01 =->     let t = dust 'α' AR 1->         n = whiteNoise 'β' AR->         d = decay t 0.5 * n * 0.3->     in bufDelayC 0 d 0.2 + d--Mouse control for delay time--> g_02 =->     let t = dust 'α' AR 1->         n = whiteNoise 'β' AR->         d = decay t 0.3 * n->         x = mouseX KR 0.0 0.2 Linear 0.1->     in d + bufDelayC 0 d x
− Help/UGen/bufDelayL.help.lhs
@@ -1,1 +0,0 @@-See bufDelayC
− Help/UGen/bufDelayN.help.lhs
@@ -1,1 +0,0 @@-See bufDelayC
− Help/UGen/bufDur.help.lhs
@@ -1,17 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "BufDur"-    Sound.SC3.UGen.DB.ugenSummary "BufDur"--> import Sound.SC3 {- hsc3 -}--Load sound file to buffer zero (required for examples)--> fn_01 = "/home/rohan/data/audio/pf-c5.aif"--    > withSC3 (async (b_allocRead 0 fn_01 0 0))--Read without loop, trigger reset based on buffer duration--> g_01 =->     let t = impulse AR (recip (bufDur KR 0)) 0->         p = sweep t (bufSampleRate KR 0)->     in bufRdL 1 AR 0 p NoLoop
− Help/UGen/bufFrames.help.lhs
@@ -1,23 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufFrames"-    > Sound.SC3.UGen.DB.ugenSummary "BufFrames"--> import Sound.SC3--Load sound file to buffer zero (required for examples)--> fn_01 = "/home/rohan/data/audio/pf-c5.aif"--    > withSC3 (async (b_allocRead 0 fn_01 0 0))--Read without loop, trigger reset based on buffer duration--> g_01 =->     let p = phasor AR 0 (bufRateScale KR 0) 0 (bufFrames KR 0) 0->     in bufRdL 1 AR 0 p NoLoop--Mouse location drags play head--> g_02 =->     let r = mce [0.05,0.075 .. 0.15]->         p = k2A (mouseX KR 0 (bufFrames KR 0) Linear r)->     in mix (bufRdL 1 AR 0 p NoLoop)
− Help/UGen/bufRateScale.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufRateScale"-    > Sound.SC3.UGen.DB.ugenSummary "BufRateScale"--> import Sound.SC3 {- hsc 3 -}--Load sound file to buffer zero (required for examples)--> fn_01 = "/home/rohan/data/audio/pf-c5.aif"--    > withSC3 (async (b_allocRead 0 fn_01 0 0))--Read buffer at 3/4 reported sample rate.--> g_01 =->     let r = 0.75 * bufRateScale KR 0->         p = phasor AR 0 r 0 (bufFrames KR 0) 0->     in bufRdL 1 AR 0 p NoLoop
− Help/UGen/bufRd.help.lhs
@@ -1,43 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufRd"-    > Sound.SC3.UGen.DB.ugenSummary "BufRd"--> import Sound.SC3 {- hsc3 -}--Load sound file to buffer zero (required for examples)--> fn_01 = "/home/rohan/data/audio/pf-c5.aif"--    > withSC3 (async (b_allocRead 0 fn_01 0 0))--Phasor as phase input--> g_01 =->     let sc = bufRateScale KR 0->         tr = impulse AR (recip (bufDur KR 0)) 0->         ph = phasor AR tr sc 0 (bufFrames KR 0) 0->     in bufRdL 1 AR 0 ph NoLoop--Audio rate sine oscillator as phase input--> g_02 =->     let phase = sinOsc AR 0.1 0 * bufFrames KR 0 * bufRateScale KR 0->     in bufRd 1 AR 0 phase Loop NoInterpolation--There are constructors, bufRd{N|L|C}, for the fixed cases.--> g_03 =->     let x = mouseX KR (mce [5, 10]) 100 Linear 0.1->         n = lfNoise1 'α' AR x->     in bufRdL 1 AR 0 (n * bufFrames KR 0 * bufRateScale KR 0) Loop--Allocate and generate (non-wavetable) buffer--    > withSC3 (do {_ <- async (b_alloc 11 256 1)-    >             ;let f = [Normalise,Clear]-    >              in send (b_gen_sine1 11 f [1,1/2,1/3,1/4,1/5])})--Fixed frequency wavetable oscillator--> g_04 =->     let phase = linLin (saw AR 440) (-1) 1 0 1 * bufFrames KR 11->     in bufRd 1 AR 11 phase Loop NoInterpolation * 0.1
− Help/UGen/bufSampleRate.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufSampleRate"-    > Sound.SC3.UGen.DB.ugenSummary "BufSampleRate"--> import Sound.SC3 {- hsc3 -}--Load sound file to buffer zero (required for examples)--> fn_01 = "/home/rohan/data/audio/pf-c5.aif"--    > withSC3 (async (b_allocRead 0 fn_01 0 0))--Sine tone derived from sample rate of buffer an 440Hz tone.--> g_01 =->     let f = mce [bufSampleRate KR 0 * 0.01, 440]->     in sinOsc AR f 0 * 0.1
− Help/UGen/bufWr.help.lhs
@@ -1,30 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "BufWr"-    > Sound.SC3.UGen.DB.ugenSummary "BufWr"--> import Sound.SC3 {- hsc3 -}--allocate a buffer (id = 0) for writing into--    > withSC3 (send (b_alloc 0 (44100 * 2) 1))--write into the buffer (id = 0) with a bufWr--> wr_gr =->     let rt = control KR "wr-rate" 1->         o = sinOsc AR (lfNoise1 'α' KR 2 * 300 + 400) 0 * 0.1->         w = bufWr 0 (phasor AR 0 (bufRateScale KR 0 * rt) 0 (bufFrames KR 0) 0) Loop o->     in mrg2 (silent 1) w--read it with a BufRd--> rd_gr =->     let rt = control KR "rd-rate" 1->     in bufRdL 1 AR 0 (phasor AR 0 (bufRateScale KR 0 * rt) 0 (bufFrames KR 0) 0) Loop--    > audition wr_gr-    > audition rd_gr--set read & write rates independently--    > withSC3 (send (n_set1 1 "wr-rate" 0.25))-    > withSC3 (send (n_set1 1 "rd-rate" 13.0))
− Help/UGen/cOsc.help.lhs
@@ -1,38 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "COsc"-    > Sound.SC3.UGen.DB.ugenSummary "COsc"--> import Sound.SC3 {- hsc3 -}--Allocate and fill buffer.--> gen_tbl b p = let f = [Normalise,Wavetable,Clear] in b_gen_sine1 b f p--> b_01 :: Num n => n {- or {-# Language NoMonomorphismRestriction #-} -}-> b_01 = 10-> b_01_setup = [b_alloc b_01 512 1,gen_tbl b_01 [1,1/2,1/3,1/4,1/5,1/6,1/7,1/8,1/9,1/10]]--    > withSC3 (mapM_ async b_01_setup)--Fixed beat frequency--> g_01 = cOsc AR b_01 200 0.7 * 0.1--Modulate beat frequency with mouseX--> g_02 = cOsc AR b_01 200 (mouseX KR 0 4 Linear 0.2) * 0.1--Compare with plain osc--> g_03 = osc AR b_01 200 0.0 * 0.1--Summing behaviour (<http://article.gmane.org/gmane.comp.audio.supercollider.devel/62575>)--> b_02 :: Num n => n-> b_02 = 11-> b_02_setup = [b_alloc b_02 512 1,gen_tbl b_02 [1]]--    > withSC3 (mapM_ async b_02_setup)-    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (cOsc AR 11 100 5)--![](sw/hsc3/Help/SVG/cOsc.0.svg)
− Help/UGen/changed.help.lhs
@@ -1,12 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Changed"-    > Sound.SC3.UGen.DB.ugenSummary "Changed"--> import Sound.SC3 {- hsc3 -}--simple composition of hpz1 and >*--> g_01 =->     let s = lfNoise0 'α' KR 2->         c = changed s 0->         c' = decay2 c 0.01 0.5->     in sinOsc AR (440 + mce2 s c' * 440) 0 * 0.1
− Help/UGen/choose.help.lhs
@@ -1,9 +0,0 @@-    :t choose--choose is a composite of iRand and select.--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let f = uclone 'α' 2 (choose 'β' (mce [440,460 .. 880]))->     in sinOsc AR f  0 * 0.1
− Help/UGen/clip.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Clip"-    > Sound.SC3.UGen.DB.ugenSummary "Clip"--> import Sound.SC3 {- hsc3 -}->-> g_01 = clip (sinOsc AR 440 0 * 0.4) (-0.25) 0.25
− Help/UGen/clip2.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.clip2"-    > :t clip2--> import Sound.SC3 {- hsc3 -}--clipping distortion--> g_01 = clip2 (fSinOsc AR 400 0) 0.2->-> g_02 = clip2 (fSinOsc AR 400 0) (line KR 0 1 8 RemoveSynth)
− Help/UGen/clipNoise.help.lhs
@@ -1,13 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "ClipNoise"-    Sound.SC3.UGen.DB.ugenSummary "ClipNoise"--> import Sound.SC3->-> g_01 = clipNoise 'α' AR * 0.1 {- hsc3 -}--Drawings--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.01 (clipNoise 'α' AR)--![](sw/hsc3/Help/SVG/clipNoise.0.svg)
− Help/UGen/coinGate.help.lhs
@@ -1,9 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "CoinGate"-    Sound.SC3.UGen.DB.ugenSummary "CoinGate"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let g = coinGate 'α' 0.2 (impulse KR 10 0)->         f = tRand 'β' 300.0 400.0 g->     in sinOsc AR f 0 * 0.1
− Help/UGen/combC.help.lhs
@@ -1,1 +0,0 @@-See combN
− Help/UGen/combL.help.lhs
@@ -1,1 +0,0 @@-See combN
− Help/UGen/combN.help.lhs
@@ -1,37 +0,0 @@-Sound.SC3.UGen.Help.viewSC3Help "CombN"-Sound.SC3.UGen.DB.ugenSummary "CombN"--> import Sound.SC3 {- hsc3 -}--Comb filter as resonator. The resonant fundamental is equal to-reciprocal of the delay time.--> g_01 =->     let n = whiteNoise 'α' AR->         dt = xLine KR 0.0001 0.01 20 RemoveSynth->     in combN (n * 0.1) 0.01 dt 0.2--> g_02 =->     let n = whiteNoise 'α' AR->         dt = xLine KR 0.0001 0.01 20 RemoveSynth->     in combL (n * 0.1) 0.01 dt 0.2--> g_03 =->     let n = whiteNoise 'α' AR->         dt = xLine KR 0.0001 0.01 20 RemoveSynth->     in combC (n * 0.1) 0.01 dt 0.2--With negative feedback--> g_04 =->     let n = whiteNoise 'α' AR->         dt = xLine KR 0.0001 0.01 20 RemoveSynth->     in combC (n * 0.1) 0.01 dt (-0.2)--Used as an echo.--> g_05 =->     let d = dust 'α' AR 1->         n = whiteNoise 'β' AR->         i = decay (d * 0.5) 0.2 * n->     in combC i 0.2 0.2 3
− Help/UGen/compander.help.lhs
@@ -1,45 +0,0 @@-Sound.SC3.UGen.Help.viewSC3Help "Compander"-Sound.SC3.UGen.DB.ugenSummary "Compander"--> import Sound.SC3--Example signal to process.--> z =->     let e = decay2 (impulse AR 8 0 * lfSaw KR 0.3 0 * 0.3) 0.001 0.3->         p = mix (pulse AR (mce [80, 81]) 0.3)->     in e * p--> z' = soundIn 2--    audition (out 0 z)--Noise gate (no hold, no hysteresis)--> g_01 =->     let x = mouseX KR 0.01 0.15 Linear 0.1->     in mce [z, compander z z x 10 1 0.002 0.15]--Compressor--> g_02 =->     let x = mouseX KR 0.01 1 Linear 0.1->     in mce [z, compander z z x 1 (1/3) 0.01 0.01]--Expander--> g_03 =->     let x = mouseX KR 0.01 1 Linear 0.1->     in mce [z, compander z z x 1 3 0.01 0.1]--Limiter--> g_04 =->     let x = mouseX KR 0.01 1 Linear 0.1->     in mce [z, compander z z x 1 (1/10) 0.01 0.01]--Sustainer--> g_05 =->     let x = mouseX KR 0.01 0.15 Linear 0.1->     in mce [z, compander z z x (1/3) 1.0 0.01 0.05]
− Help/UGen/concat.help.lhs
@@ -1,22 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Concat"-    Sound.SC3.UGen.DB.ugenSummary "Concat"--> import Sound.SC3 {- hsc3 -}--> fn_01 = "/home/rohan/data/audio/pf-c5.snd"--    withSC3 (async (b_allocRead 12 fn_01 0 0))--Granulator--> gr_01 =->     let y0 = mouseY KR 0.01 1 Linear 0.2->         y1 = mouseY KR 12 100 Linear 0.2->         n = lfNoise0 'α' KR y0 * 3 + 4.5->         k = saw AR (sinOsc KR n 0 * 10 + y1)->         i = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing->         x0 = mouseX KR 0.01 0.1 Linear 0.2->         y2 = mouseY KR 0 0.1 Linear 0.2->         c :: UGen->         c = concat' k i 2 2 2 x0 0 y2 1 0.5 0 0->     in pan2 c 0 1
− Help/UGen/controlDur.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "ControlDur"-    > Sound.SC3.UGen.DB.ugenSummary "ControlDur"--> import Sound.SC3 {- hsc3 -}--controlRate and controlDur are reciprocals--> g_01 =->    let f = mce2 controlRate (recip controlDur)->    in sinOsc AR f 0 * 0.1
− Help/UGen/controlRate.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "ControlRate"-    > Sound.SC3.UGen.DB.ugenSummary "ControlRate"--> import Sound.SC3 {- hsc3 -}--play a sine tone at control rate, the reciprocal of controlDur--> g_01 =->     let f = mce2 controlRate (recip controlDur)->     in sinOsc AR f 0 * 0.1
− Help/UGen/convolution.help.lhs
@@ -1,8 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Convolution"-> Sound.SC3.UGen.DB.ugenSummary "Convolution"--> import Sound.SC3--> let {k = whiteNoise 'α' AR->     ;i = in' 2 AR numOutputBuses}-> in audition (out 0 (convolution i k 2048 * 0.1))
− Help/UGen/coyote.help.lhs
@@ -1,9 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Coyote"-> Sound.SC3.UGen.DB.ugenSummary "Coyote"--> import Sound.SC3--> let {i = soundIn 0->     ;c = coyote KR i 0.2 0.2 0.01 0.5 0.05 0.05->     ;o = pinkNoise 'a' AR * decay c 1}-> in audition (out 0 (mce2 i o))
− Help/UGen/crackle.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Crackle"-    Sound.SC3.UGen.DB.ugenSummary "Crackle"--> import Sound.SC3 {- hsc3 -}->-> g_01 = crackle AR 1.95 * 0.2--Modulate chaos parameter--> g_02 = crackle AR (line KR 1.0 2.0 3 RemoveSynth) * 0.2--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.01 (crackle AR 1.95)-    > plot_ugen1 0.025 (crackle AR (line KR 1.0 2.0 0.025 DoNothing))--![](sw/hsc3/Help/SVG/crackle.0.svg)-![](sw/hsc3/Help/SVG/crackle.1.svg)
− Help/UGen/cuspL.help.lhs
@@ -1,25 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "CuspL"-    Sound.SC3.UGen.DB.ugenSummary "CuspL"--> import Sound.SC3 {- hsc3 -}--Vary frequency--> g_01 =->     let x = mouseX KR 20 sampleRate Linear 0.1->     in cuspL AR x 1.0 1.99 0 * 0.3--Mouse-controlled parameters.--> g_02 =->     let x = mouseX KR 0.9 1.1 Linear 0.1->         y = mouseY KR 1.8 2.0 Linear 0.1->     in cuspL AR (sampleRate / 4) x y 0 * 0.3--As frequency control.--> g_03 =->     let x = mouseX KR 0.9 1.1 Linear 0.1->         y = mouseY KR 1.8 2.0 Linear 0.1->         n = cuspL AR 40 x y 0 * 0.3->     in sinOsc AR (n * 800 + 900) 0 * 0.4
− Help/UGen/cuspN.help.lhs
@@ -1,1 +0,0 @@-See cuspL
− Help/UGen/dPW3Tri.help.lhs
@@ -1,44 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "DPW3Tri"-    Sound.SC3.UGen.DB.ugenSummary "DPW3Tri"--> import Sound.SC3 {- hsc3 -}-> import qualified Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins as E {- hsc3 -}--> import qualified Sound.SC3.UGen.External.RDU as RDU {- sc3-rdu -}--distortion creeps in under 200Hz--> g_01 = E.dPW3Tri AR (xLine KR 2000 20 10 DoNothing) * 0.1--very fast sweeps can have transient distortion effects--> g_02 = E.dPW3Tri AR (mouseX KR 200 12000 Exponential 0.2) * 0.2--compare--> g_03 = lfTri AR (mouseX KR 200 12000 Exponential 0.2) 0 * 0.1--less efficient than LFTri--> g_04 = let f = RDU.randN 50 'α' 50 5000->        in splay (E.dPW3Tri AR f) 1 0.1 0 True--> g_05 = let f = RDU.randN 50 'α' 50 5000->        in splay (lfTri AR f 0) 1 0.1 0 True--triangle is integration of square wave--> g_06 = let f = mouseX KR 440 8800 Exponential 0.2->            o = pulse AR f 0.5->        in integrator o 0.99 * 0.05--differentiation of triangle is square--> g_07 = let f = mouseX KR 440 8800 Exponential 0.2->            o = E.dPW3Tri AR f->        in hpz1 (o * 2) * 0.25--compare--> g_08 = let f = mouseX KR 440 8800 Exponential 0.2->        in pulse AR f 0.5 * 0.1
− Help/UGen/dWGPlucked2.help.lhs
@@ -1,39 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "DWGPlucked2"-> Sound.SC3.UGen.DB.ugenSummary "DWGPlucked2"--> import Sound.SC3--self deleting--> let {amp = 0.5->     ;gate = 1->     ;freq = 440->     ;c3 = 20->     ;pan = 0->     ;e = Envelope->      [0,1,1,0] [0.001,0.006,0.0005]->      (map EnvNum [5,-5,-8]) Nothing Nothing->     ;i = amp * lfClipNoise 'α' AR 2000 * envGen AR gate 1 0 1 DoNothing e->     ;s = dWGPlucked2 AR freq amp gate 0.1 1 c3 i 0.1 1.008 0.55 0.01->     ;z = detectSilence s 0.001 0.1 RemoveSynth}-> in audition (out 0 (mrg2 (pan2 s pan 0.1) z))--re-sounding--> let {sequ e s tr = demand tr 0 (dseq e dinf (mce s))->     ;d = dseq 'α' dinf (mce [1,1,2,1,1,1,2,3,1,1,1,1,2,3,4] * 0.175)->     ;t = tDuty AR d 0 DoNothing 1 0->     ;amp = tRand 'β' 0.01 0.25 t->     ;n0 = sequ 'γ' [60,62,63,58,48,55] t->     ;n1 = sequ 'δ' [63,60,48,62,55,58] t->     ;freq = midiCPS (mce2 n0 n1)->     ;c3 = tRand 'ε' 300 1400 t->     ;pan = tRand 'ζ' (-1) 1 t->     ;e_dt = tRand 'η' 0.05 0.150 t->     ;mt = tRand 'θ' 0.992 1.008 t->     ;pp = tRand 'ι' 0.05 0.15 t->     ;dt = tRand 'κ' 0.25 1.75 t->     ;env = decay2 t 0.001 e_dt * lfClipNoise 'λ' AR 2000->     ;i = amp * lfClipNoise 'μ' AR 2000 * env->     ;ps = dWGPlucked2 AR freq amp 1 pp (1 / dt) c3 i 0.1 mt 0.55 0.01}-> in audition (out 0 (pan2 ps pan 0.1))
− Help/UGen/dbAmp.help.lhs
@@ -1,14 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.dbamp"-    > :t dbAmp--> import Sound.SC3 {- hsc3 -}--Linear db motion is exponential amplitude decay--> g_01 =->     let a = dbAmp (line KR (-12) (-40) 10 RemoveSynth)->     in fSinOsc AR 800 0 * a--There is a non-UGen variant.--    > dbAmp (-26::Double) == 0.05011872336272722
− Help/UGen/dbrown.help.lhs
@@ -1,10 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Dbrown"-> Sound.SC3.UGen.DB.ugenSummary "Dbrown"--> import Sound.SC3 {- hsc3 -}--> let {n = dbrown 'α' dinf 0 15 1->     ;x = mouseX KR 1 40 Exponential 0.1->     ;t = impulse KR x 0->     ;f = demand t 0 n * 30 + 340}-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/dbufrd.help.lhs
@@ -1,42 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dbufrd"-    > Sound.SC3.UGen.DB.ugenSummary "Dbufrd"--> import Sound.SC3 {- hsc3 -}-> import System.Random {- random -}--setup pattern at buffer 10--    > let n = randomRs (200.0,500.0) (mkStdGen 0)-    > in withSC3 (async (b_alloc_setn1 10 0 (take 24 n)))--pattern as frequency input--> g_01 =->     let s = dseq 'α' 3 (mce [0,3,5,0,3,7,0,5,9])->         b = dbrown 'β' 5 0 23 1->         p = dseq 'γ' dinf (mce [s,b])->         t = dust 'δ' KR 10->         r = dbufrd 'ε' 10 p Loop->     in sinOsc AR (demand t 0 r) 0 * 0.1--setup time pattern--    > let {i = randomRs (0,2) (mkStdGen 0)-    >     ;n = map ([1,0.5,0.25] !!) i}-    > in withSC3 (async (b_alloc_setn1 11 0 (take 24 n)))--requires buffers 10 and 11 as allocated above--> g_02 =->     let s = dseq 'α' 3 (mce [0,3,5,0,3,7,0,5,9])->         b = dbrown 'β' 5 0 23 1->         p = dseq 'γ' dinf (mce [s,b])->         j = dseries 'δ' dinf 0 1->         d = dbufrd 'ε' 11 j Loop->         l = dbufrd 'ζ' 10 p Loop->         f = duty KR (d * 0.5) 0 DoNothing l->     in sinOsc AR f 0 * 0.1--free buffers--    > withSC3 (async (b_free 10) >> async (b_free 11))
− Help/UGen/dbufwr.help.lhs
@@ -1,55 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dbufwr"-    > Sound.SC3.UGen.DB.ugenSummary "Dbufwr"--> import Sound.SC3 {- hsc3 -}--allocate buffer--    > withSC3 (async (b_alloc_setn1 0 0 (replicate 24 210)))--monadic graph constructor (type `C-cM-a` at g_01 to hear, `C-cM-g` to see)--> g_01 :: UId m => m UGen-> g_01 = do->   s1 <- dseriesM 30 0 3->   s2 <- dseriesM 30 0 1->   s3 <- dseriesM 16 1 1->   s4 <- dwhiteM 8 1 16->   s5 <- dseqM dinf (mce2 s3 s4)->   wt <- dustM KR 1                  {- write trigger -}->   rp <- dseriesM dinf 0 1           {- read pointer -}->   wp <- dseqM dinf (mce2 s1 s2)     {- write pointer -}->   r <- dbufrdM 0 rp Loop            {- reader -}->   w <- dbufwrM 0 wp (s5 * 60) Loop  {- writer -}->   let d = demand wt 0 w->       f = lag (demand (impulse KR 16 0) 0 r) 0.01->       o = sinOsc AR (f * mce2 1 1.01) 0 * 0.1->   return (mrg [d, out 0 o])--variant written using a local buffer and uid ugen forms--> g_02 =->     let b = asLocalBuf 'α' (replicate 24 210)->         s = dseq 'β' dinf (mce2 (dseries 'γ' 16 1 1) (dwhite 'δ' 8 1 16))->         rp = dseries 'ε' dinf 0 1 {- read pointer -}->         wp = dseq 'ζ' dinf (mce2 (dseries 'η' 30 0 3) (dseries 'θ' 30 0 1)) {- write pointer -}->         r = dbufrd 'ι' b rp Loop {- reader -}->         w = dbufwr 'κ' b wp (s * 60) Loop {- writer -}->         d = demand (dust 'λ' KR 1) 0 w->         f = lag (demand (impulse KR 16 0) 0 r) 0.01->         o = sinOsc AR (f * mce2 1 1.01) 0 * 0.1->     in mrg2 d (out 0 o)--demand rate single memory recurrence relation.--> rec1 z k t f =->   let b = asLocalBuf z [k]->       r = dbufrd z b 0 Loop {- reader -}->       w = dbufwr z b 0 (f r) Loop {- writer -}->   in mrg2 (demand t 0 r) (demand t 0 w)--simple counter, written in terms of rec1.--> g_03 =->     let f = rec1 'α' 0 (impulse KR 6 0) (\r -> (r + 1) `modE` 24)->     in sinOsc AR (midiCPS (60 + f)) 0 * 0.1
− Help/UGen/dc.help.lhs
@@ -1,25 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DC"-    > Sound.SC3.UGen.DB.ugenSummary "DC"--> import Sound.SC3 {- hsc3 -}--error...--> g_01 = 0 :: UGen--    > withSC3 (send (n_trace [-1]))--zero--> g_02 = dc AR 0--DC offset; will click on start and finish--> g_03 = dc AR 0.5-> g_04 = 0.5 + sinOsc AR 440 0 * 0.1-> g_05 = dc AR 0.5 + sinOsc AR 440 0 * 0.1--Transient before LeakDC adapts and suppresses the offset?--> g_06 = dc AR 1-> g_07 = leakDC (dc AR 1) 0.995
− Help/UGen/decay.help.lhs
@@ -1,18 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Decay"-    Sound.SC3.UGen.DB.ugenSummary "Decay"--> import Sound.SC3 {- hsc3 -}--Used as an envelope.--> g_01 =->     let n = pinkNoise 'α' AR -- sinOsc AR 11000 0->         s = impulse AR (xLine KR 1 50 20 RemoveSynth) 0.25->     in decay s 0.2 * n--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.05 (decay (impulse AR 1 0) 0.01)--![](sw/hsc3/Help/SVG/decay.0.svg)
− Help/UGen/decay2.help.lhs
@@ -1,27 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Decay2"-    Sound.SC3.UGen.DB.ugenSummary "Decay2"--> import Sound.SC3 {- hsc3 -}--Used as an envelope--> g_01 =->     let s = fSinOsc AR 600 0 * 0.25 -- sinOsc AR 11000 0 * 0.25->         f = xLine KR 1 50 20 RemoveSynth->     in decay2 (impulse AR f 0) 0.01 0.2 * s--Compare the above with Decay used as the envelope.--> g_02 =->     let s = fSinOsc AR 600 0 * 0.25->         f = xLine KR 1 50 20 RemoveSynth->     in decay (impulse AR f 0) 0.2 * s--Drawings, attack and decay are a difference of two decays, hence inversion--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.05 (decay2 (impulse AR 1 0) 0.001 0.01)-    > plot_ugen1 0.05 (decay2 (impulse AR 1 0) 0.01 0.001)--![](sw/hsc3/Help/SVG/decay2.0.svg)-![](sw/hsc3/Help/SVG/decay2.1.svg)
− Help/UGen/decodeB2.help.lhs
@@ -1,13 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "DecodeB2"-> Sound.SC3.UGen.DB.ugenSummary "DecodeB2"--> import Sound.SC3--fails..., but so does sclang...--> let {p = pinkNoise 'α' AR->     ;mx = mouseX KR (-1) 1 Linear 0.2->     ;my = mouseY KR 0 0.1 Linear 0.2->     ;[w,x,y] = mceChannels (panB2 p mx my)->     ;o = decodeB2 2 w x y 0.5}-> in audition (out 0 o)
− Help/UGen/degreeToKey.help.lhs
@@ -1,21 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DegreeToKey"-    > Sound.SC3.UGen.DB.ugenSummary "DegreeToKey"--> import Sound.SC3 {- hsc3 -}--allocate & initialise buffer zero--    > withSC3 (async (b_alloc_setn1 0 0 [0,2,3.2,5,7,9,10]))--modal space, mouse x controls discrete pitch in dorian mode--> g_01 =->     let n = lfNoise1 'α' KR (mce [3,3.05])->         x = mouseX KR 0 15 Linear 0.1->         k = degreeToKey 0 x 12->         f b = let o = sinOsc AR (midiCPS (b + k + n * 0.04)) 0 * 0.1->                   t = lfPulse AR (midiCPS (mce [48,55])) 0.15 0.5->                   d = rlpf t (midiCPS (sinOsc KR 0.1 0 * 10 + b)) 0.1 * 0.1->                   m = o + d->               in combN m 0.31 0.31 2 + m->     in (f 48 + f 72) * 0.25
− Help/UGen/delay1.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Delay1"-    Sound.SC3.UGen.DB.ugenSummary "Delay1"--> import Sound.SC3 {- hsc3 -}->-> g_01 = let s = impulse AR 1 0 in s + (delay1 s)--left=original, right=subtract delayed from original--> g_02 = let z = dust 'α' AR 1000 in mce2 z (z - delay1 z)
− Help/UGen/delay2.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Delay2"-    > Sound.SC3.UGen.DB.ugenSummary "Delay2"--> import Sound.SC3 {- hsc3 -}->-> g_01 = let s = impulse AR 1 0 in s + (delay2 s)
− Help/UGen/delayC.help.lhs
@@ -1,1 +0,0 @@-See delayN
− Help/UGen/delayL.help.lhs
@@ -1,1 +0,0 @@-See delayN
− Help/UGen/delayN.help.lhs
@@ -1,22 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "DelayN"-    Sound.SC3.UGen.DB.ugenSummary "DelayN"--> import Sound.SC3 {- hsc3 -}--Dust randomly triggers Decay to create an exponential decay envelope-for the WhiteNoise input source.  The input is mixed with the delay.--> g_01 =->     let i = decay (dust 'α' AR 1) 0.3 * whiteNoise 'β' AR->         maxdelaytime = 0.2->         delaytime = mouseX KR 0.0 maxdelaytime Linear 0.1->     in i + delayN i maxdelaytime delaytime--The delay time can be varied at control rate.  An oscillator either-reinforcing or cancelling with the delayed copy of itself.--> g_02 =->     let i = sinOsc AR 320 0 * 0.1->         maxdelaytime = 0.005->         delaytime = mouseX KR 0.0 maxdelaytime Linear 0.15->     in i + delayN i maxdelaytime delaytime
− Help/UGen/demand.help.lhs
@@ -1,35 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Demand"-    > Sound.SC3.UGen.DB.ugenSummary "Demand"--> import Sound.SC3 {- hsc3 -}->-> g_01 :: UId m => m UGen-> g_01 = do->   r <- dustM KR 1->   s <- dgeomM dinf (midiCPS 72) (midiRatio 1)->   let t = impulse KR 10 0->       f = demand t r s->       o = sinOsc AR (mce [f,f + 0.7]) 0->   return (max (cubed o) 0 * 0.1)->-> g_02 =->     let n = diwhite 'α' dinf 60 72->         t = impulse KR 10 0->         s = midiCPS n->         f = demand t 0 s->         o = sinOsc AR (mce [f,f + 0.7]) 0->     in cubed (cubed o) * 0.1--audio rate (poll output is equal for x1 and x2)--> g_03 =->     let i = lfNoise2 'α' AR 8000->         d = dseq 'β' dinf (mce [i])->         x = mouseX KR 1 3000 Exponential 0.2->         t = impulse AR x 0->         x1 = demand t 0 d->         x2 = latch i t->         s = mce2 x1 x2->         p = poll t s (mce2 (label "x1") (label "x2")) 0->         o = sinOsc AR (s * 300 + 400) 0 * 0.1->     in mrg2 o p
− Help/UGen/demandEnvGen.help.lhs
@@ -1,95 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "DemandEnvGen"-    Sound.SC3.UGen.DB.ugenSummary "DemandEnvGen"--> import Sound.SC3 {- hsc3 -}--Frequency ramp, exponential curve.--> g_01 =->     let l = dseq 'α' dinf (mce2 440 9600)->         y = mouseY KR 0.01 3 Exponential 0.2->         s = env_curve_shape EnvExp->         f = demandEnvGen AR l y s 0 1 1 1 0 1 DoNothing->     in sinOsc AR f 0 * 0.1--Frequency envelope with random times.--> g_02 =->     let l = dseq 'α' dinf (mce [204,400,201,502,300,200])->         t = drand 'β' dinf (mce [1.01,0.2,0.1,2.0])->         y = mouseY KR 0.01 3 Exponential 0.2->         s = env_curve_shape EnvCub->         f = demandEnvGen AR l (t * y) s 0 1 1 1 0 1 DoNothing->     in sinOsc AR (f * mce2 1 1.01) 0 * 0.1--Frequency modulation--> g_03 =->     let n = dwhite 'α' dinf 200 1000->         x = mouseX KR (-0.01) (-4) Linear 0.2->         y = mouseY KR 1 3000 Exponential 0.2->         s = env_curve_shape (EnvNum undefined)->         f = demandEnvGen AR n (sampleDur * y) s x 1 1 1 0 1 DoNothing->     in sinOsc AR f 0 * 0.1--Short sequence with doneAction, linear--> g_04 =->     let l = dseq 'α' 1 (mce [1300,500,800,300,400])->         s = env_curve_shape EnvLin->         f = demandEnvGen KR l 2 s 0 1 1 1 0 1 RemoveSynth->     in sinOsc AR (f * mce2 1 1.01) 0 * 0.1--Gate, mouse x on right side of screen toggles gate--> g_05 =->     let n = roundTo (dwhite 'α' dinf 300 1000) 100->         x = mouseX KR 0 1 Linear 0.2->         g = x >* 0.5->         f = demandEnvGen AR n 0.1 5 0.3 g 1 1 0 1 DoNothing->     in sinOsc AR (f * mce2 1 1.21) 0 * 0.1--gate-mouse x on right side of screen toggles sample and hold-mouse button does hard reset--> g_06 =->     let l = dseq 'α' 2 (mce [dseries 'β' 5 400 200,500,800,530,4000,900])->         x = mouseX KR 0 1 Linear 0.2->         g = (x >* 0.5) - 0.1->         b = mouseButton KR 0 1 0.2->         r = (b >* 0.5) * 2->         s = env_curve_shape EnvSin->         f = demandEnvGen KR l 0.1 s 0 g r 1 0 1 DoNothing->     in sinOsc AR (f * mce2 1 1.001) 0 * 0.1--initialise coordinate buffer-layout is (initial-level,duration,level,..,loop-duration)--    > withSC3 (async (b_alloc_setn1 0 0 [0,0.5,0.1,0.5,1,0.01]))--> g_07 =->     let b = 0->         l_i = dseries 'β' dinf 0 2->         d_i = dseries 'γ' dinf 1 2->         l = dbufrd 'δ' b l_i Loop->         d = dbufrd 'ε' b d_i Loop->         s = env_curve_shape EnvLin->         e = demandEnvGen KR l d s 0 1 1 1 0 5 RemoveSynth->         f = midiCPS (60 + (e * 12))->     in sinOsc AR (f * mce2 1 1.01) 0 * 0.1--change envelope by setting values or indeed reallocating buffer--    > withSC3 (send (b_set1 0 1 0.1))-    > withSC3 (async (b_alloc_setn1 0 0 [0.5,0.9,0.1,0.1,1,0.01]))--read envelope break-points from buffer, here simply duration/level pairs.-the behavior is odd if the curve is zero (ie. flat segments).--> g_08 =->     let b = asLocalBuf 'α' [61,1,60,2,72,1,55,5,67,9,67]->         lvl = dbufrd 'β' b (dseries 'γ' 6 0 2) Loop->         dur = dbufrd 'δ' b (dseries 'ε' 5 1 2) Loop->         e = demandEnvGen KR lvl dur 1 0 1 1 1 0 1 RemoveSynth->     in sinOsc AR (midiCPS e) 0 * 0.1
− Help/UGen/detectIndex.help.lhs
@@ -1,20 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DetectIndex"-    > Sound.SC3.UGen.DB.ugenSummary "DetectIndex"--> import Sound.SC3 {- hsc3 -}--Allocate and set values at buffer ten--    > withSC3 (async (b_alloc_setn1 10 0 [2,3,4,0,1,5]))--Find indexes and map to an audible frequency range.--> g_01 =->     let n = 6->         x = floorE (mouseX KR 0 n Linear 0.1)->         i = detectIndex 10 x->     in sinOsc AR (linExp i 0 n 200 700) 0 * 0.1--Free buffer.--    > withSC3 (send (b_free 10))
− Help/UGen/detectSilence.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DetectSilence"-    > Sound.SC3.UGen.DB.ugenSummary "DetectSilence"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let s = sinOsc AR 440 0 * mouseY KR 0 0.2 Linear 0.1->         d = detectSilence s 0.1 0.1 RemoveSynth->     in mrg [s,d]
− Help/UGen/dfm1.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "DFM1"-    Sound.SC3.UGen.DB.ugenSummary "DFM1"--> import Sound.SC3--Play it with the mouse--> gr_01 =->     let n = pinkNoise 'α' AR * 0.5->         x = mouseX KR 80 5000 Exponential 0.1->         y = mouseX KR 0.1 1.2 Linear 0.1->     in dfm1 n x y 1 0 3e-4--Bass...--> gr_02 =->     let i = pulse AR 100 0.5 * 0.4 + pulse AR 100.1 0.5 * 0.4->         f = range 80 2000 (sinOsc KR (range 0.2 5 (sinOsc KR 0.3 0)) 0)->     in dfm1 i f 1.1 2 0 3e-4 * 0.1
− Help/UGen/dgeom.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dgeom"-    > Sound.SC3.UGen.DB.ugenSummary "Dgeom"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = dgeom 'α' 15 1 1.2->         x = mouseX KR 1 40 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dibrown.help.lhs
@@ -1,4 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Dibrown"-> Sound.SC3.UGen.DB.ugenSummary "Dibrown"--See dbrown
− Help/UGen/difSqr.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.difsqr"-    > :t difSqr--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = fSinOsc AR 800 0->         b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0->     in difSqr a b * 0.125--Written out:--> g_02 =->     let a = fSinOsc AR 800 0->         b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0->     in (a * a - b * b) * 0.125
− Help/UGen/disintegrator.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Disintegrator"-    Sound.SC3.UGen.DB.ugenSummary "Disintegrator"--> import Sound.SC3 {- hsc3 -}--> gr_01 =->     let x = mouseX KR 0 1 Linear 0.2->         y = mouseY KR 0 1 Linear 0.2->         s = sinOsc AR (mce2 400 404) 0 * 0.2->     in disintegrator 'α' s x y
− Help/UGen/diskIn.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DiskIn"-    > Sound.SC3.UGen.DB.ugenSummary "DiskIn"--> import Sound.SC3 {- hsc3 -}->-> fn_01 = "/home/rohan/data/audio/pf-c5.snd"-> nc_01 = 1-> msg_01 = [b_alloc 0 65536 nc_01,b_read 0 fn_01 0 (-1) 0 True]-> msg_02 = [b_close 0,b_free 0]--allocate buffer and open file for reading--    > withSC3 (mapM_ async msg_01)--> g_01 = diskIn nc_01 0 Loop--close file & free buffer--    > withSC3 (mapM_ async msg_02)
− Help/UGen/diskOut.help.lhs
@@ -1,48 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DiskOut"-    > Sound.SC3.UGen.DB.ugenSummary "DiskOut"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--Example graph--> g_01 =->     let d = xLine KR 20000 2 10 RemoveSynth->     in dust 'α' AR d * 0.15--> g_02 = soundIn 0--Check incoming signal (either graph above or the outside world, or `C-cC-a`)--    > audition (out 0 g_01)--Record incoming signal (or above...), print some informational traces...--> trace str = liftIO (putStrLn str)-> sy_01 = synthdef "disk-out" (diskOut 0 g_01)-> fn_01 = "/tmp/disk-out.aiff"-> nc_01 = 1-> msg_01 = [b_alloc 0 65536 nc_01,b_write 0 fn_01 Aiff PcmInt16 (-1) 0 True]-> msg_02 = [b_close 0,b_free 0]--    > withSC3 (do {trace "b_alloc & b_write"-    >             ;mapM_ async msg_01-    >             ;trace "record for 10 seconds"-    >             ;playSynthdef (2001,AddToTail,1,[]) sy_01-    >             ;pauseThread 10-    >             ;trace "stop recording and tidy up"-    >             ;send (n_free [2001])-    >             ;mapM_ async msg_02-    >             ;return ()})--Listen to recording (on loop...)--> msg_03 = [b_alloc 0 65536 nc_01,b_read 0 fn_01 0 (-1) 0 True]--    > withSC3 (mapM_ async msg_03)--> g_03 = diskIn nc_01 0 Loop--Tidy up...--    > withSC3 (mapM_ async msg_02)
− Help/UGen/distort.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.distort"-    > :t distort--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let e = xLine KR 0.1 10 10 DoNothing->         o = fSinOsc AR 500 0.0->     in distort (o * e) * 0.25
− Help/UGen/diwhite.help.lhs
@@ -1,4 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Diwhite"-> Sound.SC3.UGen.DB.ugenSummary "Diwhite"--See dwhite
− Help/UGen/done.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Done"-    > Sound.SC3.UGen.DB.ugenSummary "Done"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR (-1) 1 Linear 0.1->         e = linen x 0.1 0.1 0.5 DoNothing->         o1 = sinOsc AR 880 0 * 0.1->         o2 = sinOsc AR 440 0 * e->     in mce [done e * o1,o2]
− Help/UGen/drand.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Drand"-    > Sound.SC3.UGen.DB.ugenSummary "Drand"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = drand 'α' dinf (mce [1, 3, 2, 7, 8])->         x = mouseX KR 1 400 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dseq.help.lhs
@@ -1,41 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Dseq"-    Sound.SC3.UGen.DB.ugenSummary "Dseq"--> import Sound.SC3 {- hsc3 -}--At control rate.--> gr_01 =->     let n = dseq 'α' 3 (mce [1,3,2,7,8])->         x = mouseX KR 1 40 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1--At audio rate.--> gr_02 =->     let n = dseq 'α' dinf (mce [1,3,2,7,8,32,16,18,12,24])->         x = mouseX KR 1 10000 Exponential 0.1->         t = impulse AR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1--The SC2 Sequencer UGen is somewhat like the sequ function below--> gr_03 =->     let sequ e s tr = demand tr 0 (dseq e dinf (mce s))->         t = impulse AR 6 0->         n0 = sequ 'α' [60,62,63,58,48,55] t->         n1 = sequ 'β' [63,60,48,62,55,58] t->     in lfSaw AR (midiCPS (mce2 n0 n1)) 0 * 0.1--Rather than MCE expansion at _tr_, it can be clearer to view _tr_ as a-functor.--> gr_04 =->     let tr = impulse KR (mce [2,3,5]) 0->         f (z,t) = demand t 0 (dseq z dinf (mce [60,63,67,69]))->         m = mce_map_ix f tr->         o = sinOsc AR (midiCPS m) 0 * 0.1->     in splay o 1 1 0 True
− Help/UGen/dser.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dser"-    > Sound.SC3.UGen.DB.ugenSummary "Dser"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = dser 'α' 7 (mce [1, 3, 2, 7, 8])->         x = mouseX KR 1 40 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 a * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dseries.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dseries"-    > Sound.SC3.UGen.DB.ugenSummary "Dseries"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = dseries 'α' 15 0 1->         x = mouseX KR 1 40 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dshuf.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dshuf"-    > Sound.SC3.UGen.DB.ugenSummary "Dshuf"--> import Sound.SC3 {- hsc3 -}-> import qualified Sound.SC3.UGen.External.RDU as RDU {- sc3-rdu -}--> g_01 =->     let a = dseq 'α' dinf (dshuf 'β' 3 (mce [1,3,2,7,8.5]))->         x = mouseX KR 1 40 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 a * 30 + 340->     in sinOsc AR f 0 * 0.1--> g_02 =->     let a = dseq 'α' dinf (dshuf 'β' 5 (RDU.randN 81 'γ' 0 10))->         x = mouseX KR 1 10000 Exponential 0.1->         t = impulse AR x 0->         f = demand t 0 a * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dstutter.help.lhs
@@ -1,26 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dstutter"-    > Sound.SC3.UGen.DB.ugenSummary "Dstutter"--> import Sound.SC3 {- hsc3-}->-> g_01 =->     let inp = dseq 'α' dinf (mce [1,2,3])->         nse = diwhite 'β' dinf 2 8->         rep = dstutter 'γ' nse inp->         trg = impulse KR (mouseX KR 1 40 Exponential 0.2) 0->         frq = demand trg 0 rep * 30 + 340->     in sinOsc AR frq 0 * 0.1--see also <https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html>--> g_02 =->     let a z = let xr = dxrand z dinf (mce [0.1,0.2,0.3,0.4,0.5])->                   lf = dstutter z 2 xr->                   du = duty AR lf 0 DoNothing lf->                   tr = abs (hpz1 du) >* 0->                   ph = sweep tr (1/du)->               in linExp ph 0 1 (rand z 50 100) (rand z 500 2000)->         f = mce (map a ['a'..'h'])->         [s0,s1] = mceChannels (splay (sinOsc AR f 0) 1 1 0 True)->         o = limiter (rotate2 s0 s1 (lfSaw KR 0.1 0)) 1 1e-2->     in o * 0.25
− Help/UGen/dswitch.help.lhs
@@ -1,21 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dswitch"-    > Sound.SC3.UGen.DB.ugenSummary "Dswitch"--> import Sound.SC3 {- hsc3 -}->-> mk_g :: UId m => (UGen -> UGen -> m UGen) -> m UGen-> mk_g sw = do->   a0 <- dwhiteM 2 3 4->   a1 <- dwhiteM 2 0 1->   a2 <- dseqM 2 (mce [1,1,1,0])->   i <- dseqM 2 (mce [0,1,2,1,0])->   d <- sw i (mce [a0,a1,a2])->   let t = impulse KR 4 0->       f = demand t 0 d * 300 + 400->   return (sinOsc AR f 0 * 0.1)--compare with dswitch1--> g_01,g_02 :: UId m => m UGen-> g_01 = mk_g dswitchM-> g_02 = mk_g dswitch1M
− Help/UGen/dswitch1.help.lhs
@@ -1,13 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dswitch1"-    > Sound.SC3.UGen.DB.ugenSummary "Dswitch1"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let x = mouseX KR 0 4 Linear 0.1->         y = mouseY KR 1 15 Linear 0.1->         t = impulse KR 3 0->         w = dwhite 'α' dinf 20 23->         n = dswitch1 'β' x (mce [1, 3, y, 2, w])->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dust.help.lhs
@@ -1,25 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Dust"-    Sound.SC3.UGen.DB.ugenSummary "Dust"--> import Sound.SC3->-> g_01 = dust 'α' AR 200 * 0.25->-> g_02 =->     let d = xLine KR 20000 2 10 RemoveSynth->     in dust 'β' AR d * 0.15--Drawings--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (dust 'γ' AR 300)-    plot_ugen1 0.1 (dust 'γ' AR (xLine KR 5000 100 0.1 RemoveSynth))--![](sw/hsc3/Help/SVG/dust.0.svg)-![](sw/hsc3/Help/SVG/dust.1.svg)--Illustrate monadic constructor--> g_03,g_04 :: UId m => m UGen-> g_03 = fmap (* 0.25) (dustM AR 200)-> g_04 = fmap (* 0.15) (dustM AR (xLine KR 20000 2 10 RemoveSynth))
− Help/UGen/dust2.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Dust2"-    Sound.SC3.UGen.DB.ugenSummary "Dust2"--> import Sound.SC3 {- hsc3 -}--> g_01 = dust2 'α' AR 200 * 0.5--> g_02 =->     let d = xLine KR 20000 2 10 RemoveSynth->     in dust2 'β' AR d * 0.15--Drawings--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (dust2 'γ' AR 400)-    plot_ugen1 0.1 (dust2 'γ' AR (xLine KR 5000 100 0.1 RemoveSynth))--![](sw/hsc3/Help/SVG/dust2.0.svg)-![](sw/hsc3/Help/SVG/dust2.1.svg)
− Help/UGen/duty.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Duty"-    > Sound.SC3.UGen.DB.ugenSummary "Duty"--> import Sound.SC3 {- hsc3 -}->-> g_01 :: UId m => m UGen-> g_01 = do->   n0 <- drandM dinf (mce [0.01,0.2,0.4])->   n1 <- dseqM dinf (mce [204,400,201,502,300,200])->   let f = duty KR n0 0 RemoveSynth n1->   return (sinOsc AR (f * mce2 1 1.01) 0 * 0.1)--Using control rate signal, mouseX, to determine duration.--> g_02 =->     let n = dseq 'α' dinf (mce [204,400,201,502,300,200])->         x = mouseX KR 0.001 2 Linear 0.1->         f = duty KR x 0 RemoveSynth n->     in sinOsc AR (f * mce2 1 1.01) 0 * 0.1
− Help/UGen/dwhite.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dwhite"-    > Sound.SC3.UGen.DB.ugenSummary "Dwhite"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = dwhite 'α' 30 0 15->         x = mouseX KR 1 40 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dwrand.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dwrand"-    > Sound.SC3.UGen.DB.ugenSummary "Dwrand"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = dwrand 'α' dinf (mce [0.3,0.2,0.1,0.2,0.2]) (mce [1,3,2,7,8])->         x = mouseX KR 1 400 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dwt.help.lhs
@@ -1,3 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "DWT"-> Sound.SC3.UGen.DB.ugenSummary "DWT"-
− Help/UGen/dxrand.help.lhs
@@ -1,30 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Dxrand"-    > Sound.SC3.UGen.DB.ugenSummary "Dxrand"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = mce [0.2,0.4,dseq 'α' 2 (mce [0.1,0.1])]->         d = dxrand 'β' dinf i->     in tDuty AR d 0 DoNothing (dwhite 'γ' dinf 0.5 1) 0--The list inputs to demand rate ugens may operate at different rates.-The variants i' and i'' below ought to generate the same graph.  A-simple-minded mce rule sets the rate of the operator primitive to the-maximum rate of the inputs and then does not revise this after mce-transformation, where it may be lower.  The hsc3 constructors attempt-to get this right!--> g_02 =->     let i = mce [0.2,0.4,dseq 'α' 2 (mce [0.1,0.1])]->         i' = mceMap (* 0.5) i->         i'' = i * 0.5->         d = dxrand 'β' dinf i''->     in tDuty AR d 0 DoNothing (dwhite 'γ' dinf 0.5 1) 0--> g_03 =->     let n = dxrand 'α' dinf (mce [1, 3, 2, 7, 8])->         x = mouseX KR 1 400 Exponential 0.1->         t = impulse KR x 0->         f = demand t 0 n * 30 + 340->     in sinOsc AR f 0 * 0.1
− Help/UGen/dynKlang.help.lhs
@@ -1,25 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DynKlang"-    > Sound.SC3.UGen.DB.ugenSummary "DynKlang"--> import Sound.SC3 {- hsc3 -}--fixed--> g_01 =->     let s = klangSpec [800,1000,1200] [0.3,0.3,0.3] [pi,pi,pi]->     in dynKlang AR 1 0 s * 0.4--fixed: randomised--> g_02 =->     let f = map (\z -> rand z 600 1000) ['a'..'l']->         s = klangSpec f (replicate 12 1) (replicate 12 0)->     in dynKlang AR 1 0 s * 0.05--dynamic: frequency modulation--> g_03 =->     let f = mce3 800 1000 1200 + sinOsc KR (mce3 2 3 4.2) 0 * mce3 13 24 12->         a = mce3 0.3 0.3 0.3->         p = mce3 pi pi pi->     in dynKlang AR 1 0 (klangSpec_mce f a p) * 0.1
− Help/UGen/dynKlank.help.lhs
@@ -1,45 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "DynKlank"-    > Sound.SC3.UGen.DB.ugenSummary "DynKlank"--> import Sound.SC3 {- hsc3 -}--    {s=`[[800,1071,1153,1723],nil,[1,1,1,1]]-    ;DynKlank.ar(,Impulse.ar(2,0,0.1))}.play--> g_01 =->     let s = klankSpec [800,1071,1153,1723] [1,1,1,1] [1,1,1,1]->     in dynKlank (impulse AR 2 0 * 0.1) 1 0 1 s--    {s=`[[800,1071,1353,1723],nil,[1,1,1,1]]-    ;DynKlank.ar(s,Dust.ar(8,0.1))}.play--> g_02 =->     let s = klankSpec [800,1071,1353,1723] [1,1,1,1] [1,1,1,1]->     in dynKlank (dust 'α' AR 8 * 0.1) 1 0 1 s--    {s=`[[800,1071,1353,1723],nil,[1,1,1,1]]-    ;DynKlank.ar(s,PinkNoise.ar(0.007))}.play--> g_03 =->     let s = klankSpec [800,1071,1353,1723] [1,1,1,1] [1,1,1,1]->     in dynKlank (pinkNoise 'α' AR * 0.007) 1 0 1 s--    {s=`[[200,671,1153,1723],nil,[1,1,1,1]]-    ;a=[0.007,0.007]-    ;DynKlank.ar(s,PinkNoise.ar(a))}.play;--> g_04 =->     let s = klankSpec [200,671,1153,1723] [1,1,1,1] [1,1,1,1]->         a = mce2 0.007 0.007->     in dynKlank (pinkNoise 'α' AR * a) 1 0 1 s--Change frequencies (x) and ring-times (y) with mouse.--> g_05 =->     let x = mouseX KR 0.5 2 Exponential 0.2->         f = map (* x) [800,1071,1153,1723]->         y = mouseY KR 0.1 10 Exponential 0.2->         d = map (* y) [1,1,1,1]->         s = klankSpec f [1,1,1,1] d->         i = impulse AR 2 0 * 0.1->     in dynKlank i 1 0 1 s
− Help/UGen/envADSR.help.lhs
@@ -1,70 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*adsr"-    :i Sound.SC3.ADSR-    :t Sound.SC3.envADSR_r-    :t Sound.SC3.envADSR--> import Sound.SC3 {- hsc3 -}--{SinOsc.ar * EnvGen.kr(Env.adsr(0.75, 2.75, 0.1, 7.25, 1, -4, 0))}.draw;--> g_01 =->     let c = control KR "env-gate" 1->         p = envADSR 0.75 2.75 0.1 7.25 1 (EnvNum (-4)) 0->         e = envGen KR c 1 0 1 DoNothing p->     in sinOsc AR 440 0 * e * 0.1--    import Sound.OSC {- hosc -}-    withSC3 (sendMessage (n_set1 (-1) "env-gate" 0))-    withSC3 (sendMessage (n_set1 (-1) "env-gate" 1))-    withSC3 (sendMessage (n_free [-1]))--> e_01 =->     [envADSR 0.75 0.75 0.5 0.75 1 (EnvNum (-4)) 0->     ,envADSR 0.02 0.2 0.25 1 1 (EnvNum (-4)) 0->     ,envADSR 0.001 0.2 0.25 1 1 (EnvNum (-4)) 0->     ,envADSR 0 2 1 0.1 0.5 EnvSin 0->     ,envADSR 0.001 1.54 1 0.001 0.4 EnvSin 0]--    import Sound.SC3.Plot {- hsc3 -}-    plotEnvelope e_01--There is a record variant:--> g_02 =->     let g = control KR "gate" 1->         c = EnvNum (-4)->         r = ADSR {adsr_attackTime = 0.75->                  ,adsr_decayTime = 0.75->                  ,adsr_sustainLevel = 0.5->                  ,adsr_releaseTime = 0.75->                  ,adsr_peakLevel = 1->                  ,adsr_curve = (c,c,c)->                  ,adsr_bias = 0}->         p = envADSR_r r->         e = envGen KR g 0.1 0 1 DoNothing p->     in sinOsc AR 440 0 * e--    withSC3 (sendMessage (n_set1 (-1) "gate" 0))-    withSC3 (sendMessage (n_set1 (-1) "gate" 1))-    withSC3 (sendMessage (n_free [-1]))--SC3 comparison:--Env.adsr.asArray == [0,3,2,-99,1,0.01,5,-4,0.5,0.3,5,-4,0,1,5,-4];--> r_03 = [0,3,2,-99,1,0.01,5,-4,0.5,0.3,5,-4,0,1,5,-4]-> e_03 = envADSR 0.01 0.3 0.5 1 1 (EnvNum (-4)) 0-> a_03 = envelope_sc3_array e_03--    e_03 == envADSR_r adsrDefault-    a_03 == Just r_03--> r_04 = [0,3,2,-99,1,0.3,5,-4,0.1,0.4,5,-4,0,1.2,5,-4]-> e_04 = envADSR 0.3 0.4 0.1 1.2 1 (EnvNum (-4)) 0-> a_04 = envelope_sc3_array e_04--    a_04 == Just r_04--x = {|gate=0, freq=440 | EnvGen.kr(Env.adsr,gate) * SinOsc.ar(freq,0) * 0.1}.play-x.set(\gate,1);-x.set(\gate,0);
− Help/UGen/envASR.help.lhs
@@ -1,30 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*asr"-    :i Sound.SC3.ASR--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let g = control KR "env-gate" 1->         p = envASR 0.01 1 1 (EnvNum (-4))->         e = envGen KR g 0.1 0 1 RemoveSynth p->     in sinOsc AR 440 0 * e--    import Sound.OSC {- hosc -}-    withSC3 (sendMessage (n_set1 (-1) "env-gate" 0))--> e_01 =->     [envASR 0.1 1 1 (EnvNum (-4))->     ,envASR 0.3 0.25 1 EnvSin->     ,envASR 0.01 0.5 1.25 EnvLin]--    import Sound.SC3.Plot {- hsc3-plot -}-    plotEnvelope e_01--An envelope with a long release time that mostly sustains and then decays quickly--> e_02 = envASR_c 0.01 1 0.75 (EnvNum (-4),EnvNum 4)-> e_03 = envASR_c 0.15 1 1.25 (EnvNum (-4),EnvNum (-4))-> e_04 = envASR_c 0.15 1 1.25 (EnvNum (-4),EnvNum 64)--    plotEnvelope [e_02,e_03,e_04]-
− Help/UGen/envCoord.help.lhs
@@ -1,53 +0,0 @@-    :t envCoord--> import Sound.SC3--co-ordinate (break-point) envelope--> g_01 =->     let c = EnvLin->         p = envCoord [(0,0),(0.5,0.1),(0.55,1),(1,0)] 9 0.1 c->         e = envGen KR 1 1 0 1 RemoveSynth p->     in sinOsc AR 440 0 * e--line segments, set target value & transition time and trigger--> g_02 =->     let tr = tr_control "tr" 1->         st = control KR "st" 440->         en = control KR "en" 880->         tm = control KR "tm" 2->         p = envCoord [(0,st),(tm,en)] 1 1 EnvLin->         e = envGen KR tr 1 0 1 DoNothing p->     in sinOsc AR e 0 * 0.2--    import Sound.OSC {- hosc3 -}-    withSC3 (sendMessage (n_set (-1) [("en",550),("tm",4),("tr",1)]))-    withSC3 (sendMessage (n_set (-1) [("en",990),("tm",1),("tr",1)]))-    withSC3 (sendMessage (n_set (-1) [("en",110),("tm",2),("tr",1)]))--likewise, but internal graph triggers and randomises line end points--> g_03 =->     let tr = dust 'α' KR 2->         st = 440->         en = tRand 'β' 300 900 tr->         tm = tRand 'γ' 0.5 1.5 tr->         p = envCoord [(0,st),(tm,en)] 1 1 EnvLin->         e = envGen KR tr 1 0 1 DoNothing p->     in sinOsc AR e 0 * 0.2--plotting--> e_01 =->     let c0 = [(0,0),(0.35,0.1),(0.55,1),(1,0)]->         c1 = [(0,0),(0.15,0.6),(0.35,0.2),(1,0)]->         c2 = [(0,0),(0.65,0.3),(0.85,0.7),(1,0)]->         c3 = [(0,0.1),(0.25,0.6),(0.5,0.4),(1,0.4)]->     in [envCoord c0 9 0.1 EnvLin->        ,envCoord c1 6 0.1 EnvSin->        ,envCoord c2 5 0.1 EnvCub->        ,envCoord c3 7 0.1 EnvStep]--    import Sound.SC3.Plot {- hsc3-plot -}-    plotEnvelope e_01
− Help/UGen/envDetect.help.lhs
@@ -1,14 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "EnvDetect"-    Sound.SC3.UGen.DB.ugenSummary "EnvDetect"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> g_01 =->     let i = soundIn 4->         c = envDetect AR i 0.01 0.1->         p = pitch i 440 60 4000 100 16 1 0.01 0.5 1 0->         f = mceChannel 0 p * 3->         e = lagUD (mceChannel 1 p) 0 0.1->         o = pinkNoise 'α' AR * c + sinOsc AR f 0 * c * e->     in mce2 i o
− Help/UGen/envFollow.help.lhs
@@ -1,12 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "EnvFollow"-    > Sound.SC3.UGen.DB.ugenSummary "EnvFollow"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> g_01 =->     let z = soundIn 4->         d = mouseX KR 0.990 0.999 Linear 0.2->         c = envFollow KR z d->         o = pinkNoise 'α' AR * c->     in mce2 z o
− Help/UGen/envGate.help.lhs
@@ -1,34 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "EnvGate"--> import Sound.SC3 {- hsc3 -}--Make envGate, giving the /default/ arguments, as used by envGate'.--> g_01 =->     let k = control KR->         e = envGate 1 (k "gate" 1) (k "fadeTime" 0.02) RemoveSynth EnvSin->     in lpf (saw AR 200) 600 * 0.1 * e--Set fade time, then release gate.--    import Sound.OSC {- hosc -}-    withSC3 (sendMessage (n_set1 (-1) "fadeTime" 2))-    withSC3 (sendMessage (n_set1 (-1) "gate" 0))--The same, but built in defaults.--> g_02 =->     let e = envGate'->     in lpf (saw AR 200) 600 * 0.1 * e--Several envGate nodes can coexist in one synth, but if they are the-same they're shared (as ever).--> g_03 =->     let e = envGate'->         s1 = lpf (saw AR 80) 600 * e->         s2 = rlpf (saw AR 200 * 0.5) (6000 * e + 60) 0.1 * e->     in mce2 s1 s2 * 0.1--    withSC3 (sendMessage (n_set1 (-1) "fadeTime" 5))-    withSC3 (sendMessage (n_set1 (-1) "gate" 0))
− Help/UGen/envGen.help.lhs
@@ -1,33 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "EnvGen"-    > Sound.SC3.UGen.DB.ugenSummary "EnvGen"--At least the following envelope constructors are provided:-envPerc, envSine, envCoord, envTrapezoid, and envLinen.--> import Sound.SC3 {- hsc3 -}--env_circle joins the end of the envelope to the start--> g_01 =->     let e = Envelope [6000,700,100] [1,1] [EnvExp,EnvLin] Nothing Nothing->         f = envGen KR 1 1 0 1 DoNothing (env_circle e 0 EnvLin)->     in sinOsc AR f 0 * 0.1 + impulse AR 1 0--Env([6000,700,100],[1,1],['exp','lin']).circle.asArray == [6000,2,-99,-99,700,1,2,0,100,1,1,0]--    > let {e = Envelope [6000,700,100] [1,1] [EnvExp,EnvLin] Nothing Nothing-    >     ;r = [0,4,3,0,6000,0,1,0,700,1,2,0,100,1,1,0,0,9e8,1,0]}-    > in envelope_sc3_array (env_circle e 0 EnvLin) == Just r--Env([0,1],[0.1]).asArray == [0,1,-99,-99,1,0.1,1,0]--    > let e = (Envelope [0,1] [0.1] [EnvLin] Nothing Nothing)-    > in envelope_sc3_array e == Just [0,1,-99,-99,1,0.1,1,0]--https://www.listarc.bham.ac.uk/lists/sc-users/msg14815.html--> g_02 =->     let n = range 0.01 0.1 (lfNoise1 'α' KR 2)->         e = Envelope [0,1] [n] [EnvLin] Nothing (Just 0)->         a = envGen AR 1 1 0 1 DoNothing (env_circle e 0 EnvLin)->     in sinOsc AR (a * 400 + 500) 0 * 0.1
− Help/UGen/envLinen.help.lhs
@@ -1,30 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*linen"-    :i Sound.SC3.LINEN-    :t envLinen--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let t = envLinen 0.4 2 0.4 0.1->         e = envGen KR 1 1 0 1 RemoveSynth t->     in sinOsc AR 440 0 * e--> e_01 =->     [envLinen 0 1 0 0.4->     ,envelope_normalise (envLinen 0 2 0 0.5)->     ,envLinen 0.4 2 0.4 0.6->     ,envLinen 0.6 1 1.2 0.7]--    import Sound.SC3.Plot {- hsc3-plot -}-    plotEnvelope e_01--> e_02 =->     let e = envLinen 0 1 0 1->     in (envelope_duration e->        ,envelope_segment_ix e 0->        ,envelope_segment_ix e 1->        ,envelope_segment e 0->        ,envelope_segment e 1->        ,envelope_at e 0->        ,envelope_at e 1->        ,envelope_render 10 e)
− Help/UGen/envPerc.help.lhs
@@ -1,21 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*perc"-    :t envPerc'--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let a = 0.1->         p = envPerc 0.01 1->         e = envGen KR 1 a 0 1 RemoveSynth p->     in sinOsc AR 440 0 * e--> g_02 =->     let a = 0.1->         c = EnvNum (-4)->         p = envPerc' 0.01 1 a (c,c)->         e = envGen KR 1 1 0 1 RemoveSynth p->     in sinOsc AR 440 0 * e---import Sound.SC3.Plot {- hsc3-plot -}-plotEnvelope [envPerc 0.05 1,envPerc 0.2 0.75]
− Help/UGen/envSine.help.lhs
@@ -1,14 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*sine"-    :t Sound.SC3.envSine--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let s = envSine 9 0.1->         e = envGen KR 1 1 0 1 RemoveSynth s->     in sinOsc AR 440 0 * e--> e_01 = [envSine 9 1,envSine 3 0.25]--    import Sound.SC3.Plot {- hsc3-plot -}-    plotEnvelope e_01
− Help/UGen/envStep.help.lhs
@@ -1,23 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*step"-    :i Sound.SC3.envStep--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let env = envStep [0.0,0.5,0.7,1.0,0.9,0.0] [0.5,0.1,0.2,1.0,1.5,3] Nothing Nothing->         envgen = envGen AR 1 1 0 1 RemoveSynth env->     in sinOsc AR (envgen * 1000 + 440) 0 * (envgen + 1) * 0.1--major scale, accelerating, with loop & release nodes--> g_02 =->     let env = envStep [0,2,4,5,7,9,11,12,0] (take 9 (iterate (* 0.75) 1)) (Just 8) (Just 0)->         envgen = envGen AR 1 1 0 1 DoNothing env->     in sinOsc AR (midiCPS (envgen + 60)) 0 * 0.1--draw envelope--> e_01 = [envStep [0,2,4,5,7,9,11,12] (take 8 (iterate (* 0.75) 1)) Nothing Nothing]--    import Sound.SC3.Plot-    plotEnvelope e_01
− Help/UGen/envTrapezoid.help.lhs
@@ -1,20 +0,0 @@-    :t Sound.SC3.envTrapezoid--> import Sound.SC3--> g_01 =->     let t = envTrapezoid 0.05 0.95 3 0.1->         e = envGen KR 1 1 0 1 RemoveSynth t->     in sinOsc AR 440 0 * e--> e_02 = envTrapezoid 0 0.25 2 0.1 :: Envelope Double-> r_02 = [0,3,-99,-99,0.1,0.5,1,0,0.1,0,1,0,0,1.5,1,0]-> a_02 = envelope_sc3_array e_02--     a_02 == Just r_02--> e_03 :: [Envelope Double]-> e_03 = [envTrapezoid 0.75 0.25 2 1,envTrapezoid 0.25 0.75 3 0.5]--    import Sound.SC3.Plot-    plotEnvelope e_03
− Help/UGen/envTriangle.help.lhs
@@ -1,14 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Env.*triangle"-    :t envTriangle--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let t = envTriangle 1 0.1->         e = envGen KR 1 1 0 1 RemoveSynth t->     in sinOsc AR 440 0 * e--> e_02 = [envTriangle 1 1,envTriangle 0.25 0.5]--    import Sound.SC3.Plot-    plotEnvelope e_02
− Help/UGen/eq.help.lhs
@@ -1,2 +0,0 @@-See gt (>)-
− Help/UGen/excess.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.excess"-    > :t excess--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = fSinOsc AR 1000 0->         l = line KR 0 1 8 DoNothing->     in excess o l * 0.1--or written out in terms of clip2--> g_02 =->     let o = fSinOsc AR 1000 0->         l = line KR 0 1 8 DoNothing->     in (o - clip2 o l) * 0.1
− Help/UGen/expRand.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "ExpRand"-    > Sound.SC3.UGen.DB.ugenSummary "ExpRand"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = line KR 0.5 0 0.01 RemoveSynth->         f = expRand 'α' 100.0 8000.0->     in fSinOsc AR f 0 * a
− Help/UGen/fSinOsc.help.lhs
@@ -1,44 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "FSinOsc"-    > Sound.SC3.UGen.DB.ugenSummary "FSinOsc"--Note: SC2 did not have the initial phase argument.--> import Sound.SC3 {- hsc3 -}--> g_01 = fSinOsc AR (mce2 440 550) 0 * 0.05--Modulate frequency--> g_02 = fSinOsc AR (xLine KR 200 4000 1 RemoveSynth) 0 * 0.1--Loses amplitude towards the end--> g_03 =->     let f = fSinOsc AR (xLine KR 4 401 8 RemoveSynth)->     in fSinOsc AR (f 0 * 200 + 800) 0 * 0.1--sin grain with sine envelope (see also 'sine_grain_ugen_graph')--> sine =->     let b = control IR "out" 0->         f = control IR "freq" 440->         d = control IR "dur" 0.2->         a = control IR "amp" 0.1->         p = control IR "pan" 0->         o = fSinOsc AR f 0->         s = envSine d a->         e = envGen AR 1 1 0 1 RemoveSynth s->         u = offsetOut b (pan2 o p e)->     in synthdef "sine" u--    > import Sound.SC3.Lang.Pattern {- hsc3-lang -}--granular synthesis--    > paudition (pbind [(K_instr,psynth sine)-    >                  ,(K_midinote,fmap roundE (pbrown 'α' 72 84 1 inf))-    >                  ,(K_detune,pwhite 'β' 0 10 inf)-    >                  ,(K_dur,pbrown 'γ' 0.005 0.15 0.05 inf)-    >                  ,(K_legato,pbrown 'δ' 1 2 0.1 inf)-    >                  ,(K_amp,pbrown 'ε' 0.05 0.25 0.05 inf)-    >                  ,(K_param "pan",pbrown 'ζ' (-1) 1 0.2 inf)])
− Help/UGen/fbSineC.help.lhs
@@ -1,33 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "FBSineC"-    > Sound.SC3.UGen.DB.ugenSummary "FBSineC"--> import Sound.SC3 {- hsc3 -}--SC3 default values.--> g_01 = fbSineC AR (sampleRate / 4) 1 0.1 1.1 0.5 0.1 0.1 * 0.2--Increase feedback--> g_02 =->     let fb = line KR 0.01 4 10 DoNothing->     in fbSineC AR sampleRate 1 fb 1.1 0.5 0.1 0.1 * 0.2--Increase phase multiplier--> g_03 =->     let a = line KR 1 2 10 DoNothing->     in fbSineC AR sampleRate 1 0 a 0.5 0.1 0.1 * 0.2--Randomly modulate parameters--> g_04 =->     let madd a m = (+ a) . (* m)->         x = mouseX KR 1 12 Linear 0.1->         n e = lfNoise2 e KR x->         n0 = madd 1e4 1e4 (n 'α')->         n1 = madd 33 32 (n 'β')->         n2 = madd 0 0.5 (n 'γ')->         n3 = madd 1.05 0.05 (n 'δ')->         n4 = madd 0.3 0.3 (n 'ε')->     in fbSineC AR n0 n1 n2 n3 n4 0.1 0.1 * 0.2
− Help/UGen/fbSineL.help.lhs
@@ -1,1 +0,0 @@-See fbSineC
− Help/UGen/fbSineN.help.lhs
@@ -1,1 +0,0 @@-See fbSineC
− Help/UGen/fdiv.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator./"-    > :t (/)--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = fSinOsc KR 10 0.5->         n = pinkNoise 'α' AR->     in (n * 0.1) / (o * 0.75)
− Help/UGen/fft.help.lhs
@@ -1,23 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "FFT"-    Sound.SC3.UGen.DB.ugenSummary "FFT"-    :t fft'--> import Sound.SC3 {- hsc3 -}--Non-local buffer--    withSC3 (async (b_alloc 10 2048 1))--Variants with default values--> gr_01 =->     let n = whiteNoise 'α' AR->     in ifft' (fft' 10 (n * 0.05))--Local buffer allocating fft variant--> gr_02 =->     let s0 = sinOsc KR 0.08 0 * 6 + 6.2->         s1 = sinOsc KR (squared s0) 0 * 100 + 800->         s2 = sinOsc AR s1 0->     in ifft (ffta 'α' 2048 s2 0.5 0 1 0) 0 0 * 0.25
− Help/UGen/fftTrigger.help.lhs
@@ -1,2 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "FFTTrigger"-> Sound.SC3.UGen.DB.ugenSummary "FFTTrigger"
− Help/UGen/fm7.help.lhs
@@ -1,85 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "FM7"-    Sound.SC3.UGen.DB.ugenSummary "FM7"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> gr_01 =->     let c = [[xLine KR 300 310 4 DoNothing,0,1]->             ,[xLine KR 300 310 8 DoNothing,0,1]->             ,[0,0,1]->             ,[0,0,1]->             ,[0,0,1]->             ,[0,0,1] ]->         m = [[line KR 0 0.001 2 DoNothing,line KR 0.1 0 4 DoNothing,0,0,0,0]->             ,[line KR 0 6 1 DoNothing,0,0,0,0,0]->             ,[0,0,0,0,0,0]->             ,[0,0,0,0,0,0]->             ,[0,0,0,0,0,0]->             ,[0,0,0,0,0,0] ]->         [l,r,_,_,_,_] = mceChannels (fm7 c m)->     in mce2 l r * 0.1--An algorithmically generated graph courtesy f0.--> gr_02 =->     let x = [[[0.0,-1/3,-1.0,0.0]->              ,[0.75,0.75,0.0,-0.5]->              ,[-0.5,-0.25,0.25,-0.75]->              ,[-0.5,1.0,1.0,1.0]->              ,[0.0,1/6,-0.75,-1.0]->              ,[0.5,0.5,-0.5,1/3]]->             ,[[-1/3,0.5,-0.5,-0.5]->              ,[0.5,0.75,0.25,0.75]->              ,[-15/18,0.25,-1.0,0.5]->              ,[1.5,0.25,0.25,-0.25]->              ,[-2/3,-2/3,-1.0,-0.5]->              ,[-1.0,0.0,-15/18,-1/3]]->             ,[[0.25,-0.5,-0.5,-1.0]->              ,[-0.5,1.0,-1.5,0.0]->              ,[-1.0,-1.5,-0.5,0.0]->              ,[0.5,-1.0,7/6,-0.5]->              ,[15/18,-0.75,-1.5,0.5]->              ,[0.25,-1.0,0.5,1.0]]->             ,[[1.0,1/3,0.0,-0.75]->              ,[-0.25,0.0,0.0,-0.5]->              ,[-0.5,-0.5,0.0,0.5]->              ,[1.0,0.75,0.5,0.5]->              ,[0.0,1.5,-0.5,0.0]->              ,[1.0,0.0,-0.25,-0.5]]->             ,[[0.5,-0.25,0.0,1/3]->              ,[0.25,-0.75,1/3,-1.0]->              ,[-0.25,-0.5,0.25,-7/6]->              ,[0.0,0.25,0.5,1/6]->              ,[-1.0,-0.5,15/18,-0.5]->              ,[15/18,-0.75,-0.5,0.0]]->             ,[[0.0,-0.75,-1/6,0.0]->              ,[1.0,0.5,0.5,0.0]->              ,[-0.5,0.0,-0.5,0.0]->              ,[-0.5,-1/6,0.0,0.5]->              ,[-0.25,1/6,-0.75,0.25]->              ,[-7/6,-4/3,-1/6,1.5]]]->         y = [[[0.0,-0.5,1.0,0.0]->              ,[-0.5,1.0,0.5,-0.5]->              ,[0.0,1/3,1.0,1.0]]->             ,[[-0.5,0.5,1.0,1.0]->              ,[0.0,1/3,0.0,1.5]->              ,[-0.5,15/18,1.0,0.0]]->             ,[[0.25,-2/3,0.25,0.0]->              ,[0.5,-0.5,-0.5,-0.5]->              ,[0.5,-0.5,-0.75,15/18]]->             ,[[-0.25,1.0,0.0,1/3]->              ,[-1.25,-0.25,0.5,0.0]->              ,[0.0,-1.25,-0.25,-0.5]]->             ,[[0.75,-0.25,1.5,0.0]->              ,[0.25,-1.5,0.5,0.5]->              ,[-0.5,-0.5,-0.5,-0.25]]->             ,[[0.0,0.5,-0.5,0.25]->              ,[0.25,0.5,-1/3,0.0]->              ,[1.0,0.5,-1/6,0.5]]]->         cs = map (map (\[f,p,m,a] -> sinOsc AR f p * m + a)) x->         ms = map (map (\[f,w,m,a] -> pulse AR f w * m + a)) y->         [c1,c2,c3,_,c4,c5] = mceChannels (fm7 cs ms)->         g3 = linLin (lfSaw KR 0.1 0) (-1) 1 0 (dbAmp (-12))->         g5 = dbAmp (-3)->     in mce [c1 + c3 * g3 + c5 * g5,c2 + c4 + c5 * g5]
− Help/UGen/fmGrain.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "FMGrain"-    > Sound.SC3.UGen.DB.ugenSummary "FMGrain"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let t = impulse AR 20 0->         n = linLin (lfNoise1 'α' KR 1) (-1) 1 1 10->         s = envSine 9 0.1->         e = envGen KR 1 1 0 1 RemoveSynth s->     in fmGrain t 0.2 440 220 n * e
− Help/UGen/fmGrainB.help.lhs
@@ -1,15 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "FMGrainB"-> Sound.SC3.UGen.DB.ugenSummary "FMGrainB"--> import Sound.SC3--> withSC3 (do {_ <- async (b_alloc 10 512 1)->             ;let f = [Normalise,Wavetable,Clear]->              in send (b_gen_sine2 10 f [(0.5,0.1)])})--> let {t = impulse AR 20 0->     ;n = linLin (lfNoise1 'α' KR 1) (-1) 1 1 10->     ;s = envSine 9 0.1->     ;e = envGen KR 1 1 0 1 RemoveSynth s->     ;o = fmGrainB t 0.2 440 220 n 10 * e}-> in audition (out 0 o)
− Help/UGen/fold2.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.fold2"-    > :t fold2--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = fSinOsc AR 1000 0->         l = line KR 0 1 8 DoNothing->     in fold2 o l
− Help/UGen/formant.help.lhs
@@ -1,21 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Formant"-    Sound.SC3.UGen.DB.ugenSummary "Formant"--> import Sound.SC3--Modulate fundamental frequency, formant frequency stays constant.--> g_01 = formant AR (xLine KR 400 1000 8 RemoveSynth) 2000 800 * 0.125--Modulate formant frequency, fundamental frequency stays constant.--> g_02 =->     let f = mce [200, 300, 400, 500]->         ff = xLine KR 400 4000 8 RemoveSynth->     in formant AR f ff 200 * 0.125--Modulate width frequency, other frequencies stay constant.--> g_03 =->     let bw = xLine KR 800 8000 8 RemoveSynth->     in formant AR 400 2000 bw * 0.1
− Help/UGen/formlet.help.lhs
@@ -1,34 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Formlet"-    > Sound.SC3.UGen.DB.ugenSummary "Formlet"--> import Sound.SC3 {- hsc3 -}--> g_01 = formlet (impulse AR 20 0.5) 1000 0.01 0.1--> g_02 =->     let f = xLine KR 10 400 8 RemoveSynth->     in formlet (blip AR f 1000 * 0.1) 1000 0.01 0.1--Modulating formant frequency.--> g_03 =->     let s = blip AR (sinOsc KR 5 0 * 20 + 300) 1000 * 0.1->         ff = xLine KR 1500 700 8 RemoveSynth->     in formlet s ff 0.005 0.04--Mouse control of frequency and decay time.--> g_04 =->     let s = blip AR (sinOsc KR 5 0 * 20 + 300) 1000 * 0.1->         x = mouseX KR 0.01 0.2 Exponential 0.2->         y = mouseY KR 700 2000 Exponential 0.2->     in formlet s y 0.005 x--and again...--> g_05 =->     let s = dust 'α' KR (mce2 10 11)->         x = mouseX KR 0.1 2 Exponential 0.2->         y = mouseY KR 7 200 Exponential 0.2->         f = formlet s y 0.005 x->     in sinOsc AR (f * 200 + mce2 500 600 - 100) 0 * 0.2
− Help/UGen/fos.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "FOS"-> Sound.SC3.UGen.DB.ugenSummary "FOS"--> import Sound.SC3--Same as OnePole.--> let x = lfTri AR 0.4 0 * 0.99-> in audition (out 0 (fos (lfSaw AR 200 0 * 0.2) (1 - (abs x)) 0 x))--Same as OneZero--> let x = lfTri AR 0.4 0 * 0.99-> in audition (out 0 (fos (lfSaw AR 200 0 * 0.2) (1 - (abs x)) x 0))
− Help/UGen/free.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Free"-    > Sound.SC3.UGen.DB.ugenSummary "Free"--> import Sound.SC3 {- hsc3 -}->-> g_01 = out 0 (sinOsc AR 880 0 * 0.1)->-> g_02 =->     let n0 = pinkNoise 'α' AR->         n1 = dust 'β' KR 20->     in mrg [out 1 (n0 * 0.1), free n1 1001]--    > audition_at (1001,AddToTail,1,[]) g_01-    > audition_at (-1,AddToTail,1,[]) g_02-
− Help/UGen/freeSelf.help.lhs
@@ -1,8 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "FreeSelf"-    > Sound.SC3.UGen.DB.ugenSummary "FreeSelf"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = dust 'α' KR 0.5->     in mrg [sinOsc AR 440 0 * 0.1,freeSelf n]
− Help/UGen/freeSelfWhenDone.help.lhs
@@ -1,18 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "FreeSelfWhenDone"-    > Sound.SC3.UGen.DB.ugenSummary "FreeSelfWhenDone"--> import Sound.SC3 {- hsc3 -}--using RemoveSynth doneAction--> g_01 =->     let x = mouseX KR (-1) 1 Linear 0.1->         e = linen x 1 0.1 1 RemoveSynth->     in sinOsc AR 440 0 * e--using FreeSelfWhenDone UGen--> g_02 =->     let x = mouseX KR (-1) 1 Linear 0.1->         e = linen x 1 0.1 1 DoNothing->     in mrg [sinOsc AR 440 0 * e,freeSelfWhenDone e]
− Help/UGen/freeVerb.help.lhs
@@ -1,21 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "FreeVerb"-    > Sound.SC3.UGen.DB.ugenSummary "FreeVerb"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = impulse AR 1 0->         c = lfCub AR 1200 0->         s = decay i 0.25 * c * 0.1->         x = mouseX KR 0 1 Linear 0.1->         y = mouseY KR 0 1 Linear 0.1->     in freeVerb s y x 0.5--Process input channels--> g_02 =->     let i = soundIn (mce2 0 1)->         c = mceChannel->         x = mouseX KR 0 1 Linear 0.1->         y = mouseY KR 0 1 Linear 0.1->     in freeVerb2 (c 0 i) (c 1 i) y x 0.5
− Help/UGen/freqShift.help.lhs
@@ -1,50 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "FreqShift"-    Sound.SC3.UGen.DB.ugenSummary "FreqShift"--> import Sound.SC3 {- hcs3 -}--Shifting a 100Hz tone by 1 Hz rising to 500Hz--> g_01 =->     let i = sinOsc AR 100 0->         s = xLine KR 1 500 5 RemoveSynth->     in freqShift i s 0 * 0.1--Shifting a complex tone by 1 Hz rising to 500Hz--> g_02 =->     let d = klangSpec [101, 303, 606, 808] [1, 1, 1, 1] [1, 1, 1, 1]->         i = klang AR 1 0 d->         s = xLine KR 1 500 5 RemoveSynth->     in freqShift i s 0 * 0.1--Modulating shift and phase--> g_03 =->     let s = lfNoise2 'α' AR 0.3->         i = sinOsc AR 10 0->         p = linLin (sinOsc AR 500 0) (-1) 1 0 (2 * pi)->     in freqShift i (s * 1500) p * 0.1--Shifting bandpassed noise--> g_04 =->     let n1 = whiteNoise 'α' AR->         n2 = lfNoise0 'β' AR 5.5->         i = bpf n1 1000 0.001->         s = n2 * 1000->     in freqShift i s 0 * 32--    {a=Blip.ar(60,4,LFGauss.ar(4,1/8))-    ;a=a/4+LocalIn.ar(2)-    ;a=FreqShift.ar(a,LFNoise0.kr(1/4,90))-    ;LocalOut.ar(DelayC.ar(a,1,0.1,0.9))-    ;a}.play--> g_05 =->     let e = lfGauss AR 4 (1/8) 0 Loop DoNothing->         o = blip AR 60 4 * e->         a = o / 4 + localIn 2 AR 0->         s = freqShift a (lfNoise0 'α' KR (1/4) * 90) 0->         z = delayC s 1 0.1 * 0.9->     in mrg2 s (localOut z)
− Help/UGen/gVerb.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "GVerb"-    > Sound.SC3.UGen.DB.ugenSummary "GVerb"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = impulse AR 1 0->         c = lfCub AR 1200 0->         s = decay i 0.25 * c * 0.1->     in gVerb s 10 3 0.5 0.5 15 1 0.7 0.5 300
− Help/UGen/gate.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Gate"-> Sound.SC3.UGen.DB.ugenSummary "Gate"--> import Sound.SC3--> let t = lfPulse AR 1 0 0.1-> in audition (out 0 (gate (fSinOsc AR 500 0 * 0.25) t))
− Help/UGen/gbmanL.help.lhs
@@ -1,1 +0,0 @@-See GbmanN
− Help/UGen/gbmanN.help.lhs
@@ -1,28 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "GbmanN"-    Sound.SC3.UGen.DB.ugenSummary "GbmanN"--> import Sound.SC3 {- hsc3 -}--default initial params--> g_01 =->     let x = mouseX KR 20 sampleRate Linear 0.2->     in gbmanN AR x 1.2 2.1 * 0.1--change initial params--> g_02 =->     let x = mouseX KR 20 sampleRate Linear 0.2->     in gbmanN AR x (-0.7) (-2.7) * 0.1--wait for it...--> g_03 =->     let x = mouseX KR 20 sampleRate Linear 0.2->     in gbmanN AR x 1.2 2.0002 * 0.1--as a frequency control--> g_04 =->     let f = gbmanN AR 40 1.2 2.1 * 400 + 500->     in sinOsc AR f 0 * 0.4
− Help/UGen/gendy1.help.lhs
@@ -1,114 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Gendy1"-    > Sound.SC3.UGen.DB.ugenSummary "Gendy1"--> import Data.Char {- base -}-> import Sound.SC3 {- base -}--SC3 default parameters--> g_01 = gendy1 'α' AR 1 1 1 1 440 660 0.5 0.5 12 12 * 0.15--Wandering bass--> g_02 = gendy1 'α' AR 1 1 1.0 1.0 30 100 0.3 0.05 5 5 * 0.15--Play me--> g_03 =->     let x = mouseX KR 100 1000 Exponential 0.1->         g = gendy1 'α' AR 1 1 1.0 1.0 30 100 0.3 0.05 5 5->     in rlpf g 500 0.3 * 0.1--Scream!--> g_04 =->     let x = mouseX KR 220 440 Exponential 0.1->         y = mouseY KR 0.0 1.0 Linear 0.1->     in gendy1 'α' AR 2 3 1 1 x (8 * x) y y 7 7 *0.3--1 CP = random noise--> g_05 = gendy1 'α' AR 1 1 1 1 440 660 0.5 0.5 1 1 * 0.15--2 CPs = an oscillator--> g_06 = gendy1 'α' AR 1 1 1 1 440 660 0.5 0.5 2 2 * 0.15--Used as an LFO--> g_07 =->     let ad = sinOsc KR 0.10 0 * 0.49 + 0.51->         dd = sinOsc KR 0.13 0 * 0.49 + 0.51->         as = sinOsc KR 0.17 0 * 0.49 + 0.51->         ds = sinOsc KR 0.19 0 * 0.49 + 0.51->         g = gendy1 'α' KR 2 4 ad dd 3.4 3.5 as ds 10 10->     in sinOsc AR (g * 50 + 350) 0 * 0.3--Wasp--> g_08 =->     let ad = sinOsc KR 0.1 0 * 0.1 + 0.9->     in gendy1 'α' AR 0 0 ad 1.0 50 1000 1 0.005 12 12 * 0.2--Modulate distributions. Change of pitch as distributions change-the duration structure and spectrum--> g_09 =->     let x = mouseX KR 0 7 Linear 0.1->         y = mouseY KR 0 7 Linear 0.1->     in gendy1 'α' AR x y 1 1 440 660 0.5 0.5 12 12 * 0.2--Modulate number of CPs.--> g_10 =->     let x = mouseX KR 1 13 Linear 0.1->     in gendy1 'α' AR 1 1 1 1 440 660 0.5 0.5 12 x * 0.2--Self modulation.--> g_11 =->     let x = mouseX KR 1   13 Linear 0.1->         y = mouseY KR 0.1 10 Linear 0.1->         g0 = gendy1 'α' AR 5 4 0.3 0.7 0.1 y 1.0 1.0 5 5->     in gendy1 'α' AR 1 1 1 1 440 (g0 * 500 + 600) 0.5 0.5 12 x * 0.2--Use SINUS to track any oscillator and take CP positions from it use-adParam and ddParam as the inputs to sample.--> g_12 =->     let p = lfPulse KR 100 0 0.4->         s = sinOsc KR 30 0 * 0.5->     in gendy1 'α' AR 6 6 p s 440 660 0.5 0.5 12 12 * 0.2--Near the corners are interesting.--> g_13 =->     let x = mouseX KR 0 200 Linear 0.1->         y = mouseY KR 0 200 Linear 0.1->         p = lfPulse KR x 0 0.4->         s = sinOsc KR y 0 * 0.5->     in gendy1 'α' AR 6 6 p s 440 660 0.5 0.5 12 12 * 0.2--Texture--> g_14 =->     let node e = let f = rand e 130 160.3->                      r0 = rand e 0 6->                      r1 = rand (toUpper e) 0 6->                      l = rand e (-1) 1->                      ad = sinOsc KR 0.10 0 * 0.49 + 0.51->                      dd = sinOsc KR 0.13 0 * 0.49 + 0.51->                      as = sinOsc KR 0.17 0 * 0.49 + 0.51->                      ds = sinOsc KR 0.19 0 * 0.49 + 0.51->                      g = gendy1 'α' AR r0 r1 ad dd f f as ds 12 12->                      o = sinOsc AR (g * 200 + 400) 0->                  in pan2 o l 0.1->     in mix (mce (map node ['β'..'γ']))--Try durscale 10.0 and 0.0 too.--> g_15 =->     let x = mouseX KR 10 700 Linear 0.1->         y = mouseY KR 50 1000 Linear 0.1->         g = gendy1 'α' AR 2 3 1 1 1 x 0.5 0.1 10 10->     in combN (resonz g y 0.1) 0.1 0.1 5 * 0.6
− Help/UGen/grainBuf.help.lhs
@@ -1,31 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "GrainBuf"-    Sound.SC3.UGen.DB.ugenSummary "GrainBuf"--> import Sound.SC3 {- hsc3 -}--> fn_01 = "/home/rohan/data/audio/pf-c5.snd"--    > withSC3 (async (b_allocRead 10 fn_01 0 0))--> g_01 =->     let buf = 10->         dur = 15->         lin a b = line KR a b dur RemoveSynth->         tr = impulse KR (lin 7.5 15) 0->         gd = lin 0.05 0.1->         r = lin 1 0.5 {- rate -}->         i = lin 0 1 {- read-location -}->         l = lin (-0.5) 0.5 {- stereo-location -}->     in grainBuf 2 tr gd buf r i 2 l (-1) 512--> g_02 =->     let b = 10->         e = -1->         x = mouseX KR (-1) 1 Linear 0.1->         y = mouseY KR 10 45 Linear 0.1->         i = impulse KR y 0->         n1 = lfNoise1 'α' KR 500->         n2 = lfNoise2 'β' KR 0.1->         r = linLin n1 (-1) 1 0.5 2->         p = linLin n2 (-1) 1 0 1->     in grainBuf 2 i 0.1 b r p 2 x e 512
− Help/UGen/grainFM.help.lhs
@@ -1,23 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "GrainFM"-    Sound.SC3.UGen.DB.ugenSummary "GrainFM"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let d = 15->         lin a b = line KR a b d RemoveSynth->         l = lin (-0.5) 0.5->         f = lin 200 800->         t = impulse KR (lin 7.5 15) 0->         i = lin (-1) 1->     in grainFM 2 t 0.1 f 200 i l (-1) 512 * 0.1--> g_02 =->     let n1 = whiteNoise 'α' KR->         n2 = lfNoise1 'β' KR 500->         x = mouseX KR (-0.5) 0.5 Linear 0.1->         y = mouseY KR 0 400 Linear 0.1->         f = n1 * y + 440->         t = impulse KR 12.5 0->         i = linLin n2 (-1) 1 1 10->     in grainFM 2 t 0.1 f 200 i x (-1) 512 * 0.1
− Help/UGen/grainIn.help.lhs
@@ -1,11 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "GrainIn"-    Sound.SC3.UGen.DB.ugenSummary "GrainIn"--> import Sound.SC3--> g_01 =->     let n = pinkNoise 'α' AR->         x = mouseX KR (-0.5) 0.5 Linear 0.1->         y = mouseY KR 5 25 Linear 0.1->         t = impulse KR y 0->     in grainIn 2 t 0.1 n x (-1) 512 * 0.1
− Help/UGen/grainSin.help.lhs
@@ -1,12 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "GrainSin"-    > Sound.SC3.UGen.DB.ugenSummary "GrainSin"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = whiteNoise 'α' KR->         x = mouseX KR (-0.5) 0.5 Linear 0.1->         y = mouseY KR 0 400 Linear 0.1->         f = n * y + 440->         t = impulse KR 10 0->     in grainSin 2 t 0.1 f x (-1) 512 * 0.1
− Help/UGen/grayNoise.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "GrayNoise"-    > Sound.SC3.UGen.DB.ugenSummary "GrayNoise"--> import Sound.SC3 {- hsc3 -}->-> g_01 = grayNoise 'α' AR * 0.1--Drawing--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.025 (grayNoise 'γ' AR)--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.1 (grayNoise 'γ' AR)--![](sw/hsc3/Help/SVG/grayNoise.0.svg)-![](sw/hsc3/Help/SVG/grayNoise.1.svg)
− Help/UGen/gt.help.lhs
@@ -1,22 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.=="-    > :t (==*)--The star suffixes (<*,<=*,>*,>=*) are because the result of the-operators is not of type Bool, as is required by the signature for the-class Ord.  At some point `<*` was written into the standard prelude...--> import Prelude hiding ((<*)) {- base -}-> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = sinOsc KR 1 0->         t = [o >* 0->             ,o >=* 0->             ,o <* 0->             ,o <=* 0->             ,o ==* 0->             ,(o <* 0.001) * (o >* (-0.001))]->         f = [220, 330, 440, 550, 660, 770]->         p = envPerc 0.01 1->         e = envGen KR (mce t) 0.1 0 1 DoNothing p->     in mix (sinOsc AR (mce f) 0 * e)
− Help/UGen/hasher.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Hasher"-> Sound.SC3.UGen.DB.ugenSummary "Hasher"--> import Sound.SC3--noise--> audition (out 0 (hasher (line AR 0 1 1 RemoveSynth) * 0.2))--remap x--> let {x = mouseX KR 0 10 Linear 0.2->     ;f = hasher (roundTo x 1) * 300 + 500}-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/henonC.help.lhs
@@ -1,1 +0,0 @@-See henonN
− Help/UGen/henonL.help.lhs
@@ -1,1 +0,0 @@-See henonN
− Help/UGen/henonN.help.lhs
@@ -1,40 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "HenonN"-    > Sound.SC3.UGen.DB.ugenSummary "HenonN"--> import Sound.SC3 {- hsc3 -}--With SC3 default initial parameters.--> g_01 =->     let x = mouseX KR 20 sampleRate Linear 0.1->     in henonN AR x 1.4 0.3 0 0 * 0.1--With mouse-control of parameters.--> g_02 =->     let x = mouseX KR 1 1.4 Linear 0.1->         y = mouseY KR 0 0.3 Linear 0.1->     in henonN AR (sampleRate / 4) x y 0 0 * 0.1--With randomly modulated parameters.--> g_03 =->     let n0 = lfNoise2 'α' KR 1 * 0.20 + 1.20->         n1 = lfNoise2 'β' KR 1 * 0.15 + 0.15->     in henonN AR (sampleRate / 8) n0 n1 0 0 * 0.1--As a frequency control.--> g_04 =->     let x = mouseX KR 1 1.4 Linear 0.1->         y = mouseY KR 0 0.3 Linear 0.1->         f0 = 40->         f = henonN AR f0 x y 0 0 * 800 + 900->     in sinOsc AR f 0 * 0.4--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (henonN AR 2500 1.4 0.3 0 0 * 0.1)--![](sw/hsc3/Help/SVG/henonN.0.svg)
− Help/UGen/hpf.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "HPF"-    > Sound.SC3.UGen.DB.ugenSummary "HPF"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000->     in hpf (saw AR 200 * 0.2) f--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.05 (hpf (whiteNoise 'α' AR) 12000)
− Help/UGen/hpz1.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "HPZ1"-    > Sound.SC3.UGen.DB.ugenSummary "HPZ1"--> import Sound.SC3 {- hsc3 -}--> g_01 = let n = whiteNoise 'α' AR in hpz1 (n * 0.25)--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.05 (hpz1 (whiteNoise 'α' AR))-
− Help/UGen/hpz2.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "HPZ2"-> Sound.SC3.UGen.DB.ugenSummary "HPZ2"--> import Sound.SC3--> let n = whiteNoise 'α' AR-> in audition (out 0 (hpz2 (n * 0.25)))
− Help/UGen/hypot.help.lhs
@@ -1,29 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.hypot"-    > :t hypot--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let x = mouseX KR 0 0.1 Linear 0.1->         y = mouseY KR 0 0.1 Linear 0.1->     in sinOsc AR 440 0 * hypot x y--Object travels 200 meters in 6 secs (=120kph) passing 10 meters-from the listener.  The speed of sound is 344 meters/sec.--> g_02 =->     let x = 10->         y = lfSaw KR (1 / 6) 0 * 100->         d = hypot x y->         v = slope d->         r = (344 - v) / 344->         a = 10 / (squared d)->     in fSinOsc AR (1000 * r) 0 * a->-> g_03 =->     let x = 10->         y = lfSaw KR (1 / 6) 0 * 100->         d = hypot x y->         a = 40 / (squared d)->         s = rlpf (fSinOsc AR 200 0 * lfPulse AR 31.3 0 0.4) 400 0.3->     in delayL s (110 / 344) (d / 344) * a
− Help/UGen/iEnvGen.help.lhs
@@ -1,25 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "IEnvGen"-    Sound.SC3.UGen.DB.ugenSummary "IEnvGen"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let l = [0,0.6,0.3,1.0,0]->         t = [0.1,0.02,0.4,1.1]->         c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]->         e = Envelope l t c Nothing Nothing->         x = mouseX KR 0 (sum t) Linear 0.2->         g = iEnvGen KR x e->     in sinOsc AR (g * 500 + 440) 0 * 0.1--index with an SinOsc ... mouse controls amplitude of SinOsc-use offset so negative values of SinOsc will map into the Env--> g_02 =->     let l = [-1,-0.7,0.7,1]->         t = [0.8666,0.2666,0.8668]->         c = [EnvLin,EnvLin]->         e = Envelope l t c Nothing Nothing->         x = mouseX KR 0 1 Linear 0.2->         o = (sinOsc AR 440 0 + 1) * x->     in iEnvGen AR o e * 0.1
− Help/UGen/iRand.help.lhs
@@ -1,9 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "IRand"-    Sound.SC3.UGen.DB.ugenSummary "IRand"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let f = iRand 'α' 200 1200->         e = line KR 0.2 0 0.1 RemoveSynth->     in fSinOsc AR f 0 * e
− Help/UGen/idwt.help.lhs
@@ -1,33 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "IDWT"-> Sound.SC3.UGen.DB.ugenSummary "IDWT"--> import Sound.SC3--> let {i = whiteNoise 'α' AR * 0.05->     ;b = localBuf 'β' 1024 1->     ;c = dwt b i 0.5 0 1 0 0}-> in audition (out 0 (mce2 (idwt c 0 0 0) i))--direct synthesis via writing values to buffer (try changing wavelet type...)--> withSC3 (async (b_alloc 10 1024 1) >> send (b_zero 10))--> let {c = fftTrigger 10 0.5 0->     ;i = idwt c (-1) 0 0}-> in audition (out 0 (i * 0.1))--> import Control.Monad.Random-> import Sound.SC3.Lang.Random.Monad--> withSC3 (send (b_zero 10))--run this to change sound: WARNING, NOISY!--> do {a <- evalRandIO (nrrand 1024 (-1) 1)->    ;withSC3 (send (b_setn 10 [(0,a)]))}--> let a = map (/ 1024) [0..1023]-> in withSC3 (send (b_setn 10 [(0,a)]))--> let a = map (\i -> 1 - i / 1024) [0..1023]-> in withSC3 (send (b_setn 10 [(0,a)]))
− Help/UGen/ifft.help.lhs
@@ -1,5 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "IFFT"-> Sound.SC3.UGen.DB.ugenSummary "IFFT"-> :t ifft'--# ifft' is a variant with the default window type and size
− Help/UGen/impulse.help.lhs
@@ -1,21 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Impulse"-    > Sound.SC3.UGen.DB.ugenSummary "Impulse"--Note: SC2 had no phase input.--> import Sound.SC3 {- hsc3 -}--> g_01 = impulse AR 800 0 * 0.1--> g_02 =->     let f = xLine KR 800 10 5 RemoveSynth->     in impulse AR f 0.0 * 0.1--> g_03 =->     let f = mouseY KR 4 8 Linear 0.1->         x = mouseX KR 0 1 Linear 0.1->     in impulse AR f (mce [0,x]) * 0.1--An impulse with frequency 0 returns a single impulse--> g_04 = decay (impulse AR 0 0) 1 * brownNoise 'α' AR * 0.1
− Help/UGen/in.help.lhs
@@ -1,56 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "In"-    > Sound.SC3.UGen.DB.ugenSummary "In"--Note: `hsc3` renames UGen to `in'` since `in` is a reserved keyword--> import Sound.SC3 {- hsc3 -}--Patching input to output (see also soundIn).--> g_01 = in' 2 AR numOutputBuses--Patching input to output, with delay.--> g_02 =->     let i = in' 2 AR numOutputBuses->         d = delayN i 0.5 0.5->     in i + d--Write noise to first private bus, then read it out.-The multiple root graph is ordered.--> g_03 =->     let n = pinkNoise 'α' AR->         b = numOutputBuses + numInputBuses->         wr = out b (n * 0.3)->         rd = out 0 (in' 1 AR b)->     in mrg [rd,wr]--There are functions to encapsulate the offset calculation.-(There is also a firstPrivateBus value.)--> g_04 =->     let n = pinkNoise 'α' AR->         wr = privateOut 0 (n * 0.3)->         rd = out 0 (privateIn 1 AR 0)->     in mrg [rd,wr]--Set value on a control bus--    > withSC3 (send (c_set1 0 300))--Read a control bus--> g_05 = sinOsc AR (in' 1 KR 0) 0 * 0.1--Re-set value on bus--    > withSC3 (send (c_set1 0 600))--Control rate graph writing buses 0 & 1.--> g_06 = mce2 (tRand 'α' 220 2200 (dust 'β' KR 1)) (dust 'γ' KR 3)--Audio rate graph reading control buses 0 & 1.--> g_07 = sinOsc AR (in' 1 KR 0) 0 * decay (in' 1 KR 1) 0.2 * 0.1
− Help/UGen/inFeedback.help.lhs
@@ -1,37 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "InFeedback"-    > Sound.SC3.UGen.DB.ugenSummary "InFeedback"--> import Sound.SC3 {- hsc3 -}--Audio feedback modulation--> g_01 =->     let f = inFeedback 1 0 * 1300 + 300->     in sinOsc AR f 0 * 0.4--Audition these in either order and hear both tones.--> g_02 = inFeedback 1 firstPrivateBus->-> g_03 =->     let b  = firstPrivateBus->         s0 = out b (sinOsc AR 220 0 * 0.1)->         s1 = out 0 (sinOsc AR 660 0 * 0.1)->     in mrg [s0, s1]--Doubters consult this--> g_04 = let b = firstPrivateBus in in' 1 AR b--Resonator, see localOut for variant.--> g_05 =->     let b = firstPrivateBus->         p = inFeedback 1 b->         i = impulse AR 1 0->         d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate)->     in mrg [offsetOut b d, offsetOut 0 p]--Compare with oscillator (at right).--> g_06 = out 1 (sinOsc AR 440 0 * 0.2)
− Help/UGen/inRange.help.lhs
@@ -1,12 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "InRange"-    > Sound.SC3.UGen.DB.ugenSummary "InRange"--> import Sound.SC3 {- hsc3 -}--trigger noise burst--> g_01 =->     let n = brownNoise 'α' AR * 0.1->         x = mouseX KR 1 2 Linear 0.1->         o = sinOsc KR x 0 * 0.2->     in inRange o (-0.15) 0.15 * n
− Help/UGen/inTrig.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "InTrig"-    > Sound.SC3.UGen.DB.ugenSummary "InTrig"--> import Sound.SC3 {- hsc3 -}--Run an oscillator with the trigger at bus 10.--> g_01 =->     let t = inTrig 1 10->         e = envGen KR t t 0 1 DoNothing (envPerc 0.01 1)->     in sinOsc AR 440 0 * e--Set bus 10, each set will trigger a ping.--    > withSC3 (send (c_set1 10 0.1))
− Help/UGen/index.help.lhs
@@ -1,18 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Index"-    > Sound.SC3.UGen.DB.ugenSummary "Index"--> import Sound.SC3 {- hsc3 -}--Allocate and set values at buffer ten--    > withSC3 (async (b_alloc_setn1 10 0 [50,100,200,400,800,1600]))--Index buffer for frequency values--> g_01 =->     let f = index 10 (lfSaw KR 2 3 * 4)->     in sinOsc AR (mce [f,f * 9]) 0 * 0.1--Free buffer--    > withSC3 (send (b_free 10))
− Help/UGen/indexInBetween.help.lhs
@@ -1,29 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "IndexInBetween"-    > Sound.SC3.UGen.DB.ugenSummary "IndexInBetween"--> import Sound.SC3 {- hsc3 -}--Allocate and set values at buffer ten--    > withSC3 (async (b_alloc_setn1 10 0 [200,210,400,430,600,800]))--Index into buffer for frequency values--> g_01 =->     let f0 = mouseX KR 200 900 Linear 0.1->         i = indexInBetween 10 f0->         l0 = index 10 i->         l1 = index 10 (i + 1)->         f1 = linLin (frac i) 0 1 l0 l1->     in sinOsc AR (mce [f0,f1]) 0 * 0.1--Free buffer--    > withSC3 (send (b_free 10))--> g_02 =->     let from = asLocalBuf 'α' [1, 2, 4, 8, 16]->         to = asLocalBuf 'β' [0, 1, 0, -1, 0]->         x = mouseX KR 1 16 Linear 0.1->         i = indexL KR to (indexInBetween from x)->     in sinOsc AR (linLin i (-1) 1 440 880) 0 * 0.1
− Help/UGen/integrator.help.lhs
@@ -1,32 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Integrator"-    > Sound.SC3.UGen.DB.ugenSummary "Integrator"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let x = mouseX KR 0.001 0.999 Exponential 0.2->         o = lfPulse AR 300 0.2 0.1 * 0.1->     in integrator o x--used as an envelope--> g_02 =->     let i = lfPulse AR 3 0.2 0.0004->         o = sinOsc AR 700 0->     in integrator i 0.999 * o---scope--> g_03 =->     let x = mouseX KR 0.01 0.999 Exponential 0.2->         o = lfPulse AR (1500 / 4) 0.2 0.1->     in integrator o x * 0.1--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > let s = lfPulse AR (1500 / 4) 0.2 0.1-    > plot_ugen 0.006 (integrator s (mce [0.1,0.4,0.7]))--![](sw/hsc3/Help/SVG/integrator.0.svg)
− Help/UGen/ix.md
@@ -1,717 +0,0 @@-## Algebraic--[sum3](?t=hsc3&e=Help/UGen/sum3.help.lhs),-[sum4](?t=hsc3&e=Help/UGen/sum4.help.lhs)---## Analysis--[beatTrack](?t=hsc3&e=Help/UGen/beatTrack.help.lhs),-[beatTrack2](?t=hsc3&e=Help/UGen/beatTrack2.help.lhs),-[mFCC](?t=hsc3&e=Help/UGen/mFCC.help.lhs),-[onsets](?t=hsc3&e=Help/UGen/onsets.help.lhs),-[runningSum](?t=hsc3&e=Help/UGen/runningSum.help.lhs),-[slope](?t=hsc3&e=Help/UGen/slope.help.lhs)---## Analysis>Amplitude--[ampComp](?t=hsc3&e=Help/UGen/ampComp.help.lhs),-[ampCompA](?t=hsc3&e=Help/UGen/ampCompA.help.lhs),-[amplitude](?t=hsc3&e=Help/UGen/amplitude.help.lhs),-[detectSilence](?t=hsc3&e=Help/UGen/detectSilence.help.lhs),-[loudness](?t=hsc3&e=Help/UGen/loudness.help.lhs),-[peak](?t=hsc3&e=Help/UGen/peak.help.lhs),-[peakFollower](?t=hsc3&e=Help/UGen/peakFollower.help.lhs),-[sendPeakRMS](?t=hsc3&e=Help/UGen/sendPeakRMS.help.lhs)---## Analysis>Pitch--[keyTrack](?t=hsc3&e=Help/UGen/keyTrack.help.lhs),-[pitch](?t=hsc3&e=Help/UGen/pitch.help.lhs),-[zeroCrossing](?t=hsc3&e=Help/UGen/zeroCrossing.help.lhs)---## Buffer--[bufRd](?t=hsc3&e=Help/UGen/bufRd.help.lhs),-[bufWr](?t=hsc3&e=Help/UGen/bufWr.help.lhs),-[dbufrd](?t=hsc3&e=Help/UGen/dbufrd.help.lhs),-[dbufwr](?t=hsc3&e=Help/UGen/dbufwr.help.lhs),-[delTapRd](?t=hsc3&e=Help/UGen/delTapRd.help.lhs),-[delTapWr](?t=hsc3&e=Help/UGen/delTapWr.help.lhs),-[detectIndex](?t=hsc3&e=Help/UGen/detectIndex.help.lhs),-[diskIn](?t=hsc3&e=Help/UGen/diskIn.help.lhs),-[diskOut](?t=hsc3&e=Help/UGen/diskOut.help.lhs),-[grainBuf](?t=hsc3&e=Help/UGen/grainBuf.help.lhs),-[index](?t=hsc3&e=Help/UGen/index.help.lhs),-[indexInBetween](?t=hsc3&e=Help/UGen/indexInBetween.help.lhs),-[indexL](?t=hsc3&e=Help/UGen/indexL.help.lhs),-[localBuf](?t=hsc3&e=Help/UGen/localBuf.help.lhs),-[phasor](?t=hsc3&e=Help/UGen/phasor.help.lhs),-[playBuf](?t=hsc3&e=Help/UGen/playBuf.help.lhs),-[recordBuf](?t=hsc3&e=Help/UGen/recordBuf.help.lhs),-[scopeOut](?t=hsc3&e=Help/UGen/scopeOut.help.lhs),-[shaper](?t=hsc3&e=Help/UGen/shaper.help.lhs),-[tGrains](?t=hsc3&e=Help/UGen/tGrains.help.lhs),-[tap](?t=hsc3&e=Help/UGen/tap.help.lhs),-[vDiskIn](?t=hsc3&e=Help/UGen/vDiskIn.help.lhs),-[warp1](?t=hsc3&e=Help/UGen/warp1.help.lhs),-[wrapIndex](?t=hsc3&e=Help/UGen/wrapIndex.help.lhs)---## Buffer>Info--[bufChannels](?t=hsc3&e=Help/UGen/bufChannels.help.lhs),-[bufDur](?t=hsc3&e=Help/UGen/bufDur.help.lhs),-[bufFrames](?t=hsc3&e=Help/UGen/bufFrames.help.lhs),-[bufRateScale](?t=hsc3&e=Help/UGen/bufRateScale.help.lhs),-[bufSampleRate](?t=hsc3&e=Help/UGen/bufSampleRate.help.lhs),-[bufSamples](?t=hsc3&e=Help/UGen/bufSamples.help.lhs)---## Conversion--[a2K](?t=hsc3&e=Help/UGen/a2K.help.lhs),-[degreeToKey](?t=hsc3&e=Help/UGen/degreeToKey.help.lhs),-[k2A](?t=hsc3&e=Help/UGen/k2A.help.lhs),-[t2A](?t=hsc3&e=Help/UGen/t2A.help.lhs),-[t2K](?t=hsc3&e=Help/UGen/t2K.help.lhs)---## Convolution--[convolution](?t=hsc3&e=Help/UGen/convolution.help.lhs),-[convolution2](?t=hsc3&e=Help/UGen/convolution2.help.lhs),-[convolution2L](?t=hsc3&e=Help/UGen/convolution2L.help.lhs),-[convolution3](?t=hsc3&e=Help/UGen/convolution3.help.lhs),-[partConv](?t=hsc3&e=Help/UGen/partConv.help.lhs),-[stereoConvolution2L](?t=hsc3&e=Help/UGen/stereoConvolution2L.help.lhs)---## Delays--[allpassC](?t=hsc3&e=Help/UGen/allpassC.help.lhs),-[allpassL](?t=hsc3&e=Help/UGen/allpassL.help.lhs),-[allpassN](?t=hsc3&e=Help/UGen/allpassN.help.lhs),-[combC](?t=hsc3&e=Help/UGen/combC.help.lhs),-[combL](?t=hsc3&e=Help/UGen/combL.help.lhs),-[combN](?t=hsc3&e=Help/UGen/combN.help.lhs),-[delTapRd](?t=hsc3&e=Help/UGen/delTapRd.help.lhs),-[delTapWr](?t=hsc3&e=Help/UGen/delTapWr.help.lhs),-[delay1](?t=hsc3&e=Help/UGen/delay1.help.lhs),-[delay2](?t=hsc3&e=Help/UGen/delay2.help.lhs),-[delayC](?t=hsc3&e=Help/UGen/delayC.help.lhs),-[delayL](?t=hsc3&e=Help/UGen/delayL.help.lhs),-[delayN](?t=hsc3&e=Help/UGen/delayN.help.lhs),-[pluck](?t=hsc3&e=Help/UGen/pluck.help.lhs),-[tDelay](?t=hsc3&e=Help/UGen/tDelay.help.lhs)---## Delays>Buffer--[bufAllpassC](?t=hsc3&e=Help/UGen/bufAllpassC.help.lhs),-[bufAllpassL](?t=hsc3&e=Help/UGen/bufAllpassL.help.lhs),-[bufAllpassN](?t=hsc3&e=Help/UGen/bufAllpassN.help.lhs),-[bufCombC](?t=hsc3&e=Help/UGen/bufCombC.help.lhs),-[bufCombL](?t=hsc3&e=Help/UGen/bufCombL.help.lhs),-[bufCombN](?t=hsc3&e=Help/UGen/bufCombN.help.lhs),-[bufDelayC](?t=hsc3&e=Help/UGen/bufDelayC.help.lhs),-[bufDelayL](?t=hsc3&e=Help/UGen/bufDelayL.help.lhs),-[bufDelayN](?t=hsc3&e=Help/UGen/bufDelayN.help.lhs),-[tap](?t=hsc3&e=Help/UGen/tap.help.lhs)---## Demand--[dbrown](?t=hsc3&e=Help/UGen/dbrown.help.lhs),-[dbufrd](?t=hsc3&e=Help/UGen/dbufrd.help.lhs),-[dbufwr](?t=hsc3&e=Help/UGen/dbufwr.help.lhs),-[dconst](?t=hsc3&e=Help/UGen/dconst.help.lhs),-[demand](?t=hsc3&e=Help/UGen/demand.help.lhs),-[demandEnvGen](?t=hsc3&e=Help/UGen/demandEnvGen.help.lhs),-[dgeom](?t=hsc3&e=Help/UGen/dgeom.help.lhs),-[dibrown](?t=hsc3&e=Help/UGen/dibrown.help.lhs),-[diwhite](?t=hsc3&e=Help/UGen/diwhite.help.lhs),-[dpoll](?t=hsc3&e=Help/UGen/dpoll.help.lhs),-[drand](?t=hsc3&e=Help/UGen/drand.help.lhs),-[dreset](?t=hsc3&e=Help/UGen/dreset.help.lhs),-[dseq](?t=hsc3&e=Help/UGen/dseq.help.lhs),-[dser](?t=hsc3&e=Help/UGen/dser.help.lhs),-[dseries](?t=hsc3&e=Help/UGen/dseries.help.lhs),-[dshuf](?t=hsc3&e=Help/UGen/dshuf.help.lhs),-[dstutter](?t=hsc3&e=Help/UGen/dstutter.help.lhs),-[dswitch](?t=hsc3&e=Help/UGen/dswitch.help.lhs),-[dswitch1](?t=hsc3&e=Help/UGen/dswitch1.help.lhs),-[dunique](?t=hsc3&e=Help/UGen/dunique.help.lhs),-[duty](?t=hsc3&e=Help/UGen/duty.help.lhs),-[dwhite](?t=hsc3&e=Help/UGen/dwhite.help.lhs),-[dwrand](?t=hsc3&e=Help/UGen/dwrand.help.lhs),-[dxrand](?t=hsc3&e=Help/UGen/dxrand.help.lhs),-[tDuty](?t=hsc3&e=Help/UGen/tDuty.help.lhs)---## Dynamics--[compander](?t=hsc3&e=Help/UGen/compander.help.lhs),-[companderD](?t=hsc3&e=Help/UGen/companderD.help.lhs),-[limiter](?t=hsc3&e=Help/UGen/limiter.help.lhs),-[normalizer](?t=hsc3&e=Help/UGen/normalizer.help.lhs)---## Envelopes--[decay](?t=hsc3&e=Help/UGen/decay.help.lhs),-[decay2](?t=hsc3&e=Help/UGen/decay2.help.lhs),-[demandEnvGen](?t=hsc3&e=Help/UGen/demandEnvGen.help.lhs),-[envGen](?t=hsc3&e=Help/UGen/envGen.help.lhs),-[iEnvGen](?t=hsc3&e=Help/UGen/iEnvGen.help.lhs),-[line](?t=hsc3&e=Help/UGen/line.help.lhs),-[linen](?t=hsc3&e=Help/UGen/linen.help.lhs),-[xLine](?t=hsc3&e=Help/UGen/xLine.help.lhs)---## FFT--[beatTrack](?t=hsc3&e=Help/UGen/beatTrack.help.lhs),-[beatTrack2](?t=hsc3&e=Help/UGen/beatTrack2.help.lhs),-[convolution](?t=hsc3&e=Help/UGen/convolution.help.lhs),-[convolution2](?t=hsc3&e=Help/UGen/convolution2.help.lhs),-[convolution2L](?t=hsc3&e=Help/UGen/convolution2L.help.lhs),-[fft](?t=hsc3&e=Help/UGen/fft.help.lhs),-[fFTTrigger](?t=hsc3&e=Help/UGen/fFTTrigger.help.lhs),-[ifft](?t=hsc3&e=Help/UGen/ifft.help.lhs),-[pv_Add](?t=hsc3&e=Help/UGen/pv_Add.help.lhs),-[pv_BinScramble](?t=hsc3&e=Help/UGen/pv_BinScramble.help.lhs),-[pv_BinShift](?t=hsc3&e=Help/UGen/pv_BinShift.help.lhs),-[pv_BinWipe](?t=hsc3&e=Help/UGen/pv_BinWipe.help.lhs),-[pv_BrickWall](?t=hsc3&e=Help/UGen/pv_BrickWall.help.lhs),-[pv_ChainUGen](?t=hsc3&e=Help/UGen/pv_ChainUGen.help.lhs),-[pv_ConformalMap](?t=hsc3&e=Help/UGen/pv_ConformalMap.help.lhs),-[pv_Conj](?t=hsc3&e=Help/UGen/pv_Conj.help.lhs),-[pv_Copy](?t=hsc3&e=Help/UGen/pv_Copy.help.lhs),-[pv_CopyPhase](?t=hsc3&e=Help/UGen/pv_CopyPhase.help.lhs),-[pv_Diffuser](?t=hsc3&e=Help/UGen/pv_Diffuser.help.lhs),-[pv_Div](?t=hsc3&e=Help/UGen/pv_Div.help.lhs),-[pv_HainsworthFoote](?t=hsc3&e=Help/UGen/pv_HainsworthFoote.help.lhs),-[pv_JensenAndersen](?t=hsc3&e=Help/UGen/pv_JensenAndersen.help.lhs),-[pv_LocalMax](?t=hsc3&e=Help/UGen/pv_LocalMax.help.lhs),-[pv_MagAbove](?t=hsc3&e=Help/UGen/pv_MagAbove.help.lhs),-[pv_MagBelow](?t=hsc3&e=Help/UGen/pv_MagBelow.help.lhs),-[pv_MagClip](?t=hsc3&e=Help/UGen/pv_MagClip.help.lhs),-[pv_MagDiv](?t=hsc3&e=Help/UGen/pv_MagDiv.help.lhs),-[pv_MagFreeze](?t=hsc3&e=Help/UGen/pv_MagFreeze.help.lhs),-[pv_MagMul](?t=hsc3&e=Help/UGen/pv_MagMul.help.lhs),-[pv_MagNoise](?t=hsc3&e=Help/UGen/pv_MagNoise.help.lhs),-[pv_MagShift](?t=hsc3&e=Help/UGen/pv_MagShift.help.lhs),-[pv_MagSmear](?t=hsc3&e=Help/UGen/pv_MagSmear.help.lhs),-[pv_MagSquared](?t=hsc3&e=Help/UGen/pv_MagSquared.help.lhs),-[pv_Max](?t=hsc3&e=Help/UGen/pv_Max.help.lhs),-[pv_Min](?t=hsc3&e=Help/UGen/pv_Min.help.lhs),-[pv_Mul](?t=hsc3&e=Help/UGen/pv_Mul.help.lhs),-[pv_PhaseShift](?t=hsc3&e=Help/UGen/pv_PhaseShift.help.lhs),-[pv_PhaseShift270](?t=hsc3&e=Help/UGen/pv_PhaseShift270.help.lhs),-[pv_PhaseShift90](?t=hsc3&e=Help/UGen/pv_PhaseShift90.help.lhs),-[pv_RandComb](?t=hsc3&e=Help/UGen/pv_RandComb.help.lhs),-[pv_RandWipe](?t=hsc3&e=Help/UGen/pv_RandWipe.help.lhs),-[pv_RectComb](?t=hsc3&e=Help/UGen/pv_RectComb.help.lhs),-[pv_RectComb2](?t=hsc3&e=Help/UGen/pv_RectComb2.help.lhs),-[packFFT](?t=hsc3&e=Help/UGen/packFFT.help.lhs),-[partConv](?t=hsc3&e=Help/UGen/partConv.help.lhs),-[specCentroid](?t=hsc3&e=Help/UGen/specCentroid.help.lhs),-[specFlatness](?t=hsc3&e=Help/UGen/specFlatness.help.lhs),-[specPcile](?t=hsc3&e=Help/UGen/specPcile.help.lhs),-[stereoConvolution2L](?t=hsc3&e=Help/UGen/stereoConvolution2L.help.lhs),-[unpack1FFT](?t=hsc3&e=Help/UGen/unpack1FFT.help.lhs),-[unpackFFT](?t=hsc3&e=Help/UGen/unpackFFT.help.lhs)---## Filters--[lag2UD](?t=hsc3&e=Help/UGen/lag2UD.help.lhs),-[lag3UD](?t=hsc3&e=Help/UGen/lag3UD.help.lhs),-[lagUD](?t=hsc3&e=Help/UGen/lagUD.help.lhs),-[moogFF](?t=hsc3&e=Help/UGen/moogFF.help.lhs)---## Filters>BEQSuite--[bAllPass](?t=hsc3&e=Help/UGen/bAllPass.help.lhs),-[bBandPass](?t=hsc3&e=Help/UGen/bBandPass.help.lhs),-[bBandStop](?t=hsc3&e=Help/UGen/bBandStop.help.lhs),-[bEQSuite](?t=hsc3&e=Help/UGen/bEQSuite.help.lhs),-[bHiPass](?t=hsc3&e=Help/UGen/bHiPass.help.lhs),-[bHiShelf](?t=hsc3&e=Help/UGen/bHiShelf.help.lhs),-[bLowPass](?t=hsc3&e=Help/UGen/bLowPass.help.lhs),-[bLowShelf](?t=hsc3&e=Help/UGen/bLowShelf.help.lhs),-[bPeakEQ](?t=hsc3&e=Help/UGen/bPeakEQ.help.lhs)---## Filters>Linear--[apf](?t=hsc3&e=Help/UGen/apf.help.lhs),-[bpf](?t=hsc3&e=Help/UGen/bpf.help.lhs),-[bpz2](?t=hsc3&e=Help/UGen/bpz2.help.lhs),-[brf](?t=hsc3&e=Help/UGen/brf.help.lhs),-[brz2](?t=hsc3&e=Help/UGen/brz2.help.lhs),-[changed](?t=hsc3&e=Help/UGen/changed.help.lhs),-[decay](?t=hsc3&e=Help/UGen/decay.help.lhs),-[decay2](?t=hsc3&e=Help/UGen/decay2.help.lhs),-[dynKlank](?t=hsc3&e=Help/UGen/dynKlank.help.lhs),-[fos](?t=hsc3&e=Help/UGen/fos.help.lhs),-[formlet](?t=hsc3&e=Help/UGen/formlet.help.lhs),-[hpf](?t=hsc3&e=Help/UGen/hpf.help.lhs),-[hpz1](?t=hsc3&e=Help/UGen/hpz1.help.lhs),-[hpz2](?t=hsc3&e=Help/UGen/hpz2.help.lhs),-[integrator](?t=hsc3&e=Help/UGen/integrator.help.lhs),-[klank](?t=hsc3&e=Help/UGen/klank.help.lhs),-[lpf](?t=hsc3&e=Help/UGen/lpf.help.lhs),-[lpz1](?t=hsc3&e=Help/UGen/lpz1.help.lhs),-[lpz2](?t=hsc3&e=Help/UGen/lpz2.help.lhs),-[lag](?t=hsc3&e=Help/UGen/lag.help.lhs),-[lag2](?t=hsc3&e=Help/UGen/lag2.help.lhs),-[lag3](?t=hsc3&e=Help/UGen/lag3.help.lhs),-[leakDC](?t=hsc3&e=Help/UGen/leakDC.help.lhs),-[midEQ](?t=hsc3&e=Help/UGen/midEQ.help.lhs),-[onePole](?t=hsc3&e=Help/UGen/onePole.help.lhs),-[oneZero](?t=hsc3&e=Help/UGen/oneZero.help.lhs),-[rhpf](?t=hsc3&e=Help/UGen/rhpf.help.lhs),-[rlpf](?t=hsc3&e=Help/UGen/rlpf.help.lhs),-[ramp](?t=hsc3&e=Help/UGen/ramp.help.lhs),-[resonz](?t=hsc3&e=Help/UGen/resonz.help.lhs),-[ringz](?t=hsc3&e=Help/UGen/ringz.help.lhs),-[sos](?t=hsc3&e=Help/UGen/sos.help.lhs),-[slope](?t=hsc3&e=Help/UGen/slope.help.lhs),-[twoPole](?t=hsc3&e=Help/UGen/twoPole.help.lhs),-[twoZero](?t=hsc3&e=Help/UGen/twoZero.help.lhs),-[varLag](?t=hsc3&e=Help/UGen/varLag.help.lhs)---## Filters>Nonlinear--[ball](?t=hsc3&e=Help/UGen/ball.help.lhs),-[freqShift](?t=hsc3&e=Help/UGen/freqShift.help.lhs),-[hasher](?t=hsc3&e=Help/UGen/hasher.help.lhs),-[hilbert](?t=hsc3&e=Help/UGen/hilbert.help.lhs),-[hilbertFIR](?t=hsc3&e=Help/UGen/hilbertFIR.help.lhs),-[mantissaMask](?t=hsc3&e=Help/UGen/mantissaMask.help.lhs),-[median](?t=hsc3&e=Help/UGen/median.help.lhs),-[slew](?t=hsc3&e=Help/UGen/slew.help.lhs),-[spring](?t=hsc3&e=Help/UGen/spring.help.lhs),-[tBall](?t=hsc3&e=Help/UGen/tBall.help.lhs)---## Filters>Pitch--[freqShift](?t=hsc3&e=Help/UGen/freqShift.help.lhs),-[pitchShift](?t=hsc3&e=Help/UGen/pitchShift.help.lhs),-[vibrato](?t=hsc3&e=Help/UGen/vibrato.help.lhs)---## Generators>Chaotic--[chaosGen](?t=hsc3&e=Help/UGen/chaosGen.help.lhs),-[cuspL](?t=hsc3&e=Help/UGen/cuspL.help.lhs),-[cuspN](?t=hsc3&e=Help/UGen/cuspN.help.lhs),-[fBSineC](?t=hsc3&e=Help/UGen/fBSineC.help.lhs),-[fBSineL](?t=hsc3&e=Help/UGen/fBSineL.help.lhs),-[fBSineN](?t=hsc3&e=Help/UGen/fBSineN.help.lhs),-[gbmanL](?t=hsc3&e=Help/UGen/gbmanL.help.lhs),-[gbmanN](?t=hsc3&e=Help/UGen/gbmanN.help.lhs),-[henonC](?t=hsc3&e=Help/UGen/henonC.help.lhs),-[henonL](?t=hsc3&e=Help/UGen/henonL.help.lhs),-[henonN](?t=hsc3&e=Help/UGen/henonN.help.lhs),-[latoocarfianC](?t=hsc3&e=Help/UGen/latoocarfianC.help.lhs),-[latoocarfianL](?t=hsc3&e=Help/UGen/latoocarfianL.help.lhs),-[latoocarfianN](?t=hsc3&e=Help/UGen/latoocarfianN.help.lhs),-[linCongC](?t=hsc3&e=Help/UGen/linCongC.help.lhs),-[linCongL](?t=hsc3&e=Help/UGen/linCongL.help.lhs),-[linCongN](?t=hsc3&e=Help/UGen/linCongN.help.lhs),-[logistic](?t=hsc3&e=Help/UGen/logistic.help.lhs),-[lorenzL](?t=hsc3&e=Help/UGen/lorenzL.help.lhs),-[quadC](?t=hsc3&e=Help/UGen/quadC.help.lhs),-[quadL](?t=hsc3&e=Help/UGen/quadL.help.lhs),-[quadN](?t=hsc3&e=Help/UGen/quadN.help.lhs),-[sinOscFB](?t=hsc3&e=Help/UGen/sinOscFB.help.lhs),-[standardL](?t=hsc3&e=Help/UGen/standardL.help.lhs),-[standardN](?t=hsc3&e=Help/UGen/standardN.help.lhs)---## Generators>Deterministic--[blip](?t=hsc3&e=Help/UGen/blip.help.lhs),-[cOsc](?t=hsc3&e=Help/UGen/cOsc.help.lhs),-[dynKlang](?t=hsc3&e=Help/UGen/dynKlang.help.lhs),-[dynKlank](?t=hsc3&e=Help/UGen/dynKlank.help.lhs),-[fSinOsc](?t=hsc3&e=Help/UGen/fSinOsc.help.lhs),-[formant](?t=hsc3&e=Help/UGen/formant.help.lhs),-[impulse](?t=hsc3&e=Help/UGen/impulse.help.lhs),-[klang](?t=hsc3&e=Help/UGen/klang.help.lhs),-[klank](?t=hsc3&e=Help/UGen/klank.help.lhs),-[lfCub](?t=hsc3&e=Help/UGen/lfCub.help.lhs),-[lfGauss](?t=hsc3&e=Help/UGen/lfGauss.help.lhs),-[lfPar](?t=hsc3&e=Help/UGen/lfPar.help.lhs),-[lfPulse](?t=hsc3&e=Help/UGen/lfPulse.help.lhs),-[lfSaw](?t=hsc3&e=Help/UGen/lfSaw.help.lhs),-[lfTri](?t=hsc3&e=Help/UGen/lfTri.help.lhs),-[osc](?t=hsc3&e=Help/UGen/osc.help.lhs),-[oscN](?t=hsc3&e=Help/UGen/oscN.help.lhs),-[pSinGrain](?t=hsc3&e=Help/UGen/pSinGrain.help.lhs),-[pulse](?t=hsc3&e=Help/UGen/pulse.help.lhs),-[saw](?t=hsc3&e=Help/UGen/saw.help.lhs),-[sinOsc](?t=hsc3&e=Help/UGen/sinOsc.help.lhs),-[sinOscFB](?t=hsc3&e=Help/UGen/sinOscFB.help.lhs),-[syncSaw](?t=hsc3&e=Help/UGen/syncSaw.help.lhs),-[vOsc](?t=hsc3&e=Help/UGen/vOsc.help.lhs),-[vOsc3](?t=hsc3&e=Help/UGen/vOsc3.help.lhs),-[varSaw](?t=hsc3&e=Help/UGen/varSaw.help.lhs),-[vibrato](?t=hsc3&e=Help/UGen/vibrato.help.lhs)---## Generators>Granular--[grainBuf](?t=hsc3&e=Help/UGen/grainBuf.help.lhs),-[grainFM](?t=hsc3&e=Help/UGen/grainFM.help.lhs),-[grainIn](?t=hsc3&e=Help/UGen/grainIn.help.lhs),-[grainSin](?t=hsc3&e=Help/UGen/grainSin.help.lhs),-[tGrains](?t=hsc3&e=Help/UGen/tGrains.help.lhs),-[warp1](?t=hsc3&e=Help/UGen/warp1.help.lhs)---## Generators>PhysicalModels--[ball](?t=hsc3&e=Help/UGen/ball.help.lhs),-[spring](?t=hsc3&e=Help/UGen/spring.help.lhs),-[tBall](?t=hsc3&e=Help/UGen/tBall.help.lhs)---## Generators>Single-value--[dc](?t=hsc3&e=Help/UGen/dc.help.lhs)---## Generators>Stochastic--[brownNoise](?t=hsc3&e=Help/UGen/brownNoise.help.lhs),-[clipNoise](?t=hsc3&e=Help/UGen/clipNoise.help.lhs),-[coinGate](?t=hsc3&e=Help/UGen/coinGate.help.lhs),-[crackle](?t=hsc3&e=Help/UGen/crackle.help.lhs),-[dust](?t=hsc3&e=Help/UGen/dust.help.lhs),-[dust2](?t=hsc3&e=Help/UGen/dust2.help.lhs),-[gendy1](?t=hsc3&e=Help/UGen/gendy1.help.lhs),-[gendy2](?t=hsc3&e=Help/UGen/gendy2.help.lhs),-[gendy3](?t=hsc3&e=Help/UGen/gendy3.help.lhs),-[grayNoise](?t=hsc3&e=Help/UGen/grayNoise.help.lhs),-[lfClipNoise](?t=hsc3&e=Help/UGen/lfClipNoise.help.lhs),-[lfdClipNoise](?t=hsc3&e=Help/UGen/lfdClipNoise.help.lhs),-[lfdNoise0](?t=hsc3&e=Help/UGen/lfdNoise0.help.lhs),-[lfdNoise1](?t=hsc3&e=Help/UGen/lfdNoise1.help.lhs),-[lfdNoise3](?t=hsc3&e=Help/UGen/lfdNoise3.help.lhs),-[lfNoise0](?t=hsc3&e=Help/UGen/lfNoise0.help.lhs),-[lfNoise1](?t=hsc3&e=Help/UGen/lfNoise1.help.lhs),-[lfNoise2](?t=hsc3&e=Help/UGen/lfNoise2.help.lhs),-[pinkNoise](?t=hsc3&e=Help/UGen/pinkNoise.help.lhs),-[randID](?t=hsc3&e=Help/UGen/randID.help.lhs),-[randSeed](?t=hsc3&e=Help/UGen/randSeed.help.lhs),-[vibrato](?t=hsc3&e=Help/UGen/vibrato.help.lhs),-[whiteNoise](?t=hsc3&e=Help/UGen/whiteNoise.help.lhs)---## InOut--[diskIn](?t=hsc3&e=Help/UGen/diskIn.help.lhs),-[diskOut](?t=hsc3&e=Help/UGen/diskOut.help.lhs),-[in](?t=hsc3&e=Help/UGen/in.help.lhs),-[inFeedback](?t=hsc3&e=Help/UGen/inFeedback.help.lhs),-[inTrig](?t=hsc3&e=Help/UGen/inTrig.help.lhs),-[lagIn](?t=hsc3&e=Help/UGen/lagIn.help.lhs),-[localIn](?t=hsc3&e=Help/UGen/localIn.help.lhs),-[localOut](?t=hsc3&e=Help/UGen/localOut.help.lhs),-[maxLocalBufs](?t=hsc3&e=Help/UGen/maxLocalBufs.help.lhs),-[offsetOut](?t=hsc3&e=Help/UGen/offsetOut.help.lhs),-[out](?t=hsc3&e=Help/UGen/out.help.lhs),-[replaceOut](?t=hsc3&e=Help/UGen/replaceOut.help.lhs),-[vDiskIn](?t=hsc3&e=Help/UGen/vDiskIn.help.lhs),-[xOut](?t=hsc3&e=Help/UGen/xOut.help.lhs)---## Info--[checkBadValues](?t=hsc3&e=Help/UGen/checkBadValues.help.lhs),-[controlDur](?t=hsc3&e=Help/UGen/controlDur.help.lhs),-[controlRate](?t=hsc3&e=Help/UGen/controlRate.help.lhs),-[dpoll](?t=hsc3&e=Help/UGen/dpoll.help.lhs),-[numAudioBuses](?t=hsc3&e=Help/UGen/numAudioBuses.help.lhs),-[numBuffers](?t=hsc3&e=Help/UGen/numBuffers.help.lhs),-[numControlBuses](?t=hsc3&e=Help/UGen/numControlBuses.help.lhs),-[numInputBuses](?t=hsc3&e=Help/UGen/numInputBuses.help.lhs),-[numOutputBuses](?t=hsc3&e=Help/UGen/numOutputBuses.help.lhs),-[numRunningSynths](?t=hsc3&e=Help/UGen/numRunningSynths.help.lhs),-[poll](?t=hsc3&e=Help/UGen/poll.help.lhs),-[radiansPerSample](?t=hsc3&e=Help/UGen/radiansPerSample.help.lhs),-[sampleDur](?t=hsc3&e=Help/UGen/sampleDur.help.lhs),-[sampleRate](?t=hsc3&e=Help/UGen/sampleRate.help.lhs),-[subsampleOffset](?t=hsc3&e=Help/UGen/subsampleOffset.help.lhs)---## Maths--[clip](?t=hsc3&e=Help/UGen/clip.help.lhs),-[fold](?t=hsc3&e=Help/UGen/fold.help.lhs),-[inRange](?t=hsc3&e=Help/UGen/inRange.help.lhs),-[inRect](?t=hsc3&e=Help/UGen/inRect.help.lhs),-[integrator](?t=hsc3&e=Help/UGen/integrator.help.lhs),-[leastChange](?t=hsc3&e=Help/UGen/leastChange.help.lhs),-[linExp](?t=hsc3&e=Help/UGen/linExp.help.lhs),-[modDif](?t=hsc3&e=Help/UGen/modDif.help.lhs),-[mostChange](?t=hsc3&e=Help/UGen/mostChange.help.lhs),-[mulAdd](?t=hsc3&e=Help/UGen/mulAdd.help.lhs),-[runningMax](?t=hsc3&e=Help/UGen/runningMax.help.lhs),-[runningMin](?t=hsc3&e=Help/UGen/runningMin.help.lhs),-[runningSum](?t=hsc3&e=Help/UGen/runningSum.help.lhs),-[schmidt](?t=hsc3&e=Help/UGen/schmidt.help.lhs),-[slope](?t=hsc3&e=Help/UGen/slope.help.lhs),-[wrap](?t=hsc3&e=Help/UGen/wrap.help.lhs)---## Multichannel>Ambisonics--[biPanB2](?t=hsc3&e=Help/UGen/biPanB2.help.lhs),-[decodeB2](?t=hsc3&e=Help/UGen/decodeB2.help.lhs),-[panB](?t=hsc3&e=Help/UGen/panB.help.lhs),-[panB2](?t=hsc3&e=Help/UGen/panB2.help.lhs),-[rotate2](?t=hsc3&e=Help/UGen/rotate2.help.lhs)---## Multichannel>Panners--[balance2](?t=hsc3&e=Help/UGen/balance2.help.lhs),-[linPan2](?t=hsc3&e=Help/UGen/linPan2.help.lhs),-[pan2](?t=hsc3&e=Help/UGen/pan2.help.lhs),-[pan4](?t=hsc3&e=Help/UGen/pan4.help.lhs),-[panAz](?t=hsc3&e=Help/UGen/panAz.help.lhs),-[rotate2](?t=hsc3&e=Help/UGen/rotate2.help.lhs),-[splay](?t=hsc3&e=Help/UGen/splay.help.lhs),-[splayAz](?t=hsc3&e=Help/UGen/splayAz.help.lhs)---## Multichannel>Select--[linXFade2](?t=hsc3&e=Help/UGen/linXFade2.help.lhs),-[select](?t=hsc3&e=Help/UGen/select.help.lhs),-[xFade2](?t=hsc3&e=Help/UGen/xFade2.help.lhs)---## Random--[dshuf](?t=hsc3&e=Help/UGen/dshuf.help.lhs),-[dwrand](?t=hsc3&e=Help/UGen/dwrand.help.lhs),-[expRand](?t=hsc3&e=Help/UGen/expRand.help.lhs),-[hasher](?t=hsc3&e=Help/UGen/hasher.help.lhs),-[iRand](?t=hsc3&e=Help/UGen/iRand.help.lhs),-[linRand](?t=hsc3&e=Help/UGen/linRand.help.lhs),-[nRand](?t=hsc3&e=Help/UGen/nRand.help.lhs),-[rand](?t=hsc3&e=Help/UGen/rand.help.lhs),-[randID](?t=hsc3&e=Help/UGen/randID.help.lhs),-[randSeed](?t=hsc3&e=Help/UGen/randSeed.help.lhs),-[tExpRand](?t=hsc3&e=Help/UGen/tExpRand.help.lhs),-[tIRand](?t=hsc3&e=Help/UGen/tIRand.help.lhs),-[tRand](?t=hsc3&e=Help/UGen/tRand.help.lhs),-[tWindex](?t=hsc3&e=Help/UGen/tWindex.help.lhs)---## Reverbs--[freeVerb](?t=hsc3&e=Help/UGen/freeVerb.help.lhs),-[freeVerb2](?t=hsc3&e=Help/UGen/freeVerb2.help.lhs),-[gVerb](?t=hsc3&e=Help/UGen/gVerb.help.lhs)---## Synth control--[control](?t=hsc3&e=Help/UGen/control.help.lhs),-[detectSilence](?t=hsc3&e=Help/UGen/detectSilence.help.lhs),-[done](?t=hsc3&e=Help/UGen/done.help.lhs),-[free](?t=hsc3&e=Help/UGen/free.help.lhs),-[freeSelf](?t=hsc3&e=Help/UGen/freeSelf.help.lhs),-[freeSelfWhenDone](?t=hsc3&e=Help/UGen/freeSelfWhenDone.help.lhs),-[lagControl](?t=hsc3&e=Help/UGen/lagControl.help.lhs),-[pause](?t=hsc3&e=Help/UGen/pause.help.lhs),-[pauseSelf](?t=hsc3&e=Help/UGen/pauseSelf.help.lhs),-[pauseSelfWhenDone](?t=hsc3&e=Help/UGen/pauseSelfWhenDone.help.lhs),-[trigControl](?t=hsc3&e=Help/UGen/trigControl.help.lhs)---## Triggers--[changed](?t=hsc3&e=Help/UGen/changed.help.lhs),-[gate](?t=hsc3&e=Help/UGen/gate.help.lhs),-[inTrig](?t=hsc3&e=Help/UGen/inTrig.help.lhs),-[lastValue](?t=hsc3&e=Help/UGen/lastValue.help.lhs),-[latch](?t=hsc3&e=Help/UGen/latch.help.lhs),-[phasor](?t=hsc3&e=Help/UGen/phasor.help.lhs),-[pulseCount](?t=hsc3&e=Help/UGen/pulseCount.help.lhs),-[pulseDivider](?t=hsc3&e=Help/UGen/pulseDivider.help.lhs),-[sendReply](?t=hsc3&e=Help/UGen/sendReply.help.lhs),-[sendTrig](?t=hsc3&e=Help/UGen/sendTrig.help.lhs),-[setResetFF](?t=hsc3&e=Help/UGen/setResetFF.help.lhs),-[stepper](?t=hsc3&e=Help/UGen/stepper.help.lhs),-[sweep](?t=hsc3&e=Help/UGen/sweep.help.lhs),-[t2A](?t=hsc3&e=Help/UGen/t2A.help.lhs),-[t2K](?t=hsc3&e=Help/UGen/t2K.help.lhs),-[tDelay](?t=hsc3&e=Help/UGen/tDelay.help.lhs),-[tExpRand](?t=hsc3&e=Help/UGen/tExpRand.help.lhs),-[tIRand](?t=hsc3&e=Help/UGen/tIRand.help.lhs),-[tRand](?t=hsc3&e=Help/UGen/tRand.help.lhs),-[tWindex](?t=hsc3&e=Help/UGen/tWindex.help.lhs),-[timer](?t=hsc3&e=Help/UGen/timer.help.lhs),-[toggleFF](?t=hsc3&e=Help/UGen/toggleFF.help.lhs),-[trig](?t=hsc3&e=Help/UGen/trig.help.lhs),-[trig1](?t=hsc3&e=Help/UGen/trig1.help.lhs)---## Undocumented--[apf](?t=hsc3&e=Help/UGen/apf.help.lhs),-[audioControl](?t=hsc3&e=Help/UGen/audioControl.help.lhs),-[blockSize](?t=hsc3&e=Help/UGen/blockSize.help.lhs),-[dustR](?t=hsc3&e=Help/UGen/dustR.help.lhs),-[nodeID](?t=hsc3&e=Help/UGen/nodeID.help.lhs),-[pauseSelfWhenDone](?t=hsc3&e=Help/UGen/pauseSelfWhenDone.help.lhs),-[rDelayMap](?t=hsc3&e=Help/UGen/rDelayMap.help.lhs),-[rDelaySet](?t=hsc3&e=Help/UGen/rDelaySet.help.lhs),-[rDelaySetB](?t=hsc3&e=Help/UGen/rDelaySetB.help.lhs),-[rFreezer](?t=hsc3&e=Help/UGen/rFreezer.help.lhs),-[rLoopSet](?t=hsc3&e=Help/UGen/rLoopSet.help.lhs),-[rPlayTrace](?t=hsc3&e=Help/UGen/rPlayTrace.help.lhs),-[rShufflerB](?t=hsc3&e=Help/UGen/rShufflerB.help.lhs),-[rShufflerL](?t=hsc3&e=Help/UGen/rShufflerL.help.lhs),-[rTraceRd](?t=hsc3&e=Help/UGen/rTraceRd.help.lhs),-[rTraceRdX](?t=hsc3&e=Help/UGen/rTraceRdX.help.lhs),-[rTraceRdY](?t=hsc3&e=Help/UGen/rTraceRdY.help.lhs),-[rTraceRdZ](?t=hsc3&e=Help/UGen/rTraceRdZ.help.lhs),-[scopeOut](?t=hsc3&e=Help/UGen/scopeOut.help.lhs),-[scopeOut2](?t=hsc3&e=Help/UGen/scopeOut2.help.lhs),-[trigControl](?t=hsc3&e=Help/UGen/trigControl.help.lhs)---## User interaction--[keyState](?t=hsc3&e=Help/UGen/keyState.help.lhs),-[mouseButton](?t=hsc3&e=Help/UGen/mouseButton.help.lhs),-[mouseX](?t=hsc3&e=Help/UGen/mouseX.help.lhs),-[mouseY](?t=hsc3&e=Help/UGen/mouseY.help.lhs)---## Operator>Binary--[add](?t=hsc3&e=Help/UGen/add.help.lhs),-[sub](?t=hsc3&e=Help/UGen/sub.help.lhs),-[mul](?t=hsc3&e=Help/UGen/mul.help.lhs),-[iDiv](?t=hsc3&e=Help/UGen/iDiv.help.lhs),-[fDiv](?t=hsc3&e=Help/UGen/fDiv.help.lhs),-[mod](?t=hsc3&e=Help/UGen/mod.help.lhs),-[eq](?t=hsc3&e=Help/UGen/eq.help.lhs),-[ne](?t=hsc3&e=Help/UGen/ne.help.lhs),-[lt](?t=hsc3&e=Help/UGen/lt.help.lhs),-[gt](?t=hsc3&e=Help/UGen/gt.help.lhs),-[le](?t=hsc3&e=Help/UGen/le.help.lhs),-[ge](?t=hsc3&e=Help/UGen/ge.help.lhs),-[min](?t=hsc3&e=Help/UGen/min.help.lhs),-[max](?t=hsc3&e=Help/UGen/max.help.lhs),-[bitAnd](?t=hsc3&e=Help/UGen/bitAnd.help.lhs),-[bitOr](?t=hsc3&e=Help/UGen/bitOr.help.lhs),-[bitXor](?t=hsc3&e=Help/UGen/bitXor.help.lhs),-[lcm](?t=hsc3&e=Help/UGen/lcm.help.lhs),-[gcd](?t=hsc3&e=Help/UGen/gcd.help.lhs),-[round](?t=hsc3&e=Help/UGen/round.help.lhs),-[roundUp](?t=hsc3&e=Help/UGen/roundUp.help.lhs),-[trunc](?t=hsc3&e=Help/UGen/trunc.help.lhs),-[atan2](?t=hsc3&e=Help/UGen/atan2.help.lhs),-[hypot](?t=hsc3&e=Help/UGen/hypot.help.lhs),-[hypotx](?t=hsc3&e=Help/UGen/hypotx.help.lhs),-[pow](?t=hsc3&e=Help/UGen/pow.help.lhs),-[shiftLeft](?t=hsc3&e=Help/UGen/shiftLeft.help.lhs),-[shiftRight](?t=hsc3&e=Help/UGen/shiftRight.help.lhs),-[unsignedShift](?t=hsc3&e=Help/UGen/unsignedShift.help.lhs),-[fill](?t=hsc3&e=Help/UGen/fill.help.lhs),-[ring1](?t=hsc3&e=Help/UGen/ring1.help.lhs),-[ring2](?t=hsc3&e=Help/UGen/ring2.help.lhs),-[ring3](?t=hsc3&e=Help/UGen/ring3.help.lhs),-[ring4](?t=hsc3&e=Help/UGen/ring4.help.lhs),-[difSqr](?t=hsc3&e=Help/UGen/difSqr.help.lhs),-[sumSqr](?t=hsc3&e=Help/UGen/sumSqr.help.lhs),-[sqrSum](?t=hsc3&e=Help/UGen/sqrSum.help.lhs),-[sqrDif](?t=hsc3&e=Help/UGen/sqrDif.help.lhs),-[absDif](?t=hsc3&e=Help/UGen/absDif.help.lhs),-[thresh](?t=hsc3&e=Help/UGen/thresh.help.lhs),-[aMClip](?t=hsc3&e=Help/UGen/aMClip.help.lhs),-[scaleNeg](?t=hsc3&e=Help/UGen/scaleNeg.help.lhs),-[clip2](?t=hsc3&e=Help/UGen/clip2.help.lhs),-[excess](?t=hsc3&e=Help/UGen/excess.help.lhs),-[fold2](?t=hsc3&e=Help/UGen/fold2.help.lhs),-[wrap2](?t=hsc3&e=Help/UGen/wrap2.help.lhs),-[firstArg](?t=hsc3&e=Help/UGen/firstArg.help.lhs),-[randRange](?t=hsc3&e=Help/UGen/randRange.help.lhs),-[expRandRange](?t=hsc3&e=Help/UGen/expRandRange.help.lhs)---## Operator>Unary--[neg](?t=hsc3&e=Help/UGen/neg.help.lhs),-[not](?t=hsc3&e=Help/UGen/not.help.lhs),-[isNil](?t=hsc3&e=Help/UGen/isNil.help.lhs),-[notNil](?t=hsc3&e=Help/UGen/notNil.help.lhs),-[bitNot](?t=hsc3&e=Help/UGen/bitNot.help.lhs),-[abs](?t=hsc3&e=Help/UGen/abs.help.lhs),-[asFloat](?t=hsc3&e=Help/UGen/asFloat.help.lhs),-[asInt](?t=hsc3&e=Help/UGen/asInt.help.lhs),-[ceil](?t=hsc3&e=Help/UGen/ceil.help.lhs),-[floor](?t=hsc3&e=Help/UGen/floor.help.lhs),-[frac](?t=hsc3&e=Help/UGen/frac.help.lhs),-[sign](?t=hsc3&e=Help/UGen/sign.help.lhs),-[squared](?t=hsc3&e=Help/UGen/squared.help.lhs),-[cubed](?t=hsc3&e=Help/UGen/cubed.help.lhs),-[sqrt](?t=hsc3&e=Help/UGen/sqrt.help.lhs),-[exp](?t=hsc3&e=Help/UGen/exp.help.lhs),-[recip](?t=hsc3&e=Help/UGen/recip.help.lhs),-[mIDICPS](?t=hsc3&e=Help/UGen/mIDICPS.help.lhs),-[cPSMIDI](?t=hsc3&e=Help/UGen/cPSMIDI.help.lhs),-[mIDIRatio](?t=hsc3&e=Help/UGen/mIDIRatio.help.lhs),-[ratioMIDI](?t=hsc3&e=Help/UGen/ratioMIDI.help.lhs),-[dbAmp](?t=hsc3&e=Help/UGen/dbAmp.help.lhs),-[ampDb](?t=hsc3&e=Help/UGen/ampDb.help.lhs),-[octCPS](?t=hsc3&e=Help/UGen/octCPS.help.lhs),-[cPSOct](?t=hsc3&e=Help/UGen/cPSOct.help.lhs),-[log](?t=hsc3&e=Help/UGen/log.help.lhs),-[log2](?t=hsc3&e=Help/UGen/log2.help.lhs),-[log10](?t=hsc3&e=Help/UGen/log10.help.lhs),-[sin](?t=hsc3&e=Help/UGen/sin.help.lhs),-[cos](?t=hsc3&e=Help/UGen/cos.help.lhs),-[tan](?t=hsc3&e=Help/UGen/tan.help.lhs),-[arcSin](?t=hsc3&e=Help/UGen/arcSin.help.lhs),-[arcCos](?t=hsc3&e=Help/UGen/arcCos.help.lhs),-[arcTan](?t=hsc3&e=Help/UGen/arcTan.help.lhs),-[sinH](?t=hsc3&e=Help/UGen/sinH.help.lhs),-[cosH](?t=hsc3&e=Help/UGen/cosH.help.lhs),-[tanH](?t=hsc3&e=Help/UGen/tanH.help.lhs),-[rand_](?t=hsc3&e=Help/UGen/rand_.help.lhs),-[rand2](?t=hsc3&e=Help/UGen/rand2.help.lhs),-[linRand_](?t=hsc3&e=Help/UGen/linRand_.help.lhs),-[biLinRand](?t=hsc3&e=Help/UGen/biLinRand.help.lhs),-[sum3Rand](?t=hsc3&e=Help/UGen/sum3Rand.help.lhs),-[distort](?t=hsc3&e=Help/UGen/distort.help.lhs),-[softClip](?t=hsc3&e=Help/UGen/softClip.help.lhs),-[coin](?t=hsc3&e=Help/UGen/coin.help.lhs),-[digitValue](?t=hsc3&e=Help/UGen/digitValue.help.lhs),-[silence](?t=hsc3&e=Help/UGen/silence.help.lhs),-[thru](?t=hsc3&e=Help/UGen/thru.help.lhs),-[rectWindow](?t=hsc3&e=Help/UGen/rectWindow.help.lhs),-[hanWindow](?t=hsc3&e=Help/UGen/hanWindow.help.lhs),-[welchWindow](?t=hsc3&e=Help/UGen/welchWindow.help.lhs),-[triWindow](?t=hsc3&e=Help/UGen/triWindow.help.lhs),-[ramp_](?t=hsc3&e=Help/UGen/ramp_.help.lhs),-[sCurve](?t=hsc3&e=Help/UGen/sCurve.help.lhs)--
− Help/UGen/k2A.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "K2A"-    > Sound.SC3.UGen.DB.ugenSummary "K2A"--> import Sound.SC3 {- hsc3 -}--> g_01 = k2A (whiteNoise 'α' KR * 0.3)--compare--> g_02 = mce2 (k2A (whiteNoise 'α' KR * 0.3)) (whiteNoise 'β' AR * 0.1)--> g_03 =->     let blockSize = controlDur * sampleRate->         freq = (mouseX KR 0.1 40 Exponential 0.2) / blockSize * sampleRate;->         o1 = k2A (lfNoise0 'α' KR freq)->         o2 = lfNoise0 'β' AR freq->     in mce2 o1 o2 * 0.1
− Help/UGen/keyState.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "KeyState"-    > Sound.SC3.UGen.DB.ugenSummary "KeyState"--> import Sound.SC3 {- hsc3 -}--The keycode 38 is the A key on my keyboard.  Under X the xev(1)-command is useful in determining your keyboard layout.--> g_01 = sinOsc AR 800 0 * keyState KR 38 0 0.1 0.5
− Help/UGen/klang.help.lhs
@@ -1,31 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Klang"-    > Sound.SC3.UGen.DB.ugenSummary "Klang"--Note: SC2 had mul/add inputs.--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = [440,550..1100]->         a = take 7 (cycle [0.05, 0.02])->         p = replicate 7 0->     in klang AR 1 0 (klangSpec f a p)--    play({Klang.ar(`[[800,1000,1200],[0.3,0.3,0.3],[pi,pi,pi]],1,0)*0.4})--> g_02 =->     let s = klangSpec [800,1000,1200] [0.3,0.3,0.3] [pi,pi,pi]->     in klang AR 1 0 s * 0.4--    play({Klang.ar(`[[800,1000,1200],nil,nil],1,0)*0.25})--> g_03 =->     let s = klangSpec [800,1000,1200] [1,1,1] [0,0,0]->     in klang AR 1 0 s * 0.25--    play({Klang.ar(`[Array.rand(12,600.0,1000.0),nil,nil],1,0)*0.05})--> g_04 =->     let f = map (\z -> rand z 600 1000) ['a'..'l']->         s = klangSpec f (replicate 12 1) (replicate 12 0)->     in klang AR 1 0 s * 0.05
− Help/UGen/klank.help.lhs
@@ -1,34 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Klank"-    > Sound.SC3.UGen.DB.ugenSummary "Klank"--> import Sound.SC3 {- hsc3 -}--The function klankSpec can help create the 'spec' entry.--> g_01 =->     let s = klankSpec' [800,1071,1153,1723] [1,1,1,1] [1,1,1,1]->     in klank (impulse AR 2 0 * 0.1) 1 0 1 s--A variant spec function takes non-UGen inputs--> g_02 =->     let f = [800::Double,1071,1153,1723]->         u = [1,1,1,1]->         s = klankSpec' f u u->     in klank (impulse AR 2 0 * 0.1) 1 0 1 s--There is a limited form of multiple channel expansion possible at-'specification' input, below three equal dimensional specifications-are transposed and force expansion in a sensible manner.--> g_03 =->     let u = [1,1,1,1]->         p = [200,171,153,172]->         q = [930,971,953,1323]->         r = [8900,16062,9013,7892]->         k = mce [klankSpec' p u u,klankSpec' q u u,klankSpec' r u u]->         s = mceTranspose k->         i = mce [2,2.07,2.13]->         t = impulse AR i 0 * 0.1->         l = mce [-1,0,1]->     in mix (pan2 (klank t 1 0 1 s) l 1)
− Help/UGen/lag.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Lag"-    > Sound.SC3.UGen.DB.ugenSummary "Lag"--> import Sound.SC3 {- hsc3 -}--used to lag pitch--> g_01 =->     let x = mouseX KR 220 440 Linear 0.2->     in sinOsc AR (mce [x, lag x 1]) 0 * 0.1--used to smooth amplitude changes--> g_02 =->     let n = lfNoise0 'a' KR 0.5->     in sinOsc AR (220 + (lag n 1 * 220)) 0 * (lag n 2 * 0.1)
− Help/UGen/lag2.help.lhs
@@ -1,8 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Lag2"-    Sound.SC3.UGen.DB.ugenSummary "Lag2"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR 220 440 Exponential 0.1->     in sinOsc AR (mce [x, lag2 x 1]) 0 * 0.1
− Help/UGen/lag3.help.lhs
@@ -1,8 +0,0 @@-     Sound.SC3.UGen.Help.viewSC3Help "Lag3"-    Sound.SC3.UGen.DB.ugenSummary "Lag3"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR 220 440 Exponential 0.1->     in sinOsc AR (mce [x, lag3 x 1]) 0 * 0.1
− Help/UGen/lagIn.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LagIn"-    > Sound.SC3.UGen.DB.ugenSummary "LagIn"--> import Sound.SC3 {- hsc3 -}--Set frequency at control bus--    > withSC3 (send (c_set1 10 200))--Oscillator reading frequency at control bus--> g_01 = sinOsc AR (lagIn 1 10 1) 0 * 0.1--Re-set frequency at control bus--    > withSC3 (send (c_set1 10 2000))
− Help/UGen/lagUD.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LagUD"-    Sound.SC3.UGen.DB.ugenSummary "LagUD"--> import Sound.SC3 {- hsc3 -}--lag pitch, slower down (5 seconds) than up (1 second)--> g_01 =->     let x = mouseX KR 220 440 Linear 0.2->     in sinOsc AR (mce2 x (lagUD x 1 5)) 0 * 0.1
− Help/UGen/lastValue.help.lhs
@@ -1,12 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LastValue"-> Sound.SC3.UGen.DB.ugenSummary "LastValue"--> import Sound.SC3--> let x = mouseX KR 100 400 Linear 0.1-> in audition (out 0 (sinOsc AR (lastValue x 40) 0 * 0.1))--Difference between currrent and the last changed-> let {x = mouseX KR 0.1 4 Linear 0.1->     ;f = abs (lastValue x 0.5 - x) * 400 + 200}-> in audition (out 0 (sinOsc AR f 0 * 0.2))
− Help/UGen/latch.help.lhs
@@ -1,26 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Latch"-    Sound.SC3.UGen.DB.ugenSummary "Latch"--> import Sound.SC3 {- hsc3 -}--> g_01 =->   let n = whiteNoise 'α' AR->       i = impulse AR 9 0->       l = latch n i->   in blip AR (l * 400 + 500) 4 * 0.2--The above is just meant as example. LFNoise0 is a faster way to-generate random steps :--> g_02 =->   let n = lfNoise0 'α' KR 9->   in blip AR (n * 400 + 500) 4 * 0.2--http://create.ucsb.edu/pipermail/sc-users/2006-December/029991.html--> g_03 =->   let n0 = lfNoise2 'α' KR 8->       n1 = lfNoise2 'β' KR 3->       s = blip AR (n0 * 200 + 300) (n1 * 10 + 20)->       x = mouseX KR 1000 (sampleRate * 0.1) Exponential 0.1->   in latch s (impulse AR x 0)
− Help/UGen/latoocarfianC.help.lhs
@@ -1,20 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LatoocarfianC"-> Sound.SC3.UGen.DB.ugenSummary "LatoocarfianC"--> import Sound.SC3--SC3 default initial parameters.--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (latoocarfianC AR x 1 3 0.5 0.5 0.5 0.5 * 0.2))--Randomly modulate all parameters.--> let {[n0,n1,n2,n3] = map (\e -> lfNoise2 e KR 5) "abcd"->     ;f = sampleRate / 4->     ;a = n0 * 1.5 + 1.5->     ;b = n1 * 1.5 + 1.5->     ;c = n2 * 0.5 + 1.5->     ;d = n3 * 0.5 + 1.5->     ;o = latoocarfianC AR f a b c d 0.5 0.5 * 0.2}-> in audition (out 0 o)
− Help/UGen/leakDC.help.lhs
@@ -1,8 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LeakDC"-    > Sound.SC3.UGen.DB.ugenSummary "LeakDC"--> import Sound.SC3--> g_01 =->     let a = lfPulse AR 800 0 0.5 * 0.1 + 0.5->     in mce [a,leakDC a 0.995]
− Help/UGen/lfBrownNoise2.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LFBrownNoise2"-    > Sound.SC3.UGen.DB.ugenSummary "LFBrownNoise2"--> import Sound.SC3 {- hsc3 -}-> import qualified Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins as E {- hsc3 -}--Modulate frequency.--> g_01 =->     let x = mouseX KR 0 5 Linear 0.2->     in E.lfBrownNoise2 'α' AR 1000 1 x * 0.25--Use as frequency control.--> g_02 =->     let f = E.lfBrownNoise2 'α' KR 8 0.2 0 * 400 + 450->     in sinOsc AR f 0 * 0.2
− Help/UGen/lfClipNoise.help.lhs
@@ -1,25 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFClipNoise"-    Sound.SC3.UGen.DB.ugenSummary "LFClipNoise"--> import Sound.SC3 {- hsc3 -}->-> g_01 = lfClipNoise 'α' AR 1000 * 0.05--Modulate frequency--> g_02 =->     let f = xLine KR 1000 10000 10 RemoveSynth->     in lfClipNoise 'α' AR f * 0.05--Use as frequency control--> g_03 =->     let n = lfClipNoise 'α' KR 4->     in sinOsc AR (n * 200 + 600) 0 * 0.1--Drawings--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (lfClipNoise 'α' AR 1000)--![](sw/hsc3/Help/SVG/lfClipNoise.0.svg)
− Help/UGen/lfCub.help.lhs
@@ -1,39 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LFCub"-    > Sound.SC3.UGen.DB.ugenSummary "LFCub"--> import Sound.SC3--> g_01 = lfCub AR (lfCub KR (lfCub KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1-> g_02 = lfCub AR (lfCub KR 0.2 0 * 400 + 800) 0 * 0.1-> g_03 = lfCub AR 800 0 * 0.1-> g_04 = lfCub AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1--Compare w/ lfPar--> g_05 = lfPar AR (lfPar KR (lfPar KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1-> g_06 = lfPar AR (lfPar KR 0.2 0 * 400 + 800) 0 * 0.1-> g_07 = lfPar AR 800 0 * 0.1-> g_08 = lfPar AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1--Compare w/ sinOsc--> g_09 = sinOsc AR (sinOsc KR (sinOsc KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1-> g_11 = sinOsc AR (sinOsc KR 0.2 0 * 400 + 800) 0 * 0.1-> g_12 = sinOsc AR 800 0 * 0.1-> g_13 = sinOsc AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1--Compare w/ lfTri--> g_14 = lfTri AR (lfTri KR (lfTri KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1-> g_15 = lfTri AR (lfTri KR 0.2 0 * 400 + 800) 0 * 0.1-> g_16 = lfTri AR 800 0 * 0.1-> g_17 = lfTri AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen 0.1 (mce2 (sinOsc AR 20 0) (lfCub AR 20 0))-    > plot_ugen 0.1 (mce2 (sinOsc AR 20 0) (lfPar AR 20 pi))--![](sw/hsc3/Help/SVG/lfCub.0.svg)-![](sw/hsc3/Help/SVG/lfCub.1.svg)
− Help/UGen/lfGauss.help.lhs
@@ -1,111 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFGauss"-    Sound.SC3.UGen.DB.ugenSummary "LFGauss"--> import Sound.SC3 {- hsc3 -}--modulating duration--> g_01 =->     let d = xLine KR 0.1 0.001 10 DoNothing->     in lfGauss AR d 0.03 0 Loop DoNothing * 0.2--modulating width, freq 60 Hz--> g_02 =->     let w = xLine KR 0.1 0.001 10 DoNothing->     in lfGauss AR (1/60) w 0 Loop DoNothing * 0.2--modulating both: x position is frequency, y is width factor.-note the artefacts due to alisasing at high frequencies--> g_03 =->     let d = mouseX KR (1/8000) 0.1 Exponential 0.2->         w = mouseY KR 0.001 0.1 Exponential 0.2->     in lfGauss AR d w 0 Loop DoNothing * 0.1--LFGauss as amplitude modulator--> g_04 =->     let d = mouseX KR 1 0.001 Exponential 0.2->         g = lfGauss AR d 0.1 0 Loop DoNothing->         o = sinOsc AR 1000 0->     in g * o * 0.1--modulate iphase--> g_05 =->     let ph = mouseX KR (-1) 1 Linear 0.2->         g = lfGauss AR 0.001 0.2 (mce2 0 ph) Loop DoNothing->     in mix g * 0.2--for very small width we are "approaching" a dirac function--> g_06 =->     let w = sampleDur * mouseX KR 10 3000 Exponential 0.2->     in lfGauss AR 0.01 w 0 Loop DoNothing * 0.2--dur and width can be modulated at audio rate--> g_07 =->     let x = mouseX KR 2 1000 Exponential 0.2->         d = range 0.0006 0.01 (sinOsc AR x 0 * mce2 1 1.1)->         w = range 0.01 0.3 (sinOsc AR (0.5 * (mce2 1 1.1)) 0)->     in lfGauss AR d w 0 Loop DoNothing * 0.2--several frequencies and widths combined--> g_08 =->     let x = mouseX KR 1 0.07 Exponential 0.2->         y = mouseY KR 1 3 Linear 0.2->         g = lfGauss AR x (y ** mce [-1,-2 .. -6]) 0 Loop DoNothing->         o = sinOsc AR (200 * (1.3 ** mce [0..5])) 0->     in mix (g * o) * 0.1--    > withSC3 (send (n_trace [-1]))--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > let plot_f tm du ph = plot_ugen1 tm (lfGauss AR du 0.12 ph Loop DoNothing)-    > plot_f 0.1 0.1 0-    > plot_f 0.1 0.1 (-1) -- shifting left-    > plot_f 0.1 0.1 2 -- moving further away from the center-    > plot_f 0.3 0.065 0 -- several grains--![](sw/hsc3/Help/SVG/lfGauss.0.svg)-![](sw/hsc3/Help/SVG/lfGauss.1.svg)-![](sw/hsc3/Help/SVG/lfGauss.2.svg)-![](sw/hsc3/Help/SVG/lfGauss.3.svg)--gabor grain (see also 'gabor_grain_ugen_graph')--> gabor =->     let b = control IR "out" 0->         f = control IR "freq" 440->         s = control IR "sustain" 1->         p = control IR "pan" 0->         a = control IR "amp" 0.1->         w = control IR "width" 0.25->         e = lfGauss AR s w 0 NoLoop RemoveSynth->         o = fSinOsc AR f (pi / 2) * e->         u = offsetOut b (pan2 o p a)->     in synthdef "gabor" u--    > import Sound.SC3.Lang.Pattern {- hsc3-lang -}--granular synthesis, modulating duration, width and pan--    > paudition (pbind [(K_instr,psynth gabor)-    >                  ,(K_freq,1000)-    >                  ,(K_legato,2)-    >                  ,(K_dur,pbrown 'α' 0.005 0.025 0.001 inf)-    >                  ,(K_param "width",pbrown 'β' 0.05 0.25 0.005 inf)-    >                  ,(K_param "pan",pbrown 'γ' (-1) 1 0.05 inf)])--granular synthesis, modulating width only--    > paudition (pbind [(K_instr,psynth gabor)-    >                  ,(K_freq,1000)-    >                  ,(K_dur,0.01)-    >                  ,(K_param "width",pgeom 0.25 0.995 1250)-    >                  ,(K_legato,2)])
− Help/UGen/lfNoise0.help.lhs
@@ -1,29 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFNoise0"-    Sound.SC3.UGen.DB.ugenSummary "LFNoise0"--> import Sound.SC3 {- hsc3 -}->-> g_01 = lfNoise0 'α' AR 1000 * 0.05--Modulate frequency.--> g_02 =->     let f = xLine KR 1000 10000 10 RemoveSynth->     in lfNoise0 'α' AR f * 0.05--Use as frequency control.--> g_03 =->     let f = lfNoise0 'α' KR 4->     in sinOsc AR (f * 400 + 450) 0 * 0.1--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (lfNoise0 'γ' AR 1000)-    > plot_ugen1 0.1 (lfNoise1 'γ' AR 1000)-    > plot_ugen1 0.1 (lfNoise2 'γ' AR 1000)--![](sw/hsc3/Help/SVG/lfNoise0.0.svg)-![](sw/hsc3/Help/SVG/lfNoise0.1.svg)-![](sw/hsc3/Help/SVG/lfNoise0.2.svg)
− Help/UGen/lfNoise1.help.lhs
@@ -1,18 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LFNoise1"-> Sound.SC3.UGen.DB.ugenSummary "LFNoise1"--> import Sound.SC3--> audition (out 0 (lfNoise1 'α' AR 1000 * 0.05))--Modulate frequency.--> let {f = xLine KR 1000 10000 10 RemoveSynth->     ;n = lfNoise1 'α' AR f}-> in audition (out 0 (n * 0.05))--Use as frequency control.--> let {n = lfNoise1 'α' KR 4->     ;f = n * 400 + 450}-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/lfNoise2.help.lhs
@@ -1,25 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFNoise2"-    Sound.SC3.UGen.DB.ugenSummary "LFNoise2"--> import Sound.SC3 {- hsc3 -}->-> g_01 = lfNoise2 'α' AR 1000 * 0.05--Modulate frequency.--> g_02 =->     let f = xLine KR 1000 10000 10 RemoveSynth->     in lfNoise2 'α' AR f * 0.05--Use as frequency control.--> g_03 =->     let f = lfNoise2 'α' KR 4->     in sinOsc AR (f * 400 + 450) 0 * 0.1--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (lfNoise2 'α' AR 1000)--![](sw/hsc3/Help/SVG/lfNoise2.0.svg)
− Help/UGen/lfPar.help.lhs
@@ -1,4 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LFPar"-> Sound.SC3.UGen.DB.ugenSummary "LFPar"--See lfCub
− Help/UGen/lfPulse.help.lhs
@@ -1,32 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFPulse"-    Sound.SC3.UGen.DB.ugenSummary "LFPulse"--Note: SC2 had no initial phase argument.--> import Sound.SC3->-> g_01 = let f = lfPulse KR 3 0 0.3 * 200 + 200 in lfPulse AR f 0 0.2 * 0.1->-> g_02 = let x = mouseX KR 0 1 Linear 0.2 in lfPulse AR 220 0 x * 0.1--square wave as sum of sines.-for odd partials n, amplitude is (1 / n), for even partials amplitude is 0.-phase is always 0.--> g_03 =->     let mk_freq f0 n = f0 * fromInteger n->         mk_amp n = if even n then 0 else 1 / fromInteger n->         mk_param f0 n = let m = [1,3 .. n] in zip (map (mk_freq f0) m) (map mk_amp m)->         x = midiCPS (mouseX KR 20 72 Linear 0.2)->         y = mouseY KR 0.01 0.1 Exponential 0.2->         e = xLine KR 0.01 1 20 DoNothing->         o1 = sum (map (\(fr,am) -> sinOsc AR fr 0 * am) (mk_param x 50)) * (1 - e)->         o2 = lfPulse AR x 0 0.5 * e->     in mce2 o1 o2 * y--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (lfPulse AR (line KR 100 800 0.1 DoNothing) 0 0.5)--![](sw/hsc3/Help/SVG/lfPulse.0.svg)
− Help/UGen/lfSaw.help.lhs
@@ -1,44 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LFSaw"-    > Sound.SC3.UGen.DB.ugenSummary "LFSaw"--Note: SC2 did not have the initial phase argument.--> import Sound.SC3--> g_01 = lfSaw AR 500 1 * 0.1--Used as both Oscillator and LFO.--> g_02 = lfSaw AR (lfSaw KR 4 0 * 400 + 400) 0 * 0.1--Output range is bi-polar.--> g_03 =->     let f = mce [linLin (lfSaw KR 0.5 0) (-1) 1 200 1600, 200, 1600]->         a = mce [0.1,0.05,0.05]->     in mix (sinOsc AR f 0 * a)--saw-tooth wave as sum of sines.-for all partials n, amplitude is (1 / n).-phase is always 0.-cross-fade from sum to lfSaw.--> g_04 =->     let mk_freq f0 n = f0 * fromInteger n->         mk_amp n = 1 / fromInteger n->         mk_param f0 n = let m = [1,2 .. n] in zip (map (mk_freq f0) m) (map mk_amp m)->         x = midiCPS (mouseX KR 20 72 Linear 0.2)->         y = mouseY KR 0.01 0.1 Exponential 0.2->         e = xLine KR 0.01 1 20 DoNothing->         o1 = sum (map (\(fr,am) -> sinOsc AR fr 0 * am) (mk_param x 25)) * (1 - e)->         o2 = lfSaw AR x 0 * e->     in mce2 o1 o2 * y--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (lfSaw AR 50 0) -- ascending-    > plot_ugen1 0.002 (lfSaw AR 5000 0)--![](sw/hsc3/Help/SVG/lfSaw.0.svg)-![](sw/hsc3/Help/SVG/lfSaw.1.svg)
− Help/UGen/lfTri.help.lhs
@@ -1,32 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFTri"-    Sound.SC3.UGen.DB.ugenSummary "LFTri"--see <http://thread.gmane.org/gmane.comp.audio.supercollider.user/84719>--> import Sound.SC3 {- hsc3 -}->-> g_01 = lfTri AR 500 1 * 0.1--Used as both Oscillator and LFO.--> g_02 = lfTri AR (lfTri KR 4 0 * 400 + 400) 0 * 0.1--Multiple phases--> g_03 = let f = lfTri KR 0.4 (mce [0..3]) * 200 + 400->        in mix (lfTri AR f 0 * 0.1)->-> g_04 = let x = midiCPS (mouseX KR 20 72 Linear 0.2)->            e = xLine KR 0.01 1 20 DoNothing->            o1 = triAS 25 x * (1 - e)->            o2 = lfTri AR x 0 * e->        in mce2 o1 o2 * 0.1--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (lfTri AR 40 0)-    > plot_ugen1 0.1 (lfTri AR (xLine KR 1 800 0.1 DoNothing) 0)--![](sw/hsc3/Help/SVG/lfTri.0.svg)-![](sw/hsc3/Help/SVG/lfTri.1.svg)
− Help/UGen/lfdClipNoise.help.lhs
@@ -1,22 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LFDClipNoise"-> Sound.SC3.UGen.DB.ugenSummary "LFDClipNoise"--> import Sound.SC3--for fast x lfClipNoise frequently seems stuck, lfdClipNoise changes smoothly--> let {x = mouseX KR 0.1 1000 Exponential 0.2->     ;n = lfdClipNoise 'α' AR x}-> in audition (out 0 (sinOsc AR (n * 200 + 500) 0 * 0.05))--> let {x = mouseX KR 0.1 1000 Exponential 0.2->     ;n = lfClipNoise 'α' AR x}-> in audition (out 0 (sinOsc AR (n * 200 + 500) 0 * 0.05))--lfClipNoise quantizes time steps at high freqs, lfdClipNoise does not:--> let f = xLine KR 1000 20000 10 RemoveSynth-> in audition . (out 0) . (* 0.05) =<< lfdClipNoiseM AR f--> let f = xLine KR 1000 20000 10 RemoveSynth-> in audition . (out 0) . (* 0.05) =<< lfClipNoiseM AR f
− Help/UGen/lfdNoise0.help.lhs
@@ -1,33 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LFDNoise0"-    Sound.SC3.UGen.DB.ugenSummary "LFDNoise0"--> import Sound.SC3 {- hsc3 -}--for fast x LFNoise frequently seems stuck, LFDNoise changes smoothly--> g_01 = lfdNoise0 'a' AR (mouseX KR 0.1 1000 Exponential 0.2) * 0.1->-> g_02 = lfNoise0 'a' AR (mouseX KR 0.1 1000 Exponential 0.2) * 0.1--silent for 2 secs before going up in freq--> g_03 = lfdNoise0 'a' AR (xLine KR 0.5 10000 3 RemoveSynth)->-> g_04 = lfNoise0 'a' AR (xLine KR 0.5 10000 3 RemoveSynth)--LFNoise quantizes time steps at high freqs, LFDNoise does not:--> g_05 = lfdNoise0 'a' AR (xLine KR 1000 20000 10 RemoveSynth)->-> g_06 = lfNoise0 'a' AR (xLine KR 1000 20000 10 RemoveSynth)--Drawings--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (lfdNoise0 'γ' AR 1000)-    plot_ugen1 0.1 (lfdNoise1 'γ' AR 1000)-    plot_ugen1 0.1 (lfdNoise3 'γ' AR 1000)--![](sw/hsc3/Help/SVG/lfdNoise0.0.svg)-![](sw/hsc3/Help/SVG/lfdNoise0.1.svg)-![](sw/hsc3/Help/SVG/lfdNoise0.2.svg)
− Help/UGen/lfdNoise1.help.lhs
@@ -1,4 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LFDNoise1"-> Sound.SC3.UGen.DB.ugenSummary "LFDNoise1"--See lfdNoise0
− Help/UGen/lfdNoise3.help.lhs
@@ -1,13 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LFDNoise3"-    > Sound.SC3.UGen.DB.ugenSummary "LFDNoise3"--See lfdNoise0--Drawings--    > import Sound.SC3 {- hsc3 -}-    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (lfdNoise3 'α' AR (xLine AR 1000 100 0.1 DoNothing))--![](sw/hsc3/Help/SVG/lfdNoise3.0.svg)-
− Help/UGen/limiter.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Limiter"-> Sound.SC3.UGen.DB.ugenSummary "Limiter"--> import Sound.SC3--example signal-> let z = let i = impulse AR 8 0 * lfSaw KR 0.25 0 * (-0.6) + 0.7->         in decay2 i 0.001 0.3 * fSinOsc AR 500 0--unprocessed-> audition (out 0 z)--limited-> audition (out 0 (limiter z 0.4 0.01))
− Help/UGen/linCongC.help.lhs
@@ -1,18 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LinCongC"-> Sound.SC3.UGen.DB.ugenSummary "LinCongC"--> import Sound.SC3--Default SC3 initial parameters.--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (linCongC AR x 1.1 0.13 1 0 * 0.2))--Randomly modulate parameters.--> let {fr = [1,0.1,0.1,0.1]->     ;[n0,n1,n2,m] = map (\(i,j) -> lfNoise2 i KR j) (zip "abde" fr)->     ;f = n0 * 1e4 + 1e4->     ;a = n1 * 0.5 + 1.4->     ;c = n2 * 0.1 + 0.1}-> in audition (out 0 (linCongC AR f a c m 0 * 0.2))
− Help/UGen/linCongL.help.lhs
@@ -1,1 +0,0 @@-See linCongC
− Help/UGen/linCongN.help.lhs
@@ -1,1 +0,0 @@-See linCongC
− Help/UGen/linExp.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LinExp"-    > Sound.SC3.UGen.DB.ugenSummary "LinExp"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let f = linExp (mouseX KR 0 1 Linear 0.2) 0 1 440 660->     in sinOsc AR f 0 * 0.1--The destination range may be k-rate.--> g_02 =->     let x = mouseX KR 0 1 Linear 0.2->         y = mouseY KR 220 440 Linear 0.2->         f = linExp x 0 1 y 660->     in sinOsc AR f 0 * 0.1
− Help/UGen/linLin.help.lhs
@@ -1,27 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LinLin"-    Sound.SC3.UGen.DB.ugenSummary "LinLin"--> import Sound.SC3 {- hsc3 -}--linLin is a function for writing a MulAdd UGen.--> g_01 =->     let f = linLin (mouseX KR 0 1 Linear 0.2) 0 1 440 660->     in sinOsc AR f 0 * 0.1--The destination range may be k-rate.--> g_02 =->     let x = mouseX KR 0 1 Linear 0.2->         y = mouseY KR 220 440 Linear 0.2->         f = linLin x 0 1 y 660->     in sinOsc AR f 0 * 0.1--Modulating source and destination values.--> g_03 =->     let n = lfNoise2 'α' AR 80->         x = mouseX KR 200 8000 Linear 0.2->         y = mouseY KR 200 8000 Linear 0.2->         f = linLin n (sinOsc KR 0.2 0) (sinOsc KR 0.2543 0) x y->     in sinOsc AR f 0 * 0.1
− Help/UGen/linPan2.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LinPan2"-    > Sound.SC3.UGen.DB.ugenSummary "LinPan2"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = pinkNoise 'α' AR->     in linPan2 n (fSinOsc KR 2 0) 0.1->-> g_02 = linPan2 (fSinOsc AR 800 0) (fSinOsc KR 3 0) 0.1
− Help/UGen/linRand.help.lhs
@@ -1,8 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LinRand"-> Sound.SC3.UGen.DB.ugenSummary "LinRand"--> import Sound.SC3--> let {f = linRand 'α' 200.0 10000.0 (mce [-1, 1])->     ;e = line KR 0.4 0 0.01 RemoveSynth}-> in audition (out 0 (fSinOsc AR f 0 * e))
− Help/UGen/linXFade2.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LinXFade2"-    > Sound.SC3.UGen.DB.ugenSummary "LinXFade2"--> import Sound.SC3 {- hsc3 -}--> g_01 = linXFade2 (saw AR 440) (sinOsc AR 440 0) (lfTri KR 0.1 0) 0.1->-> gen_cmp ty = ty (fSinOsc AR 800 0 * 0.2)->                 (pinkNoise 'α' AR * 0.2)->                 (fSinOsc KR 0.5 0)->                 1.0->-> g_03 = gen_cmp linXFade2->-> g_04 = gen_cmp xFade2
− Help/UGen/line.help.lhs
@@ -1,16 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Line"-    Sound.SC3.UGen.DB.ugenSummary "Line"--Note: SC3 reorders the mul and add inputs to precede the doneAction input.--> import Sound.SC3 {- hsc3 -}->-> g_01 = let f = line KR 200 17000 5 RemoveSynth in sinOsc AR f 0 * 0.1--Demonstrate RemoveGroup done-action.--    > withSC3 (send (g_new [(10,AddToTail,1)]))--> g_02 =->    let f = line KR 200 (mce2 209 211) 5 RemoveGroup->    in audition_at (-1,AddToTail,10,[]) (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/linen.help.lhs
@@ -1,14 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Linen"-    Sound.SC3.UGen.DB.ugenSummary "Linen"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let e = linen (impulse KR 2 0) 0.01 0.6 0.4 DoNothing->     in e * sinOsc AR 440 0 * 0.1->-> g_02 =->     let x = mouseX KR (-1) 1 Linear 0.1->         y = mouseY KR 0.1 0.5 Linear 0.1->         e = linen x 1 y 1.0 DoNothing->     in sinOsc AR 440 0 * e
− Help/UGen/localBuf.help.lhs
@@ -1,79 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LocalBuf"-    Sound.SC3.UGen.DB.ugenSummary "LocalBuf"--> import Sound.SC3--Allocate a buffer local to the synthesis graph.--> g_01 =->     let n = whiteNoise 'α' AR->         b = localBuf 'β' 2048 1->         f = fft' b n->         c = pv_BrickWall f (sinOsc KR 0.1 0 * 0.75)->     in ifft' c * 0.1--Variant with two local buffers--> g_02 =->     let n = uclone 'α' 2 (whiteNoise 'β' AR)->         b = uclone 'γ' 2 (localBuf 'δ' 2048 1)->         f = fft' b n->         c = pv_BrickWall f (sinOsc KR (mce2 0.1 0.11) 0 * 0.75)->     in ifft' c * 0.1--Not clearing the buffer accesses old data, slowly overwrite data with noise--> g_03 =->     let b = localBuf 'α' 2048 2->         nf = bufFrames KR b->         x = mouseX KR 1 2 Linear 0.2->         r = playBuf 2 AR b x 1 0 Loop DoNothing * 0.1->         wr p i = bufWr b (linLin p (-1) 1 0 nf) Loop i->         n = uclone 'β' 2 (whiteNoise 'γ' AR)->         ph = lfNoise0 'δ' AR 530->     in mrg2 r (wr ph n)--bufCombC needs no clearing, because the delay line is filled by the ugen--> g_04 =->     let d = uclone 'α' 2 (dust 'β' AR 1)->         n = whiteNoise 'γ' AR->         z = decay d 0.3 * n->         l = xLine KR 0.0001 0.01 20 DoNothing->         sr = sampleRate->         b = uclone 'δ' 2 (localBuf 'ε' sr 2)->     in bufCombC b z l 0.2--asLocalBuf combines localBuf and setBuf--> g_05 =->     let b = asLocalBuf 'α' [2,1,5,3,4,0]->         x = mouseX KR 0 (bufFrames KR b) Linear 0.2->         f = indexL KR b x * 100 + 40->     in saw AR (f * mce2 1 1.1) * 0.1--detectIndex example using local buffer--> g_06 =->     let b = asLocalBuf 'α' [2,3,4,0,1,5]->         n = bufFrames KR b->         x = floorE (mouseX KR 0 n Linear 0.1)->         i = detectIndex b x->     in sinOsc AR (linExp i 0 n 200 700) 0 * 0.1--degreeToKey example ('modal space') using local buffer--> g_07 =->     let n = lfNoise1 'α' KR (mce [3,3.05])->         x = mouseX KR 0 15 Linear 0.1->         b = asLocalBuf 'β' [0,2,3.2,5,7,9,10]->         k = degreeToKey b x 12->         mk_c bf = let f0 = midiCPS (bf + k + n * 0.04)->                       o = sinOsc AR f0 0 * 0.1->                       f1 = midiCPS (mce [48,55])->                       t = lfPulse AR f1 0.15 0.5->                       f2 = midiCPS (sinOsc KR 0.1 0 * 10 + bf)->                       d = rlpf t f2 0.1 * 0.1->                       m = o + d->                   in combN m 0.31 0.31 2 + m->     in (mk_c 48 + mk_c 72) * 0.25
− Help/UGen/localIn.help.lhs
@@ -1,39 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LocalIn"-    > Sound.SC3.UGen.DB.ugenSummary "LocalIn"--> import Sound.SC3 {- hsc3 -}->-> noise_signal =->     let e = decay (impulse AR 0.3 0) 0.1->     in whiteNoise 'α' AR * e * 0.2->-> outside_world = soundIn 4->-> ping_pong z =->     let a1 = localIn 2 AR 0 + mce [z,0]->         a2 = delayN a1 0.2 0.2->         a3 = mceEdit reverse a2 * 0.8->     in mrg [z + a2,localOut a3]->-> g_01 = ping_pong noise_signal-> g_02 = ping_pong outside_world->-> rotate2_mce z p =->     case mceChannels z of->       [l,r] -> rotate2 l r p->       _ -> error "rotate2_mce"->-> tape_delay dt fb z =->     let a = amplitude KR (mix z) 0.01 0.01->         z' = z * (a >* 0.02)->         l0 = localIn 2 AR 0->         l1 = onePole l0 0.4->         l2 = onePole l1 (-0.08)->         l3 = rotate2_mce l2 0.2->         l4 = delayN l3 dt dt->         l5 = leakDC l4 0.995->         l6 = softClip ((l5 + z') * fb)->     in mrg2 (l6 * 0.1) (localOut l6)->-> g_03 = tape_delay 0.35 1.20 noise_signal-> g_04 = tape_delay 0.25 1.25 outside_world
− Help/UGen/localOut.help.lhs
@@ -1,25 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LocalOut"-    > Sound.SC3.UGen.DB.ugenSummary "LocalOut"--> import Sound.SC3 {- hsc3 -}--Resonator, must subtract blockSize for correct tuning--> g_01 =->     let p = localIn 1 AR 0->         i = impulse AR 1 0->         d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate)->     in mrg [offsetOut 0 p,localOut d]--Compare with oscillator.--> g_02 = sinOsc AR 440 0 * 0.2--ping pong--> g_03 =->     let n = decay (impulse AR 0.3 0) 0.1 * whiteNoise 'α' AR * 0.2->         l = localIn 2 AR 0 + mce2 n 0->         d = delayN l 0.2 0.2->         o = localOut (mceReverse d * 0.8)->     in mrg2 d o
− Help/UGen/logistic.help.lhs
@@ -1,15 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Logistic"-> Sound.SC3.UGen.DB.ugenSummary "Logistic"--> import Sound.SC3--SC3 default parameters-> audition (out 0 (logistic AR 3 1000 0.5))--Onset of chaos-> audition (out 0 (logistic AR (line KR 3.55 3.6 5 DoNothing) 1000 0.01))--Mouse control-> let {x = mouseX KR 3 3.99 Linear 0.1->     ;y = mouseY KR 10 10000 Exponential 0.1}-> in audition (out 0 (logistic AR x y 0.25 * 0.5))
− Help/UGen/loopBuf.help.lhs
@@ -1,55 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LoopBuf"-    Sound.SC3.UGen.DB.ugenSummary "LoopBuf"--> import Sound.SC3 {- hsc3 -}-> import qualified Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins as E {- hsc3 -}--Read audio file into memory--> ld b = do->   let fn = "/home/rohan/opt/src/supercollider/sounds/a11wlk01.wav"->   withSC3 (async (b_allocRead b fn 0 0))--Simple sampler instrument--> lb0 =->     let ou = control KR "out" 0->         bf = control KR "bufnum" 0->         rt = control KR "rate" 1->         gl = control KR "glide" 0->         gt = control KR "gate" 1->         lr = control KR "loopRel" 0->         sp = control KR "startPos" 0->         sl = control KR "startLoop" 0->         el = control KR "endLoop" 0->         ip = control KR "ipol" 2->         rt' = lag rt gl * bufRateScale KR bf->         e = let d = envADSR 0.1 0.2 1 2 1 (EnvNum (-4)) 0->             in envGen AR gt 1 0 1 RemoveSynth d->         s = E.loopBuf 1 AR bf rt' (gt + lr) sp sl el ip->     in out ou (s * e)--> lb0s :: Synthdef-> lb0s = synthdef "lb0" lb0--    ld 0-    withSC3 (async (d_recv lb0s))--    import Sound.OSC {- hosc -}-    let send = sendMessage-    withSC3 (send (s_new "lb0" 3000 AddToTail 1 [("bufnum",0),("startLoop",5000),("endLoop",15000)]))--    withSC3 (send (n_set1 3000 "rate" (-1))) -- backwards-    withSC3 (send (n_set1 3000 "rate" 1)) -- forwards-    withSC3 (send (n_set 3000 [("startLoop",11000),("endLoop",13000)])) -- change loop points-    withSC3 (send (n_set1 3000 "glide" 5)) -- 5 second glide-    withSC3 (send (n_set1 3000 "rate" 2)) -- up an octave-    withSC3 (send (n_set1 3000 "rate" (-1))) -- backwards-    withSC3 (send (n_set1 3000 "rate" 1)) -- back to normal-    withSC3 (send (n_set1 3000 "ipol" 1)) -- no interpolation-    withSC3 (send (n_set1 3000 "ipol" 2)) -- linear interpolation-    withSC3 (send (n_set1 3000 "ipol" 4)) -- cubic interpolation-    withSC3 (send (n_set1 3000 "gate" 0)) -- release gate to hear post-loop--    withSC3 (send (s_new "lb0" 3000 AddToTail 1 [("bufnum",0),("startLoop",5000),("endLoop",15000)]))-    withSC3 (send (n_set 3000 [("loopRel",1),("gate",0)])) -- release instrument without post-loop
− Help/UGen/lorenzL.help.lhs
@@ -1,31 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LorenzL"-    Sound.SC3.UGen.DB.ugenSummary "LorenzL"--> import Sound.SC3 {- hsc3 -}--Vary frequency--> g_01 =->     let x = mouseX KR 20 sampleRate Linear 0.1->     in lorenzL AR x 10 27 2.667 0.05 0.1 0 0 * 0.3--Randomly modulate params--> g_02 =->     let n e = lfNoise0 e KR 0.5->         n0 = mul_add (n 'α') 2 10->         n1 = mul_add (n 'β') 20 38->         n2 = mul_add (n 'γ') 1.5 2->     in lorenzL AR sampleRate n0 n1 n2 0.05 0.1 0 0 * 0.2--As frequency control--> g_03 =->     let x = mouseX KR 1 200 Linear 0.1->         n = lorenzL AR x 10 28 2.667 0.05 0.1 0 0->     in sinOsc AR (lag n 0.003 * 800 + 900) 0 * 0.4--> g_04 =->     let x = mouseX KR 1 200 Linear 0.1->         n = lorenzL AR x 10 28 2.667 0.05 0.1 0 0->     in impulse AR (n * 4 + 8) 0 * 0.4
− Help/UGen/loudness.help.lhs
@@ -1,15 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Loudness"-    Sound.SC3.UGen.DB.ugenSummary "Loudness"--> import Sound.SC3 {- hsc3 -}--Assume hop of half fftsize--    > withSC3 (async (b_alloc 10 1024 1))--> g_01 =->     let x = mouseX KR 0.001 0.1 Exponential 0.2->         i = sinOsc AR 1000 0 * x->         f = fft' 10 i->         l = loudness f 0.25 6->     in sinOsc AR (mce2 900 (l * 300 + 600)) 0 * 0.1
− Help/UGen/lpcSynth.help.lhs
@@ -1,29 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LPCSynth"-    Sound.SC3.UGen.DB.ugenSummary "LPCSynth"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.Data.LPC {- hsc3-data -}--> lpc_instr b n lpc =->     let x = mouseX KR 0.05 1.5 Linear 0.2->         y = mouseY KR 0.25 2.0 Linear 0.2->         f = x / constant (lpcAnalysisDuration (lpcHeader lpc))->         ptr = lfSaw AR f 1 * 0.5 + 0.5->         [cps, rms, err] = mceChannels (lpcVals AR b ptr)->         nh = floorE (22000 / cps)->         voc = blip AR (cps * y) nh * (1 - err)->         s = lpcSynth b (voc + (n * err * 20)) ptr->     in s * 1e-5 * rms--> fn_01 = "/home/rohan/cvs/tn/tn-56/lpc/fate.lpc"--> au_01 lpc = do->   let d = map realToFrac (lpcSC3 lpc)->   _ <- async (b_alloc 10 (length d) 1)->   mapM_ send (b_setn1_segmented 512 10 0 d)->   let s = lpc_instr 10 (pinkNoise 'α' AR) lpc->   play (out 0 s)--    lpc <- lpcRead fn_01-    withSC3 (au_01 lpc)
− Help/UGen/lpcVals.help.lhs
@@ -1,1 +0,0 @@-See lpcSynth
− Help/UGen/lpf.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "LPF"-    > Sound.SC3.UGen.DB.ugenSummary "LPF"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = xLine KR 0.7 300 20 RemoveSynth->         ff = fSinOsc KR f 0 * 3600 + 4000->     in lpf (saw AR 200 * 0.1) ff--Control rate filtering.--> g_02 =->     let ctl = lpf (lfPulse KR 8 0 0.5) (mouseX KR 2 50 Exponential 0.1)->     in sinOsc AR (ctl * 200 + 400) 0 * 0.1
− Help/UGen/lpz1.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LPZ1"-> Sound.SC3.UGen.DB.ugenSummary "LPZ1"--> import Sound.SC3--> let n = whiteNoise 'α' AR * 0.1-> in audition (out 0 (mce2 n (lpz1 n)))
− Help/UGen/lpz2.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "LPZ2"-> Sound.SC3.UGen.DB.ugenSummary "LPZ2"--> import Sound.SC3--> let n = whiteNoise 'α' AR-> in audition (out 0 (lpz2 (n * 0.25)))
− Help/UGen/lti.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "LTI"-    Sound.SC3.UGen.DB.ugenSummary "LTI"--> import Sound.SC3 {- hsc3 -}->-> gr_01 =->     let a = [0.02,-0.01]->         b = [1,0.7,0,0,0,0,-0.8,0,0,0,0,0.9,0,0,0,-0.5,0,0,0,0,0,0,0.25,0.1,0.25]->         z = pinkNoise 'α' AR * 0.1 {- soundIn 4 -}->     in lti AR z (asLocalBuf 'β' a) (asLocalBuf 'γ' b)
− Help/UGen/mantissaMask.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "MantissaMask"-> Sound.SC3.UGen.DB.ugenSummary "MantissaMask"--> import Sound.SC3--> let s = sinOsc AR (sinOsc KR 0.2 0 * 400 + 500) 0 * 0.4-> in audition (out 0 (mantissaMask s 3))
− Help/UGen/max.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.max"-    > :t max--> import Sound.SC3 {- hsc3 -}--q modulates and envelopes p--> g_01 =->     let p = fSinOsc AR 500 0 * 0.25->         q = fSinOsc AR 0.5 0->     in p `max` q
− Help/UGen/median.help.lhs
@@ -1,26 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Median"-> Sound.SC3.UGen.DB.ugenSummary "Median"--> import Sound.SC3--Signal with impulse noise.--> let n = dust2 'α' AR 100-> in audition (out 0 (median 3 (saw AR 500 * 0.1 + n * 0.9)))--The median length can be increased for longer duration noise.--> let n = dust2 'α' AR 100-> in audition (out 0 (median 5 (saw AR 500 * 0.1 + lpz1 (n * 0.9))))--Long Median filters begin chopping off the peaks of the waveform--> let x = sinOsc AR 1000 0 * 0.2-> in audition (out 0 (mce [x, median 31 x]))--Another noise reduction application. Use Median filter for high-frequency noise.  Use LeakDC for low frequency noise.--> let {n = whiteNoise 'α' AR->     ;s = median 31 (n * 0.1 + sinOsc AR 800 0 * 0.1)}-> in audition (out 0 (leakDC s 0.9))
− Help/UGen/membraneCircle.help.lhs
@@ -1,20 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "MembraneCircle"-> Sound.SC3.UGen.DB.ugenSummary "MembraneCircle"--> import Sound.SC3--Excite the mesh with some pink noise, triggered by an-impulse generator.  mouseX is tension and impulse frequency,-mouseY is duration of excitation, release-time and amplitude.--> let {x = mouseX KR 0 1 Linear 0.2->     ;y = mouseY KR 1e-9 1 Exponential 0.2->     ;loss = linLin y 0 1 0.999999 0.999->     ;wobble = sinOsc KR 2 0->     ;tension = linLin x 0 1 0.01 0.1 + (wobble * 0.0001)->     ;p = envPerc 0.0001 y->     ;tr = impulse KR (linLin x 0 1 3 9) 0->     ;e = envGen KR tr (linLin y 0 1 0.05 0.25) 0 0.1 DoNothing p->     ;m = membraneCircle->     ;n = pinkNoise 'α' AR}-> in audition (out (mce2 0 1) (m (n * e) tension loss))
− Help/UGen/membraneHexagon.help.lhs
@@ -1,1 +0,0 @@-See membraneCircle
− Help/UGen/metro.help.lhs
@@ -1,16 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Metro"-> Sound.SC3.UGen.DB.ugenSummary "Metro"--> import Sound.SC3--> audition (out 0 (metro AR 60 1))--> let {b = xLine KR 60 120 5 DoNothing->     ;m = metro KR b 1->     ;o = sinOsc AR 440 0 * 0.1}-> in audition (out 0 (decay m 0.2 * o))--> let {b = range 30 240 (lfNoise2 'α' KR 0.2)->     ;n = dseq 'β' dinf (mce [1,0.25,0.5,0.25])->     ;a = decay (metro KR b n) 0.2 * sinOsc AR 440 0 * 0.1}-> in audition (out 0 a)
− Help/UGen/midEQ.help.lhs
@@ -1,13 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "MidEQ"-    Sound.SC3.UGen.DB.ugenSummary "MidEQ"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = midiCPS (fSinOsc KR 1 0 * 24 + 84)->     in midEQ (saw AR 200 * 0.2) f 0.3 12--> g_02 =->     let i = pinkNoise 'α' AR * 0.2 + sinOsc AR 600 0 * 0.1->         f = sinOsc KR 0.2 (0.5 * pi) * 2 + 600->     in midEQ i f 0.01 (-24)
− Help/UGen/mod.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.%"-    > :t modE--> import Sound.SC3 {- hsc3 -}->-> g_01 = fSinOsc AR 100 4 `modE` 1 * 0.1
− Help/UGen/moogFF.help.lhs
@@ -1,26 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "MoogFF"-    Sound.SC3.UGen.DB.ugenSummary "MoogFF"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let n = whiteNoise 'α' AR->         y = mouseY KR 100 10000 Exponential 0.1->         x = mouseX KR 0 4 Linear 0.1->     in moogFF (n * 0.1) y x 0--Note distortion at high gain.--> g_02 =->     let x = mouseX KR 100 20000 Exponential 0.1->         y = mouseY KR 0.1 4.0 Linear 0.1->         i = mix (saw AR (mce [0.99, 1, 1.01] * 440)) * 0.3->     in moogFF i x y 0--> g_03 =->     let n = lfNoise0 'α' KR 0.43->         p = pulse AR (mce [40, 121]) (mce [0.3, 0.7])->         f0 = linLin n 0 1 0.001 2.2->         f = linLin (sinOsc KR f0 0) (-1) 1 30 4200->         y = mouseY KR 1 4 Linear 0.1->     in moogFF p f (0.83 * y) 0
− Help/UGen/mostChange.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "MostChange"-    > Sound.SC3.UGen.DB.ugenSummary "MostChange"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = lfNoise0 'α' KR 1->         x = mouseX KR 200 300 Linear 0.1->         f = mostChange (n * 400 + 900) x->     in sinOsc AR f 0 * 0.1
− Help/UGen/mouseButton.help.lhs
@@ -1,12 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "MouseButton"-    > Sound.SC3.UGen.DB.ugenSummary "MouseButton"--> import Sound.SC3 {- hsc3 -}--As amplitude envelope--> g_01 = sinOsc AR 800 0 * mouseButton KR 0 0.1 0.1--There is a variant that randomly presses the button.--> g_02 = sinOsc AR 800 0 * mouseButton' KR 0 0.1 0.1
− Help/UGen/mouseX.help.lhs
@@ -1,20 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "MouseX"-    Sound.SC3.UGen.DB.ugenSummary "MouseX"--> import Sound.SC3--> e_01 = map from_warp [Linear,Exponential]--    e_01 == [0,1]--Frequency control--> g_01 =->     let x = mouseX KR 40 10000 Exponential 0.2->     in sinOsc AR x 0 * 0.1--There is a variant with equal arguments but random traversal.--> g_02 =->     let x = mouseX' KR 40 10000 Exponential 0.2->     in sinOsc AR x 0 * 0.1
− Help/UGen/mouseY.help.lhs
@@ -1,18 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "MouseY"-    > Sound.SC3.UGen.DB.ugenSummary "MouseY"--> import Sound.SC3 {- hsc3 -}--Frequency at X axis and amplitude at Y axis.--> g_01 =->     let freq = mouseX KR 20 2000 Exponential 0.1->         ampl = mouseY KR 0.01 0.1 Linear 0.1->     in sinOsc AR freq 0 * ampl--There is a variant with equal arguments but a random traversal.--> g_02 =->     let freq = mouseX' KR 20 2000 Exponential 0.1->         ampl = mouseY' KR 0.01 0.1 Linear 0.1->     in sinOsc AR freq 0 * ampl
− Help/UGen/mrg2.help.lhs
@@ -1,24 +0,0 @@-> :t mrg2--> import Sound.SC3--mrg2 defines a node indicating a multiple root graph.-> let {l = out 0 (sinOsc AR 300 0 * 0.1)->     ;r = out 1 (sinOsc AR 900 0 * 0.1)}-> in audition (mrg2 l r)--there is a leftmost rule, so that mrg nodes need not-be terminal.-> let {l = sinOsc AR 300 0 * 0.1->     ;r = out 1 (sinOsc AR 900 0 * 0.1)}-> in audition (out 0 (mrg2 l r))--the leftmost node may be an mce node-> let {l = sinOsc AR (mce2 300 400) 0 * 0.1->     ;r = out 1 (sinOsc AR 900 0 * 0.1)}-> in audition (out 0 (mrg2 l r))--the implementation is not thorough-> let {l = sinOsc AR (mce2 300 400) 0 * 0.1->     ;r = out 1 (sinOsc AR 900 0 * 0.1)}-> in audition (out 0 (mrg2 l r + mrg2 l r))
− Help/UGen/mul.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.*"-    > :t (*)--> import Sound.SC3 {- hsc3 -}->-> g_01 = sinOsc AR 440 0 * 0.15--Creates a beating effect (subaudio rate).--> g_02 = fSinOsc KR 10 0 * pinkNoise 'α' AR * 0.5--Ring modulation.--> g_03 =->     let p = sinOsc AR (xLine KR 100 1001 10 DoNothing) 0->         q = syncSaw AR 100 200->     in p * q * 0.25
− Help/UGen/mzPokey.help.lhs
@@ -1,31 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "MZPokey"-> Sound.SC3.UGen.DB.ugenSummary "MZPokey"--> import Sound.SC3-> import qualified Sound.SC3.Lang.Math as M--> let b = fromIntegral . M.parseBits :: (String -> UGen)-> let bln = line KR 0 255 5 RemoveSynth-> let mz1 i j = mzPokey i j 0 0 0 0 0 0 0-> let mz1c i j c = mzPokey i j 0 0 0 0 0 0 c--> audition (out 0 (mz1 bln (b "00001111")))-> audition (out 0 (mz1 bln (b "00101111")))-> audition (out 0 (mz1 bln (b "10101111")))-> audition (out 0 (mz1c bln (b "10101111") (b "00000001")))-> audition (out 0 (mz1c bln (b "10101111") (b "01000001")))--> let mz2c i j p q c = mzPokey i j p q 0 0 0 0 c-> let bX = mouseX KR 0 255 Linear 0.1-> let bY = mouseY KR 0 255 Linear 0.1--> audition (out 0 (mz2c bX (b "10101010") bY (b "10101010") (b "00000001")))--> let mz4pc (f1,c1) (f2,c2) (f3,c3) (f4,c4) c = mzPokey f1 c1 f2 c2 f3 c3 f4 c4 c--> let { v1 = (bX,b "11000111")->     ; v2 = (bY,b "11100111")->     ; v3 = (sinOsc KR 0.4 0 * 127.5 + 127.5,b "11000111")->     ; v4 = (sinOsc KR 0.5 0 * 127.5 + 127.5,b "01000111")->     ; m = mz4pc v1 v2 v3 v4 (b "00000000") }-> in audition (out 0 (mce2 m m))
− Help/UGen/nRand.help.lhs
@@ -1,8 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "NRand"-> Sound.SC3.UGen.DB.ugenSummary "NRand"--> import Sound.SC3--> let {n = nRand 'α' 1200.0 4000.0 (mce [2,5])->     ;e = line KR 0.2 0 0.1 RemoveSynth}-> in audition (out 0 (fSinOsc AR n 0 * e))
− Help/UGen/normalizer.help.lhs
@@ -1,9 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Normalizer"-> Sound.SC3.UGen.DB.ugenSummary "Normalizer"--> import Sound.SC3--> let {s = fSinOsc AR 500 0->     ;t = impulse AR 8 (lfSaw KR 0.25 (-0.6) * 0.7)->     ;z = decay2 t 0.001 0.3 * s}-> in audition (out 0 (mce [z, normalizer z 0.4 0.01]))
− Help/UGen/numAudioBuses.help.lhs
@@ -1,3 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "NumAudioBuses"-    > Sound.SC3.UGen.DB.ugenSummary "NumAudioBuses"-
− Help/UGen/numBuffers.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "NumBuffers"-    > Sound.SC3.UGen.DB.ugenSummary "NumBuffers"--> import Sound.SC3 {- hsc3 -}--the number of audio buffers available at the server (by default 1024)--> g_01 = poll (impulse KR 1 0) numBuffers (label "numBuffers") 0->-> g_02 = let f = 110 + numBuffers in sinOsc AR f 0 * 0.1
− Help/UGen/numControlBuses.help.lhs
@@ -1,2 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "NumControlBuses"-    > Sound.SC3.UGen.DB.ugenSummary "NumControlBuses"
− Help/UGen/numInputBuses.help.lhs
@@ -1,2 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "NumInputBuses"-    > Sound.SC3.UGen.DB.ugenSummary "NumInputBuses"
− Help/UGen/numOutputBuses.help.lhs
@@ -1,2 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "NumOutputBuses"-    > Sound.SC3.UGen.DB.ugenSummary "NumOutputBuses"
− Help/UGen/numRunningSynths.help.lhs
@@ -1,8 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "NumRunningSynths"-    > Sound.SC3.UGen.DB.ugenSummary "NumRunningSynths"--> import Sound.SC3 {- hsc3 -}--each concurrent audition increases oscillator frequency--> g_01 = sinOsc AR (numRunningSynths * 200 + 400) 0 * 0.1
− Help/UGen/offsetOut.help.lhs
@@ -1,69 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "OffsetOut"-    > Sound.SC3.UGen.DB.ugenSummary "OffsetOut"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = offsetOut 0 (impulse AR 5 0)->         b = out 0 (sinOsc AR 60 0 * 0.1)->     in mrg [a,b]->-> g_02 =->     let a = out 0 (impulse AR 5 0)->         b = out 0 (sinOsc AR 60 0 * 0.1)->     in mrg [a,b]--Phase cancellation, the `offsetOut` at bus 0 should cancel, the `out` at-bus 1 doesn't (or at least is exceedingly unlikely to).--> sy_01 sr =->     let f = sr / 100->         o = sinOsc AR (constant f) 0 * 0.2->     in synthdef "sy_01" (mrg [offsetOut 0 o,out 1 o])->-> bnd_01 sr t =->     let latency = 0.2->         c = 100 / sr {- recip f -}->         m = s_new "sy_01" (-1) AddToHead 1 []->         p = bundle (t + latency) [m]->         q = bundle (t + latency + c/2) [m]->     in [p,q]->-> proc_01 :: Transport m => m ()-> proc_01 = do->   sr <- serverSampleRateActual->   _ <- async (d_recv (sy_01 sr))->   t <- time->   mapM_ sendBundle (bnd_01 sr t)--    > withSC3 proc_01--The cancellation isn't completely reliable though.  In supercollider language it seems-to be better, though these _should_ be equivalent...--    Routine(-    {var sr = s.actualSampleRate-    ;var f = sr / 100-    ;var c = 1 / f-    ;var g = {var o = SinOsc.ar(f,0) * 0.2; OffsetOut.ar(0,o); Out.ar(1,o)}-    ;var sy = SynthDef("g",g)-    ;var m = ["/s_new", "g", -1, 0, 1]-    ;var latency = 0.2-    ;sy.send(s)-    ;s.sync-    ;s.sendBundle(latency,m)-    ;s.sendBundle(latency + (c/2),m)}).play--To see/hear scheduler clock and sample clock drift:--    Routine(-    {var g = {OffsetOut.ar(0,Saw.ar(400) * EnvGen.kr(Env.perc, doneAction: 2) * 0.2)}-    ;var h = {OffsetOut.ar(1,Saw.ar(800) * Decay2.ar(Impulse.ar(1)) * 0.2)}-    ;var t_delay = 0.25-    ;SynthDef("g",g).send(s)-    ;SynthDef("h",h).send(s)-    ;s.sync-    ;s.sendBundle(t_delay,["/s_new", "h", -1, 0, 1])-    ;inf.do({s.sendBundle(t_delay,["/s_new", "g", -1, 0, 1]); 1.0.wait})}).play-
− Help/UGen/onePole.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "OnePole"-> Sound.SC3.UGen.DB.ugenSummary "OnePole"--> import Sound.SC3--> let n = whiteNoise 'α' AR-> in audition (out 0 (onePole (n * 0.5) 0.95))--> let n = whiteNoise 'α' AR-> in audition (out 0 (onePole (n * 0.5) (-0.95)))--> let {n = whiteNoise 'α' AR->     ;c = line KR (-0.99) 0.99 10 RemoveSynth}-> in audition (out 0 (onePole (n * 0.5) c))
− Help/UGen/oneZero.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "OneZero"-> Sound.SC3.UGen.DB.ugenSummary "OneZero"--> import Sound.SC3--> let n = whiteNoise 'α' AR-> in audition (out 0 (oneZero (n * 0.5) 0.5))--> let n = whiteNoise 'α' AR-> in audition (out 0 (oneZero (n * 0.5) (-0.5)))--> let {n = whiteNoise 'α' AR->     ;c = line KR (-0.5) 0.5 10 RemoveSynth}-> in audition (out 0 (oneZero (n * 0.5) c))
− Help/UGen/onsets.help.lhs
@@ -1,43 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Onsets"-    > Sound.SC3.UGen.DB.ugenSummary "Onsets"--> import Sound.SC3 {- hsc3 -}--    > withSC3 (async (b_alloc 10 512 1))--> f_01 t = t2A t 0--> f_02 t =->     let s = sinOsc AR 440 0 * 0.2->         e = envGen KR t 1 0 1 DoNothing (envPerc 0.001 0.1)->     in s * e--> f_03 f =->     let x = mouseX KR 0 1 Linear 0.2->         i = mix (soundIn (mce2 0 1))->         c = fft' 10 i->         o = onsets' c x (onsetType "rcomplex")->     in f o--> g_01 = f_03 f_01--> g_02 = mce2 (dc AR 0) (mix (soundIn (mce2 0 1) * 0.75))--a generative signal with distinct onsets!--> g_03 =->     let e = linLin (saw AR 2) (-1) 1 0 1->         p = let f = midiCPS (tIRand 'α' 63 75 (impulse KR 2 0))->             in pulse AR f 0.5->         f = linExp (lfNoise2 'β' KR 0.5) (-1) 1 100 10000->     in lpf p f * e--x varies threshold, whitenoise bursts indicate detected onsets--> g_04 =->     let c = fft' 10 g_03->         x = mouseX KR 0 1 Linear 0.2->         o = onsets' c x (onsetType "rcomplex")->         p = let d = envPerc 0.001 0.1->             in whiteNoise 'α' AR * envGen KR o 0.2 0 1 DoNothing d->     in pan2 g_03 (-0.75) 0.2 + pan2 p 0.75 1
− Help/UGen/osc.help.lhs
@@ -1,48 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Osc"-    > Sound.SC3.UGen.DB.ugenSummary "Osc"--> import Sound.SC3 {- hsc3 -}--Allocate and generate wavetable buffer--    > withSC3 (do {_ <- async (b_alloc 10 512 1)-    >             ;let f = [Normalise,Wavetable,Clear]-    >              in send (b_gen_sine1 10 f [1,1/2,1/3,1/4,1/5])})--Fixed frequency wavetable oscillator--> g_01 = osc AR 10 220 0 * 0.1--Modulate frequency--> g_02 =->     let f = xLine KR 2000 200 1 DoNothing->     in osc AR 10 f 0 * 0.1--As frequency modulator--> g_03 =->     let f = osc AR 10 (xLine KR 1 1000 9 RemoveSynth) 0 * 200 + 800->     in osc AR 10 f 0 * 0.1--As phase modulatulator--> g_04 =->     let p = osc AR 10 (xLine KR 20 8000 10 RemoveSynth) 0 * 2 * pi->     in osc AR 10 800 p * 0.1--Fixed frequency wavetable oscillator--> g_05 = osc AR 10 220 0 * 0.1--Change the wavetable while its playing--    > let f = [Normalise,Wavetable,Clear]-    > in withSC3 (send (b_gen_sine1 10 f [1,0.6,1/4]))--Send directly calculated wavetable--    > import Sound.SC3.Common.Buffer {- hsc3 -}-    > import Sound.SC3.Common.Math.Window {- hsc3 -}-    > let t = to_wavetable (triangular_table 512)-    > withSC3 (send (b_setn1 10 0 t))
− Help/UGen/osc1.help.lhs
@@ -1,9 +0,0 @@-> import Sound.SC3--> withSC3 (let {z = [Normalise,Wavetable,Clear]->              ;a = [[13,8,55,34,5,21,3,1,2],[55,34,1,3,2,13,5,8,21]]->              ;f (b,l) = do {_ <- async (b_alloc b 512 1)->                            ;send (b_gen_sine1 b z (map recip l))}}->          in mapM_ f (zip [10,11] a))--> audition (out 0 (lfSaw AR (mce2 110 164) 0 * 0.1 * osc1 AR (mce2 10 11) 4 RemoveSynth))
− Help/UGen/oscN.help.lhs
@@ -1,4 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "OscN"-> Sound.SC3.UGen.DB.ugenSummary "OscN"--See osc
− Help/UGen/out.help.lhs
@@ -1,13 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Out"-    > Sound.SC3.UGen.DB.ugenSummary "Out"--> import Sound.SC3 {- hsc3 -}--Oscillators at outputs zero (330) and one (331)--> g_01 = out 0 (sinOsc AR (mce2 330 331) 0 * 0.1)--`out` is summing, as opposed to `replaceOut`--> g_02 = mrg [out 0 (sinOsc AR (mce2 330 990) 0 * 0.1)->            ,out 0 (sinOsc AR (mce2 331 991) 0 * 0.1)]
− Help/UGen/packFFT.help.lhs
@@ -1,22 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PackFFT"-> Sound.SC3.UGen.DB.ugenSummary "PackFFT"--> import Sound.SC3--> withSC3 (async (b_alloc 10 512 1))--> let {n = 100->     ;square a = a * a->     ;r1 = let f = expRand 'α' 0.1 1->           in linLin (fSinOsc KR f 0) (-1) 1 0 1->     ;m1 = uclone' 'β' n r1->     ;m2 = zipWith (*) m1 (map square [1.0, 0.99 ..])->     ;r2 = let r = iRand 'γ' (-3) 5->           in lfPulse KR (2 ** r) 0 0.3->     ;i = uclone' 'δ' n r2->     ;m3 = zipWith (*) m2 i->     ;p = replicate n 0.0->     ;c1 = fft' 10 (fSinOsc AR 440 0)->     ;c2 = packFFT c1 512 0 (constant n - 1) 1 (packFFTSpec m3 p)->     ;s = ifft' c2}-> in audition (out 0 (mce [s,s]))
− Help/UGen/pan2.help.lhs
@@ -1,14 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Pan2"-    > Sound.SC3.UGen.DB.ugenSummary "Pan2"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = pinkNoise 'α' AR->     in pan2 n (fSinOsc KR 2 0) 0.3->-> g_02 =->     let n = pinkNoise 'α' AR->         x = mouseX KR (-1) 1 Linear 0.2->         y = mouseY KR 0 1 Linear 0.2->     in pan2 n x y
− Help/UGen/panAz.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PanAz"-    > Sound.SC3.UGen.DB.ugenSummary "PanAz"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = pinkNoise 'α' AR->         nc = 4->         fr = 0.15->     in panAz nc o (lfSaw KR fr 0) 0.1 2 0.5
− Help/UGen/partConv.help.lhs
@@ -1,23 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PartConv"-> Sound.SC3.UGen.DB.ugenSummary "PartConv"--> import Sound.SC3--> let { fft_size = 2048->     ; ir_file = "/home/rohan/data/audio/reverbs/chapel.wav"->     ; ir_length = 62494 {- frame count of ir_file -}->     ; accum_size = pc_calcAccumSize fft_size ir_length->     ; ir_td_b = 10 {- time domain -}->     ; ir_fd_b = 11 {- frequency domain -}->     ; target_b = 12 {- source signal -}->     ; target_file = "/home/rohan/data/audio/pf-c5.snd"->     ; c = constant->     ; g = let { i = playBuf 1 AR (c target_b) 1 0 0 Loop DoNothing->               ; pc = partConv i (c fft_size) (c ir_fd_b) }->           in out 0 (pc * 0.1) }-> in withSC3 (do->     {_ <- async (b_allocRead ir_td_b ir_file 0 ir_length)->     ;_ <- async (b_alloc ir_fd_b accum_size 1)->     ;send (pc_preparePartConv ir_fd_b ir_td_b fft_size)->     ;_ <- async (b_allocRead target_b target_file 0 0)->     ;play g })
− Help/UGen/pause.help.lhs
@@ -1,20 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Pause"-    > Sound.SC3.UGen.DB.ugenSummary "Pause"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let f = control KR "f" 440->         g = control KR "g" 1->     in mrg [sinOsc AR f 0 * 0.1,pause g 1001]--    > audition_at (1001,AddToTail,1,[]) g_01-    > audition_at (1002,AddToTail,1,[("f",880)]) g_01--Request that node 1002 pause node 1001.--    > withSC3 (send (n_set 1002 [("g",0)]))--Restart node 1001.--    > withSC3 (send (n_set 1002 [("g",1)]))
− Help/UGen/pauseSelf.help.lhs
@@ -1,13 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PauseSelf"-    > Sound.SC3.UGen.DB.ugenSummary "PauseSelf"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR (-1) 1 Linear 0.1->         o = sinOsc AR 440 0 * 0.1->     in mrg [o,pauseSelf x]--Run paused node (assuming no intermediate node is created).--    > withSC3 (send (n_run [(-1, True)]))
− Help/UGen/pauseSelfWhenDone.help.lhs
@@ -1,23 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PauseSelfWhenDone"-    > Sound.SC3.UGen.DB.ugenSummary "PauseSelfWhenDone"--> import Sound.SC3 {- hsc3 -}--using PauseSynth done action--> g_01 =->     let x = mouseX KR (-1) 1 Linear 0.1->         e = linen x 1 0.1 1 PauseSynth->     in sinOsc AR 440 0 * e--Run paused node (assuming no intermediate node is created).--    > withSC3 (send (n_run [(-1, True)]))--> g_02 =->     let x = mouseX KR (-1) 1 Linear 0.1->         e = linen x 1 0.1 1 DoNothing->         o = sinOsc AR 440 0 * e->     in mrg [o,pauseSelfWhenDone e]--    > withSC3 (send (n_run [(-1, True)]))
− Help/UGen/peak.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Peak"-    > Sound.SC3.UGen.DB.ugenSummary "Peak"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let t = dust 'α' AR 20->         r = impulse AR 0.4 0->         f = peak t r * 500 + 200->     in sinOsc AR f 0 * 0.2
− Help/UGen/phasor.help.lhs
@@ -1,54 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Phasor"-    Sound.SC3.UGen.DB.ugenSummary "Phasor"--> import Prelude hiding ((<*))-> import Sound.SC3--phasor controls sine frequency, end frequency matches second sine.--> g_01 =->     let rate = mouseX KR 0.2 2 Exponential 0.1->         tr = impulse AR rate 0->         sr = sampleRate->         x = phasor AR tr (rate / sr) 0 1 0->         f = mce [linLin x 0 1 600 1000, 1000]->     in sinOsc AR f 0 * 0.2--Load sound file to buffer zero--    let fn = "/home/rohan/data/audio/pf-c5.aif"-    withSC3 (async (b_allocRead 0 fn 0 0))--Phasor as phase input to bufRd--> g_02 =->      let ph = phasor AR 0 (bufRateScale KR 0) 0 (bufFrames KR 0) 0->      in bufRdN 1 AR 0 ph Loop--Allocate and generate (non-wavetable) buffer at index one-(see osc for wavetable oscillator)--    withSC3 (async (b_alloc 1 256 1) >> send (b_gen_sine1 1 [Normalise,Clear] [1]))--Audio rate phasor oscillator as phase input to bufRd--> g_03 =->     let b = 1->         f = 440->         fr = bufFrames KR b->         rt = f * (fr / sampleRate)->         ph = phasor AR b (rt * bufRateScale KR b) 0 fr 0->     in bufRdL 1 AR b ph Loop * 0.1--Phasor as impulse with reset--> g_04 =->     let impulse_reset freq reset =->             let ph = phasor AR reset (freq / sampleRate) 0 1 0->             in hpz1 ph <* 0->         x = mouseX KR 0 1 Linear 0.2 >* 0.5->         ck = impulse AR 3 0->         im = impulse_reset 3 x->         x' = sinOsc AR 440 0 * x * 0.05->         im' = sinOsc AR 220 0 * decay2 (ck + im) 0.01 0.5 * 0.1->     in mce2 x' im'
− Help/UGen/pinkNoise.help.lhs
@@ -1,29 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PinkNoise"-    > Sound.SC3.UGen.DB.ugenSummary "PinkNoise"--> import Sound.SC3 {- hsc3 -}--    audition . (out 0) . (* 0.05) =<< pinkNoiseM AR-    audition . (out 0) . (* 0.05) =<< whiteNoiseM AR-    audition . (out 0) . (* 0.05) =<< brownNoiseM AR--speaker balance--> g_01 = let n = pinkNoise 'α' AR * 0.05 in mce2 n n->-> g_02 =->     let x = mouseX KR 0 1 Linear 0.2->         x' = 1 - x->         n = pinkNoise 'α' AR * 0.05->     in mce2 (n * x') (n * x)--Drawing--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.1 (pinkNoise 'α' AR)--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.1 (pinkNoise 'α' AR)--![](sw/hsc3/Help/SVG/pinkNoise.0.svg)-![](sw/hsc3/Help/SVG/pinkNoise.1.svg)
− Help/UGen/pitch.help.lhs
@@ -1,31 +0,0 @@-     Sound.SC3.UGen.Help.viewSC3Help "Pitch"-     Sound.SC3.UGen.DB.ugenSummary "Pitch"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR 220 660 Linear 0.1->         y = mouseY KR 0.05 0.25 Linear 0.1->         s = sinOsc AR x 0 * y->         a = amplitude KR s 0.05 0.05->         f = pitch s 440 60 4000 100 16 7 0.02 0.5 1 0->     in mce [s, sinOsc AR (mceChannel 0 f / 2) 0 * a]--> g_02 =->     let s = soundIn 4->         a = amplitude KR s 0.1 0.1->         f = pitch s 440 60 4000 100 16 7 0.02 0.5 1 0->     in mce [s, sinOsc AR (mceChannel 0 f) 0 * a]--Comparison of input frequency (x) and tracked oscillator frequency (f).-Output is printed to the console by scsynth.--> g_03 =->     let x = mouseX KR 440 880 Exponential 0.1->         o = sinOsc AR x 0 * 0.1->         [f,_] = mceChannels (pitch o 440 60 4000 100 16 7 0.02 0.5 1 0)->         r = sinOsc AR f 0 * 0.1->         t = impulse KR 4 0->         pf = poll t f (label "f") 0->         px = poll t x (label "x") 0->     in mce [out 0 (mce2 o r),pf,px]
− Help/UGen/pitchShift.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PitchShift"-    > Sound.SC3.UGen.DB.ugenSummary "PitchShift"--> import Sound.SC3 {- hsc3 -}--> gr_01 =->     let s = sinOsc AR 440 0 * 0.1->         r = mouseX KR 0.5 2.0 Linear 0.1->         d = mouseY KR 0.0 0.1 Linear 0.1->     in pitchShift s 0.2 r d 0--> gr_02 =->     let s = soundIn 0->         pd = mouseX KR 0.0 0.1 Linear 0.1->         td = mouseY KR 0.0 0.1 Linear 0.1->     in pitchShift s 0.2 (mce2 1.0 1.5) pd td
− Help/UGen/playBuf.help.lhs
@@ -1,86 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PlayBuf"-    > Sound.SC3.UGen.DB.ugenSummary "PlayBuf"--> import Sound.SC3 {- hsc3 -}--Load sound file to buffer zero (single channel file required for examples)--> fn = "/home/rohan/data/audio/pf-c5.aif"--    withSC3 (async (b_allocRead 0 fn 0 0))--Play once only.--> gr_01 = playBuf 1 AR 0 (bufRateScale KR 0) 1 0 NoLoop RemoveSynth--Play in infinite loop.--> gr_02 = playBuf 1 AR 0 (bufRateScale KR 0) 1 0 Loop DoNothing--Trigger playback at each pulse.--> gr_03 =->     let t = impulse KR 2 0->         s = bufRateScale KR 0->     in playBuf 1 AR 0 s t 0 NoLoop DoNothing--Trigger playback at each pulse (diminishing intervals).--> gr_04 =->     let f = xLine KR 0.1 100 10 RemoveSynth->         t = impulse KR f 0->         s = bufRateScale KR 0->     in playBuf 1 AR 0 s t 0 NoLoop DoNothing--Loop playback, accelerating pitch.--> gr_05 =->     let r = xLine KR 0.1 100 60 RemoveSynth->     in playBuf 1 AR 0 r 1 0 Loop DoNothing--Sine wave control of playback rate, negative rate plays backwards.--> gr_06 =->     let f = xLine KR 0.2 8 30 RemoveSynth->         r = fSinOsc KR f 0 * 3 + 0.6->         s = bufRateScale KR 0 * r->     in playBuf 1 AR 0 s 1 0 Loop DoNothing--Channel mismatch, single channel buffer, two channel playBuf, result-is single channel playback and channel mismatch message in server log.--> gr_07 = playBuf 2 AR 0 (bufRateScale KR 0) 1 0 Loop DoNothing--Graph will play both channels after loading a two channel signal to-buffer.--> fn' = "/home/rohan/data/audio/sp/tinguely.aif"--    withSC3 (async (b_allocRead 0 fn' 0 0))--Release buffer.--    withSC3 (send (b_free 0))--Scan sequence of buffers:--> gr_08 =->     let n = 29 * 6->         b = mouseX KR 0 n Linear 0.2->         r = bufRateScale KR b->     in playBuf 1 AR b r 1 0 Loop DoNothing--In sclanguage:--{var fn = "/home/rohan/data/audio/pf-c5.aif"-;s.sendMsg("/b_allocRead",0,fn,0,0)}.value--{var sc = BufRateScale.kr(0)-;Out.ar(0,PlayBuf.ar(2,0,sc,1,0,1,0))}.play--{var fn = "/home/rohan/data/audio/sp/tinguely.aif"-;s.sendMsg("/b_allocRead",0,fn,0,0)}.value--{var b = MouseX.kr(32,64,0,0.2)-;var r = BufRateScale.kr(b)-;Out.ar(0,PlayBuf.ar(1,b,r,1,0,1,0))}.play
− Help/UGen/playBufCF.help.lhs
@@ -1,31 +0,0 @@-wslib: external/composite--> import Sound.SC3 {- hsc3 -}--Load sound file to buffer zero (single channel file required for examples)--> fn_01 = "/home/rohan/data/audio/pf-c5.aif"-> fn_02 = "/home/rohan/opt/src/supercollider/sounds/a11wlk01.wav"--    > withSC3 (async (b_allocRead 0 fn_02 0 0))--control-rate trigger and start-position inputs--> g_01 =->     let b = 0->         r = bufRateScale KR b->         tr = impulse KR 2 0->         wn = whiteNoise 'α' KR->         sp = linLin wn (-1) 1 0 (bufFrames KR b - (0.5 * 44100))->         o = playBufCF 1 b r tr sp NoLoop 0.1 2->         o' = playBuf 1 AR b r tr sp NoLoop DoNothing->     in mce2 o o'--demand ugens inputs--> g_02 =->     let b = 0->         r = drand 'α' dinf (mce [0.95,1,1.05])->         tr = dwhite 'β' dinf 0.1 0.3->         sp = dbrown 'γ' dinf 0 0.95 0.1 * bufFrames KR b->     in playBufCF 1 b r tr sp NoLoop 2 5
− Help/UGen/pluck.help.lhs
@@ -1,29 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Pluck"-    Sound.SC3.UGen.DB.ugenSummary "Pluck"--> import Sound.SC3 {- hsc3 -}--Excitation signal is white noise, triggered twice a second with varying OnePole coef.--> g_01 =->     let n = whiteNoise 'α' AR->         t = impulse KR 9 0->         x = mouseX KR (-0.999) 0.999 Linear 0.1->         y = mouseY KR 0.1 1 Linear 0.1->         dl = 1 / 440->     in pluck (n * 0.25) t dl (dl * y) 10 x--> g_02 =->     let n = 50->         udup = uclone 'α'->         f = udup n (rand 'β' 0.05 0.2)->         p = udup n (rand 'γ' 0 1)->         w = udup n (whiteNoise 'δ' AR)->         fi = udup n (rand 'ε' 10 12)->         coef = rand 'ζ' 0.01 0.2->         l = udup n (rand 'η' (-1) 1)->         x = mouseX KR 60 1000 Exponential 0.1->         o = linLin (sinOsc KR f p) (-1) 1 x 3000->         i = impulse KR fi 0->         ks = pluck (w * 0.1) i 0.01 (1 / o) 2 coef->     in leakDC (mix (pan2 ks l 1)) 0.995
− Help/UGen/pmOsc.help.lhs
@@ -1,25 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "PMOsc"-    :t pmOsc--pmOsc is a composite of sinOsc, ie. sinOsc r cf (sinOsc r mf mp * pm)--> import Sound.SC3--Random parameters, linear modulation index motion over n seconds--> pmi n =->     let cf = rand 'α' 0 2000->         mf = rand 'β' 0 800->         pme = rand 'γ' 0 12->         l = rand 'δ' (-1) 1->         pm = line KR 0 pme n DoNothing->     in linPan2 (pmOsc AR cf mf pm 0) l 0.05--> g_01 = pmi 2--PM textures--    > import qualified Sound.SC3.Lang.Control.OverlapTexture as L-    > L.overlapTextureU (0,1,8,maxBound) (pmi 1)-    > L.overlapTextureU (1,2,7,maxBound) (pmi 2)-    > L.overlapTextureU (6,6,6,maxBound) (pmi 12)
− Help/UGen/poll.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Poll"-    > Sound.SC3.UGen.DB.ugenSummary "Poll"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let t = impulse KR 10 0->         l = line KR 0 1 1 RemoveSynth->     in poll t l (label "polling...") 0--multichannel expansion (requires labels be equal length...)--> g_02 =->     let t = impulse KR (mce2 10 5) 0->         l = line KR 0 (mce2 1 5) (mce2 1 2) DoNothing->     in poll t l (mce2 (label "t1") (label "t2")) 0
− Help/UGen/pow.help.lhs
@@ -1,20 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.**"-    > :t (**)--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = fSinOsc AR 100 0 * 0.1->     in mce2 a (a ** 10)--see also <http://create.ucsb.edu/pipermail/sc-users/2006-December/029998.html>--> g_02 =->     let n0 = lfNoise2 'α' KR 8->         n1 = lfNoise2 'β' KR 3->         s = blip AR (n0 * 200 + 300) (n1 * 10 + 20)->         x = mouseX KR 1000 (sampleRate * 0.5) Exponential 0.1->         y = mouseY KR 1 24 Exponential 0.1->         d = latch s (impulse AR x 0)->         b = roundUp d (0.5 ** y)->     in mce2 d b
− Help/UGen/pulse.help.lhs
@@ -1,23 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Pulse"-    > Sound.SC3.UGen.DB.ugenSummary "Pulse"--> import Sound.SC3 {- hsc3 -}--Modulate frequency--> g_01 =->     let f = xLine KR 40 4000 6 RemoveSynth->     in pulse AR f 0.1 * 0.1--Modulate pulse width--> g_02 =->     let w = line KR 0.01 0.99 8 RemoveSynth->     in pulse AR 200 w * 0.1--Two band limited square waves through a resonant low pass filter--> g_03 =->     let p = pulse AR (mce2 100 250) 0.5 * 0.1->         f = xLine KR 8000 400 5 DoNothing->     in rlpf p f 0.05
− Help/UGen/pulseCount.help.lhs
@@ -1,15 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PulseCount"-> Sound.SC3.UGen.DB.ugenSummary "PulseCount"--> import Sound.SC3 {- hsc3 -}--> let c = pulseCount (impulse AR 10 0) (impulse AR 0.4 0)-> in audition (out 0 (sinOsc AR (c * 200) 0 * 0.05))--printer--> let {b = localBuf 'α' 11 1->     ;t = impulse AR 10 0->     ;p = pulseCount t 0->     ;d = demand t 0 (dbufwr 'α' (-666) b p NoLoop)}-> in audition (mrg [out 0 (dc AR 0),poll t p (label "p") 0])
− Help/UGen/pulseDivider.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PulseDivider"-    > Sound.SC3.UGen.DB.ugenSummary "PulseDivider"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let p = impulse AR 8 0->         d = pulseDivider p (mce [4,7]) 0->         a = sinOsc AR 1200 0 * decay2 p 0.005 0.1->         b = sinOsc AR  600 0 * decay2 d 0.005 0.5->     in a + b * 0.4
− Help/UGen/pv_BinDelay.help.lhs
@@ -1,61 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PV_BinDelay"-    > Sound.SC3.UGen.DB.ugenSummary "PV_BinDelay"--> import Sound.SC3 {- hsc3 -}--function to allocate buffers (fft,delay,feedback)--> mk_buf sz = do->   _ <- async (b_alloc 10 (sz * 2) 1)->   _ <- async (b_alloc 11 sz 1)->   async (b_alloc 12 sz 1)--allocate buffers (number of bins)--    withSC3 (mk_buf 128)--function to generate bindelay filter--> mk_del z =->     let maxdel = 0.5->         c1 = fft 10 z 0.25 0 1 0->         c2 = pv_BinDelay c1 maxdel 11 12 0.25->     in z + ifft c2 0 0--start filter--> gr_01 = mk_del (soundIn 0)--set delay times (unary)--    withSC3 (send (b_fill 11 [(0,128,0.25)]))--set feedback gain--    withSC3 (send (b_fill 12 [(0,128,0.75)]))--function to generate sin table of n places in range (l,r)--> gen_sin l r n ph =->     let f x = range l r (sin ((x / n) * 2 * pi + ph))->     in map f [0..n]--set delay times (sin)--    withSC3 (send (b_setn1 11 0 (gen_sin 0 0.35 128 0)))--set feedback gain (sin)--    withSC3 (send (b_setn1 12 0 (gen_sin 0.75 0.95 128 pi)))--modulate delay times (lfo)--> gr_02 =->     let o = range 0.15 0.35 (blip KR (1/23) 3)->     in recordBuf KR 11 0 1 0 1 Loop 1 DoNothing o--modulate feedback gains (lfo)--> gr_03 =->     let o = range 0.75 0.95 (blip KR (1/25) 5)->     in recordBuf KR 12 0 1 0 1 Loop 1 DoNothing o
− Help/UGen/pv_BinScramble.help.lhs
@@ -1,26 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_BinScramble"-> Sound.SC3.UGen.DB.ugenSummary "PV_BinScramble"--> import Sound.SC3--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;async (b_allocRead 12 fileName 0 0)})--> let {a = playBuf 1 AR 12 (bufRateScale KR 12) 1 0 Loop DoNothing->     ;f = fft' 10 a->     ;x = mouseX KR 0.0 1.0 Linear 0.1->     ;y = mouseY KR 0.0 1.0 Linear 0.1->     ;g = pv_BinScramble 'α' f x y (impulse KR 4 0)}-> in audition (out 0 (pan2 (ifft' g) 0 0.5))--careful - feedback loop!--> let {a = soundIn (mce2 4 5) * 4->     ;f = fft' 10 a->     ;x = mouseX KR 0.15 1 Linear 0.1->     ;y = mouseY KR 0.15 1 Linear 0.1->     ;i = impulse KR (lfNoise0 'α' KR 2 * 8 + 10) 0->     ;g = pv_BinScramble 'β' f x y i->     ;h = ifft' g}-> in audition (out 0 (pan2 h 0 0.5))
− Help/UGen/pv_BinShift.help.lhs
@@ -1,30 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_BinShift"-> Sound.SC3.UGen.DB.ugenSummary "PV_BinShift"--> import Sound.SC3--allocate buffer--> withSC3 (async (b_alloc 10 2048 1))--source signal (oscillators)--> let z = let {s0 = sinOsc KR 0.08 0 * 6 + 6.2->             ;s1 = sinOsc KR (squared s0) 0 * 100 + 800}->         in sinOsc AR s1 0 * 0.2--source signal (the world)--> let z = soundIn 4--default values--> audition (out 0 (ifft' (pv_BinShift (fft' 10 z) 1 0 0)))--mouse control--> let {x = mouseX KR (-10) 100 Linear 0.1->     ;y = mouseY KR 1 4 Linear 0.1->     ;b = mouseButton KR 0 1 0.2->     ;pv = pv_BinShift (fft' 10 z) y x b}-> in audition (out 0 (ifft' pv))
− Help/UGen/pv_BinWipe.help.lhs
@@ -1,17 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_BinWipe"-> Sound.SC3.UGen.DB.ugenSummary "PV_BinWipe"--> import Sound.SC3--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;_ <- async (b_alloc 11 2048 1)->                ;async (b_allocRead 12 fileName 0 0)})--> let {n = whiteNoise 'α' AR->     ;b = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing->     ;f = fft' 10 (n * 0.2)->     ;g = fft' 11 b->     ;x = mouseX KR 0.0 1.0 Linear 0.1->     ;h = pv_BinWipe f g x}-> in audition (out 0 (pan2 (ifft' h) 0 0.5))
− Help/UGen/pv_BrickWall.help.lhs
@@ -1,10 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_BrickWall"-> Sound.SC3.UGen.DB.ugenSummary "PV_BrickWall"--> import Sound.SC3--> withSC3 (async (b_alloc 10 2048 1))--> let {n = whiteNoise 'α' AR->     ;x = mouseX KR (-1) 1 Linear 0.1}-> in audition (out 0 (ifft' (pv_BrickWall (fft' 10 (n * 0.2)) x)))
− Help/UGen/pv_BufRd.help.lhs
@@ -1,32 +0,0 @@-> import Sound.SC3--allocate anazlysis buffer and load soundfile--> let {p = "/home/rohan/opt/share/SuperCollider/sounds/a11wlk01.wav"->     ;f = 1024 {- frame size -}->     ;h = 0.25 {- hop size -}->     ;p_dur = 4.2832879818594 {- duration (in seconds) of p -}->     ;b_size = pv_calcPVRecSize p_dur f h 48000}-> in withSC3 (do {_ <- async (b_alloc 0 b_size 1)->                ;async (b_allocRead 1 p 0 0)})--do the analysis and store to buffer.  the window type and overlaps are-important for resynthesis parameters--> let {rec_buf = 0->     ;au_buf = 1->     ;l_buf = localBuf 'α' 1024 1;->     ;rt = bufRateScale KR au_buf->     ;i = playBuf 1 AR au_buf rt 1 0 NoLoop RemoveSynth->     ;c0 = fft l_buf i 0.25 1 1 0->     ;c1 = pv_RecordBuf c0 rec_buf 0 1 0 0.25 1}-> in audition (mrg2 (out 0 (dc AR 0)) c1)--play analysis back--> let {rec_buf = 0->     ;l_buf = localBuf 'α' 1024 1->     ;x = mouseX KR 0 1 Linear 0.2->     ;c0 = pv_BufRd l_buf rec_buf x->     ;s = ifft c0 1 0}-> in audition (out 0 s)
− Help/UGen/pv_ConformalMap.help.lhs
@@ -1,27 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_ConformalMap"-> Sound.SC3.UGen.DB.ugenSummary "PV_ConformalMap"--> import Sound.SC3--> withSC3 (async (b_alloc 10 1024 1))--> let { i = soundIn 4->     ; x = mouseX KR (-1) 1 Linear 0.1->     ; y = mouseY KR (-1) 1 Linear 0.1 }-> in audition (out 0 (pan2 (ifft' (pv_ConformalMap (fft' 10 i) x y)) 0 1))--With filtering.--> withSC3 (async (b_alloc 0 2048 1))--> let z = let {o = mce [1, 1.1, 1.5, 1.78, 2.45, 6.7, 8] * 220->             ;f = sinOsc KR (mce [0.16, 0.33, 0.41]) 0 * 10 + o}->         in mix (lfSaw AR f 0) * 0.3--> let z = soundIn 4--> let {x = mouseX KR 0.01  2.0 Linear 0.1->     ;y = mouseY KR 0.01 10.0 Linear 0.1->     ;c = fft' 0 z->     ;m = ifft' (pv_ConformalMap c x y)}-> in audition (out 0 (pan2 (combN m 0.1 0.1 10 * 0.5 + m) 0 1))
− Help/UGen/pv_Copy.help.lhs
@@ -1,30 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PV_Copy"-    > Sound.SC3.UGen.DB.ugenSummary "PV_Copy"--> import Sound.SC3 {- hsc3 -}--Proof of concept, silence.  This graph is disallowed.  pv_Copy is-required to run before the ifft of c0, which mutates c0, however that-is not apparent from the edge structure of the graph.  See instead-PV_Split.--> cpy0 =->     let z = lfClipNoise 'α' AR 100 * 0.1->         c0 = fft' (localBuf 'β' 2048 1) z->         c1 = pv_Copy c0 (localBuf 'γ' 2048 1)->     in ifft' c1 - ifft' c0--The equivalent situation in sclang.--{var z = LFClipNoise.ar(100) * 0.1-;var g = FFT(LocalBuf(2048),z)-;IFFT(g) - IFFT(PV_Copy(g,LocalBuf(2048)))}.play--{var z = LFClipNoise.ar(100) * 0.1-;var g = FFT(LocalBuf(2048),z)-;IFFT(PV_Copy(g,LocalBuf(2048))) - IFFT(g)}.play--{var z = LFClipNoise.ar(100) * 0.1-;var g = FFT(LocalBuf(2048),z)-;var h = PV_Copy(g,LocalBuf(2048))-;IFFT(g) - IFFT(h)}.play
− Help/UGen/pv_Diffuser.help.lhs
@@ -1,20 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "PV_Diffuser"-    Sound.SC3.UGen.DB.ugenSummary "PV_Diffuser"--> import Sound.SC3 {- hsc3 -}--> diff_01 = do->   let fn = "/home/rohan/data/audio/pf-c5.snd"->   withSC3 (async (b_alloc 10 2048 1) >> async (b_allocRead 12 fn 0 0))--> diff_02 = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing--> diff_02' = soundIn 0--Trigger revised phase shifts with MouseX crossing center of screen--> diff_03 =->     let f = fft' 10 diff_02->         x = mouseX KR 0 1 Linear 0.1->         h = pv_Diffuser f (x >* 0.5)->     in ifft' h * 0.5
− Help/UGen/pv_HainsworthFoote.help.lhs
@@ -1,23 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "PV_HainsworthFoote"-    Sound.SC3.UGen.DB.ugenSummary "PV_HainsworthFoote"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let i = soundIn 4->         b = localBuf 'α' 2048 1->         f = fft' b i->         x = mouseX KR 0.5 1.25 Linear 0.2->         h = pv_HainsworthFoote f 1 0 x 0.04->         o = sinOsc AR (mrg2 440 445) 0 * decay (h * 0.1) 0.1->     in o + i--spot note transitions--> g_02 =->     let s = lfSaw AR (lfNoise0 'a' KR 1 * 90 + 400) 0 * 0.5->         b = localBuf 'α' 2048 1->         f = fft' b s->         d = pv_HainsworthFoote f 1.0 0.0 0.9 0.5->         t = sinOsc AR 440 0 * decay (d * 0.1) 0.1->     in mce2 (s * 0.2) t
− Help/UGen/pv_Invert.help.lhs
@@ -1,13 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_Invert"-> Sound.SC3.UGen.DB.ugenSummary "PV_Invert"--> import Sound.SC3--> let {s = sinOsc AR 440 0 * 0.4->     ;n = pinkNoise 'α' AR * 0.1->     ;i = s + n->     ;c0 = fft' 10 i->     ;c1 = pv_Invert c0->     ;run = do {_ <- async (b_alloc 10 2048 1)->               ;play (out 0 (mce2 i (ifft' c1) * 0.5))}}-> in withSC3 run
− Help/UGen/pv_LocalMax.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_LocalMax"-> Sound.SC3.UGen.DB.ugenSummary "PV_LocalMax"--> import Sound.SC3--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;async (b_allocRead 12 fileName 0 0)})--> let { a = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing->     ; f = fft' 10 a->     ; x = mouseX KR 0 100 Linear 0.1->     ; h = pv_LocalMax f x }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/pv_MagAbove.help.lhs
@@ -1,22 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_MagAbove"-> Sound.SC3.UGen.DB.ugenSummary "PV_MagAbove"--> import Sound.SC3--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;async (b_allocRead 12 fileName 0 0) })--> let {a = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing->     ;f = fft' 10 a->     ;x = mouseX KR 0 100 Linear 0.1->     ;h = pv_MagAbove f x}-> in audition (out 0 (ifft' h * 0.5))--Synthesised input.-> let {a = sinOsc KR (squared (sinOsc KR 0.08 0 * 6 + 6.2)) 0 * 100 + 800->     ;b = sinOsc AR a 0->     ;f = fft' 10 b->     ;x = mouseX KR 0 1024 Linear 0.1->     ;h = pv_MagAbove f x}-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/pv_MagBelow.help.lhs
@@ -1,22 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_MagBelow"-> Sound.SC3.UGen.DB.ugenSummary "PV_MagBelow"--> import Sound.SC3--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;async (b_allocRead 12 fileName 0 0)})--> let { a = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing->     ; f = fft' 10 a->     ; x = mouseX KR 0 100 Linear 0.1->     ; h = pv_MagBelow f x }-> in audition (out 0 (ifft' h * 0.5))--Synthesised input.-> let { a = sinOsc KR (squared (sinOsc KR 0.08 0 * 6 + 6.2)) 0 * 100 + 800->     ; b = sinOsc AR a 0->     ; f = fft' 10 b->     ; x = mouseX KR 0 1024 Linear 0.1->     ; h = pv_MagBelow f x }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/pv_MagClip.help.lhs
@@ -1,28 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_MagClip"-> Sound.SC3.UGen.DB.ugenSummary "PV_MagClip"--> import Sound.SC3--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;async (b_allocRead 12 fileName 0 0)})--File input--> let z = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing--Synthesised input.--> let z = let {f0 = squared (sinOsc KR 0.08 0 * 6 + 6.2)->             ;f1 = sinOsc KR f0 0 * 100 + 800}->         in sinOsc AR f1 0--Outside world--> let z = soundIn 4--> let {f = fft' 10 z->     ;c = 128->     ;x = mouseX KR 0 c Linear 0.1->     ;h = pv_MagClip f x}-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/pv_MagFreeze.help.lhs
@@ -1,31 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_MagFreeze"-> Sound.SC3.UGen.DB.ugenSummary "PV_MagFreeze"--> import Sound.SC3 {- hsc3 -}--Load audio file.--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 2048 1)->                ;async (b_allocRead 12 fileName 0 0)})--File as signal...--> let z = playBuf 1 AR 12 (bufRateScale KR 12) 0 0 Loop DoNothing--Synthesised signal...--> let z = let {o1 = sinOsc KR 0.08 0->             ;o2 = sinOsc KR (squared (o1 * 6 + 6.2)) 0 * 100 + 800}->         in sinOsc AR o2 0--Outside world signal...--> let z = soundIn 4--Process (freeze) 'z'...--> let {f = fft' 10 z->     ;x = mouseX KR 0 1 Linear 0.1->     ;h = pv_MagFreeze f (x >* 0.5)}-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/pv_MagMul.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "PV_MagMul"-    > Sound.SC3.UGen.DB.ugenSummary "PV_MagMul"--> import Sound.SC3 {- hsc3 -}--    > withSC3 (async (b_alloc 0 2048 1) >> async (b_alloc 1 2048 1))--> mm0 z =->     let y = lfSaw AR (midiCPS 43) 0 * 0.2->         c0 = fft' (localBuf 'α' 2048 1) y->         c1 = fft' (localBuf 'β' 2048 1) z->         c2 = pv_MagMul c0 c1->     in ifft' c2 * 0.1--> g_01 = mm0 (whiteNoise 'γ' AR * 0.2)-> g_02 = mm0 (soundIn 4 * 0.5)
− Help/UGen/pv_RandComb.help.lhs
@@ -1,23 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_RandComb"-> Sound.SC3.UGen.DB.ugenSummary "PV_RandComb"--> import Sound.SC3--allocate buffer--> withSC3 (async (b_alloc 10 2048 1))--noise signal--> let z = whiteNoise 'α' AR * 0.5--outside world--> let z = soundIn 4--processor--> let {t = impulse KR 0.1 0->     ;x = mouseX KR 0.6 0.95 Linear 0.1->     ;c = pv_RandComb 'α' (fft' 10 z) x t}-> in audition (out 0 (pan2 (ifft' c) 0 1))
− Help/UGen/pv_RandWipe.help.lhs
@@ -1,23 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_RandWipe"-> Sound.SC3.UGen.DB.ugenSummary "PV_RandWipe"--> import Sound.SC3-> import qualified System.Random as R--> withSC3 (do {_ <- async (b_alloc 10 2048 1)->             ;async (b_alloc 11 2048 1)})--> let { n0 = R.randomRs (400.0, 1000.0) (R.mkStdGen 0)->     ; n1 = R.randomRs (80.0, 400.0) (R.mkStdGen 1)->     ; n2 = R.randomRs (0.0, 8.0) (R.mkStdGen 2)->     ; o0 = map (\n -> lfSaw AR n 0 * 0.1) (take 6 n0)->     ; o1 = map (\n -> lfPulse AR n 0.0 0.2) (take 6 n1)->     ; o2 = map (\n -> sinOsc KR n 0 * 0.2) (take 6 n2)->     ; a = mix (mce o0)->     ; b = mix (mce (zipWith (\p s -> p * (max s 0.0)) o1 o2))->     ; f = fft' 10 a->     ; g = fft' 11 b->     ; x = mouseX KR 0 1 Linear 0.1->     ; y = mouseY KR 0 1 Linear 0.1->     ; h = pv_RandWipe 'a' f g x (y >* 0.5) }-> in audition (out 0 (pan2 (ifft' h) 0 0.5))
− Help/UGen/pv_RectComb.help.lhs
@@ -1,24 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_RectComb"-> Sound.SC3.UGen.DB.ugenSummary "PV_RectComb"--> import Sound.SC3--> withSC3 (async (b_alloc 10 2048 1))--noise source--> let z = whiteNoise 'α' AR * 0.3--outside world--> let z = soundIn 4--> let {x = mouseX KR 0 0.5 Linear 0.1->     ;y = mouseY KR 0 0.5 Linear 0.1->     ;c = pv_RectComb (fft' 10 z) 8 x y}-> in audition (out 0 (pan2 (ifft' c) 0 1))--> let {p = lfTri KR 0.097 0 *   0.4  + 0.5->     ;w = lfTri KR 0.240 0 * (-0.5) + 0.5->     ;c = pv_RectComb (fft' 10 z) 8 p w}-> in audition (out 0 (pan2 (ifft' c) 0 1))
− Help/UGen/pvcollect.help.lhs
@@ -1,53 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "PV_ChainUGen.pvcollect"-> :t pvcollect--> import Prelude hiding ((<*))-> import Data.List {- base -}-> import Sound.SC3 {- hsc3 -}--> let fileName = "/home/rohan/data/audio/pf-c5.snd"-> in withSC3 (do {_ <- async (b_alloc 10 1024 1)->                ;async (b_allocRead 11 fileName 0 0)})--> let spectral_delay m p _ =->     let {l = lfPar KR 0.5 0->         ;v = linLin l (-1) 1 0.1 1}->     in (m + delayN m 1 v,p)--> let bpf_sweep nf m p i =->     let {l = lfPar KR 0.1 0->         ;e = abs (i - (linLin l (-1) 1 2 (nf / 20)))}->     in ((e <* 10) * m,p)--> let pv_g nf cf =->   let {no_op m p _ = (m,p)->       ;combf m p i = ((modE i 7.0 ==* 0) * m,p)->       ;sf = playBuf 1 AR 11 (bufRateScale KR 11) 1 0 Loop DoNothing->       ;c1 = fft' 10 sf->       ;c2 = pvcollect c1 nf cf 0 250 0}->   in out 0 (0.1 * ifft' c2)--> let pv_au nf cf =->   let {no_op m p _ = (m,p)->       ;combf m p i = ((modE i 7.0 ==* 0) * m,p)->       ;c1 = fft' 10 (soundIn 0)->       ;c2 = pvcollect c1 nf cf 0 250 0}->   in out 0 (0.1 * ifft' c2)--> let r = unlines ["number of constants       : 257"->                 ,"number of controls        : 0"->                 ,"control rates             : []"->                 ,"number of unit generators : 1013"->                 ,"unit generator rates      : [(KR,5),(AR,4),(DR,1004)]"]-> in r `isPrefixOf` synthstat (pv_g 1024 spectral_delay)--> synthstat (pv_g 1024 (bpf_sweep 1024))-> audition (pv_g 1024 spectral_delay)-> audition (pv_g 1024 (bpf_sweep 1024))--> audition (pv_au 1024 spectral_delay)-> audition (pv_au 1024 (bpf_sweep 1024))--> import Sound.SC3.UGen.Dot {- hsc3-dot -}--> draw_svg (pv_g 1024 (bpf_sweep 1024))
− Help/UGen/qitch.help.lhs
@@ -1,23 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Qitch"-> Sound.SC3.UGen.DB.ugenSummary "Qitch"--> import Sound.SC3-> import System.FilePath--Load required data file (edit path as required)--> let {d = "/home/rohan/opt/share/SuperCollider/Extensions/SC3plugins"->     ;qf = d </> "PitchDetection/extraqitchfiles/QspeckernN2048SR48000.wav"}-> in withSC3 (async (b_allocRead 10 qf 0 0))--Comparison of input frequency (x) and tracked oscillator frequency (f).-Output is printed to the console by scsynth.--> let {x = mouseX KR 440 880 Exponential 0.1->     ;o = sinOsc AR x 0 * 0.1->     ;[f,e] = mceChannels (qitch KR o 10 1e-2 1 0 0 2500)->     ;r = sinOsc AR f 0 * 0.1->     ;t = impulse KR 4 0->     ;pf = poll t f (label "f") 0->     ;px = poll t x (label "x") 0}-> in audition (mrg [out 0 (mce2 o r),pf,px])
− Help/UGen/quadC.help.lhs
@@ -1,1 +0,0 @@-See quadN
− Help/UGen/quadL.help.lhs
@@ -1,1 +0,0 @@-See quadN
− Help/UGen/quadN.help.lhs
@@ -1,13 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "QuadN"-> Sound.SC3.UGen.DB.ugenSummary "QuadN"--> import Sound.SC3--> audition (out 0 (quadC AR 4000 1 (-1) (-0.75) 0 * 0.2))--> let x = mouseX KR 3.5441 4 Linear 0.1-> in audition (out 0 (quadC AR 4000 (negate x) x 0 0.1 * 0.4))--> let {x = mouseX KR 3.5441 4 Linear 0.1->     ;f = quadC AR 4 (negate x) x 0 0.1 * 800 + 900}-> in audition (out 0 (sinOsc AR f 0 * 0.4))
− Help/UGen/radiansPerSample.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "RadiansPerSample"-    > Sound.SC3.UGen.DB.ugenSummary "RadiansPerSample"--> import Sound.SC3 {- hsc3 -}--two pi divided by the nominal sample rate (ie. a very small number)--> g_01 =->     let f = mce2 radiansPerSample ((2 * pi) / sampleRate) * 5e6->     in sinOsc AR f 0 * 0.1
− Help/UGen/ramp.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Ramp"-    > Sound.SC3.UGen.DB.ugenSummary "Ramp"--> import Sound.SC3 {- hsc3 -}--Used to lag pitch--> g_01 =->     let o = lfPulse KR 4 0 0.5 * 50 + 400->         l = line KR 0 1 15 DoNothing->         f = ramp o l->     in sinOsc AR f 0 * 0.3--mouse control--> g_02 =->     let x = mouseX KR 220 440 Exponential 0->         x' = ramp x (300 / 1000)->     in sinOsc AR (mce2 x x') 0 * 0.1
− Help/UGen/rand.help.lhs
@@ -1,10 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Rand"-> Sound.SC3.UGen.DB.ugenSummary "Rand"--> import Sound.SC3--> let {f = rand 'α' 200 1200->     ;l = rand 'β' (-1) 1->     ;e = line KR 0.2 0 0.1 RemoveSynth->     ;o = fSinOsc AR f 0}-> in audition (out 0 (pan2 (o * e) l 1))
− Help/UGen/randID.help.lhs
@@ -1,2 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "RandID"-> Sound.SC3.UGen.DB.ugenSummary "RandID"
− Help/UGen/randSeed.help.lhs
@@ -1,27 +0,0 @@-Sound.SC3.UGen.Help.viewSC3Help "RandSeed"-Sound.SC3.UGen.DB.ugenSummary "RandSeed"--> import Sound.SC3--start a noise patch--> u0 =->     let n = uclone 'α' 2 (whiteNoise 'β' AR * 0.05 + dust2 'γ' AR 70)->         f = lfNoise1 'δ' KR 3 * 5500 + 6000->     in resonz (n * 5) f 0.5 + n * 0.5--reset the seed at a variable rate (crash?)--> u1 =->      let s = 1956 -- control KR "seed" 1956->          i = impulse KR (mouseX KR 0.1 100 Linear 0.2) 0->      in randSeed KR i s--always the same (for a given seed)...--> u2 =->     let sd = 1957->         n = tIRand 'α' 4 12 (dust 'β' KR 1)->         f = n * 150 + (mce [0,1])->         r = randSeed IR 1 sd->     in mrg2 (sinOsc AR f 0 * 0.1) r
− Help/UGen/recordBuf.help.lhs
@@ -1,24 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "RecordBuf"-    > Sound.SC3.UGen.DB.ugenSummary "RecordBuf"--> import Sound.SC3 {- hsc3 -}--Allocate a buffer (assume SR of 48k)--    > withSC3 (async (b_alloc 0 (48000 * 4) 1))--Record for four seconds (until end of buffer)--> g_01 =->     let o = formant AR (xLine KR 400 1000 4 DoNothing) 2000 800 * 0.125->     in mrg2 o (recordBuf AR 0 0 1 0 1 NoLoop 1 RemoveSynth o)--Play it back--> g_02 = playBuf 1 AR 0 1 1 0 NoLoop RemoveSynth--Mix second signal equally with existing signal, replay to hear--> g_03 =->     let o = formant AR (xLine KR 200 1000 4 DoNothing) 2000 800 * 0.125->     in mrg2 o (recordBuf AR 0 0 0.5 0.5 1 NoLoop 1 RemoveSynth o)
− Help/UGen/replaceOut.help.lhs
@@ -1,72 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "ReplaceOut"-    > Sound.SC3.UGen.DB.ugenSummary "ReplaceOut"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--> g_01 = replaceOut 0 (sinOsc AR 440 0 * 0.1)--Send signal to a bus, overwrite existing signal.--> g_02 =->     let a = out 0 (sinOsc AR (mce [330, 331]) 0 * 0.1)->         b = replaceOut 0 (sinOsc AR (mce [880, 881]) 0 * 0.1)->         c = out 0 (sinOsc AR (mce [120, 121]) 0 * 0.1)->     in mrg [a, b, c]--Compare to--> g_03 =->     let a = out 0 (sinOsc AR (mce [330, 331]) 0 * 0.1)->         b = out 0 (sinOsc AR (mce [880, 881]) 0 * 0.1)->         c = out 0 (sinOsc AR (mce [120, 121]) 0 * 0.1)->     in mrg [a,b,c]--- a writes noise to 24-- b reads 24 and replaces with filtered variant-- c reads 24 and writes to 0--> g_04 =->     let a = out 24 (pinkNoise 'α' AR * 0.1)->         b = replaceOut 24 (bpf (in' 1 AR 24) 440 1)->         c = out 0 (in' 1 AR 24)->     in mrg [c,b,a]--    > putStrLn$ synthstat g_04--~~~~-number of constants       : 5-number of controls        : 0-control rates             : []-number of unit generators : 7-unit generator rates      : [(AR,7)]-unit generator set        : *,BPF,In,Out,PinkNoise,ReplaceOut-unit generator sequence   : PinkNoise,*,Out,In,BPF,ReplaceOut,Out-~~~~--Signal/effect model using separate groups operating at the same bus.--> n_01 =->     let d = dust 'α' AR 1->         n = whiteNoise 'β' AR->         i = decay (d * 0.5) 0.2 * n->     in synthdef "n_01" (out 0 i)--> n_02 =->     let i = in' 1 AR 0->     in synthdef "n_02" (replaceOut 0 (combC i 0.2 0.2 3))--> m_01 =->     [g_new [(1,AddToTail,0)]->     ,g_new [(2,AddToTail,0)]->     ,d_recv n_01->     ,d_recv n_02->     ,s_new "n_01" (-1) AddToTail 1 []->     ,s_new "n_02" (-1) AddToTail 2 []]--> f_01 m =->     if isAsync m->     then async m >> return ()->     else send m--   > withSC3 (mapM_ f_01 m_01)
− Help/UGen/resonz.help.lhs
@@ -1,35 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Resonz"-> Sound.SC3.UGen.DB.ugenSummary "Resonz"--> import Sound.SC3--> let n = whiteNoise 'α' AR-> in audition (out 0 (resonz (n * 0.5) 2000 0.1))--Modulate frequency--> let {n = whiteNoise 'α' AR->     ;f = xLine KR 1000 8000 10 RemoveSynth}-> in audition (out 0 (resonz (n * 0.5) f 0.05))--Modulate bandwidth--> let {n = whiteNoise 'α' AR->     ;bw = xLine KR 1 0.001 8 RemoveSynth}-> in audition (out 0 (resonz (n * 0.5) 2000 bw))--Modulate bandwidth opposite direction--> let {n = whiteNoise 'α' AR->     ;bw = xLine KR 0.001 1 8 RemoveSynth}-> in audition (out 0 (resonz (n * 0.5) 2000 bw))--Mouse exam (1/Q = bandwidth / center-frequency)--> let {n = pinkNoise 'α' AR->     ;m = mouseX KR 36 85 Linear 0.2 {- midi note -}->     ;w = mouseY KR 0.1 5 Linear 0.2 {- bandwidth -}->     ;f = midiCPS (floorE m) {- centre frequency -}->     ;rq = w / f {- 1/Q (reciprocal of Q) -}->     ;o = resonz (n * 0.5) f rq}-> in audition (out 0 o)
− Help/UGen/rhpf.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "RHPF"-> Sound.SC3.UGen.DB.ugenSummary "RHPF"--> import Sound.SC3--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000-> in audition (out 0 (rhpf (saw AR 200 * 0.1) f 0.2))
− Help/UGen/ring1.help.lhs
@@ -1,12 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.ring1"-    > :t ring1--> import Sound.SC3 {- hsc3 -}->-> o_01 = fSinOsc AR 800 0-> o_02 = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0-> g_01 = ring1 o_01 o_02 * 0.125--is equivalent to:--> g_02 = ((o_01 * o_02) + o_01) * 0.125
− Help/UGen/ringz.help.lhs
@@ -1,29 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Ringz"-> Sound.SC3.UGen.DB.ugenSummary "Ringz"--> import Sound.SC3--> let n = dust 'α' AR 3-> in audition (out 0 (ringz (n * 0.3) 2000 2))--> let n = whiteNoise 'α' AR-> in audition (out 0 (ringz (n * 0.005) 2000 0.5))--Modulate frequency--> let {n = whiteNoise 'α' AR->     ;f = xLine KR 100 3000 10 RemoveSynth}-> in audition (out 0 (ringz (n * 0.005) f 0.5))--> let f = xLine KR 100 3000 10 RemoveSynth-> in audition (out 0 (ringz (impulse AR 6 0.3) f 0.5))--Modulate ring time--> let rt = xLine KR 4 0.04 8 RemoveSynth-> in audition (out 0 (ringz (impulse AR 6 0.3) 2000 rt))--Modulate ring time opposite direction--> let rt = xLine KR 0.04 4 8 RemoveSynth-> in audition (out 0 (ringz (impulse AR 6 0.3) 2000 rt))
− Help/UGen/rlpf.help.lhs
@@ -1,12 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "RLPF"-> Sound.SC3.UGen.DB.ugenSummary "RLPF"--> import Sound.SC3--> let {n = whiteNoise 'α' AR->     ;f = sinOsc AR 0.5 0 * 40 + 220->     ;r = rlpf n f 0.1}-> in audition (out 0 r)--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000-> in audition (out 0 (rlpf (saw AR 200 * 0.1) f 0.2))
− Help/UGen/rossler.help.lhs
− Help/UGen/rotate2.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Rotate2"-    > Sound.SC3.UGen.DB.ugenSummary "Rotate2"--> import Sound.SC3 {- hsc3 -}--Rotation of stereo sound, via LFO.--> g_01 =->     let x = pinkNoise 'α' AR->         y = lfTri AR 800 0 * lfPulse KR 3 0 0.3 * 0.2->     in rotate2 x y (lfSaw KR 0.1 0)--Rotation of stereo sound, via mouse.--> g_02 =->     let x = mix (lfSaw AR (mce [198..201]) 0 * 0.1)->         y = sinOsc AR 900 0 * lfPulse KR 3 0 0.3 * 0.2->         p = mouseX KR 0 2 Linear 0.2->     in rotate2 x y p
− Help/UGen/roundUp.help.lhs
@@ -1,13 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.round"-    > :t roundUp--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let x = mouseX KR 60 4000 Linear 0.1->         f = roundUp x 100->     in sinOsc AR f 0 * 0.1->-> g_02 =->     let n = line KR 24 108 6 RemoveSynth->     in saw AR (midiCPS (roundUp n 1)) * 0.2
− Help/UGen/runningMax.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "RunningMax"-    > Sound.SC3.UGen.DB.ugenSummary "RunningMax"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let n = dust 'α' AR 20->         t = impulse AR 0.4 0->         f = runningMax n t * 500 + 200->     in t + sinOsc AR f 0 * 0.2--follow a sine lfo, reset rate controlled by mouse x--> g_02 =->     let t = impulse KR (mouseX KR 0.01 2 Linear 0.1) 0->         f = runningMax (sinOsc KR 0.2 0) t * 500 + 200->     in t + sinOsc AR f 0 * 0.2
− Help/UGen/runningMin.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "RunningMin"-    > Sound.SC3.UGen.DB.ugenSummary "RunningMin"--> import Sound.SC3 {- hsc3 -}--Follow a sine lfo, reset rate controlled by mouseX--> g_01 =->     let o = sinOsc KR 2 pi->         x = mouseX KR 0.01 10 Exponential 0.1->         t = impulse AR x 0->         f = runningMin o t * 500 + 200->     in t + sinOsc AR f 0 * 0.1->-> g_02 =->     let n = dust 'α' AR 20->         t = impulse AR 0.4 0->         f = runningMin n t * 500 + 200->     in sinOsc AR f 0 * 0.2
− Help/UGen/runningSum.help.lhs
@@ -1,28 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "RunningSum"-    > Sound.SC3.UGen.DB.ugenSummary "RunningSum"--> import Sound.SC3 {- hsc3 -}--distorts of course - would need scaling--> g_01 = runningSum (soundIn 4) 40--Running Average over x samples--> g_02 = let x = 100 in runningSum (lfSaw AR 440 0) x * recip x--RMS Power--> g_03 =->     let input = lfSaw AR 440 0->         numsamp = 30->     in runningSum (input * input) numsamp / (sqrt numsamp)--composite UGen--> g_04 = runningSumRMS (soundIn 4) 40--> g_05 =->     let z = soundIn 4->         a = runningSum z 40->     in sinOsc AR 440 0 * a * 0.1
− Help/UGen/sampleDur.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SampleDur"-    > Sound.SC3.UGen.DB.ugenSummary "SampleDur"--> import Sound.SC3 {- hsc3 -}--`sampleDur` is the reciprocal of the nominal sample rate of the server--> g_01 =->     let f = mce2 sampleRate (recip sampleDur) * 0.01->     in sinOsc AR f 0 * 0.1
− Help/UGen/sampleRate.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SampleRate"-    > Sound.SC3.UGen.DB.ugenSummary "SampleRate"--> import Sound.SC3 {- hsc3 -}--the current nominal sample rate of the server--> g_01 =->     let sr = 48000 {- 44100 -}->         f = mce2 sampleRate sr * 0.01->     in sinOsc AR f 0 * 0.1--The server status command can extract nominal and actual sample rates-from a running server.--    > import Control.Monad-    > withSC3 (liftM2 (,) serverSampleRateNominal serverSampleRateActual)
− Help/UGen/saw.help.lhs
@@ -1,25 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Saw"-    > Sound.SC3.UGen.DB.ugenSummary "Saw"--> import Sound.SC3 {- hsc3 -}->-> g_01 = saw AR (xLine KR 40 4000 6 RemoveSynth) * 0.1--compare to the non-bandlimited lfSaw--> g_02 = lfSaw AR (xLine KR 40 4000 6 RemoveSynth) 0 * 0.1--Two band limited sawtooth waves thru a resonant low pass filter--> g_03 =->     let f = xLine KR 8000 400 5 DoNothing->     in rlpf (saw AR (mce2 100 250) * 0.1) f 0.05--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen1 0.1 (saw AR 50) -- descending-    > plot_ugen1 0.002 (saw AR 5000) -- ragged--![](sw/hsc3/Help/SVG/saw.0.svg)-![](sw/hsc3/Help/SVG/saw.1.svg)
− Help/UGen/scaleNeg.help.lhs
@@ -1,18 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.scaleneg"-    > :t scaleNeg--> import Prelude hiding ((<*)) {- base -}-> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let o = fSinOsc AR 1000 0->         l = line AR 1 (-1) 4 RemoveSynth->     in scaleNeg o l * 0.1--written out:--> g_02 =->     let o = fSinOsc AR 1000 0->         l = line AR 1 (-1) 4 RemoveSynth->         c = o <* 0->     in (c * (o * l) + (1 - c) * o) * 0.1
− Help/UGen/schmidt.help.lhs
@@ -1,11 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Schmidt"-    > Sound.SC3.UGen.DB.ugenSummary "Schmidt"--> import Sound.SC3 {- hsc3 -}--threshold octave jumps--> g_01 =->     let n = lfNoise1 'α' KR 3->         o = schmidt n (-0.15) 0.15 + 1->     in sinOsc AR (n * 200 + 500 * o) 0 * 0.1
− Help/UGen/select.help.lhs
@@ -1,19 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Select"-    > Sound.SC3.UGen.DB.ugenSummary "Select"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let n = 3/2->         a = mce [sinOsc AR 440 0, saw AR 440, pulse AR 440 0.1]->     in select (lfSaw KR 1 0 * n + n) a * 0.2--Here used as a sequencer:--> g_02 =->     let n = 10->         a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]->         c = n / 2->         f = select (lfSaw KR 0.5 0 * c + c) a->     in saw AR f * 0.2-
− Help/UGen/selectX.help.lhs
@@ -1,22 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "SelectX"-> :t selectX--# composite ugen graph--> import Sound.SC3-> import Sound.SC3.UGen.Dot--> let { n = 3/2->     ; f = mce2 440 441->     ; a = mce [sinOsc AR f 0, saw AR f, pulse AR f 0.1]->     ; s = mceSum (selectX (lfSaw KR 1 0 * n + n) a * 0.2) }-> in audition (out 0 s) >> draw s--Here used as a sequencer:--> let { n = 10->     ; a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]->     ; c = n / 2->     ; f = mceSum (selectX (lfSaw KR 0.5 0 * c + c) a)->     ; s = saw AR f * 0.2 }-> in audition (out 0 s) >> draw s
− Help/UGen/sendReply.help.lhs
@@ -1,16 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "SendReply"-    Sound.SC3.UGen.DB.ugenSummary "SendReply"--> import Sound.OSC {- hosc3 -}-> import Sound.SC3 {- hsc3 -}--> g_01 =->   let s0 = lfNoise0 'α' KR 5->       s1 = lfNoise0 'β' KR 5->       o = sinOsc AR (s0 * 200 + 500) 0 * s1 * 0.1->   in mrg [o,sendReply s0 0 "/send-reply" [s0,s1]]--> f_01 :: (DuplexOSC m) => m Message-> f_01 = withNotifications (waitReply "/send-reply")--    withSC3 f_01
− Help/UGen/sendTrig.help.lhs
@@ -1,48 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "SendTrig"-    Sound.SC3.UGen.DB.ugenSummary "SendTrig"--> import Control.Monad {- base -}-> import Data.Maybe {- base -}--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--Retrieve a single message--> g_01 =->     let s = lfNoise0 'α' KR 5->         o = sinOsc AR (s * 200 + 500) 0 * 0.1->     in mrg [o,sendTrig s 0 s]--> f_01 :: Transport m => m Message-> f_01 = withNotifications (waitReply "/tr")--    withSC3 f_01--Send random triggers, request notifications, then for each trigger start a synth (s_03).--> g_02 =->     let t = dust 'α' KR 1.0->     in sendTrig t 0 t--> g_03 =->     let freq = control KR "freq" 440->         env = envGen KR 1 0.1 0 1 RemoveSynth (envPerc 0.01 1)->     in sinOsc AR freq 0 * env--> s_03 = synthdef "s_03" (out 0 g_03)--> f_02 :: Transport m => m ()-> f_02 = do->   r <- waitReply "/tr"->   let (_,_,n) = unpack_tr_err r->   sendMessage (s_new "s_03" (-1) AddToTail 1 [("freq",110 + (n * 110))])--> f_03 :: Transport m => m ()-> f_03 = do->   play g_02->   async_ (notify True)->   async_ (d_recv s_03)->   repeatM_ f_02--     withSC3 f_03
− Help/UGen/setResetFF.help.lhs
@@ -1,21 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "SetResetFF"-> Sound.SC3.UGen.DB.ugenSummary "SetResetFF"--> import Sound.SC3--d0 is the set trigger, d1 the reset trigger--> let {n = brownNoise 'α' AR->     ;d0 = dust 'β' AR 5->     ;d1 = dust 'γ' AR 5}-> in audition (out 0 (setResetFF d0 d1 * n * 0.2))--silence--> let tr = setResetFF (impulse KR 5 0) (impulse KR 10 0)-> in audition (out 0 (brownNoise 'α' AR * 0.1 * decay2 tr 0.01 0.05))--duty cycle--> let tr = 1 - setResetFF (impulse KR 10 0) (impulse KR 5 0)-> in audition (out 0 (brownNoise 'α' AR * 0.1 * decay2 tr 0.01 0.05))
− Help/UGen/shaper.help.lhs
@@ -1,52 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Shaper"-    > Sound.SC3.UGen.DB.ugenSummary "Shaper"--> import Sound.SC3 {- hsc3 -}--function to generate wavetable buffer using b_gen_cheby--> mk_b a =->     let tbl_f = [Normalise,Wavetable,Clear]->         msg = [b_alloc 10 512 1,b_gen_cheby 10 tbl_f a]->     in withSC3 (mapM_ async msg)--hear waveshaper at pure (sin) tone--    > mk_b [1,0,1,1,0,1]--> g_01 =->     let z = sinOsc AR 300 0 * line KR 0 1 6 RemoveSynth->     in shaper 10 z * 0.1--plot wavetable (as in-buffer layout, as plain wavetable)--    > import Sound.SC3.Plot {- hsc3-plot -}-    > withSC3 (plot_buffer1 10)-    > withSC3 (plot_wavetable1 10)--![](sw/hsc3/Help/SVG/shaper.0.svg)-![](sw/hsc3/Help/SVG/shaper.1.svg)--variations--    > mk_b [0.25,0.5,0.25]--> g_02 =->     let z = sinOsc AR 400 (pi / 2) * line KR 0 1 6 RemoveSynth->     in shaper 10 z * 0.1--wave shape external signal--    > mk_b [1,0,1,1,0,1]--> g_03 =->     let z = soundIn 0->         x = sinOsc KR (1/4) 0->     in xFade2 z (shaper 10 z) x 0.5--    > mk_b [1,0,1,1,0,1,0.5,0,0.25,0,0.75,1]--> g_04 =->     let z = soundIn 4->         x = mouseX KR (-1) 1 Linear 0.2->     in xFade2 z (shaper 10 z) x 0.5
− Help/UGen/silent.help.lhs
@@ -1,7 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Silent"-> Sound.SC3.UGen.DB.ugenSummary "Silent"--> import Sound.SC3--> let g = out 0 (silent 2)-> in audition g
− Help/UGen/sinOsc.help.lhs
@@ -1,61 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SinOsc"-    > Sound.SC3.UGen.DB.ugenSummary "SinOsc"--> import Sound.SC3 {- hsc3 -}--Fixed frequency--> g_01 = sinOsc AR (midiCPS 69) 0 * 0.25--Modulate freq--> g_02 = sinOsc AR (xLine KR 2000 200 9 RemoveSynth) 0 * 0.5--Modulate freq--> g_03 =->     let f = sinOsc AR (xLine KR 1 1000 9 RemoveSynth) 0 * 200 + 800->     in sinOsc AR f 0 * 0.1--Modulate phase--> g_04 =->     let ph = sinOsc AR (xLine KR 20 8000 10 RemoveSynth) 0 * 2 * pi->     in sinOsc AR 800 ph * 0.1--Mouse control--> g_05 =->     let x = mouseX KR 40 10000 Exponential 0.2->         y = mouseY KR 0.01 0.25 Exponential 0.2->     in sinOsc AR x 0 * y--Simple bell-like tone.--> g_06 =->     let f = mce [0.5,1,1.19,1.56,2,2.51,2.66,3.01,4.1]->         a = mce [0.25,1,0.8,0.5,0.9,0.4,0.3,0.6,0.1]->         o = sinOsc AR (500 * f) 0 * a->         e = envGen KR 1 0.1 0 1 RemoveSynth (envPerc 0.01 10)->     in mix o * e--"When two pure tones of slightly different frequency are superposed,-our ears perceive audible beats at a rate given by the difference of-the two frequencies."--> g_07 =->     let f0 = 220->         f1 = 221.25->         d = abs (f1 - f0)->     in sinOsc AR (mce2 f0 f1) 0 * 0.1 + impulse AR d 0 * 0.25--"When two tones are sounded together, a tone of lower frequency is-frequently heard. Such a tone is called a combination tone.  The most-commonly heard combination tone occurs at a frequency f2 - f1."--> g_08 =->     let f1 = 300->         f2 = 300 * (3/2)->         f = mce2 (mce2 f1 f2) (abs (f2 - f1))->         a = mce2 0.1 (max (sinOsc KR 0.05 0 * 0.1) 0)->     in sinOsc AR f 0 * a
− Help/UGen/sinOscFB.help.lhs
@@ -1,28 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SinOscFB"-    > Sound.SC3.UGen.DB.ugenSummary "SinOscFB"--> import Sound.SC3 {- hsc3 -}--    {SinOscFB.ar([400,301],MouseX.kr(0,4))*0.1}.play--> g_01 =->     let x = mouseX KR 0 4 Linear 0.2->     in sinOscFB AR (mce2 400 301) x * 0.1--    {var y = MouseY.kr(10,1000,'exponential')-    ;var x = MouseX.kr(0.5pi,pi)-    ;SinOscFB.ar(y,x) * 0.1}.play--> g_02 =->     let y = mouseY KR 10 1000 Exponential 0.2->         x = mouseX KR (pi/2) pi Linear 0.2->     in sinOscFB AR y x * 0.1--    {var y = MouseY.kr(1,1000,'exponential')-    ;var x = MouseX.kr(0.5pi,pi)-    ;SinOscFB.ar(100 * SinOscFB.ar(y)+200,x) * 0.1}.play--> g_03 =->     let y = mouseY KR 1 1000 Exponential 0.2->         x = mouseX KR (pi/2) pi Linear 0.2->     in sinOscFB AR (100 * sinOscFB AR y 0 + 200) x * 0.1
− Help/UGen/slew.help.lhs
@@ -1,20 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Slew"-    > Sound.SC3.UGen.DB.ugenSummary "Slew"--> import Sound.SC3 {- hsc3 -}->-> g_01 = let z = lfPulse AR 800 0 0.5 * 0.1 in mce2 z (slew z 4000 4000)->-> g_02 = let z = saw AR 800 * 0.1 in mce2 z (slew z 400 400)--Drawings--    > import Sound.SC3.Plot {- hsc3-plot -}-    > let z = lfPulse AR 800 0 0.5-    > plot_ugen1 0.05 z-    > plot_ugen1 0.05 (slew z 4000 4000)-    > plot_ugen1 0.05 (slew z 500 500)--![](sw/hsc3/Help/SVG/slew.0.svg)-![](sw/hsc3/Help/SVG/slew.1.svg)-![](sw/hsc3/Help/SVG/slew.2.svg)
− Help/UGen/slope.help.lhs
@@ -1,22 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Slope"-    > Sound.SC3.UGen.DB.ugenSummary "Slope"--> import Sound.SC3 {- hsc3 -}->-> sig f0 =->     let a = lfNoise2 'α' AR f0 {- quadratic noise -}->         b = slope a {- first derivative, line segments -}->         c = slope b {- second derivative, constant segments -}->         s = 0.0002->     in [a, b * s, c * s * s]->-> g_01 =->     let f = mce (sig 2) * 220 + 220->     in mix (sinOsc AR f 0 * 0.1)--Drawing--    > import Sound.SC3.Plot {- hsc3-plot -}-    > plot_ugen 0.05 (mce (sig 2000))--![](sw/hsc3/Help/SVG/slope.0.svg)
− Help/UGen/sms.help.lhs
@@ -1,12 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "SMS"-> Sound.SC3.UGen.DB.ugenSummary "SMS"--> import Sound.SC3--sine reconstruction left channel, noises on right--> let {z= soundIn 0->     ;y = mouseY KR 1 50 Linear 0.2->     ;x = mouseX KR 0.5 4 Linear 0.2->     ;o = sms z 50 y 8 0.3 x 0 0 0 1 (-1)}-> in audition (out 0 o)
− Help/UGen/softClip.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.softclip"-    > :t softClip--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let e = xLine KR 0.1 10 10 RemoveSynth->         o = fSinOsc AR 500 0.0->     in softClip (o * e) * 0.25
− Help/UGen/sos.help.lhs
@@ -1,13 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "SOS"-    Sound.SC3.UGen.DB.ugenSummary "SOS"--> import Sound.SC3 {- hsc3 -}--Same as TwoPole--> g_01 =->     let theta = line KR (0.2 * pi) pi 5 RemoveSynth->     rho = line KR 0.6 0.99 5 RemoveSynth->     b1 = 2 * rho * cos theta->     b2 = - (rho * rho) }-> in sos (lfSaw AR 200 0 * 0.1) 1 0 0 b1 b2)
− Help/UGen/soundIn.help.lhs
@@ -1,23 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SoundIn"--soundIn is a composite of the UGens in' and numOutputBuses--> import Sound.SC3 {- hsc3 -}--copy fifth second channel (index 4) to first output channel (index 0)--> gr_01 = out 0 (soundIn 0)--Copy input from 1 & 0 to outputs 0 & 1.--> gr_02 = out 0 (soundIn (mce2 1 0))--io matrix:--  0 1 2 3-0 *-1     *-2   *-3       *--> gr_03 = out 0 (soundIn (mce [0, 2, 1, 3]))
− Help/UGen/specCentroid.help.lhs
@@ -1,14 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "SpecCentroid"-> Sound.SC3.UGen.DB.ugenSummary "SpecCentroid"--> import Sound.SC3--as the number of harmonics increases, the centroid is pushed higher-> let {f0 = mouseY KR 1000 100 Exponential 0.2->     ;nh = mouseX KR 1 100 Exponential 0.2->     ;z = blip AR f0 nh->     ;f = fft' (localBuf 'α' 2048 1) z->     ;c = specCentroid f->     ;p = poll' (impulse KR 1 0) c (label "c") 0->     ;o = sinOsc AR p 0 * 0.1}-> in audition (out 0 o)
− Help/UGen/specFlatness.help.lhs
@@ -1,13 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "SpecFlatness"-> Sound.SC3.UGen.DB.ugenSummary "SpecFlatness"--> import Sound.SC3--> let {z = soundIn 4->     ;g = 1 {- gain, set as required -}->     ;a = wAmp KR z 0.05->     ;f = fft' (localBuf 'α' 2048 1) z->     ;c = poll' 1 (specCentroid f) (label "c") 0->     ;w = poll' 1 (specFlatness f) (label "w") 0->     ;o = bpf (pinkNoise 'a' AR) c w * a * g}-> in audition (out 0 o)
− Help/UGen/splay.help.lhs
@@ -1,60 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Splay"--splay is a composite UGen, arguments are:-inArray spread=1 level=1 center=0 levelComp=true--> import Sound.SC3 {- hsc3 -}--mouse control--> g_01 =->     let i = 6->         r = map (\e -> rand e 10 20) (take i ['α'..])->         n = lfNoise2 'β' KR (mce r)->         x = mouseX KR (-1) 1 Linear 0.1->         y = mouseY KR 1 0 Linear 0.1->         ci = constant . fromIntegral->         f = mce [1 .. ci i] + 3 * 100->         o = sinOsc AR (n * 200 + f) 0->     in splay o y 0.2 x True--n_set control--> g_02 =->     let i = 10->         s = control KR "spread" 1->         l = control KR "level" 0.2->         c = control KR "center" 0->         r = map (\e -> rand e 10 20) (take i ['α'..])->         ci = constant . fromIntegral->         f = mce [1 .. ci i] + 3 * 100->         n = lfNoise2 'β' KR (mce r) * 200 + f->     in splay (sinOsc AR n 0) s l c True--full stereo--    > withSC3 (send (n_set (-1) [("spread",1),("center",0)]))--less wide--    > withSC3 (send (n_set (-1) [("spread",0.5),("center",0)]))--mono center--    > withSC3 (send (n_set (-1) [("spread",0),("center",0)]))--from center to right--    > withSC3 (send (n_set (-1) [("spread",0.5),("center",0.5)]))--all left--    > withSC3 (send (n_set (-1) [("spread",0),("center",-1)]))--single channel input--> g_03 =->     let x = mouseX KR (-1) 1 Linear 0.1->         y = mouseY KR 1 0 Linear 0.1->         o = sinOsc AR (lfNoise2 'α' KR 6 * 9 + 440) 0 * 0.1->     in splay o y 0.2 x True
− Help/UGen/squiz.help.lhs
@@ -1,27 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Squiz"-> Sound.SC3.UGen.DB.ugenSummary "Squiz"--> import Sound.SC3--Squiz of sin oscillator--> let {o = sinOsc AR 440 0->     ;x = mouseX KR 1 10 Exponential 0.2->     ;y = mouseY KR 1 10 Linear 0.2->     ;s = squiz o x y 0.1 * 0.1}-> in audition (out 0 s)--Load sound file to buffer zero--> let {fn' = "/home/rohan/data/audio/pf-c5.aif"->     ;fn = "/home/rohan/opt/share/SuperCollider/sounds/a11wlk01.wav"}-> in withSC3 (async (b_allocRead 0 fn 0 0))--Squiz of audio file.--> let {r = bufRateScale KR 0->     ;p = playBuf 1 AR 0 (r * 0.5) 1 0 Loop DoNothing->     ;x = mouseX KR 1 100 Exponential 0.2->     ;y = mouseY KR 1 10 Linear 0.2->     ;o = squiz p x y 0.1 * 0.5}-> in audition (out 0 o)
− Help/UGen/stepper.help.lhs
@@ -1,42 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Stepper"-> Sound.SC3.UGen.DB.ugenSummary "Stepper"--> import Sound.SC3--> let {i = impulse KR 10 0->     ;f = stepper i 0 4 16 (-3) 4 * 100}-> in audition (out 0 (sinOsc AR f 0 * 0.1))--Using Stepper and BufRd for sequencing--> let {compose = foldl (flip (.)) id->     ;rvb z s =->         let f i = let dly = mce [rand (z `joinID` i `joinID` 'α') 0 0.5->                                 ,rand (z `joinID` i `joinID` 'β') 0 0.5]->                     in allpassN i 0.05 dly (rand i 1.5 2)->         in compose (replicate 5 f) s->     ;stpr = let {rate = mouseX KR 1.75 2.25 Exponential 0.1->                 ;clock = impulse KR rate 0->                 ;envl = decay2 clock 0.002 2.5->                 ;indx = stepper clock 0 0 15 1 0->                 ;freq = bufRdN 1 KR 10 indx Loop->                 ;ffreq = lag2 freq 0.1 + mce [0,0.3]->                 ;lfo = sinOsc KR 0.2 (mce [0,pi/2]) * 0.0024 + 0.0025->                 ;top = mix (lfPulse AR (freq * mce [1,1.5,2]) 0 0.3)->                 ;chn = [\s -> rlpf s ffreq 0.3 * envl->                        ,\s -> rlpf s ffreq 0.3 * envl->                        ,\s -> s * 0.5->                        ,\s -> combL s 1 (0.66 / rate) 2 * 0.8 + s->                        ,\s -> s + (rvb 'γ' s * 0.3)->                        ,\s -> leakDC s 0.1->                        ,\s -> delayL s 0.1 lfo + s->                        ,\s -> onePole s 0.9]}->             in compose chn top->     ;stprInit =->      let n = [97.999,195.998,523.251,466.164,195.998->              ,233.082,87.307,391.995,87.307,261.626->              ,195.998,77.782,233.082,195.998,97.999->              ,155.563]->      in do {_ <- async (b_alloc 10 128 1)->            ;send (b_setn 10 [(0,n)])}}-> in withSC3 (stprInit >> play (out 0 stpr))
− Help/UGen/stkBowed.help.lhs
@@ -1,8 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "StkBowed"-> Sound.SC3.UGen.DB.ugenSummary "StkBowed"--> import Sound.SC3--no longer working...-> let g = toggleFF (impulse KR 1 0)-> in audition (out 0 (stkBowed AR 220 64 64 64 64 64 g 1 1))
− Help/UGen/stkFlute.help.lhs
@@ -1,8 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "StkFlute"-> Sound.SC3.UGen.DB.ugenSummary "StkFlute"--> import Sound.SC3--> let { bp = line KR 76 32 3 RemoveSynth->     ; ng = line KR 16 64 3 DoNothing }-> in audition (out 0 (stkFlute AR 400 64 ng 16 16 bp 1))
− Help/UGen/stkMandolin.help.lhs
@@ -1,24 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "StkMandolin"-> Sound.SC3.UGen.DB.ugenSummary "StkMandolin"--> import Control.Monad-> import Sound.SC3--requires "../../rawwaves/mand1.raw"--> let {x = mouseX KR 0.25 4 Linear 0.2->     ;tr = impulse KR x 0 - 0.5 }-> in do {mn <- tRandM 54 66 tr->       ;[bs, pp, dm, dt, at] <- replicateM 5 (tRandM 0 127 tr)->       ;audition (out 0 (stkMandolin AR (midiCPS mn) bs pp dm dt at tr))}--> let {x = mouseX KR 3 16 Linear 0.2->     ;t = impulse KR x 0 - 0.5->     ;tr = pulseDivider t 6 0 }-> in do {mn <- tIRandM 54 66 t->       ;bs <- tRandM 72 94 tr->       ;pp <- tRandM 32 42 tr->       ;dm <- tRandM 64 72 tr->       ;dt <- tRandM 0 4 tr->       ;at <- tRandM 2 8 tr->       ;audition (out 0 (stkMandolin AR (midiCPS mn) bs pp dm dt at t))}
− Help/UGen/stkModalBar.help.lhs
@@ -1,29 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "StkModalBar"-> Sound.SC3.UGen.DB.ugenSummary "StkModalBar"--> import Control.Monad-> import Sound.SC3--requires "../../rawwaves/marmstk1.raw"--> let {x = mouseX KR 0.25 4 Linear 0.2->     ;tr = impulse KR x 0 - 0.5->     ;tR = tRand 0 127 tr}-> in do {i <- tRandM 0 9 tr->       ;mn <- tIRandM 25 96 tr->       ;[sh,sp,vg,vf,mx,v] <- replicateM 6 tR->       ;let s = stkModalBar AR (midiCPS mn) i sh sp vg vf mx v tr->        in audition (out 0 s)}--> let {x = mouseX KR 1 6 Linear 0.2->     ;t = impulse KR x 0 - 0.5->     ;tr = pulseDivider t 6 0}-> in do {mn <- tIRandM 52 64 t->       ;sh <- tRandM 4 8 tr->       ;sp <- tRandM 54 68 tr->       ;vg <- tRandM 66 98 tr->       ;vf <- tRandM 4 12 tr->       ;mx <- tRandM 0 1 tr->       ;v <- tRand 16 48 tr->       ;let s = stkModalBar AR (midiCPS mn) 1 sh sp vg vf mx v t->        in audition (out 0 s)}
− Help/UGen/stkShakers.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "StkShakers"-    > Sound.SC3.UGen.DB.ugenSummary "StkShakers"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}-> import Sound.SC3.UGen.External.RDU {- hsc3 -}--> gr_01 =->     let x = mouseX KR 0.25 4 Linear 0.2->         tr = impulse KR x 0 - 0.5->         i = tRand 'α' 0 23 tr->         [e,sd,no,rf] = mceChannels (tRandN 4 'β' 0 127 tr)->     in stkShakers AR i e sd no rf tr--> gr_02 =->     let tr = impulse KR 1 0 - 0.5->     in stkShakers AR 4 64 64 64 64 tr
− Help/UGen/streson.help.lhs
@@ -1,8 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Streson"-> Sound.SC3.UGen.DB.ugenSummary "Streson"--> import Sound.SC3--> let {dt = recip (linExp (lfCub KR 0.1 (0.5 * pi)) (-1) 1 280 377)->     ;s = streson (lfSaw AR (mce2 220 180) 0 * 0.2) dt 0.9 * 0.3}-> in audition (out 0 s)
− Help/UGen/subsampleOffset.help.lhs
@@ -1,33 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SubsampleOffset"-    > Sound.SC3.UGen.DB.ugenSummary "SubsampleOffset"--> 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)
− Help/UGen/sum3.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Sum3"-    > Sound.SC3.UGen.DB.ugenSummary "Sum3"--> import Sound.SC3 {- hsc3 -}->-> g_01 = sum3 (sinOsc AR 440 0) (sinOsc AR 441 0) (sinOsc AR 442 0) * 0.1
− Help/UGen/sum4.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Sum4"-    > Sound.SC3.UGen.DB.ugenSummary "Sum4"--> import Sound.SC3 {- hsc3 -}->-> g_01 = sum4 (sinOsc AR 440 0) (sinOsc AR 441 0) (sinOsc AR 442 0) (sinOsc AR 443 0) * 0.1
− Help/UGen/sumSqr.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.sumsqr"-    > :t sumSqr--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = fSinOsc AR 800 0->         b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0->     in sumSqr a b * 0.125--Written out:--> g_02 =->     let a = fSinOsc AR 800 0->         b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0->     in (a * a + b * b) * 0.125
− Help/UGen/sweep.help.lhs
@@ -1,64 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Sweep"-> Sound.SC3.UGen.DB.ugenSummary "Sweep"--> import Sound.SC3--Using sweep to modulate sine frequency--> let {x = mouseX KR 0.5 20 Exponential 0.1->     ;t = impulse KR x 0->     ;f = sweep t 700 + 500}-> in audition (out 0 (sinOsc AR f 0 * 0.2))--Load audio to buffer--> let fn = "/home/rohan/data/audio/pf-c5.aif"-> in withSC3 (send (b_allocRead 0 fn 0 0))--Using sweep to index into a buffer--> let {x = mouseX KR 0.5 20 Exponential 0.1->     ;t = impulse AR x 0->     ;p = sweep t (bufSampleRate KR 0)}-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))--Backwards, variable offset--> let {n = lfNoise0 'α' KR 15->     ;x = mouseX KR 0.5 10 Exponential 0.1->     ;t = impulse AR x 0->     ;r = bufSampleRate KR 0->     ;p = sweep t (negate r) + (bufFrames KR 0 * n)}-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))--Raising rate--> let {x = mouseX KR 0.5 10 Exponential 0.1->     ;t = impulse AR x 0->     ;r = sweep t 2 + 0.5->     ;p = sweep t (bufSampleRate KR 0 * r)}-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))--f0 (sc-users, 2012-02-09)--> let {lf = range 0.01 1.25 (lfNoise2 'α' KR 1)->     ;du = duty AR lf 0 DoNothing lf->     ;tr = abs (hpz1 du) >* 0->     ;ph = sweep tr (1/du)->     ;fr = linExp ph 0 1 400 800->     ;os = sinOsc AR fr 0 * 0.2}-> in audition (out 0 os)--line segments, set start & end values, transition time and trigger.-continues past end point if not re-triggered.--> let {tr = tr_control "tr" 0->     ;st = control KR "st" 440->     ;en = control KR "en" 880->     ;tm = control KR "tm" 2->     ;rt = ((en - st) / tm)->     ;sw = sweep tr rt + st}-> in audition (out 0 (sinOsc AR sw 0 * 0.2))--> withSC3 (send (n_set (-1) [("st",660),("en",550),("tm",4),("tr",1)]))-> withSC3 (send (n_set (-1) [("st",110),("en",990),("tm",1),("tr",1)]))
− Help/UGen/switchDelay.help.lhs
@@ -1,13 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "SwitchDelay"-> Sound.SC3.UGen.DB.ugenSummary "SwitchDelay"--> import Sound.SC3--simple feedback delay-> audition (out 0 (switchDelay (soundIn 4) 1 1 1 0.99 20))--change the buffer read pointer periodically.-> let {ix = stepper (impulse KR 0.5 0) 0 0 3 1 0->     ;dt = select ix (mce [0.02,0.1,0.725,0.25])->     ;sd = switchDelay (soundIn 4) 1 1 dt 0.99 20}-> in audition (out 0 sd)
− Help/UGen/syncSaw.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "SyncSaw"-    > Sound.SC3.UGen.DB.ugenSummary "SyncSaw"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = line KR 100 800 12 RemoveSynth->     in syncSaw AR 100 f * 0.1--Mouse control--> g_02 =->     let sy_f = mouseY KR 80 220 Exponential 0.2->         sw_f = sy_f * mouseX KR 1 3 Linear 0.2->     in syncSaw AR sy_f sw_f * 0.1
− Help/UGen/t2K.help.lhs
@@ -1,22 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "T2K"-    > Sound.SC3.UGen.DB.ugenSummary "T2K"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let tr = impulse KR (mouseX KR 1 100 Exponential 0.2) 0->     in ringz (t2A tr 0) 800 0.01 * 0.4--compare with K2A (oscilloscope)--> g_02 =->     let tr = impulse KR 200 0->     in lag (mce2 (t2A tr 0) (k2A tr)) 0.001--removing jitter by randomising offset (C-cC-a at g_03)--> g_03 =->     let tr = impulse KR (mouseX KR 1 100 Exponential 0.2) 0->         o = range 0 (blockSize - 1) (whiteNoise 'α' KR)->     in ringz (t2A tr o) 880 0.1 * 0.4-
− Help/UGen/tBetaRand.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TBetaRand"-    Sound.SC3.UGen.DB.ugenSummary "TBetaRand"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> g_01 =->     let t = dust 'α' KR 10->         f = tBetaRand 'β' 300 3000 0.1 0.1 t->     in sinOsc AR f 0 * 0.1--mouse control of parameters--> g_02 =->     let t = dust 'α' KR 10->         p1 = mouseX KR 1 5 Linear 0.2->         p2 = mouseY KR 1 5 Linear 0.2->         f = tBetaRand 'β' 300 3000 p1 p2 t->     in sinOsc AR f 0 * 0.1
− Help/UGen/tBrownRand.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TBrownRand"-    Sound.SC3.UGen.DB.ugenSummary "TBrownRand"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> g_01 =->     let t = dust 'α' KR 10->         dist = mouseX KR 0 5 Linear 0.2->         f = tBrownRand 'β' 300 3000 1 dist t->     in sinOsc AR f 0 * 0.1--> g_02 =->     let t = dust 'α' KR 10->         n = tBrownRand 'β' 0 1 0.2 0 t->         f = linExp n 0 1 300 3000->         o = sinOsc AR f 0->         l = tBrownRand 'γ' (-1) 1 1 4 t->     in pan2 o l 0.1
− Help/UGen/tChoose.help.lhs
@@ -1,16 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TChoose"-    :t tChoose--tChoose is a composite of tIRand and select.--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR 1 1000 Exponential 0.1->         t = dust 'a' AR x->         f = midiCPS (tIRand 'b' 48 60 t)->         o = let a = mce [sinOsc AR f 0->                         ,saw AR (f * 2)->                         ,pulse AR (f * 0.5) 0.1]->             in tChoose 'c' t a->     in o * 0.1
− Help/UGen/tDelay.help.lhs
@@ -1,10 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TDelay"-    Sound.SC3.UGen.DB.ugenSummary "TDelay"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let z = impulse AR 2 0->         z' = tDelay z 0.5->         o = sinOsc AR 440 0 * 0.1->     in mce [z * 0.1,toggleFF z' * o]
− Help/UGen/tDuty.help.lhs
@@ -1,46 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "TDuty"-    > Sound.SC3.UGen.DB.ugenSummary "TDuty"--> import Data.List {- base -}-> import Sound.SC3 {- hsc3 -}--Play a little rhythm--> g_01 =->     let d = dseq 'α' dinf (mce [0.1, 0.2, 0.4, 0.3])->     in tDuty AR d 0 DoNothing 1 0--Amplitude changes--> g_02 =->     let d0 = dseq 'α' dinf (mce [0.1, 0.2, 0.4, 0.3])->         d1 = dseq 'β' dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])->     in ringz (tDuty AR d0 0 DoNothing d1 1) 1000 0.1--Mouse control.--> g_03 =->     let d = dseq 'α' dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])->         x = mouseX KR 0.003 1 Exponential 0.1->     in ringz (tDuty AR x 0 DoNothing d 1) 1000 0.1 * 0.5--Note that the 440 is the shorter pitch, since gap is set to false--> g_04 =->     let d0 = dser 'α' 12 (mce [0.1, 0.3])->         d1 = dser 'β' 12 (mce [440, 880])->         t = tDuty AR d0 0 RemoveSynth d1 0->     in sinOsc AR (latch t t) 0 * 0.1--Abstraction--> g_05 =->     let bp n d act = let (e,t) = unzip d->                          mk z l = dser z n (mce l)->                          sq = tDuty AR (mk 'α' t) 0 act (mk 'β' e) 0->                      in latch sq sq->         bp' d = bp (genericLength d) d->         tm m = let f (e,t) = (e,t * m) in map f->         f1 = midiCPS (bp 35 (tm 0.125 [(60,1),(63,1),(67,2),(68,1),(62,1)]) RemoveSynth)->         f2 = midiCPS (bp' [(60,1),(63,0.5),(67,0.5),(68,1),(62,1)] DoNothing)->     in sinOsc AR (mce2 f1 f2) 0 * 0.1
− Help/UGen/tExpRand.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "TExpRand"-    > Sound.SC3.UGen.DB.ugenSummary "TExpRand"--> import Sound.SC3 {- hsc3 -}--> g_01 :: UId m => m UGen-> g_01 = do->  f <- tExpRandM 300.0 3000.0 =<< dustM KR 10->  return (sinOsc AR f 0 * 0.1)
− Help/UGen/tGaussRand.help.lhs
@@ -1,21 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TGaussRand"-    Sound.SC3.UGen.DB.ugenSummary "TGaussRand"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> g_01 =->     let t = dust 'α' KR 10->         f = tGaussRand 'β' 300 3000 t->         o = sinOsc AR f 0->         l = tGaussRand 'γ' (-1) 1 t->     in  pan2 o l 0.1--compare to tRand--> g_02 =->     let t = dust 'α' KR 10->         f = tRand 'β' 300 3000 t->         o = sinOsc AR f 0->         l = tRand 'γ' (-1) 1 t->     in pan2 o l 0.1
− Help/UGen/tGrains.help.lhs
@@ -1,56 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "TGrains"-    > Sound.SC3.UGen.DB.ugenSummary "TGrains"--> import Sound.SC3 {- hsc3 -}--Load audio (#10) data--    > let fn = "/home/rohan/data/audio/pf-c5.aif"-    > withSC3 (async (b_allocRead 10 fn 0 0))--Mouse control--> g_01 =->     let tRate = mouseY KR 2 200 Exponential 0.1->         ctr = mouseX KR 0 (bufDur KR 10) Linear 0.1->         tr = impulse AR tRate 0->     in tGrains 2 tr 10 1 ctr (4 / tRate) 0 0.25 2--> g_02 =->     let b = 10->         rt = mouseY KR 8 120 Exponential 0.1->         dur = 4 / rt->         clk = dust 'α' AR rt->         r = tRand 'β' 0 0.01 clk->         pan = whiteNoise 'γ' KR * 0.6->         x = mouseX KR 0 (bufDur KR b) Linear 0.1->         pos = x + r->     in tGrains 2 clk b 1 pos dur pan 0.25 2--> g_03 =->     let b = 10->         rt = mouseY KR 2 120 Exponential 0.1->         dur = 1.2 / rt->         clk = impulse AR rt 0->         pos = mouseX KR 0 (bufDur KR b) Linear 0.1->         n0 = whiteNoise 'α' KR->         n1 = whiteNoise 'β' KR->         rate = shiftLeft 1.2 (roundTo (n0 * 3) 1)->     in tGrains 2 clk b rate pos dur (n1 * 0.6) 0.25 2--Demand UGens as inputs (may eventually hang scsynth?)--> g_04 =->     let b = 10->         rt = mouseY KR 2 100 Linear 0.2->         d e = dwhite e 1 0.1 0.2->         z e0 e1 = drand e0 1 (mce [dgeom e0 (diwhite e0 1 20 40) 0.1 (1 + d e0)->                                   ,dgeom e1 (diwhite e1 1 20 40) 1 (1 - d e1)])->         clk = impulse AR rt 0->         dsq e xs = dseq e dinf (mce xs)->         rate = dsq 'α' [1,1,z 'β' 'γ',0.5,0.5,0.2,0.1,0.1,0.1,0.1] * 2 + 1->         pos = dsq 'δ' (take 8 (zipWith z ['ε'..] ['ζ'..]))->         dur = dsq 'η' [1,d 'θ',1,z 'ι' 'κ',0.5,0.5,0.1,z 'λ' 'μ'] * 2 / rt->         pan = dsq 'ν' [1,1,1,0.5,0.2,0.1,0,0,0] * 2 - 1->         amp = dsq 'ξ' [1,0,z 'ο' 'π',0,2,1,1,0.1,0.1]->     in tGrains 2 clk b rate pos dur pan amp 2
− Help/UGen/tIRand.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "TIRand"-    > Sound.SC3.UGen.DB.ugenSummary "TIRand"--> import Sound.SC3 {- hsc3 -}--> g_01 :: UId m => m UGen-> g_01 = do->   l <- tIRandM (-1) 1 =<< dustM KR 10->   n <- pinkNoiseM AR->   return (pan2 (n * 0.1) l 1)--> g_02 :: UId m => m UGen-> g_02 = do->   n <- tIRandM 4 12 =<< dustM KR 10->   let f = n * 150 + (mce [0,1])->   return (sinOsc AR f 0 * 0.1)
− Help/UGen/tRand.help.lhs
@@ -1,16 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "TRand"-    > Sound.SC3.UGen.DB.ugenSummary "TRand"--> import Sound.SC3 {- hsc3 -}--> gr_01 =->     let t = dust 'α' KR (mce2 5 12)->         f = tRand 'β' (mce2 200 1600) (mce2 500 3000) t->     in sinOsc AR f 0 * 0.2--> gr_02_m = do->   t <- dustM KR (mce2 5 12)->   f <- tRandM (mce2 200 1600) (mce2 500 3000) t->   return (sinOsc AR f 0 * 0.2)--> gr_02 = uid_st_eval gr_02_m
− Help/UGen/tWindex.help.lhs
@@ -1,20 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TWindex"-    Sound.SC3.UGen.DB.ugenSummary "TWindex"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let p = mce [1/5, 2/5, 2/5]->         a = mce [400, 500, 600]->         t = impulse KR 6 0->         i = tWindex 'α' t 0 p->     in sinOsc AR (select i  a) 0 * 0.1--Modulating probability values--> g_02 =->     let p = mce [1/4, 1/2, sinOsc KR 0.3 0 * 0.5 + 0.5]->         a = mce [400, 500, 600]->         t = impulse KR 6 0->         i = tWindex 'α' t 1 p->     in sinOsc AR (select i a) 0 * 0.1
− Help/UGen/tartini.help.lhs
@@ -1,21 +0,0 @@-> Sound.SC3.UGen.Help.viewSC3Help "Tartini"-> Sound.SC3.UGen.DB.ugenSummary "Tartini"--> import Sound.SC3--Comparison of input frequency (x) and tracked oscillator frequency (f).--> let {x = mouseX KR 440 880 Exponential 0.1->     ;o = lfSaw AR x 0 * 0.05 {- sinOsc AR x 0 * 0.1 -}->     ;[f,e] = mceChannels (tartini KR o 0.2 2048 0 1024 0.5)->     ;r = sinOsc AR f 0 * 0.1->     ;t = impulse KR 4 0->     ;pf = poll t f (label "f") 0->     ;px = poll t x (label "x") 0}-> in audition (mrg [out 0 (mce2 o r),pf,px])--Fast test of live pitch tracking, not careful with amplitude of input--> let {z = soundIn 4->     ;[f,e] = mceChannels (tartini KR z 0.2 2048 0 1024 0.5)}-> in audition (out 0 (saw AR f * 0.05 * e))
− Help/UGen/thresh.help.lhs
@@ -1,8 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Operator.thresh"-    > :t thresh--> import Sound.SC3 {- hsc3 -}--low-rent gate--> g_01 = let n = lfNoise0 'α' AR 50 * 0.5 in thresh n 0.45
− Help/UGen/timer.help.lhs
@@ -1,8 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Timer"-    Sound.SC3.UGen.DB.ugenSummary "Timer"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let t = impulse KR (mouseX KR 0.5 20 Exponential 0.1) 0->     in sinOsc AR (timer t * 500 + 500) 0 * 0.2
− Help/UGen/toggleFF.help.lhs
@@ -1,9 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "ToggleFF"-    > Sound.SC3.UGen.DB.ugenSummary "ToggleFF"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let tr = dust 'α' AR (xLine KR 1 1000 60 DoNothing)->         fr = toggleFF tr * 400 + 800->     in sinOsc AR fr 0 * 0.1
− Help/UGen/tpv.help.lhs
@@ -1,28 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TPV"-    Sound.SC3.UGen.DB.ugenSummary "TPV"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins {- hsc3 -}--> fft_sz = 2048::Int-> hop_sz = fft_sz `div` 2-> fn_0 = "/home/rohan/data/audio/pf-c5.snd"-> fn_1 = "/home/rohan/data/audio/material/tyndall/var/talking-fragments/0001.WAV"-> tpv' b i = tpv (fft b i 0.5 1 1 0) (constant fft_sz) (constant hop_sz)--    > withSC3 (do {_ <- async (b_alloc 0 fft_sz 1)-    >             ;async (b_allocRead 1 fn_1 0 0)})--> g_01 =->     let i = playBuf 1 AR 1 (bufRateScale KR 1) 1 0 Loop DoNothing->         x = mouseX KR 1 70 Linear 0.1->         y = mouseY KR 0.25 3 Linear 0.1->         o = tpv' 0 i 70 x y 4 0.2->     in mce2 (i * 0.1) o--> g_02 =->     let i = playBuf 1 AR 1 (bufRateScale KR 1) 1 0 Loop DoNothing->         x = mouseX KR 0.1 100 Linear 0.1->         y = mouseY KR (-20) 40 Linear 0.1->         o = tpv' 0 i 50 50 1 x (dbAmp y)->     in pan2 o 0 1
− Help/UGen/trig.help.lhs
@@ -1,9 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Trig"-    Sound.SC3.UGen.DB.ugenSummary "Trig"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let d = dust 'α' AR 1->         o = fSinOsc AR 800 0 * 0.5->     in o * trig d 0.2
− Help/UGen/trig1.help.lhs
@@ -1,9 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "Trig1"-    Sound.SC3.UGen.DB.ugenSummary "Trig1"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let d = dust 'α' AR 1->         o = fSinOsc AR 800 0 * 0.2->     in o * trig1 d 0.2
− Help/UGen/trigControl.help.lhs
@@ -1,37 +0,0 @@-> import Sound.SC3 {- hsc3 -}--Graph with the three types of non-audio controls.--> g_01 =->     let freq = control KR "freq" 440->         phase = control IR "phase" 0->         gate' = tr_control "gate" 1->         amp = control KR "amp" 0.1->         e = envGen KR gate' amp 0 1 DoNothing (envASR 0.01 0.1 1 EnvLin)->     in sinOsc AR freq phase * e--Make a graph drawing--    > import Sound.SC3.UGen.Dot {- hsc3-ugen -}-    > draw (out 0 g_01)--Listen--    > audition_at (10,AddToHead,1,[]) (out 0 g_01)--Set frequency and the trigger gate.--    > withSC3 (send (n_set1 10 "freq" 2200))-    > withSC3 (send (n_set1 10 "gate" 1))--Make a control rate graph to write freq and gate values.--> g_02 = mce2 (tRand 'α' 220 2200 (dust 'β' KR 1)) (dust 'γ' KR 3)--Add it _before_ the node it will map to, the trigger is only on the bus for the current cycle.--    > audition_at (-1,AddBefore,10,[]) (out 0 g_02)--Map the control values at the audio graph.--    > withSC3 (send (n_map 10 [("freq",0),("gate",1)]))
− Help/UGen/twChoose.help.lhs
@@ -1,15 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TWChoose"--tWChoose is a composite of tWindex and select--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let x = mouseX KR 1 1000 Exponential 0.1->         d = dust 'α' AR x->         a = mce [sinOsc AR 220 0->                 ,saw AR 440->                 ,pulse AR 110 0.1]->         w = mce [0.5, 0.35, 0.15]->         o = tWChoose 'β' d a w 0->     in o * 0.1
− Help/UGen/twoPole.help.lhs
@@ -1,13 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TwoPole"-    Sound.SC3.UGen.DB.ugenSummary "TwoPole"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let n = whiteNoise 'α' AR->     in twoPole (n * 0.005) 2000 0.95--> g_02 =->     let n = whiteNoise 'α' AR->         f = xLine KR 800 8000 8 RemoveSynth->     in twoPole (n * 0.005) f 0.95
− Help/UGen/twoZero.help.lhs
@@ -1,9 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "TwoZero"-    Sound.SC3.UGen.DB.ugenSummary "TwoZero"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let n = whiteNoise 'α' AR->         f = xLine KR 20 20000 8 RemoveSynth->     in twoZero (n * 0.125) f 1
− Help/UGen/vDiskIn.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "VDiskIn"-    > Sound.SC3.UGen.DB.ugenSummary "VDiskIn"--> import Sound.SC3 {- hsc3 -}->-> fn_01 = "/home/rohan/data/audio/pf-c5.snd"-> nc_01 = 1-> msg_01 = [b_alloc 0 8192 nc_01,b_read 0 fn_01 0 (-1) 0 True]-> msg_02 = [b_close 0,b_free 0]--    > withSC3 (mapM_ async msg_01)--> g_01 = vDiskIn nc_01 0 (sinOsc KR 0.25 0 * 0.25 + 1) Loop 0--    > withSC3 (mapM_ async msg_02)
− Help/UGen/vOsc.help.lhs
@@ -1,35 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "VOsc"-    > Sound.SC3.UGen.DB.ugenSummary "VOsc"--> import Sound.OSC {- hosc -}-> import Sound.SC3 {- hsc3 -}--Allocate and fill tables 0 to 7.--> square a = a * a-> bf = [Normalise,Wavetable,Clear]-> gen_harm i =->     let n = square (i + 1)->         f j = square ((n - j) / n)->     in map f [0 .. n - 1]-> gen_setup i =->     let i' = fromIntegral i->     in (b_alloc i 1024 1,b_gen_sine1 i bf (gen_harm i'))-> run_setup (p,q) = (async p >> sendMessage q)--    > withSC3 (mapM_ (run_setup . gen_setup) [0 .. 7])--Oscillator at buffers 0 through 7, mouse selects buffer.--> g_01 =->     let x = mouseX KR 0 7 Linear 0.1->         y = mouseY KR 0.01 0.2 Exponential 0.2->     in vOsc AR x (mce [120, 121]) 0 * y--Reallocate buffers while oscillator is running.--    > import Sound.SC3.Lang.Random.IO {- hsc3-lang -}-    >-    > let resetTable i = do {h <- nrrand 12 0 1-    >                        ;sendMessage (b_gen_sine1 i bf h)}-    > in withSC3 (mapM_ resetTable [0 .. 7])
− Help/UGen/vOsc3.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "VOsc3"-    > Sound.SC3.UGen.DB.ugenSummary "VOsc3"--> import Sound.SC3 {- hsc3 -}--see vOsc help for code to allocate and fill tables 0 to 7...--oscillator at buffers 0 through 7, mouse selects buffer.--> g_01 =->     let x = mouseX KR 0 7 Linear 0.1->         y = mouseY KR 0.01 0.2 Exponential 0.2->         o1 = vOsc3 AR x 120 121 129->         o2 = vOsc3 AR x 119 123 127->     in mce2 o1 o2 * y
− Help/UGen/varLag.help.lhs
@@ -1,19 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "VarLag"-    Sound.SC3.UGen.DB.ugenSummary "VarLag"--Note: VarLag at sclang is a composite UGen, at hsc3 it's a direct-binding to the underlying UGen.--> import Sound.SC3 {- hsc3 -}--used to lag pitch--> g_01 =->     let x = mouseX KR 220 440 Linear 0.2->     in sinOsc AR (mce [x, varLag x 1 0 5 x]) 0 * 0.1--compare to lag UGen--> g_02 =->     let x = mouseX KR 220 440 Linear 0.2->     in sinOsc AR (mce [x, lag x 1]) 0 * 0.1
− Help/UGen/varSaw.help.lhs
@@ -1,30 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "VarSaw"-    > Sound.SC3.UGen.DB.ugenSummary "VarSaw"--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = lfPulse KR (mce2 3 3.03) 0 0.3 * 200 + 200->         w = linLin (lfTri KR 1 0) (-1) 1 0 1->     in varSaw AR f 0 w * 0.1--Compare with lfPulse at AR--> g_02 =->     let f = lfPulse KR 3 0 0.3 * 200 + 200->     in mce [varSaw AR f 0 0.2->            ,lfPulse AR f 0 0.2] * 0.1--per-note width modulation--> g_03 =->     let d = linLin (lfNoise2 'α' KR 0.1) (-1) 1 0.15 0.5->         t = impulse AR (1 / d) 0->         w0 = tRand 'β' 0 0.35 t->         w1 = tRand 'γ' 0.65 1 t->         w = phasor AR t ((w1 - w0) * sampleDur) w0 w1 0->         e = decay2 t 0.1 d->         f = midiCPS (tRand 'δ' 36 72 t)->         o = varSaw AR f 0 w * e * 0.1->         l = tRand 'ε' (-1) 1 t->     in pan2 o l 1
− Help/UGen/vibrato.help.lhs
@@ -1,48 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Vibrato"-    > Sound.SC3.UGen.DB.ugenSummary "Vibrato"--> import Sound.SC3 {- hsc3 -}--vibrato at 1 Hz, note the use of DC.ar--    {SinOsc.ar(Vibrato.ar(DC.ar(400.0),1,0.02))*0.1}.play--> g_01 =->     let v = vibrato 'α' AR (dc AR 400) 1 0.02 0 0 0.04 0.1 0->     in sinOsc AR v 0 * 0.1--compare: k-rate freq input can be a constant--    {SinOsc.ar(Vibrato.kr(400.0,1,0.02))}.play--> g_02 =->     let v = vibrato 'α' KR 400 1 0.02 0 0 0.04 0.1 0->     in sinOsc AR v 0 * 0.1--control rate and rateVariation--    {x=MouseX.kr(2.0,100.0)-    ;y=MouseY.kr(0.0,1.0)-    ;v=Vibrato.ar(DC.ar(400.0),x,0.1,1.0,1.0,y,0.1)-    ;SinOsc.ar(v)}.play--> g_03 =->     let x = mouseX KR 2 100 Linear 0.2->         y = mouseY KR 0 1 Linear 0.2->         v = vibrato 'α' AR (dc AR 400) x 0.1 1 1 y 0.1 0->     in sinOsc AR v 0 * 0.1--control depth and depthVariation--    {n=LFNoise1.kr(1,3,7)-    ;x=MouseX.kr(0.0,1.0)-    ;y=MouseY.kr(0.0,1.0)-    ;v=Vibrato.ar(DC.ar(400.0),n,x,1.0,1.0,y,0.1)-    ;SinOsc.ar(v)}.play--> g_04 =->     let n = lfNoise1 'α' KR 1 * 3 + 7->         x = mouseX KR 0 1 Linear 0.2->         y = mouseY KR 0 1 Linear 0.2->         v = vibrato 'β' AR (dc AR 400) n x 1 1 y 0.1 0->     in sinOsc AR v 0 * 0.1
− Help/UGen/vosim.help.lhs
@@ -1,31 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "VOSIM"-    > Sound.SC3.UGen.DB.ugenSummary "VOSIM"--> import Sound.SC3 {- hsc3 -}-> import qualified Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins as E {- hsc3 -}--> gr_00 =->     let trg = impulse AR 100 0->         frq = mouseX KR 440 880 Exponential 0.2->         n_cycles = 3->         dcy = 0.1->     in E.vosim trg frq n_cycles dcy * 0.25--> gr_01 =->     let p = tRand 'α' 0 1 (impulse AR 6 0)->         t = impulse AR (9 * ( 1 + ( p >* 0.95))) 0->         x = mouseX KR 0.25 2 Linear 0.2->         y = mouseY KR 0.25 0.75 Linear 0.2->         z = 9->         rng i = linLin i (-1) 1->         mk_n e = rng (lfNoise2 e KR z) 0.25 2->         tR e ll rl = tRand e (mce ll) (mce rl)->         f = tR 'β' [40,120,220] [440,990,880] t->         n = tR 'γ' [4] [8,16,32] t->         d = tR 'δ' [0.2,0.4,0.6] [0.6,0.8,1] t->         a = tR 'ε' [0] [0.05,0.15,0.25] t->         l = tR 'ζ' [-1] [1] t->         xn = mk_n 'η'->         yn = mk_n 'θ'->         v = E.vosim t (f * x * xn) n (d * y * yn) * a->     in pan2 (mix v) l 1
− Help/UGen/warp1.help.lhs
@@ -1,26 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "Warp1"-    > Sound.SC3.UGen.DB.ugenSummary "Warp1"--> import Sound.SC3 {- hsc3 -}--    > let fn = "/home/rohan/data/audio/pf-c5.aif"-    > withSC3 (async (b_allocRead 10 fn 0 0))--> g_01 =->     let p = linLin (lfSaw KR 0.05 0) (-1) 1 0 1->         x = mouseX KR 0.5 2 Linear 0.1->     in warp1 1 10 p x 0.1 (-1) 8 0.1 2--real-time (delayed) input--    > withSC3 (async (b_alloc 10 8192 1))--> g_02 =->     let i = soundIn 4->         r = recordBuf AR 10 0 1 0 1 Loop 1 DoNothing i->         ph = (8192 / sampleRate) * 2 * pi->         p = lfSaw KR (1 / bufDur KR 10) ph * 0.5 + 0.5->         x = mouseX KR 0.5 2 Linear 0.2->         y = mouseY KR 0.01 0.2 Linear 0.2->         w = warp1 1 10 p x 0.1 (-1) 8 y 4->     in mrg2 (i + w) r
− Help/UGen/waveTerrain.help.lhs
@@ -1,78 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "WaveTerrain"-    > Sound.SC3.UGen.DB.ugenSummary "WaveTerrain"--> import Sound.SC3 {- hsc3 -}--Terrain function--> ter_f (x,y) =->     let a = x ** 2->         b = abs (sin (10 * y)) ** (1/3)->     in 2 * (a + b) - 1--Create terrain given function.--> gen_t z =->     let w = 100 {- width -}->         h = 50 {- height -}->         tk n = take (round n)->         xs = tk w [0,1/w ..]->         ys = tk h [0,1/h ..]->         ix = map (\y -> map (\x -> (x,y)) xs) ys->         add_z = map (\(x,y) -> (x,y,z (x,y)))->     in concatMap add_z ix--Confirm terrain--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_p3_pt [gen_t ter_f]--Create table.--> tbl' = map (\(_,_,z) -> z) (gen_t ter_f)--Confirm table--    plotTable [tbl']--Send table to scsynth--    withSC3 (async (b_alloc_setn1 0 0 tbl'))--Hear terrain--> gr_01 =->     let x' = mouseX KR 1 200 Exponential 0.2->         y' = mouseY KR 1 300 Exponential 0.2->         x = abs (sinOsc AR x' 0) + lfNoise2 'α' AR 2->         y = abs (sinOsc AR y' (pi / 2))->         b = 0->     in waveTerrain AR b x y 100 50--Alternate terrain function.--> ter_f' (x,y) =->     let a = (cos(5 * x + 1.7)) ** 3->         b = abs (sin (23 * y)) ** (1/3)->     in (a - b)--Free buffer--    withSC3 (async (b_free 0))--Gerate mesh given terrain given function.--> gen_mesh z =->     let w = 100 {- width -}->         h = 50 {- height -}->         tk n = take (round n)->         xs = tk w [0,1/w ..]->         ys = tk h [0,1/h ..]->         ix0 = map (\y -> map (\x -> (x,y)) xs) ys->         ix1 = map (\x -> map (\y -> (x,y)) ys) xs->         add_z = map (\(x,y) -> (x,y,z (x,y)))->     in (map add_z ix0,map add_z ix1)--Confirm terrain mesh--    plot_p3_ln ((\(p,q) -> p ++ q) (gen_mesh ter_f))
− Help/UGen/whiteNoise.help.lhs
@@ -1,64 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "WhiteNoise"-    > Sound.SC3.UGen.DB.ugenSummary "WhiteNoise"--> import Sound.SC3 {- hsc3 -}--> g_01 = whiteNoise 'α' AR * 0.05--Random filtered noise bursts.--> g_02 =->     let n = whiteNoise 'α' AR->         t = dust 'β' AR (mce [3, 7])->         f = tExpRand 'γ' 20 1800 t->         bw = tExpRand 'δ' 0.001 1 t->         e = decay2 t 0.01 0.2->     in resonz (n * e) f bw--Monadic form of above graph.--> g_03 :: UId m => m UGen-> g_03 = do->   n <- whiteNoiseM AR->   t <- dustM AR (mce [3, 7])->   f <- tExpRandM 20 1800 t->   bw <- tExpRandM 0.001 1 t->   let e = decay2 t 0.01 0.2->   return (resonz (n * e) f bw)--The same graph again, without using do notation.--> g_04 :: UId m => m UGen-> g_04 =->     whiteNoiseM AR >>= \n ->->     dustM AR (mce [3, 7]) >>= \t ->->     tExpRandM 20 1800 t >>= \f ->->     tExpRandM 0.001 1 t >>= \bw ->->     let e = decay2 t 0.01 0.2->     in return (resonz (n * e) f bw)--Drawing--    import Sound.SC3.Plot {- hsc3-plot -}-    plot_ugen1 0.01 (whiteNoise 'γ' AR)-    plot_ugen1 0.05 (lpf (whiteNoise 'γ' AR) 500)--    import Sound.SC3.Plot.FFT {- hsc3-plot -}-    plot_ugen_fft1 0.1 (whiteNoise 'α' AR)--![](sw/hsc3/Help/SVG/whiteNoise.0.svg)-![](sw/hsc3/Help/SVG/whiteNoise.1.svg)-![](sw/hsc3/Help/SVG/whiteNoise.2.svg)--Speaker balance--> g_05 = let n = whiteNoise 'α' AR * 0.1 in mce2 n n--> g_06 =->     let x = mouseX KR 0.1 2 Linear 0.2->         l = sinOsc KR x 0->         n = whiteNoise 'α' AR->     in pan2 n l 0.1--> g_07 = hpz1 (whiteNoise 'α' AR * 0.01)-
− Help/UGen/wrapIndex.help.lhs
@@ -1,17 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "WrapIndex"-    > Sound.SC3.UGen.DB.ugenSummary "WrapIndex"--> import Sound.SC3 {- hsc3 -}--    > withSC3 (async (b_alloc_setn1 0 0 [200,300,400,500,600,800]))--> g_01 =->     let x = mouseX KR 0 18 Linear 0.1->         f = wrapIndex 0 x->     in sinOsc AR f 0 * 0.1--> g_02 =->     let b = asLocalBuf 'α' [200,300,400,500,600,800]->         x = mouseX KR 0 18 Linear 0.1->         f = wrapIndex b x->     in sinOsc AR f 0 * 0.1
− Help/UGen/wt_FilterScale.help.lhs
@@ -1,13 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "WT_FilterScale"-    Sound.SC3.UGen.DB.ugenSummary "WT_FilterScale"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.Wavelets {- hsc3 -}--> g_01 =->     let i = whiteNoise 'α' AR * 0.2->         b = localBuf 'β' 2048 1->         c = dwt b i 0.5 0 1 0 0->         x = mouseX KR (-1) 1 Linear 0.1->         c' = wt_FilterScale c x->     in pan2 (idwt c' 0 0 0) x 1
− Help/UGen/wt_TimeWipe.help.lhs
@@ -1,13 +0,0 @@-    Sound.SC3.UGen.Help.viewSC3Help "WT_TimeWipe"-    Sound.SC3.UGen.DB.ugenSummary "WT_TimeWipe"--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.Wavelets {- hsc3 -}--> g_01 =->     let i = whiteNoise 'α' AR * 0.2->         b = localBuf 'β' 2048 1->         c = dwt b i 0.5 0 1 0 0->         x = mouseX KR 0 1 Linear 0.1->         c' = wt_TimeWipe c x->     in pan2 (idwt c' 0 0 0) (x * 2 - 1) 1
− Help/UGen/xFade2.help.lhs
@@ -1,6 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "XFade2"-    > Sound.SC3.UGen.DB.ugenSummary "XFade2"--> import Sound.SC3 {- hsc3 -}--> g_01 = xFade2 (saw AR 440) (sinOsc AR 440 0) (lfTri KR 0.1 0) 0.1
− Help/UGen/xLine.help.lhs
@@ -1,10 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "XLine"-    > Sound.SC3.UGen.DB.ugenSummary "XLine"--Note: SC3 reorders mul and add inputs to precede the doneAction input.--> import Sound.SC3 {- hsc3 -}--> g_01 =->     let f = xLine KR 200 17000 10 RemoveSynth->     in sinOsc AR f 0 * 0.1
− Help/UGen/xOut.help.lhs
@@ -1,15 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "XOut"-    > Sound.SC3.UGen.DB.ugenSummary "XOut"--> import Sound.SC3 {- hsc3 -}--Send signal to a bus, crossfading with existing contents.--> g_01 =->     let p a b = sinOsc AR (mce [a, b]) 0 * 0.1->         x = mouseX KR 0 1 Linear 0.1->         y = mouseY KR 0 1 Linear 0.1->     in mrg [out  0   (p 220 221)->            ,xOut 0 x (p 330 331)->            ,xOut 0 y (p 440 441)->            ,out  0   (p 120 121)]
− Help/UGen/zeroCrossing.help.lhs
@@ -1,8 +0,0 @@-    > Sound.SC3.UGen.Help.viewSC3Help "ZeroCrossing"-    > Sound.SC3.UGen.DB.ugenSummary "ZeroCrossing"--> import Sound.SC3 {- hsc3 -}->-> g_01 =->     let a = sinOsc AR (sinOsc KR 1 0 * 600 + 700) 0 * 0.1->     in mce [a, impulse AR (zeroCrossing a) 0 * 0.25]
− Help/UGen/zitaRev1.help.lhs
@@ -1,35 +0,0 @@-faust2supercollider zita_rev1.dsp-http://kokkinizita.linuxaudio.org/linuxaudio/zita-rev1-doc/quickguide.html--delay, lin,   0.02,    0.1,     0.04-xover, log,  50.0,  1000.0,   200.0-rtlow, log,   1.0,     8.0,     3.0-rtmid, log,   1.0,     8.0,     2.0-fdamp, log,   1.5e3,  24.0e3,   6.0e3-eq1fr, log,  40.0,     2.5e3, 160.0-eq1gn, lin, -15.0,    15.0,     0.0-eq2fr, log, 160.0,    10.0e3,   2.5e3-eq2gn, lin, -15.0,    15.0,     0.0-opmix, lin,   0.0,     1.0,     0.5-level, lin,  -9.0,     9.0,   -20.0--> import Sound.SC3 {- hsc3 -}-> import Sound.SC3.UGen.Bindings.HW.External.Zita {- hsc3 -}--default settings--> g_01 =->     let i = soundIn 0->     in zitaRev1 i i 0.04 200 3 2 6000 160 0 2500 0 0.5 (-6)--longer--> g_02 =->     let i = soundIn 0->     in zitaRev1 i i 0.08 200 6 4 6000 190 (-6) 3500 6 0.5 0--longer still--> g_03 =->     let i = soundIn 0->     in zitaRev1 i i 0.1 200 6 8 6000 190 (-6) 3500 6 0.5 0
+ Help/Ugen/abs.help.hs view
@@ -0,0 +1,2 @@+-- abs+abs (syncSaw ar 100 440 * 0.1)
+ Help/Ugen/absDif.help.hs view
@@ -0,0 +1,2 @@+-- absdif+fSinOsc ar 440 0 * (0.1 `absDif` (fSinOsc ar 2 0 * 0.2))
+ Help/Ugen/acos.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "ArcCos"+Sound.Sc3.Plot.plot_fn_r1_ln acos (-1,1)
+ Help/Ugen/add.help.hs view
@@ -0,0 +1,13 @@+-- add (+)+let o = fSinOsc ar 800 0+    n = pinkNoiseId 'α' ar+in (o + n) * 0.1++-- add ; dc offset+fSinOsc ar 440 0 * 0.1 + 0.5++-- add ; optimise identity (rhs)+(sinOsc ar 440 0 + 0) * 0.1++-- add ; optimise identity (lhs)+(0 + sinOsc ar 440 0) * 0.1
+ Help/Ugen/allpassC.help.hs view
@@ -0,0 +1,10 @@+-- allpassC ; allpass delay has no audible effect as a resonator on steady state sound+let dly = xLine kr 0.0001 0.01 20 RemoveSynth+    n = whiteNoiseId 'α' ar * 0.05+in allpassC n 0.01 dly 0.2++-- allpassC ; cubic variant+let dly = xLine kr 0.0001 0.01 20 RemoveSynth+    n = whiteNoiseId 'δ' ar * 0.05+in n + allpassC n 0.01 dly 0.2+
+ Help/Ugen/allpassL.help.hs view
@@ -0,0 +1,4 @@+-- allpassL ; linear variant+let n = whiteNoiseId 'γ' ar * 0.05+    dly = xLine kr 0.0001 0.01 20 RemoveSynth+in n + allpassL n 0.01 dly 0.2
+ Help/Ugen/allpassN.help.hs view
@@ -0,0 +1,16 @@+-- allpassN ; add input to the filtered sound to hear the effect of the phase comb+let n = whiteNoiseId 'β' ar * 0.05+    dly = xLine kr 0.0001 0.01 20 RemoveSynth+in n + allpassN n 0.01 dly 0.2++-- allpassN ; used as an echo, c.f. comb ; outputs signal immediately (inverted), lower amplitude+let n = whiteNoiseId 'ε' ar+    d = dustId 'ζ' ar 1+    src = decay (d * 0.25) 0.2 * n+in allpassN src 0.2 0.2 3++-- allpassN ; phasing ; warning=feedback+let i = soundIn (mce2 0 1) -- two channels of input signal+    f = mouseX kr 0.1 1.0 Linear 0.2 -- phaser freq+    e = allpassN i 0.02 (sinOsc kr f 0 * 0.01 + 0.01) 1 -- max delay of 20msec+in i + e -- sum phase-shifted signal to original signal
+ Help/Ugen/amClip.help.hs view
@@ -0,0 +1,2 @@+-- amClip+amClip (whiteNoiseId 'α' ar) (fSinOsc kr 1 0 * 0.05)
+ Help/Ugen/ampComp.help.hs view
@@ -0,0 +1,12 @@+-- ampComp ; mouse frequency control+let freq = mouseX kr 300 15000 Exponential 0.2+in sinOsc ar freq 0 * 0.1 * ampComp kr freq 300 0.3333++-- ampComp ; modified exponent+let freq = mouseX kr 300 15000 Exponential 0.2+in pulse ar freq 0.5 * 0.1 * ampComp kr freq 300 1.3++-- ampComp ; in frequency modulation+let freq1 = mouseX kr 300 15000 Exponential 0.2+    freq2 = freq1 * (sinOsc ar (mouseY kr 3 200 Exponential 0.2) 0 * 0.5 + 1)+in sinOsc ar freq2 0 * 0.1 * ampComp ar freq2 300 0.3333
+ Help/Ugen/ampDb.help.hs view
@@ -0,0 +1,2 @@+-- ambDb+sinOsc ar (ampDb (line kr 0 1 5 DoNothing) * 2 + 180) 0 * dbAmp (-45)
+ Help/Ugen/amplitude.help.hs view
@@ -0,0 +1,14 @@+-- amplitude ; control gain+let s = soundIn 0+    a = amplitude kr s 0.01 0.01+in pulse ar 90 0.3 * a++-- amplitude ; control frequency+let s = soundIn 0+    f = amplitude kr s 0.5 0.5 * 1200 + 400+in sinOsc ar f 0 * 0.1++-- amplitude+let s = soundIn 0+    a = amplitude ar s 0.5 0.05+in s * a
+ Help/Ugen/analogBassDrum.help.hs view
@@ -0,0 +1,20 @@+-- analogBassDrum+let trig = dust2Id 'α' kr 8+    infsustain = 0.0+    accent = 0.25+    freq = tExpRandId 'β' 40 120 trig+    tone = tRandId 'γ' 0.0 0.35 trig+    decay = 0.15+    attackfm = tRandId 'δ' 0.1 0.2 trig+    selffm = tRandId 'ε' 0.1 0.9 trig+    sig = X.analogBassDrum ar trig infsustain accent freq tone decay attackfm selffm+in pan2 sig (tRandId 'ζ' (-1) 1 trig) 1++-- analogBassDrum ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 25 + 24)+          tr = trig g controlDur+          selffm = tRandId 'α' 0.1 0.9 tr+          sig = X.analogBassDrum ar tr 0 z freq y rx (ry `in_range` (0.1,0.2)) selffm+      in pan2 sig (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2
+ Help/Ugen/analogPhaser.help.hs view
@@ -0,0 +1,25 @@+-- analogPhaser+let drywet = 0+    amp = 0.01+    pan = 0+    osc = X.varShapeOsc ar 110 0.5 (sinOsc kr 0.0915 0 `in_range` (0,1)) 1 151+    skew = sinOsc kr 0.059 0+    feedback = sinOsc kr 0.005 pi `in_range` (0,0.85)+    modulation = sinOsc kr 0.0192 two_pi `in_range` (0,1)+    stages = 50+    flt = X.analogPhaser osc (sinOsc ar 0.22 0) skew feedback modulation stages+in pan2 (xFade2 osc flt drywet 1) pan amp++-- analogPhaser ; controls+let k = control kr+    drywet = k "drywet" 0+    amp = k "amp" 0.01+    pan = k "pan" 0+    freq = k "freq" 110+    osc = X.varShapeOsc ar freq 0.5 (sinOsc kr 0.0915 0 `in_range` (0,1)) 1 151+    skew = sinOsc kr 0.059 0+    feedback = sinOsc kr 0.005 pi `in_range` (0,0.85)+    modulation = sinOsc kr 0.0192 two_pi `in_range` (0,1)+    stages = control_m kr "stage" 50 (8,50,"lin")+    flt = X.analogPhaser osc (sinOsc ar 0.22 0) skew feedback modulation stages+in pan2 (xFade2 osc flt drywet 1) pan amp
+ Help/Ugen/analogPhaserMod.help.hs view
@@ -0,0 +1,7 @@+-- analogPhaserMod+let amp = 0.25+    osc = sinOsc ar (lfNoise2Id 'α' ar 10 * 1000) 0+    flt = X.analogPhaserMod osc 0 1.0 50+    drywet = lfSaw ar 0.1 0+    sig = xFade2 (sinOsc ar (osc * 401.0) 0) (sinOsc ar (flt * 401.0) 0) drywet amp+in pan2 sig 0 1
+ Help/Ugen/analogSnareDrum.help.hs view
@@ -0,0 +1,18 @@+-- analogSnareDrum+let trig = dust2Id 'α' kr 8+    infsustain = 0.0+    accent = 0.25+    freq = tExpRandId 'β' 40 220  trig+    tone = tRandId 'γ' 0.0 0.4 trig+    decay = tRandId 'δ' 0.1 0.8 trig+    snappy = tRandId 'ε' 0.0 0.9  trig+    sig = X.analogSnareDrum ar trig infsustain accent freq tone decay snappy+in pan2 sig (tRandId 'ζ' (-1) 1 trig) 0.1++-- analogSnareDrum ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 25 + 36)+          tr = trig g controlDur+          sig = X.analogSnareDrum ar tr 0 z freq y rx (ry * 2)+      in pan2 sig (o * 2 - 1) (lagUD g 0 2)+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/analogTape.help.hs view
@@ -0,0 +1,22 @@+-- analogTape+let freq = control kr "freq" 110+    width = control kr "width" 0.5+    bias = control kr "bias" 0.5+    saturation = control kr "saturation" 0.5+    drive = control kr "drive" 0.5+    sig = varSaw ar freq 0 width+in mce2 (sig * 0.05) (X.analogTape sig bias saturation drive 1 0 * 0.1)++-- analogTape ; event control+let bias = control kr "bias" 0.25+    saturation = control kr "saturation" 0.25+    drive = control kr "drive" 0.25+    f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 12 + 48)+          width = y+          sig = varSaw ar freq 0 width+      in pan2 (X.analogTape sig (bias + rx) (saturation + ry) (drive + o) 1 0) (o * 2 - 1) (z * g)+in mix (voicer 12 f) * control kr "gain" 1++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0.75 "audio" 0
+ Help/Ugen/analogVintageDistortion.help.hs view
@@ -0,0 +1,14 @@+-- analogVintageDistortion+let amp = control kr "amp" 0.025+    drivegain = control kr "drivegain" 0.85+    bias = control kr "bias" 0.1+    lowgain = control kr "lowgain" (dbAmp (-3))+    highgain = control kr "highgain" (dbAmp (-9))+    shelvingfreq = control_m kr "shelvingfreq" 600 (200,800,"exp")+    oversample = control_m kr "oversample" 1 (0,1,"switch")+    sig = sinOsc ar (sinOsc kr 1 0 `in_exprange` (80,1000)) 0+    flt = X.analogVintageDistortion sig drivegain bias lowgain highgain shelvingfreq oversample+in mce2 (sig * 0.5) flt * amp++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0
+ Help/Ugen/arrayMax.help.hs view
@@ -0,0 +1,4 @@+-- arrayMax+let son = sinOsc ar (mce [100, 100.3 .. 110]) 0+    (val,_ix) = unmce2 (X.arrayMax son)+in mce2 (son * 0.02) (leakDC val 0.995 * 0.02) -- the operation tends to induce DC offset
+ Help/Ugen/arrayMin.help.hs view
@@ -0,0 +1,4 @@+-- arrayMin+let son = sinOsc ar (mce [100, 100.3 .. 110]) 0+    (val,_ix) = unmce2 (X.arrayMin son)+in mce2 (son * 0.02) (leakDC val 0.995 * 0.02) -- the operation tends to induce DC offset
+ Help/Ugen/asin.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "ArcSin"+Sound.Sc3.Plot.plot_fn_r1_ln asin (-1,1)
+ Help/Ugen/atan.help.hs view
@@ -0,0 +1,2 @@+-- atan ; Sound.Sc3.Plot.plot_fn_r1_ln atan (-5,5)+sinOsc ar (atan (sinOsc kr 0.5 0) * 200 + 300) 0 * 0.05
+ Help/Ugen/atan2.help.hs view
@@ -0,0 +1,9 @@+-- atan2 ; pan hypot doppler example, atan2 finds direction of source, speakers at +/- 45 degrees+let x = 10+    y = lfSaw kr (1 / 6) 0 * 100+    d = hypot x y+    a = 40 / (squared d)+    s = rlpf (fSinOsc ar 200 0 * lfPulse ar 31.3 0 0.4) 400 0.3+    z = atan2E y x+    l = clip2 (z / (pi / 2)) 1+in pan2 (delayL s (110 / 344) (d / 344)) l a
+ Help/Ugen/atari2600.help.hs view
@@ -0,0 +1,27 @@+-- atari2600+X.atari2600 ar 1 2 3 4 5 5 1++-- atari2600+X.atari2600 ar 2 3 10 10 5 5 1++-- atari2600+let x = mouseX kr 0 15 Linear 0.1+    y = mouseY kr 0 15 Linear 0.1+in X.atari2600 ar x y 10 10 5 5 1++-- atari2600+let x = mouseX kr 0 31 Linear 0.1+    y = mouseY kr 0 31 Linear 0.1+in X.atari2600 ar 2 3 x y 5 5 1++-- atari2600+let x = mouseX kr 0 15 Linear 0.1+    y = mouseY kr 0 15 Linear 0.1+in X.atari2600 ar 2 3 10 10 x y 1++-- atari2600+let x = mouseX kr 0 15 Linear 0.1+    o1 = sinOsc kr 0.35 0 * 7.5 + 7.5+    y = mouseY kr 0 31 Linear 0.1+    o2 = sinOsc kr 0.3 0 * 5.5 + 5.5+in X.atari2600 ar x o1 10 y o2 5 1
+ Help/Ugen/audioMSG.help.hs view
@@ -0,0 +1,5 @@+-- audioMSG+X.audioMSG (sinOsc ar 220 0 * 0.05) (mouseX kr 0 (2 * pi) Linear 0.2)++-- audioMSG ; warning=feedback+X.audioMSG (soundIn 0) (mouseX kr 0 (2 * pi) Linear 0.2)
+ Help/Ugen/ay.help.hs view
@@ -0,0 +1,30 @@+-- ay ; default parameters+X.ay ar 1777 1666 1555 1 7 15 15 15 4 1 0++-- ay ; mouse control+let tonea = mouseY kr 10 3900 Exponential 0.2+    toneb = mouseX kr 10 3900 Exponential 0.2+    ctl = 3+    vola = 14+    volb = 14+    volc = 0+    s = X.ay ar tonea toneb 1555 1 ctl vola volb volc 4 1 0+in pan2 s 0 0.25++-- ay ; auto-pilot+let rate = mouseX kr 0.1 10 Linear 0.2+    rng l r i = linLin i (-1) 1 l r+    mk_ctlId e l r = rng l r (lfdNoise3Id e kr rate)+    mk_ctl_0Id e l r = rng l r (lfdNoise0Id e kr rate)+    tonea = mk_ctlId 'α' 10 3900+    toneb = mk_ctlId 'β' 10 3900+    tonec = mk_ctlId 'γ' 10 3900+    n = mk_ctlId 'δ' 0 31+    ctl = mk_ctl_0Id 'ε' 0 31+    vola = mk_ctlId 'ζ' 0 15+    volb = mk_ctlId 'η' 0 15+    volc = mk_ctlId 'θ' 0 15+    efreq = mk_ctlId 'ι' 0 4095+    estyle = mk_ctlId 'κ' 0 15+    s = X.ay ar tonea toneb tonec n ctl vola volb volc efreq estyle 0+in pan2 s 0 0.5
+ Help/Ugen/bAllPass.help.hs view
@@ -0,0 +1,15 @@+-- bAllPass ; thoughpass ; warning=feedback+let i = soundIn (mce2 0 1)+    f = mouseX kr 10 18000 Exponential 0.2+in bAllPass i f 0.8 * 0.2++-- bAllPass ; bandpass ; warning=feedback+let i = soundIn (mce2 0 1) * 0.5+    f = mouseX kr 100 18000 Exponential 0.2+in bAllPass i f 0.8 + negate i++-- bAllPass ; calculate coefficients and use sos ; warning=feedback+let i = soundIn (mce2 0 1) * 0.5+    f = mouseX kr 100 18000 Exponential 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bAllPassCoef sampleRate f 0.8+in sos i a0 a1 a2 b1 b2 + negate i
+ Help/Ugen/bBandPass.help.hs view
@@ -0,0 +1,12 @@+-- bBandPass ; warning=feedback+let i = soundIn 0+    f = mouseX kr 20 20000 Exponential 0.2+    bw = mouseY kr 0 10 Linear 0.2+in bBandPass i f bw++-- bBandPass ; calculate coefficients and use sos ; warning=feedback+let i = soundIn 0+    f = mouseX kr 20 20000 Exponential 0.2+    bw = mouseY kr 0 10 Linear 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bBandPassCoef sampleRate f bw+in sos i a0 a1 a2 b1 b2
+ Help/Ugen/bBandStop.help.hs view
@@ -0,0 +1,18 @@+-- bBandStop ; warning=feedback+let i = soundIn (mce2 0 1)+    f = mouseX kr 20 20000 Exponential 0.2+    bw = mouseY kr 0 10 Linear 0.2+in bBandStop i f bw++-- bBandStop ; drill+let i = sinOsc ar 1000 0+    f = mouseX kr 800 1200 Exponential 0.2+    bw = mouseY kr 0 10 Linear 0.2+in bBandStop i f bw * 0.1++-- calculate coefficients and use sos ; warning=feedback+let i = soundIn (mce2 0 1)+    f = mouseX kr 800 1200 Exponential 0.2+    bw = mouseY kr 0 10 Linear 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bBandStopCoef sampleRate f bw+in sos i a0 a1 a2 b1 b2
+ Help/Ugen/bGen.help.hs view
@@ -0,0 +1,20 @@+-- bGenSin1Tbl ; osc+let tbl = bGenSine1Tbl ("tbl", 0, 8192) [1, 1/2, 1/3, 1/4, 1/5]+in osc ar tbl 220 0 * 0.1++-- bGenSin1Tbl ; bufRd+let tbl = bGenSine1Tbl ("tbl", 0, 8192) [1, 1/2, 1/3, 1/4, 1/5]+    x = mouseX kr 220 440 Exponential 0.2+    phase = linLin (lfSaw ar x 0) (-1) 1 0 1 * bufFrames kr tbl+in bufRdC 1 ar tbl phase Loop * 0.1++-- bGenCheby ; shaper ; mouse control+let z = sinOsc ar 400 (pi / 2) * mouseY kr 0.01 1 Exponential 0.2+    t = bGenChebyTbl ("tbl", 0, 4096) [1, 0, 1, 1, 0, 1]+in shaper t z * 0.1++---- ; sine1 table setup ; allocate and generate wavetable buffer ; sin harmonics+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1, b_gen_sine1 0 [Normalise,Wavetable,Clear] [1, 1/2, 1/3, 1/4, 1/5]])++---- ; print scsynth, the interpreter value that holds the reference that stores the end brackets+scsynthPrint scsynth
+ Help/Ugen/bHiPass.help.hs view
@@ -0,0 +1,12 @@+-- bHiPass+let i = pinkNoiseId 'α' ar+    f = mouseX kr 10 20000 Exponential 0.2+    rq = mouseY kr 0 1 Linear 0.2+in bHiPass i f rq * 0.05++-- bHiPass ; calculate coefficients and use sos (see also bHiPass4)+let i = pinkNoiseId 'α' ar+    f = mouseX kr 10 20000 Exponential 0.2+    rq = mouseY kr 0 1 Linear 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bHiPassCoef sampleRate f rq+in sos i a0 a1 a2 b1 b2 * 0.05
+ Help/Ugen/bHiPass4.help.hs view
@@ -0,0 +1,5 @@+-- bHiPass4+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.3)+    f = mouseX kr 20 20000 Exponential 0.2+    rq = mouseY kr 0.1 1 Linear 0.2+in bHiPass4 i f rq
+ Help/Ugen/bHiShelf.help.hs view
@@ -0,0 +1,18 @@+-- bHiShelf ; warning=feedback+let i = soundIn 0+    f = mouseX kr 2200 18000 Exponential 0.2+    db = mouseY kr 18 (-18) Linear 0.2+in bHiShelf i f 1 db * 0.25++-- bHiShelf ; warning=feedback+let i = soundIn 0+    f = mouseX kr 2200 18000 Exponential 0.2+    rs = mouseY kr 0.1 1 Linear 0.2+in bHiShelf i f rs 6 * 0.25++-- bHiShelf ; calculate coefficients and use sos ; warning=feedback+let i = soundIn 0+    f = mouseX kr 2200 18000 Exponential 0.2+    rs = mouseY kr 0.1 1 Linear 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bHiShelfCoef sampleRate f rs 6+in sos i a0 a1 a2 b1 b2
+ Help/Ugen/bLowPass.help.hs view
@@ -0,0 +1,24 @@+-- bLowPass ; warning=feedback+let i = soundIn (mce2 0 1)+    f = mouseX kr 10 20000 Exponential 0.2+    rq = mouseY kr 0 1 Linear 0.2+in bLowPass i f rq++-- bLowPass+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.05)+    cf = mouseX kr 100 20000 Exponential 0.2 -- center-frequency+    rq = mouseY kr 0.1 1 Linear 0.2 -- reciprocal of Q+in bLowPass i cf rq++-- bLowPass ; calculate coefficients and use sos (see also bLowPass4)+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.05)+    cf = mouseX kr 100 20000 Exponential 0.2+    rq = mouseY kr 0.1 1 Linear 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bLowPassCoef sampleRate cf rq+in sos i a0 a1 a2 b1 b2++-- bLowPass ; modulate center-frequency+bLowPass (whiteNoiseId 'α' ar) (xLine kr 24000 20 10 DoNothing) 1 * 0.05++-- bLowPass ; modulate reciprocal of Q+bLowPass (whiteNoiseId 'α' ar) 1200 (xLine kr 0.5 100 10 DoNothing) * 0.05
+ Help/Ugen/bLowPass4.help.hs view
@@ -0,0 +1,5 @@+-- bLowPass4+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.3)+    f = mouseX kr 100 20000 Exponential 0.2+    rq = mouseY kr 0.1 1 Linear 0.2+in bLowPass4 i f rq
+ Help/Ugen/bLowShelf.help.hs view
@@ -0,0 +1,21 @@+-- bLowShelf ; warning=feedback+let i = soundIn (mce2 0 1)+    freq = mouseX kr 40 6000 Exponential 0.2+    rs = 1+    db = mouseY kr 24 (-24) Linear 0.2+in bLowShelf i freq rs db * 0.5++-- bLowShelf ; warning=feedback+let i = soundIn (mce2 0 1)+    freq = mouseX kr 20 6000 Exponential 0.2+    rs = mouseY kr 0.1 1 Linear 0.2+    db = 6+in bLowShelf i freq rs db * 0.5++-- bLowShelf ; calculate coefficients and use sos ; warning=feedback+let i = soundIn (mce2 0 1)+    freq = mouseX kr 20 6000 Exponential 0.2+    rs = mouseY kr 0.1 1 Linear 0.2+    db = 6+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bLowShelfCoef sampleRate freq rs db+in sos i a0 a1 a2 b1 b2 * 0.5
+ Help/Ugen/bMoog.help.hs view
@@ -0,0 +1,19 @@+-- bMoog ; modes are: 0 = lowpass, 1 = highpass, 2 = bandpass+let md = control kr "mode" 0+    dup u = mce2 u u+    x = mouseX kr 20 12000 Exponential 0.2+    o = dup (lfSaw ar (mce2 (x * 0.99) (x * 1.01)) 0 * 0.1)+    cf = sinOsc kr (sinOsc kr 0.1 0) (1.5 * pi) * 1550 + 1800+    y = mouseY kr 1 0 Linear 0.2+    sig = X.bMoog o cf y md 0.95+in (combN sig 0.5 (mce2 0.4 0.35) 2 * 0.4) + (sig * 0.5)++-- bMoog ; event control+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+      let md = constant c `modE` 3+          f0 = linExp x 0 1 20 12000+          sig = lfSaw ar (mce2 (f0 * 0.99) (f0 * 1.01)) 0 * ry * 0.4+          cf = sinOsc kr (sinOsc kr 0.1 0) (1.5 * pi) * rx * 1550 + 1800+          flt = X.bMoog sig cf y md 0.95+      in pan2 ((combN flt 0.5 (mce2 0.4 0.35) 2 * 0.4) + (flt * 0.5)) (o * 2 - 1) (lagUD g 0 3 * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/bPeakEQ.help.hs view
@@ -0,0 +1,40 @@+-- bPeakEQ+let i = pinkNoiseId 'α' ar * 0.1+    freq = mouseX kr 2200 18000 Exponential 0.2+    db = mouseY kr (-12) 12 Linear 0.2+in bPeakEQ i freq 0.8 db * 0.5++-- bPeakEQ+let i = pinkNoiseId 'α' ar * 0.1+    freq = mouseX kr 2200 18000 Exponential 0.2+    rq = mouseY kr 10 0.4 Linear 0.2+in bPeakEQ i freq rq 6 * 0.5++-- bPeakEQ ; calculate coefficients and use sos (see also bLowPass4)+let i = pinkNoiseId 'α' ar * 0.1+    freq = mouseX kr 2200 18000 Exponential 0.2+    rq = mouseY kr 10 0.4 Linear 0.2+    (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bPeakEqCoef sampleRate freq rq 6+in sos i a0 a1 a2 b1 b2 * 0.5++-- bPeakEQ ; parametric+let hf z = bPeakEQ+           z+           (control_m kr "hfFreq" 4000 (800,20000,"exp"))+           (control_m kr "hfRQ" 1 (0.01,2,"lin"))+           (control_m kr "hfGain" 0 (-15,15,"lin"))+    mf z = bPeakEQ+           z+           (control_m kr "mfFreq" 1000 (200,5000,"exp"))+           (control_m kr "mfRQ" 1 (0.01,2,"lin"))+           (control_m kr "mfGain" 0 (-15,15,"lin"))+    lf z = bPeakEQ+           z+           (control_m kr "lfFreq" 100 (20,500,"exp"))+           (control_m kr "lfRQ" 1 (0.01,2,"lin"))+           (control_m kr "lfGain" 0 (-15,15,"lin"))+    sig = pinkNoiseId 'α' ar * 0.1+in hf (mf (lf sig))++---- ; drawings+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/balance2.help.hs view
@@ -0,0 +1,33 @@+-- balance2+let l = lfSaw ar 44 0+    r = pulse ar 33 0.5+    p = fSinOsc kr 0.5 0+in balance2 l r p 0.1++-- balance2+let [s0,s1] = mceChannels (sinOsc ar (mce2 440 550) 0)+    n = lfNoise0Id 'α' kr 4+in balance2 s0 s1 n 0.3++-- balance2+let s = sinOsc ar 440 0+    p = sinOsc kr 0.2 0+in balance2 s s p 1 * 0.2++-- balance2+let s = sinOsc ar 440 0+    p = sinOsc kr 0.2 0+in balance2 s s p 0.2++-- balance2+let s0 = sinOsc ar 440 0+    s1 = sinOsc ar 550 0+    x = mouseX kr (-1) 1 Linear 0.2+in balance2 s0 s1 x 0.2++-- balance2+let s = pinkNoiseId 'α' ar+    l = lpf s 500+    h = s - l+    n = lfNoise2Id 'β' kr 4+in balance2 l h n 0.1
+ Help/Ugen/beatTrack.help.hs view
@@ -0,0 +1,11 @@+-- beatTrack+let c = localBufId 'α' 1 1024+    i = soundIn 0+    x = mouseX kr (-1) 1 Linear 0.2+    [b, h, q, t] = mceChannels (beatTrack kr (fft' c i) x)+    f = mce [440, 660, 880]+    a = mce [0.4, 0.2, 0.1]+    s = mix (sinOsc ar f 0 * a * decay (mce [b, h, q]) 0.05)+in i + s++
+ Help/Ugen/bezier.help.hs view
@@ -0,0 +1,52 @@+-- bezier ; reference sine tone+sinOsc ar 440 0 * 0.1++-- bezier ; bezier approximation of sin function+X.bezier ar 100 0.0001 440 0 (mce [0,0,0.2,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1++-- bezier+let x = mouseX kr 40 4000 Exponential 0.2+in X.bezier ar 100 0.0001 x 0 (mce [0,0,0.2,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1++-- bezier+let x = mouseX kr 40 4000 Exponential 0.2+    y = mouseY kr 0.1 0.2 Linear 0.2+in X.bezier ar 100 0.0001 x 0 (mce [0,0,y,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1++-- bezier ; dynamic shifting of control points, oscillator+let rt = ar+    (f0,f1) = (200,205)+    f2 = 2+    wId z l r = range l r (lfdNoise3Id z rt f2)+    s = X.bezier rt 100 0.0001 (wId 'α' f0 f1) 0 (mce [0,0,wId 'β' 0.05 0.25,-1.3,wId 'γ' 0.25 0.45,-1.3+                                                     ,0.5,0,wId 'δ' 0.55 0.75,1.3,wId 'ε' 0.75 0.95,1.3+                                                     ,1,0])+in pan2 s (iRandId 'α' (-1) 1) 0.1++-- bezier ; dynamic shifting of control points, amplitude modulator+let rt = kr+    (f0,f1) = (0.15,16)+    f2 = 0.5+    wId z l r = range l r (lfdNoise3Id z rt f2)+    s = X.bezier rt 100 0.0001 (wId 'α' f0 f1) 0 (mce [0,0,wId 'β' 0.05 0.25,-1.3,wId 'γ' 0.25 0.45,-1.3+                                                     ,0.5,0,wId 'δ' 0.55 0.75,1.3,wId 'ε' 0.75 0.95,1.3+                                                     ,1,0])+in soundIn 0 * range 0.25 1 s++-- bezier ; event control+let f (_,g,_,y,z,o,rx,ry,p,px,_) =+      let w i l r = linLin i 0 1 l r+          freq = midiCps (p * 127 + leakDC px 0.995)+          s = X.bezier ar 20 0.004 freq 0 (mce [0,0,w y 0.05 0.25,-1.3,w rx 0.25 0.45,-1.3+                                                         ,0.5,0,w ry 0.55 0.75,1.3,w o 0.75 0.95,1.3+                                                         ,1,0])+      in pan2 s (o * 2 - 1) (z * lagUD g 0 (1 + y * 0.65))+in mix (voicer 16 f) * control kr "gain" 0.5++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+let u = X.bezier ar 440 0 (mce [0,0,0.2,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1+plot_ugen_nrt (48000,64) 0.012 u+plot_ugen1 0.01 u++---- ; see hcg-minus:Data.CG.Minus.Bezier for rendering bezier curves as wavetable
+ Help/Ugen/blOsc.help.hs view
@@ -0,0 +1,18 @@+-- blOsc+let freq = randId 'α' 55 220+    width = randId 'β' 0 1+    waveform = iRandId 'γ' 0 2+in pan2 (X.blOsc ar freq width waveform) (randId 'δ' (-1) 1) (randId 'ε' 0.02 0.1)++-- blOsc ; k-rate (not implemented for width/waveform)+let tr = dustId 'α' kr 2+    freq = tRandId 'β' 55 220 tr+    width = tRandId 'γ' 0 1 tr+    waveform = tiRandId 'δ' 0 2 tr+in pan2 (X.blOsc ar freq width waveform) (tRandId 'ε' (-1) 1 tr) (tRandId 'ζ' 0.02 0.1 tr)++-- blOsc ; k-rate (not implemented for width/waveform)+let freq = control_m kr "freq" 110 (55,880,"exp")+    width = control_m kr "width" 0.5 (0,1,"lin")+    waveform = control_m kr "waveform" 0 (0,2,"lin")+in X.blOsc ar freq width waveform * 0.1
+ Help/Ugen/blip.help.hs view
@@ -0,0 +1,28 @@+-- blip+blip ar 440 200 * 0.1++-- blip ; modulate frequency+let f = xLine kr 20000 200 6 RemoveSynth in blip ar f 100 * 0.1++-- blip ; modulate number of harmonics+let nh = line kr 1 100 20 RemoveSynth in blip ar 200 nh * 0.2++-- blip ; self-modulation at control rate+let fr = blip kr 0.25 3 * 300 + 500+    nh = blip kr 0.15 2 * 20 + 21+in blip ar fr nh * 0.2++-- blip ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) = pan2 (blip ar (midiCps (x * 13 + 48)) (y * 10 + 1)) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 0.5++-- blip ; event control (p)+let f (_,g,_,_,z,o,rx,_,p,px,_) =+      let f0 = midiCps (p * 127 + px)+          nh = max 0 rx * 10 + 1+      in pan2 (blip ar f0 nh) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 0.5++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (blip ar 1000 20)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (blip ar 1000 20)
+ Help/Ugen/blitB3.help.hs view
@@ -0,0 +1,13 @@+-- blitB3+X.blitB3 ar (xLine kr 10000 20 10 DoNothing) * 0.2++-- blitB3 ; spot the aliasing+impulse ar (xLine kr 10000 20 10 DoNothing) 0 * 0.2++-- blitB3 ; sawtooth+let x = mouseX kr 20 1000 Exponential 0.2+in leakDC (integrator (X.blitB3 ar x * 0.2) 0.99) 0.995++-- blitB3 ; sawtooth, super-saw, can integrate, accumulates DC+let x = mouseX kr 1 4 Linear 0.2+in mix (leakDC (integrator (X.blitB3 ar (x * mce [220,221,223,224]) * 0.125) 0.99) 0.995)
+ Help/Ugen/blitB3Saw.help.hs view
@@ -0,0 +1,11 @@+-- blitB3Saw+let f = xLine kr 1000 20 10 DoNothing+in X.blitB3Saw ar f 0.99 * 0.1++-- blitB3Saw ; aliasing suddenly appears for very high frequencies+let f = mouseX kr 10 10000 Exponential 0.2+    c = mouseY kr 0.01 0.99 Linear 0.2+in X.blitB3Saw ar f c * 0.1++-- blitB3Saw ; comparison+mce2 (saw ar 20) (X.blitB3Saw ar 20 0.99) * 0.1
+ Help/Ugen/blitB3Square.help.hs view
@@ -0,0 +1,19 @@+-- blitB3Square+let x = mouseX kr 20 400 Exponential 0.2+in X.blitB3Square ar x 0.99 * 0.1++-- blitB3Square+let f = xLine kr 1000 20 10 DoNothing+in X.blitB3Square ar f 0.99 * 0.1++-- blitB3Square ; aliasing at high frequencies+let f = mouseX kr 20 10000 Exponential 0.2+    c = mouseY kr 0.001 0.999 Linear 0.2+in X.blitB3Square ar f c * 0.1++-- blitB3Square ; consider difference in CPU usage (excessive wire use,-w 1024)+let sqr_osc rt freq = X.blitB3Square rt freq 0.99 -- pulse rt f 0.5+    f z = midiCps (range 36 72 (lfNoise0Id z kr (randId z 2 3)))+    l z = randId z (-1) 1+    o z = pan2 (sqr_osc ar (f z) * 0.1) (l z) 0.1+in sum (map o [0::Int .. 99])
+ Help/Ugen/blitB3Tri.help.hs view
@@ -0,0 +1,27 @@+-- blitB3Tri+X.blitB3Tri ar (xLine kr 1000 20 10 DoNothing) 0.99 0.99 * 0.1++-- blitB3Tri ; aliasing at higher frequencies (over 5000Hz or so) is very beautiful in point scope+let x = mouseX kr 20 8000 Exponential 0.2+    y = mouseY kr 0.001 0.99 Linear 0.2+in X.blitB3Tri ar x 0.99 y * 0.1++-- blitB3Tri ; aliasing at higher frequencies (over 5000Hz or so) is very beautiful in point scope+let x = mouseX kr 20 8000 Exponential 0.2+    y = mouseY kr 0.001 0.99 Linear 0.2+    z = X.blitB3Tri ar x 0.99 y * 0.1+in mce2 z (delayN z 0.2 (sampleDur * control_m kr "sampleDelay" 12 (0,64,"lin")))++-- c.f. lfTri ; more efficient, some aliasing from 3000hz ; less harmonics for lower fundamentals+let x = mouseX kr 20 8000 Exponential 0.2+in lfTri ar x 0 * 0.1++-- blitB3Tri ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 12 + 48)+      in pan2 (X.blitB3Tri ar freq (1 - (rx * 0.05)) y) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.25++----- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 2+UI.ui_scope_rju 512 100.0 ("embed",9) 2 (512,512) 4.0
+ Help/Ugen/blockSize.help.hs view
@@ -0,0 +1,5 @@+-- blockSize ; default block size is 64 samples+sinOsc ar (mce2 (blockSize * 3) (64 * 3 + 1)) 0 * 0.1++-- blockSize+sinOsc ar (mce2 (blockSize * 3) ((controlDur * sampleRate * 3) + 1)) 0 * 0.1
+ Help/Ugen/bpf.help.hs view
@@ -0,0 +1,26 @@+-- bpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in bpf (saw ar 200 * 0.5) f 0.3++-- bpf+let x = mouseX kr 100 10000 Exponential 0.2+in bpf (saw ar 200 * 0.5) x 0.3++-- bpf+let n = whiteNoiseId 'α' ar+    x = mouseX kr 220 440 Exponential 0.1+    y = mouseY kr 0.01 0.2 Linear 0.1+in bpf n (mce [x, 550 - x]) y++-- bpf ; of control signals+let vib = bpf (pinkNoiseId 'α' kr) (mouseX kr 1 100 Exponential 0.2) 0.3 * 10+in sinOsc ar (vib * 200 + 600) 0 * 0.1++-- bpf ; ln 2021-04-11 https://lukasnowok.github.io/spectrology/+let n = bpf (whiteNoiseId 'α' ar) 10000 (xLine ar 2 0.002 20 DoNothing)+    o = sinOsc ar 10000 0 * xLine ar 0.001 0.3 20 DoNothing+in (n + o) * 0.1++---- ; drawings+Ui.ui_baudline 4096 50 "linear" 2+Sound.Sc3.Plot.Fft.plot_ugen_fft1 0.05 (bpf (whiteNoiseId 'α' ar) 440 0.01)
+ Help/Ugen/bpz2.help.hs view
@@ -0,0 +1,2 @@+-- bpz2+let n = whiteNoiseId 'α' ar in bpz2 (n * 0.1)
+ Help/Ugen/brf.help.hs view
@@ -0,0 +1,5 @@+-- brf+let i = saw ar 200 * 0.1+    freq = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3800 + 4000+    rq = 0.3+in brf i freq rq
+ Help/Ugen/brownNoise.help.hs view
@@ -0,0 +1,11 @@+-- brownNoise+brownNoiseId 'α' ar * 0.1++-- brownNoise ; kr rate noise as frequency control+let n = brownNoiseId 'α' kr+in sinOsc ar (linExp n (-1) 1 64 9600) 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (brownNoiseId 'γ' ar)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (brownNoiseId 'γ' ar)+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/brz2.help.hs view
@@ -0,0 +1,4 @@+-- brz2+let n = whiteNoiseId 'α' ar * 0.05+    x = mouseX kr (-1) 1 Linear 0.1+in xFade2 n (brz2 n) x 1
+ Help/Ugen/bufAllpassC.help.hs view
@@ -0,0 +1,6 @@+-- bufAllpassC ; filtered decaying noise bursts+let b = localBufId 'α' 1 44100+    d = dustId 'β' ar 1+    n = whiteNoiseId 'γ' ar+    x = decay d 0.2 * n * 0.25+in bufAllpassC b x 0.25 6
+ Help/Ugen/bufAllpassL.help.hs view
@@ -0,0 +1,6 @@+-- bufAllpassL ; filtered decaying noise bursts+let b = localBufId 'α' 1 44100+    d = dustId 'β' ar 1+    n = whiteNoiseId 'γ' ar+    x = decay d 0.2 * n * 0.25+in bufAllpassL b x 0.25 6
+ Help/Ugen/bufAllpassN.help.hs view
@@ -0,0 +1,6 @@+-- bufAllpassN ; filtered decaying noise bursts+let b = localBufId 'α' 1 44100+    d = dustId 'β' ar 1+    n = whiteNoiseId 'γ' ar+    x = decay d 0.2 * n * 0.25+in bufAllpassN b x 0.25 6
+ Help/Ugen/bufChannels.help.hs view
+ Help/Ugen/bufCombC.help.hs view
@@ -0,0 +1,19 @@+-- bufCombC ; comb filter as resonator ; resonant fundamental is reciprocal of the delay time+let b = localBufId 'α' 1 44100+    n = whiteNoiseId 'β' ar+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombC b (n * 0.1) dt 0.2 * 0.05++-- bufCombC ; with negative feedback+let b = localBufId 'α' 1 44100+    n = whiteNoiseId 'β' ar+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombC b (n * 0.1) dt (-0.2) * 0.05++-- bufCombC ; used as an echo (filtered decaying noise bursts)+let b = localBufId 'α' 1 44100+    d = dustId 'β' ar 1+    n = whiteNoiseId 'γ' ar+    i = decay (d * 0.5) 0.2 * n+in bufCombC b i 0.2 3+
+ Help/Ugen/bufCombL.help.hs view
@@ -0,0 +1,6 @@+-- bufCombL ; comb filter as resonator ; resonant fundamental is reciprocal of the delay time+let b = localBufId 'α' 1 44100+    n = whiteNoiseId 'β' ar+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombL b (n * 0.1) dt 0.2 * 0.05+
+ Help/Ugen/bufCombN.help.hs view
@@ -0,0 +1,6 @@+-- bufCombN ; comb filter as resonator ; resonant fundamental is reciprocal of the delay time+let b = localBufId 'α' 1 44100+    n = whiteNoiseId 'β' ar+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombN b (n * 0.1) dt 0.2 * 0.05+
+ Help/Ugen/bufDelayC.help.hs view
@@ -0,0 +1,20 @@+-- bufDelayC ; dust randomly triggers decay to create an envelope+let b = localBufId 'α' 1 44100+    t = dustId 'β' ar 1+    n = whiteNoiseId 'γ' ar+    d = decay t 0.5 * n * 0.2+in bufDelayC b d 0.2 + d++-- bufDelayC ; mouse control for delay time+let b = localBufId 'α' 1 44100+    t = dustId 'β' ar 1+    n = whiteNoiseId 'γ' ar+    d = decay t 0.3 * n * 0.2+    x = mouseX kr 0.0 0.2 Linear 0.1+in d + bufDelayC b d x++-- bufDelayC+let b = localBufId 'α' 1 44100+    o = sinOsc ar (lfNoise2Id 'β' kr 0.5 * 100 + 110) 0 * 0.05+    d = abs (lfNoise2Id 'γ' kr 0.25)+in mce2 o (bufDelayC b o d)
+ Help/Ugen/bufDelayL.help.hs view
@@ -0,0 +1,5 @@+-- bufDelayL+let b = localBufId 'α' 1 44100+    o = sinOsc ar (lfNoise2Id 'β' kr 0.5 * 100 + 110) 0 * 0.05+    d = abs (lfNoise2Id 'γ' kr 0.25)+in mce2 o (bufDelayL b o d)
+ Help/Ugen/bufDelayN.help.hs view
@@ -0,0 +1,5 @@+-- bufDelayN+let b = localBufId 'α' 1 44100+    o = sinOsc ar (lfNoise2Id 'β' kr 0.5 * 100 + 110) 0 * 0.05+    d = abs (lfNoise2Id 'γ' kr 0.25)+in mce2 o (bufDelayN b o d)
+ Help/Ugen/bufDur.help.hs view
@@ -0,0 +1,14 @@+-- bufDur ; requires=buf ; read without loop, trigger reset based on buffer duration+let (b, nc) = (control kr "buf" 100, 2)+    t = impulse ar (recip (bufDur kr b)) 0+    p = sweep ar t (bufSampleRate kr b)+in bufRd nc ar b p NoLoop LinearInterpolation * 0.1++-- bufDur ; requires=buf ; bufDur = bufFrames / bufSampleRate+let (b, nc) = (control kr "buf" 100, 2)+    t = impulse ar (bufSampleRate kr b / bufFrames kr b) 0+    p = sweep ar t (bufSampleRate kr b)+in bufRd nc ar b p NoLoop LinearInterpolation * 0.1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/bufFrames.help.hs view
@@ -0,0 +1,13 @@+-- bufFrames ; requires=buf ; read without loop, trigger reset based on buffer duration+let (b, nc) = (control kr "buf" 100, 2)+    p = phasor ar 0 (bufRateScale kr b) 0 (bufFrames kr b) 0+in bufRdL nc ar b p NoLoop * 0.1++-- bufFrames ; requires=buf ; mouse location drags play head+let (b, nc) = (control kr "buf" 100, 2)+    r = mce [0.05, 0.075 .. 0.15]+    p = k2a (mouseX kr 0 (bufFrames kr b) Linear r)+in mix (bufRdL nc ar b p NoLoop) * 0.1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/bufGrain.help.hs view
@@ -0,0 +1,9 @@+-- bufGrain ; requires=buf+let b = control kr "buf" 100+    x = mouseX kr 0.5 8 Linear 0.2+    y = mouseY kr 0.05 0.2 Linear 0.2+    e = envGen kr 1 1 0 1 RemoveSynth (envelope [0, 1, 0] [3, 2] [EnvSin, EnvSin])+in X.bufGrain ar (impulse kr 10 0) y b x e 2++---- ; load buffer+withSc3 (async (b_allocRead 0 (sfResolve "instr/celeste/long/13-C4-long.wav") 0 0))
+ Help/Ugen/bufRateScale.help.hs view
@@ -0,0 +1,23 @@+-- bufRateScale ; requires=buf ; read without loop, trigger reset based on buffer duration+let b = control kr "buf" 100+    r = bufRateScale kr b+    p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5++-- bufRateScale ; requires=buf ; read buffer at ~ 3/4 reported sample rate+let b = control kr "buf" 100+    r = midiRatio (-5) * bufRateScale kr b+    p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5++-- bufRateScale ; requires=buf ; bufRateScale = bufSampleRate / sampleRate+let b = control kr "buf" 100+    r = midiRatio (-5) * (bufSampleRate kr b / sampleRate)+    p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5++-- bufRateScale ; requires=buf ; bufRateScale = bufSampleRate * sampleDur+let b = control kr "buf" 100+    r = midiRatio (-5) * (bufSampleRate kr b * sampleDur)+    p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5
+ Help/Ugen/bufRd.help.hs view
@@ -0,0 +1,39 @@+-- bufRd ; requires=buf ; phasor as phase input ; constructors bufRd{N|L|C} preset interpolation type+let (buf, nc) = (control kr "buf" 100, 2)+    tr = impulse ar (recip (bufDur kr buf)) 0+    ph = phasor ar tr (bufRateScale kr buf) 0 (bufFrames kr buf) 0+in bufRdL nc ar buf ph NoLoop++-- bufRd ; requires=buf ; audio rate sine oscillator as phase input+let (buf, nc) = (control kr "buf" 100, 2)+    phase = sinOsc ar 0.1 0 * bufFrames kr buf * bufRateScale kr buf+in bufRdL nc ar buf phase Loop++-- bufRd ; requires=buf ; mouse control+let (buf, nc) = (control kr "buf" 100, 2)+    x = mouseX kr (mce [5, 10]) 100 Linear 0.1+    n = lfNoise1Id 'α' ar x+in mix (bufRdL nc ar buf (n * bufFrames kr buf * bufRateScale kr buf) Loop)++-- bufRd ; fixed frequency wavetable oscillator ; c.f. osc+let (buf, nc) = (asLocalBuf (Gen.sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]), 1)+    x = mouseX kr 220 440 Exponential 0.2+    phase = linLin (lfSaw ar x 0) (-1) 1 0 1 * bufFrames kr buf+in bufRdC nc ar buf phase Loop * 0.1++-- bufRd ; requires=buf ; fixed frequency wavetable oscillator ; c.f. osc+let (buf, nc) = (control kr "tbl" 0, 1)+    x = mouseX kr 220 440 Exponential 0.2+    phase = linLin (lfSaw ar x 0) (-1) 1 0 1 * bufFrames kr buf+in bufRdC nc ar buf phase Loop * 0.1++---- ; setup ; nc=1+withSc3 (async (b_allocRead 0 (sfResolve "metal.wav") 0 0))++---- ; setup ; nc=2+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "instr/bosendorfer/008/C5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "instr/bosendorfer/032/C4.aif") 0 0))++---- ; setup ; nc=1 gen=sine1 ; allocate and generate (non-wavetable) buffer+withSc3 (mapM_ maybe_async [b_alloc 0 256 1,b_gen_sine1 0 [Normalise, Clear] [1, 1/2, 1/3, 1/4, 1/5]])
+ Help/Ugen/bufSampleRate.help.hs view
@@ -0,0 +1,7 @@+-- bufSampleRate ; requires=buf ; frequency as fraction of buffer sample-rate (ie. 48000 / 100 == 480)+let b = control kr "buf" 100+    f = mce [bufSampleRate kr b * 0.01, 440]+in sinOsc ar f 0 * 0.1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/bufWr.help.hs view
@@ -0,0 +1,19 @@+-- bufWr+let b = localBufId 'α' 1 (sampleRate * 2)+    o = sinOsc ar (lfNoise1Id 'β' kr 2 * 300 + 400) 0 * 0.1+    ph z = phasor ar 0 (bufRateScale kr b * z) 0 (bufFrames kr b) 0+    w = bufWr b (ph (mouseX kr 0.25 1 Linear 0.2)) Loop o+    r = bufRdL 1 ar b (ph (mouseY kr 0.25 16 Linear 0.2)) Loop+in mrg2 r w++-- bufWr+let wr_rt = control kr "wr-rate" 1+    rd_rt = control kr "rd-rate" 1+    b = localBufId 'α' 1 (sampleRate * 2)+    o = sinOsc ar (lfNoise1Id 'β' kr 2 * 300 + 400) 0 * 0.1+    w = bufWr b (phasor ar 0 (bufRateScale kr b * wr_rt) 0 (bufFrames kr b) 0) Loop o+in bufRdL 1 ar b (phasor ar 0 (bufRateScale kr b * rd_rt) 0 (bufFrames kr b) 0) Loop++---- ; set read & write rates independently+withSc3 (Sound.OSC.sendMessage (n_set1 1 "wr-rate" 0.5))+withSc3 (Sound.OSC.sendMessage (n_set1 1 "rd-rate" 13.0))
+ Help/Ugen/cOsc.help.hs view
@@ -0,0 +1,29 @@+-- cOsc ; fixed beat frequency+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10])+in cOsc ar tbl 200 0.7 * 0.1++-- cOsc ; modulate beat frequency with mouseX+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10])+in cOsc ar tbl 200 (mouseX kr 0 4 Linear 0.2) * 0.1++-- cOsc ; compare with plain osc+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10])+    f g = g ar tbl 200 (mouseX kr 0 4 Linear 0.2)+in xFade2 (f cOsc) (f osc) (lfTri kr 0.1 0) 0.1++-- cOsc ; fixed beat frequency ; requires=tbl+cOsc ar (control kr "tbl" 0) 200 0.7 * 0.1++-- cOsc ; modulate beat frequency with mouseX ; requires=tbl+cOsc ar (control kr "tbl" 0) 200 (mouseX kr 0 4 Linear 0.2) * 0.1++-- cOsc ; compare with plain osc ; requires=tbl+let f g = g ar (control kr "tbl" 0) 200 (mouseX kr 0 4 Linear 0.2)+in xFade2 (f cOsc) (f osc) (lfTri kr 0.1 0) 0.1++---- ; setup ; allocate and fill wavetable+withSc3 (mapM_ maybe_async [b_alloc 0 512 1,b_gen_sine1 0 [Normalise,Wavetable,Clear] [1,1/2,1/3,1/4,1/5,1/6,1/7,1/8,1/9,1/10]])++---- ; drawings+withSc3 (mapM_ maybe_async [b_alloc 1 512 1,b_gen_sine1 1 [Normalise,Wavetable,Clear] [1]])+Sound.Sc3.Plot.plot_ugen1 0.1 (cOsc ar 1 100 5)
+ Help/Ugen/changed.help.hs view
@@ -0,0 +1,15 @@+-- changed ; simple composition of hpz1 and greater_than (pseudo ugen)+let s = lfNoise0Id 'α' kr 2+    c = changed s 0+    c' = decay2 c 0.01 0.5+in sinOsc ar (440 + mce2 s c' * 440) 0 * 0.1++-- changed ; sinOsc is constantly changing+let s = sinOsc ar 440 0+    c = changed s 0+in s * c * 0.2++-- changed ; fixed number of sample impulses ; https://fredrikolofsson.com/f0blog/impulse-train/+let dur = 1+    num = 8+in changed (min (ceil (sweep ar 0 (num / dur))) num) 0
+ Help/Ugen/checkBadValues.help.hs view
@@ -0,0 +1,4 @@+-- checkBadValues ; when frequency is nan set gain to zero+let freq = tChoose (impulse kr 1 0) (mce2 440 (0 / 0))+    isNormal = checkBadValues freq 0 0 `equal_to` 0+in sinOsc ar freq 0 * 0.1 * isNormal
+ Help/Ugen/chen.help.hs view
@@ -0,0 +1,21 @@+-- chen+let amp = 0.5+    chen_speed_max = 0.01+    chen_sig = X.chen ar (lfCub kr 0.1 0 `in_range` (0.001,chen_speed_max)) 0.5 0.3 0.28+    minfreq = 20+    maxfreq = 2500+    sig = sinOsc ar (linExp chen_sig 0 1 minfreq maxfreq) 0+in splay sig (mceChannel 0 chen_sig) amp 0 True++-- chen+let tr = control kr "scramble" 1+    amp = 0.5+    chen_speed_max = 0.009+    chen_sig = let s = lfCub kr (lfNoise2Id 'α' kr (chen_speed_max * 2) * 0.1) 0+                   b = lfCub kr 0.35 0 `in_range` (0,1)+               in X.chen ar (s `in_range` (0.001,chen_speed_max)) 0.192 b 0.22+    minfreq = 40+    maxfreq = 500+    sig1 = varSaw ar (linExp chen_sig 0 1 minfreq maxfreq) 0 (lag (mceReverse chen_sig) 0.1)+    sig2 = freqShift sig1 (lag3 (X.tScrambleId 'β' tr chen_sig) 0.1) 0 * 0.5+in splay (sig1 + sig2) (sum (mceChannels chen_sig) / 4) amp 0 True
+ Help/Ugen/choose.help.hs view
@@ -0,0 +1,3 @@+-- choose ; a composite of iRand and select+let f = mceFillId 'α' 2 (\z _ -> chooseId z (mce [440,460 .. 880]))+in sinOsc ar f  0 * 0.1
+ Help/Ugen/chromagram.help.hs view
@@ -0,0 +1,5 @@+-- chromagram+let sig = soundIn 0+    chn = fft' (localBufId 'α' 1 2048) sig+    chroma = X.chromagram kr chn 2048 12 (midiCps 24) 8 0 0.9 2 0+in splay (sinOsc ar (mce (map midiCps [60 .. 71])) 0 * lag chroma 0.1 * 0.2) 1 1 0 True
+ Help/Ugen/circleRamp.help.hs view
@@ -0,0 +1,9 @@+-- circleRamp ; fast x-axis movements from edges will wrap outside (no discontinuity)+let x = mouseX kr 0 2 Linear 0.2+    c = X.circleRamp kr x 0.1 (-1) 1+in pan2 (sinOsc ar 440 0) c 0.1++-- circleRamp ; editing lagTime to alter path taken+let p = lfPulse kr (line kr 20 0.1 10 DoNothing) 0 0.75 + 0.25+    c = X.circleRamp kr p (mouseX kr 0.01 0.1 Linear 0.1) (-1) 1+in pan2 (sinOsc ar 440 0) c 0.1
+ Help/Ugen/clearBuf.help.hs view
@@ -0,0 +1,14 @@+-- clearBuf+let buf = clearBuf (localBuf 1 2048)+    x = mouseX kr 1 2 Linear 0.2+    r = playBuf 1 ar buf x 1 0 Loop DoNothing * 0.1+    wr p i = bufWr buf (p `in_range` (0,bufFrames kr buf)) Loop i+in mrg2 r (wr (lfNoise0 ar 530) (whiteNoise ar))++-- clearBuf ; id+let buf = clearBuf (localBufId 'α' 1 2048)+    x = mouseX kr 1 2 Linear 0.2+    r = playBuf 1 ar buf x 1 0 Loop DoNothing * 0.1+    wr p i = bufWr buf (p `in_range` (0,bufFrames kr buf)) Loop i+in mrg2 r (wr (lfNoise0Id 'β' ar 530) (whiteNoiseId 'γ' ar))+
+ Help/Ugen/clip.help.hs view
@@ -0,0 +1,2 @@+-- clip+clip (sinOsc ar 440 0 * 0.4) (-0.25) 0.25
+ Help/Ugen/clip2.help.hs view
@@ -0,0 +1,8 @@+-- clip2 ; clipping distortion+clip2 (fSinOsc ar 400 0) 0.01++-- clip2+clip2 (fSinOsc ar 400 0) (line kr 0 1 8 RemoveSynth) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_fn_r1_ln (\x -> clip2 x 1) (-2,2)
+ Help/Ugen/clipNoise.help.hs view
@@ -0,0 +1,5 @@+-- clipNoise+clipNoiseId 'α' ar * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.01 (clipNoiseId 'α' ar)
+ Help/Ugen/coinGate.help.hs view
@@ -0,0 +1,4 @@+-- coinGate+let g = coinGateId 'α' 0.2 (impulse kr 10 0)+    f = tRandId 'β' 300.0 400.0 g+in sinOsc ar f 0 * 0.1
+ Help/Ugen/combC.help.hs view
@@ -0,0 +1,15 @@+-- combC ; c.f. combN+let n = whiteNoiseId 'α' ar * 0.02+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combC n 0.01 dt 0.2++-- combC ; with negative feedback+let n = whiteNoiseId 'α' ar * 0.02+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combC n 0.01 dt (-0.2)++-- combC ; as an echo+let d = dustId 'α' ar 1+    n = whiteNoiseId 'β' ar * 0.1+    i = decay d 0.2 * n+in combC i 0.2 0.2 3
+ Help/Ugen/combL.help.hs view
@@ -0,0 +1,5 @@+-- combL ; c.f. combN+let n = whiteNoiseId 'α' ar * 0.02+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combL n 0.01 dt 0.2+
+ Help/Ugen/combN.help.hs view
@@ -0,0 +1,4 @@+-- combN ; comb filter as resonator, the resonant fundamental is equal to reciprocal of the delay time+let n = whiteNoiseId 'α' ar * 0.02+    dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combN n 0.01 dt 0.2
+ Help/Ugen/compander.help.hs view
@@ -0,0 +1,24 @@+-- compander ; noise gate (no hold, no hysteresis) ; x = threshold+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+    x = mouseX kr 0.01 0.15 Linear 0.1+in mce [z, compander z z x 10 1 0.002 0.15]++-- compander ; compressor+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+    x = mouseX kr 0.01 1 Linear 0.1+in mce [z, compander z z x 1 (1/3) 0.01 0.01]++-- compander ; expander+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+    x = mouseX kr 0.01 1 Linear 0.1+in mce [z, compander z z x 1 3 0.01 0.1]++-- compander ; limiter+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+    x = mouseX kr 0.01 1 Linear 0.1+in mce [z, compander z z x 1 (1/10) 0.01 0.01]++-- compander ; sustainer+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+    x = mouseX kr 0.01 0.15 Linear 0.1+in mce [z, compander z z x (1/3) 1.0 0.01 0.05]
+ Help/Ugen/complexRes.help.hs view
@@ -0,0 +1,5 @@+-- complexRes+let s = pulse ar 0.1 0.001 * 0.1+    fr = 50 + 5000 * sinOsc ar 50 0+    dt = 0.5+in X.complexRes s fr dt
+ Help/Ugen/concat.help.hs view
@@ -0,0 +1,14 @@+-- concat ; requires=buf ; granulator+let (b, nc) = (control kr "buf" 100, 2)+    y0 = mouseY kr 0.01 1 Linear 0.2+    y1 = mouseY kr b 100 Linear 0.2+    n = lfNoise0Id 'α' kr y0 * 3 + 4.5+    k = saw ar (sinOsc kr n 0 * 10 + y1)+    i = playBuf nc ar b (bufRateScale kr b) 0 0 Loop DoNothing+    x0 = mouseX kr 0.01 0.1 Linear 0.2+    y2 = mouseY kr 0 0.1 Linear 0.2+    c = X.concat ar k i 2 2 2 x0 0 y2 1 0.5 0 0+in pan2 c 0 1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/control.hs view
@@ -0,0 +1,44 @@+-- control+out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1)++-- control+sinOsc ar (control kr "freq" 440) 0 * control kr "amp" 0.1++-- control ; ir and kr and tr controls ; setting amp also triggers an envelope+let phase1 = control ir "phase1" 0+    phase2 = control ir "phase2" (pi / 4)+    freq1 = control kr "freq1" 450+    freq2 = control kr "freq2" 900+    amp1 = trigControl "amp1" 0+    amp2 = trigControl "amp2" 0+    env = decay2 (impulse kr 1 0 * 0.1 + mce2 amp1 amp2) 0.01 0.2+in sinOsc ar (mce2 freq1 freq2) (mce2 phase1 phase2) * env++-- control ; constructor setting index sequence+let [f,a] = control_set [control kr "freq" 440+                        ,control kr "amp" 0.1]+in sinOsc ar f 0 * a++-- control ; contructor with control index input ; this will fail if n /= 1 (ie. 0 or 2)+let n = 1+    f = control_f64 kr (Just 0) "freq" 440+    a = control_f64 kr (Just n) "amp" 0.1+    p = control_f64 kr Nothing "phase" 0+in sinOsc ar f p * a++---- ; set frequency and gate controls+withSc3 (sendMessage (n_set1 1 "freq" 2200))+withSc3 (sendMessage (n_set1 1 "gate" 1))++---- ; command list ui to send messages to set oscillator frequency+UI.ui_scsynth_command_list (map (\x -> n_set 1 [("freq1",55 * (x ** 2)),("amp1",0.1 * (1 / x))]) [1 .. 7])++---- ; control ; printing+ugen_dump_ugens (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1))++---- ; control ; encoding+import qualified Data.ByteString.Lazy as L+L.unpack (synthdefData (Synthdef "LocalControls" (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1))))++-- ; control ; printing+putStrLn $ synthstat (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1))
+ Help/Ugen/controlDur.help.hs view
@@ -0,0 +1,5 @@+-- controlDur ; default block size = 64, default sample rate = 48000+sinOsc ar (mce2 (recip controlDur) (controlRate + 1)) 0 * 0.1++-- controlDur+sinOsc ar (mce2 (recip controlDur) (recip (blockSize / sampleRate) + 1)) 0 * 0.1
+ Help/Ugen/controlRate.help.hs view
@@ -0,0 +1,3 @@+-- controlRate ; play a sine tone at control rate, the reciprocal of controlDur+let f = mce2 controlRate (recip controlDur)+in sinOsc ar f 0 * 0.1
+ Help/Ugen/convolution.help.hs view
@@ -0,0 +1,14 @@+-- convolution ; warning=feedback+let k = pinkNoise ar * 0.1+    i = soundIn 0+in convolution i k 2048++-- convolution ; warning=feedback+let k = mix (lfSaw ar (mce [300,500,800,1000] * mouseX kr 1.0 2.0 Linear 0.2) 0 * 0.1)+    i = soundIn 0+in convolution i k 1024 * 0.5++-- convolution ; warning=feedback ; id+let k = pinkNoiseId 'α' ar * 0.1+    i = soundIn 0+in convolution i k 2048
+ Help/Ugen/cos.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "Cos"+Sound.Sc3.Plot.plot_fn_r1_ln cos (0,2 * pi)
+ Help/Ugen/cosh.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "CosH"+Sound.Sc3.Plot.plot_fn_r1_ln cosh (-4,4)
+ Help/Ugen/coyote.help.hs view
@@ -0,0 +1,5 @@+-- coyote+let i = soundIn 0+    c = X.coyote kr i 0.2 0.2 0.01 0.5 0.05 0.1+    o = pinkNoiseId 'α' ar * decay c 1 * 0.25+in mce2 (i * 0.25) o
+ Help/Ugen/crackle.help.hs view
@@ -0,0 +1,9 @@+-- crackle+crackle ar 1.95 * 0.2++-- crackle ; modulate chaos parameter+crackle ar (line kr 1.0 2.0 3 RemoveSynth) * 0.2++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.01 (crackle ar 1.95)+Sound.Sc3.Plot.plot_ugen1 0.025 (crackle ar (line kr 1.0 2.0 0.025 DoNothing))
+ Help/Ugen/crest.help.hs view
@@ -0,0 +1,4 @@+-- crest ; mouse varies from sinewave (left) to almost-square (right)+let sig = (sinOsc ar (mouseY kr 100 1000 Exponential 0.1) 0 * mouseX kr 1 10 Linear 0.2) `clip2` 1+    val = X.crest kr sig 440 1+in mce2 sig (sinOsc ar (lag val 0.2 * 400) 0) * 0.1
+ Help/Ugen/crossoverDistortion.help.hs view
@@ -0,0 +1,9 @@+-- crossoverDistortion+let x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+in X.crossoverDistortion (sinOsc ar (mce2 400 404) 0 * 0.2) x y++-- crossoverDistortion+let x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+in X.crossoverDistortion (soundIn 0) x y
+ Help/Ugen/ctl8Voicer.help.hs view
@@ -0,0 +1,36 @@+-- ctl8Voicer ; 16 voices of 8 control inputs ; control inputs are (0-1)+let f _ (c1,c2,c3,c4,c5,c6,c7,_) =+      let freq = midiCps (48 + c1 * 24)+          nh = c2 * 200+          pan = sinOsc kr (c3 * 2) 0 * c4+          amp = c5 + (sinOsc kr c6 0 * c7)+      in pan2 (blip ar freq nh) pan amp+in mix (ctl8Voicer 16 f) * control kr "gain" 0.1++-- control inputs calculated as offsets per voice ; equivalent to above+let f i =+      let cc n = in' 1 kr (11000 + constant (i * 8 + n - 1))+          freq = midiCps (48 + cc 1 * 24)+          nh = cc 2 * 200+          pan = sinOsc kr (cc 3 * 2) 0 * cc 4+          amp = cc 5 + (sinOsc kr (cc 6) 0 * cc 7)+      in pan2 (blip ar freq nh) pan amp+in sum (map f [0 .. 15]) * control kr "gain" 0.1++-- ctl16Voicer ; 8 voices of 16 control inputs ; applied at inputs as above ignores every other 8-block+let f _ ((c1,c2,c3,c4,c5,c6,c7,_),_) =+      let freq = midiCps (48 + c1 * 24)+          nh = c2 * 200+          pan = sinOsc kr (c3 * 2) 0 * c4+          amp = c5 + (sinOsc kr c6 0 * c7)+      in pan2 (blip ar freq nh) pan amp+in mix (ctl16Voicer 8 f) * control kr "gain" 0.1++---- ; initial settings ; 16 groups of eight+x = [[0.483,0.008,0.396,0.006,0.128,0.331,0.196,0],[0.005,0.015,0.194,0.481,0.037,0.052,0.189,0],[0.008,0.014,0.925,0.064,0.269,0.117,0.357,0],[0.79,0.009,0.187,0.216,0.14,0.064,0.046,0],[0.036,0.015,0.15,1,0.139,0.106,0.142,0],[0.065,0.014,0.683,1,0.208,0.108,0.042,0],[0.464,0.01,0.824,1,0.024,0.171,0.06,0],[0.498,0.018,0.828,0.066,0,0,0,0],[0.011,0.012,0.129,0,0,0,0,0],[0.07,0.015,0.309,0.162,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0.479,0.01,0.173,0.29,0,0.015,0.265,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0.286,0.011,0.027,0.39,0.238,0,0,0]]++---- ; send initial settings+import Sound.OSC {- hosc -}+withSc3 (sendMessage (c_setn1 (11000, replicate (16 * 8) 0)))+withSc3 (sendBundle (bundle immediately (map c_setn1 (zip [11000, 11008..] x))))+(length x == 16, map length x == replicate 16 8, 16 * 8 == 128)
+ Help/Ugen/cuspL.help.hs view
@@ -0,0 +1,24 @@+-- cuspL ; default values+cuspL ar 22050 1.0 1.9 0.0 * 0.1++-- cuspL ; vary frequency+let x = mouseX kr 20 (sampleRate / 2) Linear 0.1+in cuspL ar x 1.0 1.99 0 * 0.1++-- cuspL ; mouse-controlled parameters+let x = mouseX kr 0.9 1.1 Linear 0.1+    y = mouseY kr 1.8 2.0 Linear 0.1+in cuspL ar (sampleRate / 4) x y 0 * 0.1++-- cuspL ; frequency control+let x = mouseX kr 0.9 1.1 Linear 0.1+    y = mouseY kr 1.8 2.0 Linear 0.1+    n = cuspL ar 40 x y 0 * 0.3+in sinOsc ar (n * 800 + 900) 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (cuspL ar 600 1.0 1.9 0)++---- ; haskell implementation of equation+cusp_hs a b = iterate (Sound.Sc3.Common.Math.Noise.cusp_f a b) 0+Sound.Sc3.Plot.plot_p1_ln [take 600 (cusp_hs 1.0 1.9)]
+ Help/Ugen/cuspN.help.hs view
@@ -0,0 +1,3 @@+-- cuspN ; vary frequency+let x = mouseX kr 20 (sampleRate / 2) Linear 0.1+in cuspN ar x 1.0 1.99 0 * 0.1
+ Help/Ugen/dNoiseRing.help.hs view
@@ -0,0 +1,7 @@+-- dNoiseRing+let tr = impulse ar 10 0+    x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    nr = demand tr 0 (X.dNoiseRingId 'α' x y 1.0 32.0 0.0)+    freq = midiCps (linLin nr 0 (2 ** 32) 40 (40 + 48))+in sinOsc ar freq 0 * 0.1
+ Help/Ugen/dbAmp.help.hs view
@@ -0,0 +1,5 @@+-- dbAmp ; linear db motion is exponential amplitude decay+fSinOsc ar 800 0 * dbAmp (line kr (-24) (-48) 10 RemoveSynth)++---- ; there is a non-UGen variant+dbAmp (-26::Double) == 0.05011872336272722
+ Help/Ugen/dbrown.help.hs view
@@ -0,0 +1,11 @@+-- dbrown+let n = dbrownId 'α' dinf 0 15 1+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dbrown+let n = demand (impulse kr 10 0) 0 (dbrownId 'α' dinf (-1) 1 0.05)+    f = linExp n (-1) 1 64 9600+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dbufrd.help.hs view
@@ -0,0 +1,21 @@+-- dbufrd ; pattern as frequency input+let n = System.Random.randomRs (200.0,500.0) (System.Random.mkStdGen 0)+    b = asLocalBufId 'α' (take 24 n)+    s = dseqId 'β' 3 (mce [0,3,5,0,3,7,0,5,9])+    p = dseqId 'γ' dinf (mce [s,dbrownId 'δ' 5 0 23 1])+    t = dustId 'ε' kr 10+    r = dbufrdId 'ζ' b p Loop+in sinOsc ar (demand t 0 r) 0 * 0.1++-- dbufrd ; time pattern+let n1 = System.Random.randomRs (200.0,500.0) (System.Random.mkStdGen 0)+    b1 = asLocalBufId 'α' (take 24 n1)+    n2 = map ([1,0.5,0.25] !!) (System.Random.randomRs (0,2) (System.Random.mkStdGen 1))+    b2 = asLocalBufId 'β' (take 24 n2)+    s = dseqId 'γ' 3 (mce [0,3,5,0,3,7,0,5,9])+    p = dseqId 'δ' dinf (mce [s,dbrownId 'ε' 5 0 23 1])+    j = dseriesId 'ζ' dinf 0 1+    d = dbufrdId 'η' b2 j Loop+    l = dbufrdId 'θ' b1 p Loop+    f = duty kr (d * 0.5) 0 DoNothing l+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dbufwr.help.hs view
@@ -0,0 +1,38 @@+-- dbufwr ; monadic graph+uid_st_eval (do+  let b = asLocalBufId 'α' (replicate 24 210)+  s1 <- dseriesM 30 0 3+  s2 <- dseriesM 30 0 1+  s3 <- dseriesM 16 1 1+  s4 <- dwhiteM 8 1 16+  s5 <- dseqM dinf (mce2 s3 s4)+  wt <- dustM kr 1                  {- write trigger -}+  rp <- dseriesM dinf 0 1           {- read pointer -}+  wp <- dseqM dinf (mce2 s1 s2)     {- write pointer -}+  r <- dbufrdM b rp Loop            {- reader -}+  w <- dbufwrM b wp (s5 * 60) Loop  {- writer -}+  let d = demand wt 0 w+      f = lag (demand (impulse kr 16 0) 0 r) 0.01+      o = sinOsc ar (f * mce2 1 1.01) 0 * 0.1+  return (mrg [d, out 0 o]))++-- dbufwr ; uid graph+let b = asLocalBufId 'α' (replicate 24 210)+    s = dseqId 'β' dinf (mce2 (dseriesId 'γ' 16 1 1) (dwhiteId 'δ' 8 1 16))+    rp = dseriesId 'ε' dinf 0 1 {- read pointer -}+    wp = dseqId 'ζ' dinf (mce2 (dseriesId 'η' 30 0 3) (dseriesId 'θ' 30 0 1)) {- write pointer -}+    r = dbufrdId 'ι' b rp Loop {- reader -}+    w = dbufwrId 'κ' b wp (s * 60) Loop {- writer -}+    d = demand (dustId 'λ' kr 1) 0 w+    f = lag (demand (impulse kr 16 0) 0 r) 0.01+    o = sinOsc ar (f * mce2 1 1.01) 0 * 0.1+in mrg2 d (out 0 o)++-- dbufrd ; demand rate single memory recurrence relation ; simple counter+let rec1Id z k t f =+      let b = asLocalBufId z [k]+          r = dbufrdId z b 0 Loop {- reader -}+          w = dbufwrId z b 0 (f r) Loop {- writer -}+      in mrg2 (demand t 0 r) (demand t 0 w)+    f = rec1Id 'α' 0 (impulse kr 6 0) (\r -> (r + 1) `modE` 24)+in sinOsc ar (midiCps (60 + f)) 0 * 0.1
+ Help/Ugen/dc.help.hs view
@@ -0,0 +1,11 @@+-- dc ; zero+dc ar 0++-- dc ; offset, clicks on start and finish+dc ar 0.5++-- dc ; offset, clicks on start and finish+dc ar 0.5 + sinOsc ar 440 0 * 0.1++-- dc ; transient before LeakDC adapts and suppresses the offset+leakDC (dc ar 1) 0.995
+ Help/Ugen/dconst.help.hs view
@@ -0,0 +1,5 @@+-- dconst ; fast notes of random duration for 0.5 seconds, then a single note for 0.5 seconds+let dexprandId z rp l r = lin_exp (dwhiteId z rp 0 1) 0 1 l r -- there is no Dexprand+    t = dconstId 'α' 0.5 (dwhiteId 'β' dinf 0.05 0.08) 0.001+    f = duty kr (dseqId 'γ' dinf (mce2 t 0.5)) 0 DoNothing (dexprandId 'δ' dinf 200 600)+in varSaw ar (lag f 0.02) 0 0.3 * 0.1
+ Help/Ugen/decay.help.hs view
@@ -0,0 +1,7 @@+-- decay ; as envelope+let n = pinkNoiseId 'α' ar + sinOsc ar 11000 0+    s = impulse ar (xLine kr 1 50 20 RemoveSynth) 0.25+in decay s 0.05 * n++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.05 (decay (impulse ar 1 0) 0.01)
+ Help/Ugen/decay2.help.hs view
@@ -0,0 +1,13 @@+-- decay2 ; used as an envelope+let s = fSinOsc ar 600 0 * 0.25 -- sinOsc ar 11000 0 * 0.25+    f = xLine kr 1 50 20 RemoveSynth+in decay2 (impulse ar f 0) 0.01 0.2 * s++-- decay2 ; compare with decay used as the envelope+let s = fSinOsc ar 600 0 * 0.25+    f = xLine kr 1 50 20 RemoveSynth+in decay (impulse ar f 0) 0.2 * s++---- ; drawings ; attack and decay are a difference of two decays, hence inversion+Sound.Sc3.Plot.plot_ugen1 0.05 (decay2 (impulse ar 1 0) 0.001 0.01)+Sound.Sc3.Plot.plot_ugen1 0.05 (decay2 (impulse ar 1 0) 0.01 0.001)
+ Help/Ugen/degreeToKey.help.hs view
@@ -0,0 +1,11 @@+-- degreeToKey ; modal space, mouse x controls discrete pitch in dorian mode+let buf = (asLocalBufId 'β' [0,2,3.2,5,7,9,10])+    x = mouseX kr 0 15 Linear 0.1+    k = degreeToKey buf x 12+    f b = let n = lfNoise1Id 'α' kr (mce [3,3.05])+              o = sinOsc ar (midiCps (b + k + n * 0.04)) 0 * 0.1+              t = lfPulse ar (midiCps (mce [48,55])) 0.15 0.5+              d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + b)) 0.1 * 0.1+              m = o + d+          in combN m 0.31 0.31 2 + m+in (f 48 + f 72) * 0.25
+ Help/Ugen/delTapWr.help.hs view
@@ -0,0 +1,6 @@+-- delTapWr+let b = localBufId 'α' 1 48000+    src = whiteNoiseId 'β' ar * 0.2 * decay (dustId 'γ' kr 3) 0.2+    tapPhase = delTapWr b src+    (tap1,tap2,tap3) = unmce3 (delTapRd b tapPhase (mce3 0.2 0.27 0.303) 1 * mce3 1 0.4 0.2)+in mce2 (src + tap2) (tap1 + tap3)
+ Help/Ugen/delay1.help.hs view
@@ -0,0 +1,5 @@+-- delay1+let s = impulse ar 1 0 * 0.25 in s + (delay1 s)++-- delay1 ; left=original, right=subtract delayed from original+let z = dustId 'α' ar 1000 * 0.1 in mce2 z (z - delay1 z)
+ Help/Ugen/delay2.help.hs view
@@ -0,0 +1,2 @@+-- delay2+let s = impulse ar 1 0 * 0.25 in s + (delay2 s)
+ Help/Ugen/delayC.help.hs view
@@ -0,0 +1,5 @@+-- delayC ; c.f. delayN ; no zipper noise+let i = sinOsc ar 320 0 * 0.1+    maxdelaytime = 0.005+    delaytime = mouseX kr 0.0 maxdelaytime Linear 0.15+in i + delayC i maxdelaytime delaytime
+ Help/Ugen/delayL.help.hs view
@@ -0,0 +1,5 @@+-- delayL ; c.f. delayN & delayC+let t = mouseX kr 0.001 0.2 Exponential 0.2+    s = impulse ar 1 0+    d = delayL s 0.6 t+in mce2 d s
+ Help/Ugen/delayN.help.hs view
@@ -0,0 +1,19 @@+-- delayN ; dust randomly triggers decay to envelope WhiteNoise ; input is left, delay right+let i = decay (dustId 'α' ar 1) 0.3 * whiteNoiseId 'β' ar * 0.1+in mce2 i (delayN i 0.1 0.1)++-- delayN ; delay time varied at control rate ; sinOsc reinforcing or cancelling with delayed copy+let i = sinOsc ar 320 0 * 0.1+    maxdelaytime = 0.005+    delaytime = mouseX kr 0.0 maxdelaytime Linear 0.15+in i + delayN i maxdelaytime delaytime++-- delayN ; flanging ; warning=feedback+let f = 0.1 -- flanger freq+    g = 0.1 -- feedback+    i = soundIn (mce2 0 1) -- two channels of input signal+    fb = i + localIn 2 ar 0 -- add feedback+    e = delayN fb 0.02 (sinOsc kr f 0 * 0.005 + 0.005) -- max delay of 20msec+    lp_f x = bpf x (mouseX kr 1000 10000 Linear 0.2) 0.1 -- filter in the feedback loop+    o = localOut (lp_f e * g)+in mrg2 (i + e) o
+ Help/Ugen/demand.help.hs view
@@ -0,0 +1,41 @@+-- demand ; monadic form+uid_st_eval (+  do r <- dustM kr 1+     s <- dgeomM dinf (midiCps 72) (midiRatio 1)+     let t = impulse kr 10 0+         f = demand t r s+         o = sinOsc ar (mce [f,f + 0.7]) 0+     return (max (cubed o) 0 * 0.1))++-- demand+let n = diwhiteId 'α' dinf 60 72+    t = impulse kr 10 0+    s = midiCps n+    f = demand t 0 s+    o = sinOsc ar (mce [f,f + 0.7]) 0+in cubed (cubed o) * 0.1++-- demand ; audio rate (poll output is equal for x1 and x2)+let i = lfNoise2Id 'α' ar 8000+    d = dseqId 'β' dinf (mce [i])+    x = mouseX kr 1 3000 Exponential 0.2+    t = impulse ar x 0+    x1 = demand t 0 d+    x2 = latch i t+    s = mce2 x1 x2+    p = poll t s 0 (mce2 (label "x1") (label "x2"))+    o = sinOsc ar (s * 300 + 400) 0 * 0.1+in mrg2 o p++-- demand+let t = impulse ar 5 0+    d1 = dseqId 'α' dinf (mce [1,0,1,1,0,1,0,0,1,0,1])+    d2 = dseqId 'β' dinf (mce [0,1,0,0,1,0,1,1,0,1,0])+    x = demand t 0 (mce2 d1 d2) * t+in decay x 1 * brownNoiseId 'γ' ar * 0.1++-- demand+let t = impulse ar 5 0+    d = drandId 'α' dinf (mce [dseqId 'β' 1 (mce [1,1,1,1]),dseqId 'γ' 1 (mce [1,0,0,0])])+    x = demand t 0 d * t+in decay x 1 * brownNoiseId 'δ' ar * 0.1
+ Help/Ugen/demandEnvGen.help.hs view
@@ -0,0 +1,76 @@+-- demandEnvGen ; frequency ramp, exponential curve+let l = dseqId 'α' dinf (mce2 440 9600)+    y = mouseY kr 0.01 3 Exponential 0.2+    s = env_curve_shape EnvExp+    f = demandEnvGen ar l y s 0 1 1 1 0 1 DoNothing+in sinOsc ar f 0 * 0.1++-- demandEnvGen ; frequency envelope with random times+let l = dseqId 'α' dinf (mce [204,400,201,502,300,200])+    t = drandId 'β' dinf (mce [1.01,0.2,0.1,2.0])+    y = mouseY kr 0.01 3 Exponential 0.2+    s = env_curve_shape EnvCub+    f = demandEnvGen ar l (t * y) s 0 1 1 1 0 1 DoNothing+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- demandEnvGen ; Frequency modulation+let n = dwhiteId 'α' dinf 200 1000+    x = mouseX kr (-0.01) (-4) Linear 0.2+    y = mouseY kr 1 3000 Exponential 0.2+    s = env_curve_shape (EnvNum undefined)+    f = demandEnvGen ar n (sampleDur * y) s x 1 1 1 0 1 DoNothing+in sinOsc ar f 0 * 0.1++-- demandEnvGen ; Short sequence with doneAction, linear+let l = dseqId 'α' 1 (mce [1300,500,800,300,400])+    s = env_curve_shape EnvLin+    f = demandEnvGen kr l 2 s 0 1 1 1 0 1 RemoveSynth+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- demandEnvGen ; Gate, mouse x on right side of screen toggles gate+let n = roundTo (dwhiteId 'α' dinf 300 1000) 100+    x = mouseX kr 0 1 Linear 0.2+    g = x >** 0.5+    f = demandEnvGen ar n 0.1 5 0.3 g 1 1 0 1 DoNothing+in sinOsc ar (f * mce2 1 1.21) 0 * 0.1++-- demandEnvGen ; gate, mouse x toggles sample and hold, mouse button does hard reset+let l = dseqId 'α' 2 (mce [dseriesId 'β' 5 400 200,500,800,530,4000,900])+    x = mouseX kr 0 1 Linear 0.2+    g = (x >** 0.5) - 0.1+    b = mouseButton kr 0 1 0.2+    r = (b >** 0.5) * 2+    s = env_curve_shape EnvSin+    f = demandEnvGen kr l 0.1 s 0 g r 1 0 1 DoNothing+in sinOsc ar (f * mce2 1 1.001) 0 * 0.1++-- demandEnvGen ; coordinate buffer, layout is (initial-level,duration,level,..,loop-duration)+let b = asLocalBufId 'α' [0,0.5,0.1,0.5,1,0.01]+    l_i = dseriesId 'β' dinf 0 2+    d_i = dseriesId 'γ' dinf 1 2+    l = dbufrdId 'δ' b l_i Loop+    d = dbufrdId 'ε' b d_i Loop+    s = env_curve_shape EnvLin+    e = demandEnvGen kr l d s 0 1 1 1 0 5 RemoveSynth+    f = midiCps (60 + (e * 12))+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- demandEnvGen ; read envelope break-points from buffer, here simply duration/level pairs.+--              ; the behavior is odd if the curve is zero (ie. flat segments).+let b = asLocalBufId 'α' [61,1,60,2,72,1,55,5,67,9,67]+    lvl = dbufrdId 'β' b (dseriesId 'γ' 6 0 2) Loop+    dur = dbufrdId 'δ' b (dseriesId 'ε' 5 1 2) Loop+    e = demandEnvGen kr lvl dur 1 0 1 1 1 0 1 RemoveSynth+in sinOsc ar (midiCps e) 0 * 0.1++-- demandEnvGen ; lfNoise1+let y = mouseY kr 0.5 20 Linear 0.2+    lvl = dwhiteId 'β' dinf (-0.1) 0.1+    dur = sampleDur * y+in demandEnvGen ar lvl dur 5 (-4) 1 1 1 0 1 RemoveSynth++-- demandEnvGen ; lfBrownNoise+let y = mouseY kr 1 100 Exponential 0.2+    lvl = dbrownId 'β' dinf (-0.1) 0.1 0.1+    dur = sampleDur * y+in demandEnvGen ar lvl dur 1 0 1 1 1 0 1 RemoveSynth
+ Help/Ugen/detectIndex.help.hs view
@@ -0,0 +1,5 @@+-- detectIndex ; find indexes and map to an audible frequency range+let n = 6+    x = floorE (mouseX kr 0 n Linear 0.1)+    i = detectIndex (asLocalBufId 'α' [2,3,4,0,1,5]) x+in sinOsc ar (linExp i 0 n 200 700) 0 * 0.1
+ Help/Ugen/detectSilence.help.hs view
@@ -0,0 +1,4 @@+-- detectSilence+let s = sinOsc ar 440 0 * mouseY kr 0 0.2 Linear 0.1+    d = detectSilence s 0.01 0.1 RemoveSynth+in mrg [s,d]
+ Help/Ugen/dfm1.help.hs view
@@ -0,0 +1,10 @@+-- dfm1 ; mouse control+let n = pinkNoiseId 'α' ar * 0.5+    x = mouseX kr 80 5000 Exponential 0.1+    y = mouseY kr 0.1 1.2 Linear 0.1+in X.dfm1 n x y 1 0 3e-4++-- dfm1 ; bass+let i = mix (pulse ar (mce2 100 100.1) 0.5) * 0.4+    f = range 80 2000 (sinOsc kr (range 0.2 5 (sinOsc kr 0.3 0)) 0)+in X.dfm1 i f 1.1 2 0 0.0003 * 0.1
+ Help/Ugen/dgeom.help.hs view
@@ -0,0 +1,6 @@+-- dgeom+let n = dgeomId 'α' 15 1 1.2+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dibrown.help.hs view
@@ -0,0 +1,6 @@+-- dibrown ; c.f. dbrown+let n = dibrownId 'α' dinf 0 15 1+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/difSqr.help.hs view
@@ -0,0 +1,9 @@+-- difSqr+let o1 = fSinOsc ar 800 0+    o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in difSqr o1 o2 * 0.1++-- difSqr ; written out+let o1 = fSinOsc ar 800 0+    o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (o1 * o1 - o2 * o2) * 0.1
+ Help/Ugen/diodeRingMod.help.hs view
@@ -0,0 +1,39 @@+-- diodeRingMod+let o1 = sinOsc ar 440 0+    o2 = sinOsc ar (xLine kr 1 100 10 DoNothing) 0+in mce2 (X.diodeRingMod o1 o2) (o1 * o2) * 0.125++-- diodeRingMod+let o1 = sinOsc ar 440 0+    o2 = sinOsc ar (xLine kr 200 500 5 DoNothing) 0+in mce2 (X.diodeRingMod o1 o2) (o1 * o2) * 0.125++-- diodeRingMod+let s1 = sinOsc ar (3700 * mce [1, 1.1, 1.2] * range 1 2 (sinOsc ar 200 0)) 0+    s2 = sinOsc ar (100 * mce [0.75, 1, 0.5]) 0+    s3 = X.diodeRingMod s1 s2+in mix s3 * lfPulse ar (10.3 * 0.5) 0 0.04 * 0.1++-- diodeRingMod+let mf_sin = sinOsc ar+    mf_square f _ = X.blitB3Square ar f 0.99+    mf_ring_mod (lfo_ph,car_ph) car_freq lfo_type lfo_freq lfo_amp drive x_mix mod_sig =+      let range_2oct = range 0.25 2+          lfo = range_2oct (lfo_type lfo_freq lfo_ph * lfo_amp)+          car_sig = sinOsc ar (car_freq * lfo) car_ph+          mod_sig_post = mod_sig * drive+      in xFade2 mod_sig_post (X.diodeRingMod car_sig mod_sig_post) x_mix 1+    y = mouseY kr 0 1 Linear 0.2+    x = mouseX kr (-1) 1 Linear 0.2+in mf_ring_mod (0,0) 6.25 mf_sin 0.1 y 1 x (soundIn 0)++{---- ; moog++c_freq = carrier frequency (mf = six-octave range, 2-130 and 60-4000 hz)+lfo_type = LFO signal function, ie. mf_sin or mf_square+lfo_freq = LFO frequency (mf = 0.1 - 25.0 hz)+lfo_amp = the amount that the LFO output sweeps the carrier sin oscillator+drive = pre-multiplier for mod_sig+x_mix = crossfade from unmodulated to modulated audio (-1 to 1)++-}
+ Help/Ugen/disintegrator.help.hs view
@@ -0,0 +1,5 @@+-- disintegrator+let x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    s = sinOsc ar (mce2 400 404) 0 * 0.05+in X.disintegratorId 'α' s x y
+ Help/Ugen/diskIn.help.hs view
@@ -0,0 +1,7 @@+-- diskIn ; requires=dsk ; c.f. sndfileIn+let (buf, nc) = (control kr "dsk" 0, 2) in diskIn nc buf Loop++---- ; setup & cleanup+{fn = sfResolve "20.2-LW+RD.flac";nc = 2;dsk = 0}+withSc3 (mapM_ async [b_alloc dsk 65536 2,b_read dsk fn 0 (-1) 0 True])+withSc3 (mapM_ async [b_close dsk,b_free dsk])
+ Help/Ugen/distort.help.hs view
@@ -0,0 +1,2 @@+-- distort+distort (fSinOsc ar 500 0.0 * xLine kr 0.1 10 10 RemoveSynth) * 0.25
+ Help/Ugen/div.help.hs view
@@ -0,0 +1,12 @@+-- / ; division (floating point)+sinOsc ar 440 0 / 6++-- / ; creates a beating effect (subaudio rate)+(pinkNoiseId 'α' ar / fSinOsc kr 5 0) * 0.05++-- / ; optimises identity+sinOsc ar 440 0 / 1 * 0.1++-- div ; integer division+let d f = (sinOsc kr 0.25 0 * 200 + 500) `f` 17+in sinOsc ar (midiCps (mce2 (d div) (d (/)) * 3)) 0 * mce2 0.1 0.05
+ Help/Ugen/diwhite.help.hs view
@@ -0,0 +1,6 @@+-- dwhite ; c.f. dwhite+let n = diwhiteId 'α' dinf (-7) 7+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = midiCps (demand t 0 n + 60)+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dneuromodule.help.hs view
@@ -0,0 +1,6 @@+-- dneuromodule+let dt = 0.001+    theta = mce2 (mouseX kr (-2) 2 Linear 0.2) (mouseY kr (-2) 2 Linear 0.2)+    md = X.dneuromoduleId 2 'α' 2 theta (mce2 0.1 0.3) (mce [-3,2,-2,0])+    m = lag3 (duty ar dt 0 DoNothing md) dt+in sinOsc ar (m * 400 + 600) 0 * 0.05
+ Help/Ugen/done.help.hs view
@@ -0,0 +1,6 @@+-- done ; high tone left or low tone right+let x = mouseX kr (-1) 1 Linear 0.1+    e = linen x 0.1 0.1 0.5 DoNothing+    o1 = sinOsc ar 880 0 * 0.1+    o2 = sinOsc ar 440 0 * e+in mce [done e * o1,o2]
+ Help/Ugen/doubleWell3.help.hs view
@@ -0,0 +1,10 @@+-- doubleWell3 ; bass synth+let x = mouseX kr 0 200 Linear 0.2+    y = mouseY kr 0.5 4.0 Linear 0.2+    f = sinOsc ar x 0 * y+in X.doubleWell3 ar 0 0.01 f 0.25 0 0++-- doubleWell3 ; gradually changing+let f = lfSaw ar (line kr 10 1000 10 DoNothing) 0+    delta = line kr 0.0 0.3 20 DoNothing+in X.doubleWell3 ar 0 0.05 f delta 0 0 * 0.2
+ Help/Ugen/dpw3Tri.help.hs view
@@ -0,0 +1,18 @@+-- dpw3Tri ; distortion creeps in under 200Hz+X.dpw3Tri ar (xLine kr 2000 20 10 DoNothing) * 0.1++-- dpw3Tri ; very fast sweeps can have transient distortion effects ; c.f. lfTri+X.dpw3Tri ar (mouseX kr 200 12000 Exponential 0.2) * 0.1++-- dpw3Tri ; less efficient than LFTri+let f = X.randNId 50 'α' 50 5000+in splay (X.dpw3Tri ar f) 1 0.1 0 True++-- dpw3Tri ; differentiation of triangle is square+let f = mouseX kr 440 8800 Exponential 0.2+    o = X.dpw3Tri ar f+in hpz1 (o * 2) * 0.25++-- dpw3Tri ; c.f. pulse+let f = mouseX kr 440 8800 Exponential 0.2+in mce2 (X.dpw3Tri ar f) (pulse ar f 0.5) * 0.05
+ Help/Ugen/dpw4Saw.help.hs view
@@ -0,0 +1,6 @@+-- dpw4Saw+X.dpw4Saw ar (xLine kr 2000 20 10 DoNothing) * 0.1++-- dpw4Saw ; c.f. saw+let x = mouseX kr 200 12000 Exponential 0.2+in mce2 (X.dpw4Saw ar x * 0.1) (saw ar x * 0.05)
+ Help/Ugen/drand.help.hs view
@@ -0,0 +1,21 @@+-- drand+let n = drandId 'α' dinf (mce [1, 3, 2, 7, 8])+    x = mouseX kr 1 400 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- drand+let d = drandId 'α' dinf+        (mce [dseqId 'β' 1 (mce [2, 0, 2, 0, 1, 0, 1, 1])+             ,dseqId 'γ' 1 (mce [2, 0, 1, 0, 1, 0, 1, 0])+             ,dseqId 'δ' 1 (mce [2, 0, 1, 1, 1, 1, 1, 0])+             ,dseqId 'ε' 1 (mce [2, 0.3, 0.3, 1, 0.3, 0.3, 1, 0.3])+             ,dseqId 'ζ' 1 (mce [2, 0, 0.3, 0, 0.3, 0, 0.3, 0])+             ,dseqId 'η' 1 (mce [2, 0, 0, 1, 0, 0, 0, 0])+             ,dseqId 'θ' 1 (mce [2, 0, 0, 0, 0, 0, 0, 0])+             ,dseqId 'ι' 1 (mce [0, 1, 0, 1, 0, 1, 0, 1])+             ,dseqId 'κ' 1 (mce [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0])])+    t = impulse ar 10 0+    x = demand t 0 d * t+in decay x 1 * pinkNoiseId 'λ' ar * 0.1
+ Help/Ugen/dseq.help.hs view
@@ -0,0 +1,54 @@+-- dseq ; at control rate+let n = dseqId 'α' 3 (mce [1,3,2,7,8])+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dseq ; at audio rate+let n = dseqId 'α' dinf (mce [1,3,2,7,8,32,16,18,12,24])+    x = mouseX kr 1 10000 Exponential 0.1+    t = impulse ar x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dseq ; the SC2 Sequencer UGen is somewhat like the sequ function below+let sequId e s tr = demand tr 0 (dseqId e dinf (mce s))+    t = impulse ar 6 0+    n0 = sequId 'α' [60,62,63,58,48,55] t+    n1 = sequId 'β' [63,60,48,62,55,58] t+in lfSaw ar (midiCps (mce2 n0 n1)) 0 * 0.05++-- dseq ; rather than MCE expansion at tr, it can be clearer to view tr as a functor+let tr = impulse kr (mce [2,3,5]) 0+    f (z,t) = demand t 0 (dseqId z dinf (mce [60,63,67,69]))+    m = mce_map_ix f tr+    o = sinOsc ar (midiCps m) 0 * 0.1+in splay o 1 1 0 True++-- dseq ; ln 2021-04-06 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+    d = demand (impulse ar 8 0) 0 (dseqId 'α' dinf (geom 9 1 1.25))+    e = xLine ar 1 0.7 20 DoNothing+in mix (sinOsc ar (geom 8 60 2 * d * e) 0) * 1/5 * 0.1++-- dseq ; mce+let d = demand (impulse ar 8 0) 0 (dseqId 'α' dinf (mce (map mce [[60,67],[59,62]])))+in sinOsc ar (midiCps d) 0 * 0.1++-- dseq ; shared dseq, different patterns+uid_st_eval+(do a <- dseqM 3 (mce [1,3,2,7,8])+    let t = impulse kr 5 0+        f = demand t 0 (mce [a,a]) * 30 + 340+    return (sinOsc ar f 0 * 0.1))++-- dseq ; distinct dseq, equal patterns+uid_st_eval+(do a <- replicateM 2 (dseqM 3 (mce [1,3,2,7,8]))+    let t = impulse kr 5 0+        f = demand t 0 (mce a) * 30 + 340+    return (sinOsc ar f 0 * 0.1))++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/dser.help.hs view
@@ -0,0 +1,6 @@+-- dser+let a = dserId 'α' 7 (mce [1, 3, 2, 7, 8])+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 a * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dseries.help.hs view
@@ -0,0 +1,6 @@+-- dseries+let n = dseriesId 'α' 15 0 1+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dshuf.help.hs view
@@ -0,0 +1,13 @@+-- dshuf+let a = dseqId 'α' dinf (dshufId 'β' 3 (mce [1,3,2,7,8.5]))+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 a * 30 + 340+in sinOsc ar f 0 * 0.1++-- dshuf+let a = dseqId 'α' dinf (dshufId 'β' 5 (X.randNId 81 'γ' 0 10))+    x = mouseX kr 1 10000 Exponential 0.1+    t = impulse ar x 0+    f = demand t 0 a * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dstutter.help.hs view
@@ -0,0 +1,19 @@+-- dstutter+let inp = dseqId 'α' dinf (mce [1,2,3])+    nse = diwhiteId 'β' dinf 2 8+    rep = dstutterId 'γ' nse inp+    trg = impulse kr (mouseX kr 1 40 Exponential 0.2) 0+    frq = demand trg 0 rep * 30 + 340+in sinOsc ar frq 0 * 0.1++-- dstutter ; see also <https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html>+let a z = let xr = dxrandId z dinf (mce [0.1,0.2,0.3,0.4,0.5])+              lf = dstutterId z 2 xr+              du = duty ar lf 0 DoNothing lf+              tr = abs (hpz1 du) `greater_than` 0+              ph = sweep ar tr (1/du)+          in linExp ph 0 1 (randId z 50 100) (randId z 500 2000)+    f = mce (map a (id_seq 8 'α'))+    [s0,s1] = mceChannels (splay (sinOsc ar f 0) 1 1 0 True)+    o = limiter (rotate2 s0 s1 (lfSaw kr 0.1 0)) 1 0.01+in o * 0.1
+ Help/Ugen/dswitch.help.hs view
@@ -0,0 +1,10 @@+-- dswitch ; c.f. dswitch1+uid_st_eval (+  do a0 <- dwhiteM 2 3 4+     a1 <- dwhiteM 2 0 1+     a2 <- dseqM 2 (mce [1,1,1,0])+     i <- dseqM 2 (mce [0,1,2,1,0])+     d <- dswitchM i (mce [a0,a1,a2])+     let t = impulse kr 4 0+         f = demand t 0 d * 300 + 400+     return (sinOsc ar f 0 * 0.1))
+ Help/Ugen/dswitch1.help.hs view
@@ -0,0 +1,8 @@+-- dswitch1 ; c.f. dswitch+let x = mouseX kr 0 4 Linear 0.1+    y = mouseY kr 1 15 Linear 0.1+    t = impulse kr 3 0+    w = dwhiteId 'α' dinf 20 23+    n = dswitch1Id 'β' x (mce [1, 3, y, 2, w])+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dust.help.hs view
@@ -0,0 +1,17 @@+-- dust+dustId 'α' ar 2 * 0.25++-- dust+let d = xLine kr 20000 2 10 RemoveSynth+in dustId 'β' ar d * 0.15++-- dust ; illustrate monadic constructor+uid_st_eval (fmap (* 0.25) (dustM ar 200))++-- dust ; illustrate monadic constructor+uid_st_eval (fmap (* 0.15) (dustM ar (xLine kr 20000 2 10 RemoveSynth)))++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 0.1 (dustId 'γ' ar 300)+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 0.1 (dustId 'δ' ar (xLine kr 5000 100 0.1 RemoveSynth))+
+ Help/Ugen/dust2.help.hs view
@@ -0,0 +1,14 @@+-- dust2+dust2Id 'α' ar 200 * 0.5++-- dust2+let d = xLine kr 20000 2 10 RemoveSynth+in dust2Id 'β' ar d * 0.15++-- dust2 ; velvet noise (approx.)+let samplesPerPeriod = 20+in signum (dust2Id 'α' ar (sampleRate / samplesPerPeriod)) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (dust2Id 'γ' ar 400)+Sound.Sc3.Plot.plot_ugen1 0.1 (dust2Id 'γ' ar (xLine kr 5000 100 0.1 RemoveSynth))
+ Help/Ugen/dustRange.help.hs view
@@ -0,0 +1,21 @@+-- dustRange ; inter-offset times generated randomly in range (seconds) ; uniform distribution+--       ; audio rate impulse train of varying amplitude (min = max)+mce2 (X.dustRangeId 'α' ar 0.1 0.1 * 0.1) (impulse ar 10 0 * 0.1)++-- dustRange ; mean iot=0.0005 is equivalent to density=2000 at dust, dustRange spacing is more uniform+mce2 (X.dustRangeId 'β' ar 0.0001 0.001 * 0.1) (dustId 'γ' ar 2000 * 0.05)++-- dustRange ; velvet noise (approx.)+let iot = 20 / sampleRate+    x = mouseX kr 1 16 Exponential 0.1+    d = X.dustRangeId 'α' ar (iot / x) (iot * x)+    s = tRandId 'β' (-1) 1 d+in trig d sampleDur * signum s * 0.1++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen_nrt (48000,64) 1.0 (X.dustRangeId 'δ' ar 0.1 0.1)+plot_ugen_nrt (48000,64) 1.0 (X.dustRangeId 'ε' ar 0.1 0.1 + impulse ar 10 0 * 0.5)+plot_ugen_nrt (48000,64) 0.1 (X.dustRangeId 'ζ' ar 0.0001 0.001)+plot_ugen_nrt (48000,64) 0.1 (dustId 'ζ' ar 2000)+plot_ugen_nrt (48000,64) 0.1 (let tr = X.dustRangeId 'β' ar 0.001 0.005 in trig tr sampleDur * signum (tRandId 'α' (-1) 1 tr))
+ Help/Ugen/duty.help.hs view
@@ -0,0 +1,17 @@+-- duty+uid_st_eval (+  do n0 <- drandM dinf (mce [0.01,0.2,0.4])+     n1 <- dseqM dinf (mce [204,400,201,502,300,200])+     let f = duty kr n0 0 RemoveSynth n1+     return (sinOsc ar (f * mce2 1 1.01) 0 * 0.1))++-- duty ; mouseX (control rate signal) determines duration+let n = dseqId 'α' dinf (mce [204,400,201,502,300,200])+    x = mouseX kr 0.001 2 Linear 0.1+    f = duty kr x 0 RemoveSynth n+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- duty ; fixed number of sample impulses ; https://fredrikolofsson.com/f0blog/impulse-train/+let dur = 1+    num = 8+in duty ar (dseqId 'α' dinf (mce [sampleDur, dur / num - sampleDur])) 0 DoNothing (dseqId 'β' num (mce [1, 0]))
+ Help/Ugen/dwgBowed.help.hs view
@@ -0,0 +1,30 @@+-- dwgBowed+let k = control kr+    freq = k "freq" 440+    amp = k "amp" 0.5+    force = k "force" 1+    gate_ = k "gate" 1+    pos = k "pos" 0.07+    c1 = k "c1" 0.25+    c3 = k "c3" 31+    pan = k "pan" 0+    vib = gendy1Id 'α' kr 1 1 1 1 0.1 4 0.5 0.5 12 0 * 0.003 + 1+    s1 = X.dwgBowed ar (freq * vib) amp force gate_ pos 0.1 c1 c3 0.55 2+    s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+    s3 = bpf s2 118 1 + s2+    s4 = bpf s3 430 1 + s3+    s5 = bpf s4 490 1 + s4+    s6 = lpf s5 6000+in pan2 (s6 * 0.1) pan 1++-- dwgBowed ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let freq = unitCps p+          s1 = X.dwgBowed ar freq z (0.5 + rx) 1 y 0.1 0.25 31 (0.55 + ry) 2 * g * z+          s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+          s3 = bpf s2 118 1 + s2+          s4 = bpf s3 430 1 + s3+          s5 = bpf s4 490 1 + s4+          s6 = lpf s5 6000+      in pan2 s6 (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgBowedTor.help.hs view
@@ -0,0 +1,30 @@+-- dwgBowedTor+let k = control kr+    freq = k "freq" 440+    amp = k "amp" 0.5+    force = k "force" 1+    gate_ = k "gate" 1+    pos = k "pos" 0.07+    c1 = k "c1" 0.25+    c3 = k "c3" 31+    pan = k "pan" 0+    vib = gendy1Id 'α' kr 1 1 1 1 0.1 4 0.5 0.5 12 0 * 0.003 + 1+    s1 = X.dwgBowedTor ar (freq * vib) amp force gate_ pos 0.1 c1 c3 0.55 2 5.2 1 3000 1.8+    s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+    s3 = bpf s2 118 1 + s2+    s4 = bpf s3 430 1 + s3+    s5 = bpf s4 490 1 + s4+    s6 = lpf s5 6000+in pan2 (s6 * 0.1) pan 1++-- dwgBowedTor ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let freq = unitCps p+          s1 = X.dwgBowedTor ar freq z (0.5 + rx) 1 y 0.1 0.25 31 (0.55 + ry) 2 (5.2 + z) 1 3000 1.8 * g * z+          s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+          s3 = bpf s2 118 1 + s2+          s4 = bpf s3 430 1 + s3+          s5 = bpf s4 490 1 + s4+          s6 = lpf s5 6000+      in pan2 s6 (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgClarinet3.help.hs view
@@ -0,0 +1,30 @@+-- dwgClarinet3+let freq = control_m kr "freq" 440 (220,880,"exp")+    att = 0.01+    amp = linLin (control_m kr "amp" 0.5 (0,1,"amp")) 0 1 0.76 1+    ampn = 1+    pc = control_m kr "pc" 1 (0.25,1.05,"lin")+    m = control_m kr "m" 0.8 (0.4,1.25,"lin")+    gate_ = control_m kr "gate" 1 (0,1,"switch")+    release = 0.01+    c1 = control_m kr "c1" 0.2 (0,1,"lin")+    c3 = control_m kr "c3" 7 (5,9,"lin")+    pan = control_m kr "pan" 0 (-1,1,"lin")+    vib = sinOsc kr 4 0 * 0.001 + 1+    pm = envGen ar gate_ 1 0 1 DoNothing (envAsr att 1 0.2 (EnvNum 1)) * amp+    signal = X.dwgClarinet3 ar (lag freq 0 * vib) pm pc m 1 release c1 c3+in pan2 (hpf signal 200) pan amp++-- dwgClarinet3 ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 25 + 42)+          vib = sinOsc kr (y * 4) 0 * (z * 0.005) + 1+          amp = linLin z 0 1 0.65 1+          pm = k2a (amp * g)+          pc = linLin y 0 1 0.25 0.85+          m = linLin rx 0 1 0.4 1.25+          c1 = ry+          c3 = linLin o 0 1 5 9+          signal = X.dwgClarinet3 ar (freq * vib) pm pc m 1 0.01 c1 c3+      in pan2 (hpf signal 200) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgFlute.help.hs view
@@ -0,0 +1,27 @@+-- dwgFlute+let freq = control_m kr "freq" 440 (220,880,"exp")+    att = 0.01+    amp = control_m kr "amp" 0.25 (0,1,"amp")+    endr = 0.5+    jetr = control_m kr "jetr" 0.24 (0,1,"lin")+    jetRa = control_m kr "jetRa" 0.33 (0,1,"lin")+    gate_ = control_m kr "gate" 1 (0,1,"switch")+    release = 0.01+    noisegain = control_m kr "noisegain" 12 (1,36,"lin")+    pan = control_m kr "pan" 0 (-1,1,"lin")+    vib = sinOsc kr 4 0 + (0.001 * noisegain * whiteNoiseId 'α' ar)+    pm = envGen ar gate_ 1 0 1 DoNothing (envAsr att 1 0.2 (EnvNum 1)) * (1.1 + (amp * 0.2)) * vib+    signal = X.dwgFlute ar freq pm endr jetr jetRa 1 release+in pan2 (hpf (lpf signal 6000) 200) pan (0.2 * amp)++-- dwgFlute ; event control+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 25 + 42)+          vib = sinOsc kr 4 0 + (0.01 * z * whiteNoiseId c ar)+          pm = k2a ((0.1 + z) * vib * g)+          endr = linLin ry 0 1 0.35 0.65+          jetr = linLin y 0 1 0.65 0.85 * lagUD g 0.001 0.25+          jetRa = linLin rx 0 1 0.25 0.85 * lagUD g 0.001 0.25+          signal = X.dwgFlute ar freq pm endr jetr jetRa 1 0.01+      in pan2 (hpf (lpf signal 6000) 200) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgPlucked2.help.hs view
@@ -0,0 +1,47 @@+-- dwgPlucked2 ; self deleting+let freq = 440+    amp = 0.5+    gate_ = 1+    c3 = 20+    inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+          in amp * lfClipNoiseId 'α' ar 2000 * envGen ar gate_ 1 0 1 DoNothing e+    ps = X.dwgPlucked2 ar freq amp gate_ 0.1 1 c3 inp 0.1 1.008 0.55 0.01+    pan = 0+    z = detectSilence ps 0.001 0.1 RemoveSynth+in mrg2 (pan2 ps pan 0.1) z++-- dwgPlucked2 ; re-sounding+let dur = mce [1,1,2,1,1,1,2,3,1,1,1,1,2,3,4] * 0.175+    sequId e s tr = demand tr 0 (dseqId e dinf (mce s))+    t = let d = dseqId 'α' dinf dur+        in tDuty ar d 0 DoNothing 1 0+    freq = let n0 = sequId 'β' [60,62,63,58,48,55] t+               n1 = sequId 'γ' [63,60,48,62,55,58] t+           in midiCps (mce2 n0 n1)+    amp = tRandId 'δ' 0.01 0.35 t -- pulse amplitude (0  - 1, def = 0.5)+    gate_ = 1 -- synth release+    pos = tRandId 'ε' 0.05 0.25 t -- pluck position (0 - 1, def = 0.14)+    c1 = 1 / tRandId 'ζ' 0.25 1.75 t -- reciprocal of decay time (def = 1.0)+    c3 = tRandId 'η' 10 1400 t -- high frequency loss factor (def = 30)+    inp = let e_dt = tRandId 'θ' 0.05 0.150 t+              env = decay2 t 0.001 e_dt * lfClipNoiseId 'ι' ar 2000+          in amp * lfClipNoiseId 'κ' ar 2000 * env -- pluck signal+    release = tRandId 'λ' 0.05 0.15 t -- release time (seconds, def = 0.1)+    mistune = tRandId 'μ' 0.992 1.008 t -- factor for detuning second string (def = 1.008)+    mp = tRandId 'ν' 0.35 0.65 t -- excitation mixer (def = 0.55)+    gc = tRandId 'ξ' 0.001 0.020 t -- coupling string factor (def = 0.01)+    ps = X.dwgPlucked2 ar freq amp gate_ pos c1 c3 inp release mistune mp gc+    pan = tRandId 'ο' (-1) 1 t+in pan2 ps pan 0.1++-- dwgPlucked2 ; event control+let f (_,g,x,y,z,o,rx,_,p,_,_) =+      let c3 = 20+          (gt,tr) = ccEventGateReset g p+          dx = latch x tr - x+          freq = midiCps (p * 127 + dx)+          inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+                in z * lfClipNoiseId 'α' ar 2000 * envGen ar gt 1 0 1 DoNothing e+          ps = X.dwgPlucked2 ar freq 1 y 0.1 1 c3 inp 0.1 (1 + rx * 0.05) 0.55 (0.1 * z)+      in pan2 ps (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.75
+ Help/Ugen/dwgPluckedStiff.help.hs view
@@ -0,0 +1,46 @@+-- dwgPluckedStiff ; self deleting+let freq = 440+    amp = 0.5+    gate_ = 1+    pos = 0.14+    c1 = 1+    c3 = 30+    inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+          in amp * lfClipNoiseId 'α' ar 2000 * envGen ar gate_ 1 0 1 DoNothing e+    release = 0.1+    fB = 2.0+    ps = X.dwgPluckedStiff ar freq amp gate_ pos c1 c3 inp release fB+    pan = 0+    z = detectSilence ps 0.001 0.1 RemoveSynth+in mrg2 (pan2 ps pan 0.1) z++-- dwgPluckedStiff ; re-sounding+let sequId e s tr = demand tr 0 (dseqId e dinf (mce s))+    t = let d = dseqId 'α' dinf (mce [1,1,2,1,1,1,2,3,1,1,1,1,2,3,4] * 0.175)+        in tDuty ar d 0 DoNothing 1 0+    freq = let n0 = sequId 'β' [60,62,63,58,48,55] t+               n1 = sequId 'γ' [63,60,48,62,55,58] t+           in midiCps (mce2 n0 n1)+    amp = tRandId 'δ' 0.05 0.65 t -- pulse amplitude (0  - 1, def = 0.5)+    gate_ = 1 -- synth release+    pos = tRandId 'ε' 0.05 0.25 t -- pluck position (0 - 1, def = 0.14)+    c1 = 1 / tRandId 'ζ' 0.25 1.75 t -- reciprocal of decay time (def = 1.0)+    c3 = tRandId 'η' 10 1400 t -- high frequency loss factor (def = 30)+    inp = let e_dt = tRandId 'θ' 0.05 0.150 t+              env = decay2 t 0.001 e_dt * lfClipNoiseId 'ι' ar 2000+          in amp * lfClipNoiseId 'κ' ar 2000 * env -- pluck signal+    release = tRandId 'λ' 0.05 0.15 t -- release time (seconds, def = 0.1)+    fB = tRandId 'μ' 1.0 4.0 t -- inharmonicity factor (def = 2.0)+    ps = X.dwgPluckedStiff ar freq amp gate_ pos c1 c3 inp release fB+    pan = tRandId 'ο' (-1) 1 t+in mix (pan2 ps pan 0.1)++-- dwgPluckedStiff ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+      let freq = unitCps p+          c3 = 20+          inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+                in z * lfClipNoiseId 'α' ar 2000 * envGen ar g 1 0 1 DoNothing e+          ps = X.dwgPluckedStiff ar freq 1 y 0.1 (1 - rx * 0.01) c3 inp 0.1 (z * 4)+      in pan2 ps (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/dwgSoundBoard.help.hs view
@@ -0,0 +1,49 @@+-- dwgSoundBoard+let sig = decay2 (dustId 'α' ar 4) 0.01 1+    sb inp mul =+      let c1 = control_m kr "c1" 20.0 (1,40,"lin")+          c3 = control_m kr "c3" 20.0 (1,40,"lin")+          mix = control_m kr "mix" 0.8 (0,1,"lin")+          d1 = 199.0 * mul+          d2 = 211.0 * mul+          d3 = 223.0 * mul+          d4 = 227.0 * mul+          d5 = 229.0 * mul+          d6 = 233.0 * mul+          d7 = 239.0 * mul+          d8 = 241.0 * mul+      in X.dwgSoundBoard inp c1 c3 mix d1 d2 d3 d4 d5 d6 d7 d8+in sb sig (mce2 1 (control_m kr "mul" 2.8 (0.25,4,"lin")))++-- dwgSoundBoard ; event control+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+      let env = decay2 (trig g controlDur * z) 0.01 (0.05 + y * 0.15)+          sig = pinkNoiseId c ar * env+          c1_min = control_m kr "c1_min" 5 (1,5,"lin")+          c3_min = control_m kr "c3_min" 5 (1,5,"lin")+          c1 = linLin rx 0 1 c1_min 20+          c3 = linLin ry 0 1 c3_min 20+          mix = linLin y 0 1 0.75 1+          mul = linLin (1 - x) 0 1 0.05 0.75+          d1 = 199.0 * mul+          d2 = 211.0 * mul+          d3 = 223.0 * mul+          d4 = 227.0 * mul+          d5 = 229.0 * mul+          d6 = 233.0 * mul+          d7 = 239.0 * mul+          d8 = 241.0 * mul+      in pan2 (X.dwgSoundBoard sig c1 c3 mix d1 d2 d3 d4 d5 d6 d7 d8) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- dwgSoundBoard ; pluck ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let n = whiteNoiseId 'α' ar * (z + y * 0.75)+          dl_max = 1 / 220 -- 110+          dl = dl_max * (1 - x * 0.9)+          sig = pluck n g dl_max dl 10 (linLin y 0 1 0.65 0.80) -- 0.75 1.0+          flt = let m = y * 2+                in X.dwgSoundBoard sig 20 20 (rx * 0.35)+                   (199 * m) (211 * m) (223 * m) (227 * m) (229 * m) (233 * m) (239 * m) (241 * m)+      in pan2 flt (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/dwhite.help.hs view
@@ -0,0 +1,17 @@+-- dwhite+let n = dwhiteId 'α' dinf 0 15+    x = mouseX kr 1 40 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dwhite ; bias uniform noise to lower range+let n = dwhiteId 'α' dinf 0 1+    l = control_m kr "l" 48 (0,127,"lin")+    r = control_m kr "r" 96 (0,127,"lin")+    t = impulse kr (control_m kr "trigFreq" 2 (0.01,12,"lin")) 0+    m = exp (demand t 0 n * (log r - log l) + log l)+in sinOsc ar (midiCps m) 0 * 0.1++---- ; drawings+UI.ui_sc3_scope 2 0 4096 1 "audio" 0
+ Help/Ugen/dwrand.help.hs view
@@ -0,0 +1,6 @@+-- dwrand+let n = dwrandId 'α' dinf (mce [0.3,0.2,0.1,0.2,0.2]) (mce [1,3,2,7,8])+    x = mouseX kr 1 400 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dx7.help.hs view
@@ -0,0 +1,104 @@+-- dx7 ; texture node ; data at local buffer+let vc = [[25,21,98,38,99, 0,99, 0,36,17,87,2,1,0,0,0,59,0, 1,1,8]+         ,[66,69,60,35, 0, 0,98, 0, 0, 0, 4,0,0,0,0,1,90,0, 1,0,8]+         ,[25,21,98,38,99, 0,99, 2,35,15,79,3,1,1,0,0,91,1, 0,0,6]+         ,[97,69,60,35,99,91,98, 0, 0, 0, 0,0,0,0,0,1,68,0,22,0,7]+         ,[78,63,53,28,99,52,62, 3,38,11,80,3,0,0,0,0,77,0, 7,0,0]+         ,[98,56,63,23,99,89,74, 2, 0, 4, 1,0,0,0,0,0,99,0, 1,0,7]+         ,[99,99,99,99,50,50,50,50,3,2,1,29,99,1,0,0,0,1,24]]+    dur = randId 'α' 0.1 10.0+    mnn = iRandId 'β' 48 72+    vel = iRandId 'γ' 10 69+    loc = randId 'δ' (-1) 1+    gate_ = line kr 1 0 dur DoNothing+    reset_ = 0+    data_ = 0+    buf = asLocalBufId 'ε' (map constant (concat vc))+    s = pan2 (X.dx7 ar buf gate_ reset_ data_ 0 mnn vel 0x2000 0 0 0) loc 1+    d = detectSilence s 0.001 0.1 RemoveSynth+in mrg [out 0 s,d]++-- dx7 ; event control ; data at local buffer+let f (_,g,x,_,z,o,_,_,p,_,_) =+      let vc = [[25,21,98,38,99, 0,99, 0,36,17,87,2,1,0,0,0,59,0, 1,1,8]+               ,[66,69,60,35, 0, 0,98, 0, 0, 0, 4,0,0,0,0,1,90,0, 1,0,8]+               ,[25,21,98,38,99, 0,99, 2,35,15,79,3,1,1,0,0,91,1, 0,0,6]+               ,[97,69,60,35,99,91,98, 0, 0, 0, 0,0,0,0,0,1,68,0,22,0,7]+               ,[78,63,53,28,99,52,62, 3,38,11,80,3,0,0,0,0,77,0, 7,0,0]+               ,[98,56,63,23,99,89,74, 2, 0, 4, 1,0,0,0,0,0,99,0, 1,0,7]+               ,[99,99,99,99,50,50,50,50,3,2,1,29,99,1,0,0,0,1,24]]+          buf = asLocalBufId 'ε' (map constant (concat vc))+          x0 = latch x g+      in pan2 (X.dx7 ar buf g 0 0 0 (p * 100) z (0x2000 * (x - x0)) 0 0 0) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- dx7 ; data at shared buffer ; external control+let buf = control kr "dat" 400+    gate_ = control kr "gate" 0+    reset = control kr "reset" 0+    data_ = control kr "data" 0+    vc = control kr "vc" 0+    mnn = control kr "mnn" 60+    vel = control kr "vel" 99+    pw = 0x2000+    mw = 0+    bc = 0+    fc = 0+in X.dx7 ar buf gate_ reset data_ vc mnn vel pw mw bc fc++-- dx7 ; data at shared buffer+let nv = 32 -- 221+    buf = control kr "dat" 400+    tr = dustId 'α' kr 2.0+    gate_ = toggleFF tr+    reset_ = 0+    data_ = 0+    vc = tRandId 'β' 0 (nv - 1) tr+    mnn = tRandId 'γ' 56.5 57.5 tr -- fractional midi note number -- 60 61+    vel = tRandId 'δ' 10 29 tr+    loc = tRandId 'ε' (-1) 1 tr+in pan2 (X.dx7 ar buf gate_ reset_ data_ vc mnn vel 0x2000 0 0 0) loc 1++-- dx7 ; event control ; data at shared buffer+let f (_,g,x,_,z,o,_,_,p,_,_) =+      let buf = control kr "buf" 400+          vc = control_m kr "vc" 0 (0,31,"lin")+          x0 = latch x g+          pw = 0x2000 * (1 + (x - x0) * 2)+          s = X.dx7 ar buf g 0 0 vc (p * 127) (z * 99) pw 0 0 0+      in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control_m kr "gain" 1 (0,4,"amp")++---- ; send init voice+import qualified Sound.Sc3.Data.Yamaha.DX7 as DX7 {- hsc3-data -}+import qualified Sound.Sc3.Data.Yamaha.DX7.Sc3 as DX7 {- hsc3-data -}+DX7.dx7_sc3_data_load 400 [DX7.dx7_init_voice]++---- ; load patch data from .hex.text file+hex_fn = "/home/rohan/uc/the-center-is-between-us/trees/text/dx7/tc.hex.text"+v <- DX7.dx7_load_hex hex_fn+DX7.dx7_sc3_data_load 400 v+length v == 221++---- ; load patch data from .syx sysex file+syx_fn = "/home/rohan/sw/hsc3-data/data/yamaha/dx7ii/rom/DX7II-32A.syx"+bnk <- DX7.dx7_load_fmt9_sysex_err syx_fn+DX7.dx7_sc3_data_load 400 bnk+length bnk == 32++---- ; send external control messages+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set1 1 "vc" 0))+withSc3 (sendMessage (n_set1 1 "gate" 1.0))+withSc3 (sendMessage (n_set1 1 "gate" 0.0))+withSc3 (sendMessage (n_set1 1 "data" 0.0))+withSc3 (sendMessage (n_set1 1 "mnn" 69.0))+withSc3 (sendMessage (n_set1 1 "vel" 10.0))++{---- DX7++An Sc3 UGen of the+[Levien](https://github.com/google/music-synthesizer-for-android) /+[Gauthier](https://github.com/asb2m10/dexed) DX7 emulator codes.++-}
+ Help/Ugen/dxrand.help.hs view
@@ -0,0 +1,29 @@+-- dxrand ; c.f. drand ; dxrand never plays the same value twice in a row+let i = mce [0.2,0.4,dseqId 'α' 2 (mce [0.1,0.1])]+    d = dxrandId 'β' dinf i+in tDuty ar d 0 DoNothing (dwhiteId 'γ' dinf 0.5 1) 0++-- dxrand+let i0 = mce [0.2,0.4,dseqId 'α' 2 (mce [0.1,0.1])]+    i1 = mceMap (* 0.5) i0+    i2 = i0 * 0.5+    d = dxrandId 'β' dinf i2 -- compare i1 & i2+in tDuty ar d 0 DoNothing (dwhiteId 'γ' dinf 0.5 1) 0++-- dxrand+let n = dxrandId 'α' dinf (mce [1, 3, 2, 7, 8])+    x = mouseX kr 1 400 Exponential 0.1+    t = impulse kr x 0+    f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++{---- ; note++The list inputs to demand rate ugens may operate at different rates.+The variants i' and i'' above ought to generate the same graph.  A+simple-minded mce rule sets the rate of the operator primitive to the+maximum rate of the inputs and then does not revise this after mce+transformation, where it may be lower.  The hsc3 constructors attempt+to get this right!+-}+
+ Help/Ugen/dynKlang.help.hs view
@@ -0,0 +1,22 @@+-- dynKlang ; fixed+let s = klangSpec [800,1000,1200] [0.3,0.3,0.3] [pi,pi,pi]+in dynKlang ar 1 0 s * 0.4++-- dynKlang ; fixed randomised+let f = map (\z -> randId z 600 1000) ['a'..'l']+    s = klangSpec f (replicate 12 1) (replicate 12 0)+in dynKlang ar 1 0 s * 0.05++-- dynKlang ; dynamic frequency modulation+let f = mce3 800 1000 1200 + sinOsc kr (mce3 2 3 4.2) 0 * mce3 13 24 12+    a = mce3 0.3 0.3 0.3+    p = mce3 pi pi pi+in dynKlang ar 1 0 (klangSpec_mce f a p) * 0.1++-- dynKlang ; https://www.listarc.bham.ac.uk/lists/sc-users/msg66911.html+let k = 16 :: Int+    f i = (((fromIntegral i ** range_hs (0.3,0.7) (lag (lfNoise0Id i kr 1) 0.1)) + 1) * 99+          ,max 0 (lfNoise1Id i kr (linRandId i 0 10 0)))+    (frq,amp) = unzip (map f [0 .. k - 1])+    s = dynKlang ar 1 0 (klangSpec frq amp (replicate k 0)) * 0.01+in pan2 s 0 1
+ Help/Ugen/dynKlank.help.hs view
@@ -0,0 +1,24 @@+-- dynKlank+let s = klankSpec [800,1071,1153,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (impulse ar 2 0 * 0.1) 1 0 1 s++-- dynKlank+let s = klankSpec [800,1071,1353,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (dustId 'α' ar 8 * 0.1) 1 0 1 s++-- dynKlank+let s = klankSpec [800,1071,1353,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (pinkNoiseId 'α' ar * 0.007) 1 0 1 s++-- dynKlank+let s = klankSpec [200,671,1153,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (pinkNoiseId 'α' ar * 0.004) 1 0 1 s++-- dynKlank ; change frequencies (x) and ring-times (y) with mouse.+let x = mouseX kr 0.5 2 Exponential 0.2+    f = map (* x) [800,1071,1153,1723]+    y = mouseY kr 0.1 10 Exponential 0.2+    d = map (* y) [1,1,1,1]+    s = klankSpec f [1,1,1,1] d+    i = impulse ar 2 0 * 0.1+in dynKlank i 1 0 1 s
+ Help/Ugen/envAdsr.help.hs view
@@ -0,0 +1,57 @@+-- envAdsr ; random release time+let g = setResetFF 1 (dustId 'α' kr 1)+    p = envAdsr 0.01 0.25 0.15 0.75 1 (EnvNum (-4)) 0+    e = envGen kr g 0.1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envAdsr+let c = control kr "gate" 1+    p = envAdsr 0.75 2.75 0.1 7.25 1 (EnvNum (-4)) 0+    e = envGen kr c 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e * 0.1++-- envAdsr ; record variant+let g = control kr "gate" 1+    c = EnvNum (-4)+    r = Adsr {adsr_attackTime = 0.75+             ,adsr_decayTime = 0.75+             ,adsr_sustainLevel = 0.5+             ,adsr_releaseTime = 0.75+             ,adsr_peakLevel = 1+             ,adsr_curve = (c,c,c)+             ,adsr_bias = 0}+    p = envAdsr_r r+    e = envGen kr g 0.1 0 1 DoNothing p+in sinOsc ar 440 0 * e++-- envAdsr ; adsr_def+let g = control kr "gate" 1+    p = envAdsr_r adsr_def+    e = envGen kr g 0.1 0 1 DoNothing p+in sinOsc ar 440 0 * e++---- ; close gate message+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "gate" 0))++---- ; drawings+import Sound.Sc3.Plot {- hsc3 -}+plotEnvelope [envAdsr 0.75 0.75 0.5 0.75 1 (EnvNum (-4)) 0+             ,envAdsr 0.02 0.2 0.25 1 1 (EnvNum (-4)) 0+             ,envAdsr 0.001 0.2 0.25 1 1 (EnvNum (-4)) 0+             ,envAdsr 0 2 1 0.1 0.5 EnvSin 0+             ,envAdsr 0.001 1.54 1 0.001 0.4 EnvSin 0]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*adsr"++---- ; coord ; [0,3,2,-99,1,0.01,5,-4,0.5,0.3,5,-4,0,1,5,-4]+envelope_sc3_array (envAdsr 0.01 0.3 0.5 1 1 (EnvNum (-4)) 0)++---- ; coord ; [0,3,2,-99,1,0.3,5,-4,0.1,0.4,5,-4,0,1.2,5,-4]+envelope_sc3_array (envAdsr 0.3 0.4 0.1 1.2 1 (EnvNum (-4)) 0)++---- ; sc3+Env.adsr.asArray == [0,3,2,-99,1,0.01,5,-4,0.5,0.3,5,-4,0,1,5,-4];+x = {|gate=0, freq=440 | EnvGen.kr(Env.adsr,gate) * SinOsc.ar(freq,0) * 0.1}.play+x.set(\gate,1);+x.set(\gate,0);
+ Help/Ugen/envAsr.help.hs view
@@ -0,0 +1,30 @@+-- envAsr ; random release time+let g = setResetFF 1 (dustId 'α' kr 1)+    p = envAsr 0.01 1 1 (EnvNum (-4))+    e = envGen kr g 0.1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envAsr ; control+let g = control kr "env-gate" 1+    p = envAsr 0.01 1 1 (EnvNum (-4))+    e = envGen kr g 0.1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++---- ; close gate message+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "env-gate" 0))++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*asr"+:i Sound.Sc3.Asr++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plotEnvelope [envAsr 0.1 1 1 (EnvNum (-4))+             ,envAsr 0.3 0.25 1 EnvSin+             ,envAsr 0.01 0.5 1.25 EnvLin]++---- ; drawings ; an envelope with a long release time that mostly sustains and then decays quickly+plotEnvelope [envAsr_c 0.01 1 0.75 (EnvNum (-4),EnvNum 4)+             ,envAsr_c 0.15 1 1.25 (EnvNum (-4),EnvNum (-4))+             ,envAsr_c 0.15 1 1.25 (EnvNum (-4),EnvNum 64)]+
+ Help/Ugen/envCoord.help.hs view
@@ -0,0 +1,43 @@+-- envCoord ; co-ordinate (break-point) envelope+let c = EnvLin+    p = envCoord [(0,0),(0.5,0.1),(0.55,1),(1,0)] 9 0.1 c+    e = envGen kr 1 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envCoord ; line segments ; internal graph triggers and randomises line end points+let tr = dustId 'α' kr 2+    st = 440+    en = tRandId 'β' 300 900 tr+    tm = tRandId 'γ' 0.5 1.5 tr+    p = envCoord [(0,st),(tm,en)] 1 1 EnvLin+    e = envGen kr tr 1 0 1 DoNothing p+in sinOsc ar e 0 * 0.2++-- envCoord ; line segments ; external control+let tr = trigControl "tr" 1+    st = control kr "st" 440+    en = control kr "en" 880+    tm = control kr "tm" 2+    p = envCoord [(0,st),(tm,en)] 1 1 EnvLin+    e = envGen kr tr 1 0 1 DoNothing p+in sinOsc ar e 0 * 0.2++-- envCoord ; start and end reset randomly every 4 seconds, ramp every trigger+let tr = impulse kr (1/4) 0+    f0 = tExpRandId 'α' 110 450 tr+    f1 = tExpRandId 'β' 110 440 tr+    p = envCoord [(0,0),(0,f0),(4,f1)] 1 1 EnvExp+    e = envGen kr tr 1 0 1 DoNothing p+in splay (sinOsc ar (mce [f0,e,f1]) 0) 1 1 0 True * mce [0.05,0.1,0.05]++---- ; set target value & transition time and trigger+withSc3 (sendMessage (n_set 1 [("en",550),("tm",4),("tr",1)]))+withSc3 (sendMessage (n_set 1 [("en",990),("tm",1),("tr",1)]))+withSc3 (sendMessage (n_set 1 [("en",110),("tm",2),("tr",1)]))++---- ; plotting+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0),(0.35,0.1),(0.55,1),(1,0)] 9 0.1 EnvLin]+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0),(0.15,0.6),(0.35,0.2),(1,0)] 6 0.1 EnvSin]+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0),(0.65,0.3),(0.85,0.7),(1,0)] 5 0.1 EnvCub]+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0.1),(0.25,0.6),(0.5,0.4),(1,0.4)] 7 0.1 EnvStep]+Sound.Sc3.Plot.plotEnvelope [envCoord (zip [-1,-0.7,0.7,1] [0,0.45,0.55,1]) 1 1 EnvLin]
+ Help/Ugen/envDetect.help.hs view
@@ -0,0 +1,8 @@+-- envDetect+let i = soundIn 0+    c = X.envDetect ar i 0.01 0.1+    p = pitch i 440 60 4000 100 16 1 0.01 0.5 1 0+    f = mceChannel 0 p * 3+    e = lagUD (mceChannel 1 p) 0 0.1+    o = pinkNoiseId 'α' ar * c + sinOsc ar f 0 * c * e+in mce2 i o
+ Help/Ugen/envFollow.help.hs view
@@ -0,0 +1,6 @@+-- envFollow+let z = soundIn 0+    d = mouseX kr 0.990 0.999 Linear 0.2+    c = X.envFollow kr z d+    o = pinkNoiseId 'α' ar * c+in mce2 z o
+ Help/Ugen/envGate.help.hs view
@@ -0,0 +1,20 @@+-- envGate ; default arguments, as used by envGate_def+let k = control kr+    e = envGate 1 (k "gate" 1) (k "fadeTime" 0.02) RemoveSynth EnvSin+in lpf (saw ar 200) 600 * 0.1 * e++-- envGate ; defaults arguments+let e = envGate_def+in lpf (saw ar 200) 600 * 0.1 * e++-- envGate ; several envGate nodes can coexist, if they are the same they are shared+let e = envGate_def+    s1 = lpf (saw ar 80) 600 * e+    s2 = rlpf (saw ar 200 * 0.5) (6000 * e + 60) 0.1 * e+in mce2 s1 s2 * 0.1++---- ; set fade time, then release gate+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set1 (-1) "fadeTime" 5))+withSc3 (sendMessage (n_set1 (-1) "gate" 0))+
+ Help/Ugen/envGen.help.hs view
@@ -0,0 +1,54 @@+-- envGen ; https://www.listarc.bham.ac.uk/lists/sc-users/msg14815.html+let n = range 0.01 0.15 (lfNoise1Id 'α' kr 2)+    e = Envelope [0,1] [n] [EnvLin] Nothing (Just 0) 0+    c = env_circle_0 e+    a = envGen ar 1 1 0 1 DoNothing c+in sinOsc ar (a * 400 + 500) 0 * 0.1++-- envGen ; env_circle joins the end of the envelope to the start+let e = envelope [6000,700,100] [1,1] [EnvExp,EnvLin]+    c = env_circle_z 0 1 EnvLin e+    f = envGen kr 1 1 0 1 DoNothing c+in (sinOsc ar f 0 + impulse ar 1 0) * 0.1++-- envGen ; c.f. envXyc ; non-linear Phasor ; positive half traversed more quickly than negative+let e = envXyc [(0,0,EnvNum (-0.5)),(0.4,pi,EnvNum 0.5),(1,two_pi,EnvLin)]+    o = sinOsc kr 0 (envGen kr 1 1 0 2 DoNothing (env_circle_0 e))+in (soundIn 0 + pinkNoiseId 'α' ar * 0.1) * range 0.25 1 o++-- envGen ; impulse train with curvature ; see below for control messages ; https://fredrikolofsson.com/f0blog/impulse-train/+let go = trigControl "go" 1 -- trigger+    dur = control kr "dur" 1 -- total duration in seconds (also frequency)+    cur = control kr "cur" 0 -- curvature or 'shape'. 0 = pulses at regular intervals+    num = control kr "num" 8 -- number of impulses per duration+    amp = control kr "amp" 1 -- gain+    env = envGen ar go 1 0 1 DoNothing (envelope [0, 0, 1] [0, dur] [EnvNum cur])+in changed (ceil (env * num)) 0 * amp++{---- ; see also help files for the following envelope constructors++- envAdsr+- envAsr+- envCoord+- envGate+- envLinen+- envPairs+- envPerc+- envSine+- envStep+- envTrapezoid+- envTriangle+- envXyc++-}++---- ; set impulse train controls+set = withSc3 . sendMessage . n_set (-1)+set [("go", 1), ("cur", 3), ("num", 18)] -- start slow and go faster+set [("go", 1), ("cur", -2), ("num", 18)] -- slower and slower+set [("go", 1), ("amp", 0.2), ("cur", 0), ("dur", 0.5), ("num", 200)] -- 200 for half a second = 400 Hz++---- ; drawings+let e = envelope [6000,700,100] [1,1] [EnvExp,EnvLin]+envelope_sc3_array e == Just [6000,2,-99,-99,700,1,2,0,100,1,1,0]+Sound.Sc3.Plot.plotEnvelope [e]
+ Help/Ugen/envLinen.help.hs view
@@ -0,0 +1,26 @@+-- envLinen+let t = envLinen 0.4 2 0.4 0.1+    e = envGen kr 1 1 0 1 RemoveSynth t+in sinOsc ar 440 0 * e++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plotEnvelope [envLinen 0.4 2 0.4 0.6,envLinen 0.6 1 1.2 0.7]+plotEnvelope [envLinen 0 1 0 0.4]+plotEnvelope [envelope_normalise (envLinen 0 2 0 0.5)]++---- ; help+Sound.Sc3.UGen.Help.viewSc3Help "Env.*linen"+:i Sound.Sc3.LINEN++---- ; language access+let e = envLinen 0 1 0 1 :: Envelope Double+in (envelope_duration e+   ,envelope_segment_ix e 0+   ,envelope_segment_ix e 1+   ,envelope_segment e 0+   ,envelope_segment e 1+   ,envelope_at e 0+   ,envelope_at e 1+   ,envelope_render 10 e)+
+ Help/Ugen/envPairs.help.hs view
@@ -0,0 +1,14 @@+-- envPairs+let c = EnvLin+    p = envPairs [(0,0),(5,0.01),(5.5,0.1),(10,0)] c+    e = envGen kr 1 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++---- ; plot+import Sound.Sc3.Plot {- hsc3-plot -}+plotEnvelope [envPairs [(0,0),(5,0.01),(5.5,0.1),(10,0)] EnvLin]+plotEnvelope [envPairs [(0,1),(2.1,0.5),(3,1.4),(5,0.001)] EnvExp]+plotEnvelope [envPairs [(0,110),(4,220),(9,440),(11,220),(13,880),(19,110),(23,55),(27,55)] EnvExp]++---- ; help+Sound.Sc3.Common.Help.sc3_scdoc_help_open False (sc3_scdoc_help_path "Env.*pairs")
+ Help/Ugen/envPerc.help.hs view
@@ -0,0 +1,23 @@+-- envPerc+let a = 0.1+    p = envPerc 0.01 1+    e = envGen kr 1 a 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envPerc+let a = 0.1+    c = EnvNum (-4)+    p = envPerc_c 0.01 1 a (c,c)+    e = envGen kr 1 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envPerc 0.05 1,envPerc 0.2 0.75]+Sound.Sc3.Plot.plotEnvelope [envPerc 0.1 1,envPerc_c 0.1 1 1 (EnvSin,EnvSin)]+Sound.Sc3.Plot.plotEnvelope [envPerc_c 0.01 5 1 (EnvNum (-40), EnvNum (-40))]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*perc"++---- ; coordinates+envelope_sc3_array (envPerc 0.01 1) == Just [0,2,-99,-99,1,0.01,5,-4,0,1,5,-4]
+ Help/Ugen/envSine.help.hs view
@@ -0,0 +1,10 @@+-- envSine+let s = envSine 9 0.1+    e = envGen kr 1 1 0 1 RemoveSynth s+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envSine 9 1,envSine 3 0.25]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*sine"
+ Help/Ugen/envStep.help.hs view
@@ -0,0 +1,16 @@+-- envStep+let env = envStep [0.0,0.5,0.7,1.0,0.9,0.0] [0.5,0.1,0.2,1.0,1.5,3] Nothing Nothing+    envgen = envGen ar 1 1 0 1 RemoveSynth env+in sinOsc ar (envgen * 1000 + 440) 0 * (envgen + 1) * 0.1++-- envStep ; major scale, accelerating, with loop & release nodes+let env = envStep [0,2,4,5,7,9,11,12,0] (take 9 (iterate (* 0.75) 1)) (Just 8) (Just 0)+    envgen = envGen ar 1 1 0 1 DoNothing env+in sinOsc ar (midiCps (envgen + 60)) 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envStep [0,2,4,5,7,9,11,12] (take 8 (iterate (* 0.75) 1)) Nothing Nothing]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*step"+
+ Help/Ugen/envTrapezoid.help.hs view
@@ -0,0 +1,10 @@+-- envTrapezoid+let t = envTrapezoid 0.05 0.95 3 0.1+    e = envGen kr 1 1 0 1 RemoveSynth t+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envTrapezoid 0.75 0.25 2 1,envTrapezoid 0.25 0.75 3 0.5]++---- ; coord+envelope_sc3_array (envTrapezoid 0 0.25 2 0.1) == Just [0,3,-99,-99,0.1,0.5,1,0,0.1,0,1,0,0,1.5,1,0]
+ Help/Ugen/envTriangle.help.hs view
@@ -0,0 +1,10 @@+-- envTriangle+let t = envTriangle 1 0.1+    e = envGen kr 1 1 0 1 RemoveSynth t+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envTriangle 1 1,envTriangle 0.25 0.5]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*triangle"
+ Help/Ugen/envXyc.help.hs view
@@ -0,0 +1,5 @@+---- ; drawing+Sound.Sc3.Plot.plotEnvelope [envXyc [(0, 330, EnvExp), (0.5, 440, EnvExp), (1.0, 1760, EnvLin)]]++---- ; help+Sound.Sc3.Common.Help.sc3_scdoc_help_open False (sc3_scdoc_help_path "Env.*xyc")
+ Help/Ugen/equal_to.help.hs view
@@ -0,0 +1,33 @@+-- equal_to+let o = sinOsc kr 1 0+    t = [o `greater_than` 0+        ,o `greater_than_or_equal_to` 0+        ,o `less_than` 0+        ,o `less_than_or_equal_to` 0+        ,o `equal_to` 0+        ,(o `less_than` 0.001) * (o `greater_than` (-0.001))]+    f = [220, 330, 440, 550, 660, 770]+    p = envPerc 0.01 1+    e = envGen kr (mce t) 0.1 0 1 DoNothing p+in mix (sinOsc ar (mce f) 0 * e)++-- equal_to ; operators+let o = sinOsc kr 1 0+    t = [o >** 0+        ,o >=** 0+        ,o <** 0+        ,o <=** 0+        ,o ==** 0+        ,(o <** 0.001) * (o >** (-0.001))]+    f = [220, 330, 440, 550, 660, 770]+    p = envPerc 0.01 1+    e = envGen kr (mce t) 0.1 0 1 DoNothing p+in mix (sinOsc ar (mce f) 0 * e)++{---- ; operators++The star suffixes (==**,/=**,<**,<=**,>**,>=**) are because the result of the+operators is not of type Bool, as is required by the signature for the+classes Eq and Ord.++-}
+ Help/Ugen/eventVoicer.help.hs view
@@ -0,0 +1,81 @@+-- event ; c=freq ; harmonics of A2+let f (c,g,_,_,_,_,_,_,_,_,_) = sinOsc ar (110 * (constant c + 1)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.05++-- event ; x=freq ; 0-1 = full range ; i.e. mpe controller or large touch controller+let f (_,g,x,_,_,_,_,_,_,_,_) = sinOsc ar (midiCps (x * 127)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; x=freq ; 0-1 = partial range ; i.e. small touch controller+let f (_,g,x,_,_,_,_,_,_,_,_) = sinOsc ar (midiCps (x * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; y=freq ; 0-1 = partial range+let f (_,g,_,y,_,_,_,_,_,_,_) = sinOsc ar (midiCps (y * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; z=freq ; 0-1 = partial range+let f (_,g,_,_,z,_,_,_,_,_,_) = sinOsc ar (midiCps (z * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; o=freq ; 0-1 = partial range+let f (_,g,_,_,_,o,_,_,_,_,_) = sinOsc ar (midiCps (o * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; rx=freq ; 0-1 = partial range+let f (_,g,_,_,_,_,rx,_,_,_,_) = sinOsc ar (midiCps (rx * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; ry=freq ; 0-1 = partial range+let f (_,g,_,_,_,_,_,ry,_,_,_) = sinOsc ar (midiCps (ry * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; p=freq ; p is a pitch value in (0,1) calculated by the control input system+let f (_,g,_,_,_,_,_,_,p,_,_) = sinOsc ar (unitCps p) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; p+px=freq+let f (_,w,_,_,_,_,_,_,p,px,_) = sinOsc ar (midiCps (p * 127 + px)) 0 * w+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; p+px=freq ; z*z=ampl ; w=gate+let f (_,w,_,_,z,_,_,_,p,px,_) = sinOsc ar (midiCps (p * 127 + px)) 0 * w * z * z * 4+in mix (voicer 16 f) * control kr "gain" 1++-- event ; x=freq y=amp ; 0-1 = partial range+let f (_,g,x,y,_,_,_,_,_,_,_) = sinOsc ar (midiCps (x * 12 + 48)) 0 * y * lagUD g 0.05 1+in mix (voicer 16 f) * control kr "gain" 0.2++-- event ; x=freq z=amp ; 0-1 = partial range ; 24ET+let f (_,g,x,_,z,_,_,_,_,_,_) = sinOsc ar (midiCps ((x * 12 + 48) `roundTo` 0.5)) 0 * z * g+in mix (voicer 16 f) * control kr "gain" 0.5++-- event ; p=freq z=amp+let f (_,g,_,_,z,_,_,_,p,_,_) = sinOsc ar (unitCps p * 2) 0 * g * z+in mix (voicer 16 f) * control kr "gain" 1.0++-- event ; x=freq y=pan z=amp ; 0-1 = partial range ; 24ET+let f (_,g,x,y,z,_,_,_,_,_,_) =+      pan2 (sinOsc ar (midiCps ((x * 12 + 48) `roundTo` 0.5)) 0) (y * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.5++-- event ; p=freq y=pan z=amp ; 0-1 = partial range ; 24ET+let f (_,g,_,y,z,_,_,_,p,_,_) =+      pan2 (sinOsc ar (unitCps p `roundTo` 0.5) 0) (y * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.5++-- event ; simple frequency modulation+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let cR = 1 -- carrier ratio+          mR = 2 -- modulation ratio+          mI = y * 3 -- modulation index+          f0 = midiCps (x * 25 + 48)+          f1 = f0 * cR+          f2 = f0 * mR+          o2 = sinOsc ar f2 0+          o1 = sinOsc ar (f1 + (o2 * mI * f2)) 0+      in pan2 o1 (o * 2 - 1) (z * z * g)+in mix (voicer 16 f) * control kr "gain" 4++---- ; reference tones+mix (sinOsc ar (midiCps (mce [48,60,72])) 0 * mce [0.1,0.01,0.1])
+ Help/Ugen/excess.help.hs view
@@ -0,0 +1,10 @@+-- excess+(fSinOsc ar 1000 0 `excess` line kr 0 1 8 DoNothing) * 0.1++-- excess ; written out in terms of clip2+let o = fSinOsc ar 1000 0+    l = line kr 0 1 8 DoNothing+in (o - clip2 o l) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_fn_r1_ln (\x -> excess x 1) (-2,2)
+ Help/Ugen/expRand.help.hs view
@@ -0,0 +1,4 @@+-- expRand+let a = line kr 0.5 0 0.01 RemoveSynth+    f = expRandId 'α' 100.0 8000.0+in fSinOsc ar f 0 * a
+ Help/Ugen/expRandN.help.hs view
@@ -0,0 +1,13 @@+-- expRandN ; two channel sin tones+sinOsc ar (X.expRandNId 2 'α' 440 880) 0 * 0.1++-- expRandN ; n node klang synthesis+let n = 240+    f = X.expRandNId n 'α' 40 18000+    a = X.expRandNId n 'β' 0.1 0.3+    p = X.randNId n 'γ' (-1) 1+    s = klangSpec_mce f a p+in klang ar 1 0 s * 0.01++-- expRandN ; mce...+let f = X.expRandNId 2 'α' (mce2 440 441) 442 in sinOsc ar f 0 * 0.1
+ Help/Ugen/fSinOsc.help.hs view
@@ -0,0 +1,9 @@+-- fSinOsc ; note SC2 did not have the initial phase argument+fSinOsc ar (mce2 440 550) 0 * 0.05++-- fSinOsc ; modulate frequency+fSinOsc ar (xLine kr 200 4000 1 RemoveSynth) 0 * 0.1++-- fSinOsc ; loses amplitude towards the end+let f = fSinOsc ar (xLine kr 4 401 8 RemoveSynth)+in fSinOsc ar (f 0 * 200 + 800) 0 * 0.1
+ Help/Ugen/fbSineC.help.hs view
@@ -0,0 +1,31 @@+-- fbSineC ; Sc3 default values+fbSineC ar (sampleRate / 2) 1 0.1 1.1 0.5 0.1 0.1 * 0.1++-- fbSineC ; fb generating noise+fbSineC ar (sampleRate / 2) 1 4 1.1 0.5 0.1 0.1 * 0.1++-- fbSineC ; increase feedback+let fb = line kr 0.01 4 10 DoNothing+in fbSineC ar sampleRate 1 fb 1.1 0.5 0.1 0.1 * 0.1++-- fbSineC ; increase phase multiplier+let a = line kr 1 2 10 DoNothing+in fbSineC ar sampleRate 1 0 a 0.5 0.1 0.1 * 0.1++-- fbSineC ; randomly modulate parameters+let x = mouseX kr 1 12 Linear 0.1+    nId e = lfNoise2Id e kr x+    n0 = nId 'α' * 10000 + 10000+    n1 = nId 'β' * 32 + 33+    n2 = nId 'γ' * 0.5+    n3 = nId 'δ' * 0.05 + 1.05+    n4 = nId 'ε' * 0.3 + 0.3+in fbSineC ar n0 n1 n2 n3 n4 0.1 0.1 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (fbSineC ar 600 1.0 4.0 1.1 0.5 0.1 0.1)++---- ; haskell implementation of equation+import Sound.Sc3.Common.Math.Noise {- hsc3 -}+fbSineC_hs im fb a c = map fst (iterate (fbSine_f im fb a c) (0.1,0.1))+Sound.Sc3.Plot.plot_p1_ln [take 600 (fbSineC_hs 1.0 4.0 1.1 0.5)]
+ Help/Ugen/fbSineL.help.hs view
@@ -0,0 +1,1 @@+---- c.f fbSineC
+ Help/Ugen/fbSineN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. fbSineC
+ Help/Ugen/fdiv.help.hs view
@@ -0,0 +1,4 @@+-- fdiv+let o = fSinOsc kr 10 0.5+    n = pinkNoiseId 'α' ar+in (n * 0.1) / (o * 0.75)
+ Help/Ugen/fft.help.hs view
@@ -0,0 +1,9 @@+-- fft ; variant with default values+let n = whiteNoiseId 'α' ar+in ifft' (fft' (localBufId 'β' 1 2048) (n * 0.05))++-- fft ; local buffer allocating variant+let s0 = sinOsc kr 0.08 0 * 6 + 6.2+    s1 = sinOsc kr (squared s0) 0 * 100 + 800+    s2 = sinOsc ar s1 0+in ifft (fftAllocId 'α' 2048 s2 0.5 0 1 0) 0 0 * 0.1
+ Help/Ugen/fftTrigger.help.hs view
@@ -0,0 +1,1 @@+---- c.f. packFFT
+ Help/Ugen/fm7.help.hs view
@@ -0,0 +1,94 @@+-- fm7 ; two of six ; direct form+let c = mce [xLine kr 300 310 4 DoNothing,0,1+            ,xLine kr 300 310 8 DoNothing,0,1+            ,0,0,1+            ,0,0,1+            ,0,0,1+            ,0,0,1]+    m = mce [line kr 0 0.001 2 DoNothing,line kr 0.1 0 4 DoNothing,0,0,0,0+            ,line kr 0 6 1 DoNothing,0,0,0,0,0+            ,0,0,0,0,0,0+            ,0,0,0,0,0,0+            ,0,0,0,0,0,0+            ,0,0,0,0,0,0]+    [l,r,_,_,_,_] = mceChannels (X.fm7 ar c m)+in mce2 l r * 0.1++-- fm7 ; two of six ; matrix form ; inputs may be audio or control or initialization rate+let rt = ar+    c = [[xLine rt 300 310 4 DoNothing,0,1]+        ,[xLine rt 300 310 8 DoNothing,0,1]+        ,[0,0,1]+        ,[0,0,1]+        ,[0,0,1]+        ,[0,0,1] ]+    m = [[line rt 0 0.001 2 DoNothing,line rt 0.1 0 4 DoNothing,0,0,0,0]+        ,[line rt 0 6 1 DoNothing,0,0,0,0,0]+        ,[0,0,0,0,0,0]+        ,[0,0,0,0,0,0]+        ,[0,0,0,0,0,0]+        ,[0,0,0,0,0,0] ]+    [l,r,_,_,_,_] = mceChannels (X.fm7_mx c m)+in mce2 l r * 0.1++-- fm7 ; an algorithmically generated graph courtesy f0+let x = [[[0.0,-1/3,-1.0,0.0]+         ,[0.75,0.75,0.0,-0.5]+         ,[-0.5,-0.25,0.25,-0.75]+         ,[-0.5,1.0,1.0,1.0]+         ,[0.0,1/6,-0.75,-1.0]+         ,[0.5,0.5,-0.5,1/3]]+        ,[[-1/3,0.5,-0.5,-0.5]+         ,[0.5,0.75,0.25,0.75]+         ,[-15/18,0.25,-1.0,0.5]+         ,[1.5,0.25,0.25,-0.25]+         ,[-2/3,-2/3,-1.0,-0.5]+         ,[-1.0,0.0,-15/18,-1/3]]+        ,[[0.25,-0.5,-0.5,-1.0]+         ,[-0.5,1.0,-1.5,0.0]+         ,[-1.0,-1.5,-0.5,0.0]+         ,[0.5,-1.0,7/6,-0.5]+         ,[15/18,-0.75,-1.5,0.5]+         ,[0.25,-1.0,0.5,1.0]]+        ,[[1.0,1/3,0.0,-0.75]+         ,[-0.25,0.0,0.0,-0.5]+         ,[-0.5,-0.5,0.0,0.5]+         ,[1.0,0.75,0.5,0.5]+         ,[0.0,1.5,-0.5,0.0]+         ,[1.0,0.0,-0.25,-0.5]]+        ,[[0.5,-0.25,0.0,1/3]+         ,[0.25,-0.75,1/3,-1.0]+         ,[-0.25,-0.5,0.25,-7/6]+         ,[0.0,0.25,0.5,1/6]+         ,[-1.0,-0.5,15/18,-0.5]+         ,[15/18,-0.75,-0.5,0.0]]+        ,[[0.0,-0.75,-1/6,0.0]+         ,[1.0,0.5,0.5,0.0]+         ,[-0.5,0.0,-0.5,0.0]+         ,[-0.5,-1/6,0.0,0.5]+         ,[-0.25,1/6,-0.75,0.25]+         ,[-7/6,-4/3,-1/6,1.5]]]+    y = [[[0.0,-0.5,1.0,0.0]+         ,[-0.5,1.0,0.5,-0.5]+         ,[0.0,1/3,1.0,1.0]]+        ,[[-0.5,0.5,1.0,1.0]+         ,[0.0,1/3,0.0,1.5]+         ,[-0.5,15/18,1.0,0.0]]+        ,[[0.25,-2/3,0.25,0.0]+         ,[0.5,-0.5,-0.5,-0.5]+         ,[0.5,-0.5,-0.75,15/18]]+        ,[[-0.25,1.0,0.0,1/3]+         ,[-1.25,-0.25,0.5,0.0]+         ,[0.0,-1.25,-0.25,-0.5]]+        ,[[0.75,-0.25,1.5,0.0]+         ,[0.25,-1.5,0.5,0.5]+         ,[-0.5,-0.5,-0.5,-0.25]]+        ,[[0.0,0.5,-0.5,0.25]+         ,[0.25,0.5,-1/3,0.0]+         ,[1.0,0.5,-1/6,0.5]]]+    cs = map (map (\[f,p,m,a] -> sinOsc ar f p * m + a)) x+    ms = map (map (\[f,w,m,a] -> pulse ar f w * m + a)) y+    [c1,c2,c3,c4,c5,c6] = mceChannels (X.fm7_mx cs ms)+    g3 = linLin (lfSaw kr 0.1 0) (-1) 1 0 (dbAmp (-12))+    g6 = dbAmp (-3)+in mce [c1 + c3 * g3 + c5,c2 + c4 + c6 * g6]
+ Help/Ugen/fmGrain.help.hs view
@@ -0,0 +1,6 @@+-- fmGrain+let t = impulse ar 20 0+    n = linLin (lfNoise1Id 'α' kr 1) (-1) 1 1 10+    s = envSine 9 0.1+    e = envGen kr 1 1 0 1 RemoveSynth s+in X.fmGrain t 0.2 440 220 n * e
+ Help/Ugen/fmGrainB.help.hs view
@@ -0,0 +1,10 @@+-- fmGrainB+let b = control kr "tbl" 10+    t = impulse ar 20 0+    n = linLin (lfNoise1Id 'α' kr 1) (-1) 1 1 10+    s = envSine 9 0.1+    e = envGen kr 1 1 0 1 RemoveSynth s+in X.fmGrainB t 0.2 440 220 n b * e++---- ; alloc table+withSc3 (mapM_ maybe_async [b_alloc 10 512 1,b_gen_sine2 10 [Normalise,Wavetable,Clear] [(0.5,0.1)]])
+ Help/Ugen/fold2.help.hs view
@@ -0,0 +1,5 @@+-- fold2+(fSinOsc ar 1000 0 `fold2` line kr 0 1 8 DoNothing) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_fn_r1_ln (\x -> fold2 x 1) (-2,2)
+ Help/Ugen/formant.help.hs view
@@ -0,0 +1,21 @@+-- formant ; default values+formant ar 440 1760 880 * 0.125++-- formant ; modulate fundamental frequency, formant frequency stays constant+formant ar (xLine kr 400 1000 8 RemoveSynth) 2000 800 * 0.125++-- formant ; modulate formant frequency, fundamental frequency stays constant+let f = mce [200, 300, 400, 500]+    ff = xLine kr 400 4000 8 RemoveSynth+in splay (formant ar f ff 200) 1 1 0 True * 0.125++-- formant ; modulate width frequency, other frequencies stay constant+let bw = xLine kr 800 8000 8 RemoveSynth+in formant ar 400 2000 bw * 0.1++-- formant ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let f0 = mce [200, 300, 400, 500] * x+          ff = linExp y 0 1 400 1200+      in splay (formant ar f0 ff 200) 1 (g * z) (o * 2 - 1) True+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/formlet.help.hs view
@@ -0,0 +1,30 @@+-- formlet+formlet (impulse ar 20 0.5) 1000 0.01 0.1++-- formlet+let f = xLine kr 10 400 8 RemoveSynth+in formlet (blip ar f 1000 * 0.1) 1000 0.01 0.1++-- formlet ; modulating formant frequency+let s = blip ar (sinOsc kr 5 0 * 20 + 300) 1000 * 0.1+    ff = xLine kr 1500 700 8 RemoveSynth+in formlet s ff 0.005 0.04++-- formlet ; mouse control of frequency and decay time+let s = blip ar (sinOsc kr 5 0 * 20 + 300) 1000 * 0.1+    x = mouseX kr 0.01 0.2 Exponential 0.2+    y = mouseY kr 700 2000 Exponential 0.2+in formlet s y 0.005 x++-- formlet ; and again (control-rate)+let s = dustId 'α' kr (mce2 10 11)+    x = mouseX kr 0.1 2 Exponential 0.2+    y = mouseY kr 7 200 Exponential 0.2+    f = formlet s y 0.005 x+in k2a f + sinOsc ar (f * 200 + mce2 500 600 - 100) 0 * 0.1++-- formlet ; event control+let f (c,g,x,y,z,o,rx,_,_,_,_) =+      let s = blip ar (sinOsc kr 5 0 * 20 * constant (c + 1) + 300) (2000 * rx)+      in pan2 (formlet s (linExp y 0 1 700 2000) 0.005 (linExp x 0 1 0.01 0.2)) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/fos.help.hs view
@@ -0,0 +1,7 @@+-- fos ; same as OnePole+let x = lfTri ar 0.4 0 * 0.99+in fos (lfSaw ar 200 0 * 0.1) (1 - (abs x)) 0 x++-- fos ;same as OneZero+let x = lfTri ar 0.4 0 * 0.99+in fos (lfSaw ar 200 0 * 0.1) (1 - (abs x)) x 0
+ Help/Ugen/frac.help.hs view
@@ -0,0 +1,10 @@+-- frac ; fractional part ; jrhb ; https://www.listarc.bham.ac.uk/lists/sc-users/msg68991.html+let x = mouseX kr (-10) 10 Linear 0.1+    y = mouseY kr 0 5 Linear 0.1+    i = (lfSaw kr 0.062 0 `in_range` (-10,10)) + (y * mce [0 .. 8])+    d = frac i+    a = 0.8 - modDif d 0.5 1+    z1 = gcdE i x + d+    z2 = lcmE i x + d+    freq = (abs (mceTranspose (mce [z1,z2])) + 1) * 120+in mix (sinOsc ar freq 0 * ampComp kr freq 261.625 (1/3)) * a * 0.01
+ Help/Ugen/free.help.hs view
@@ -0,0 +1,5 @@+-- free+let n0 = pinkNoiseId 'α' ar * 0.05+    n1 = dustId 'β' kr 1+in mrg [n0,free n1 (-1)]+
+ Help/Ugen/freeSelf.help.hs view
@@ -0,0 +1,3 @@+-- freeSelf+let n = dustId 'α' kr 0.5+in mrg [sinOsc ar 440 0 * 0.1,freeSelf n]
+ Help/Ugen/freeSelfWhenDone.help.hs view
@@ -0,0 +1,9 @@+-- freeSelfWhenDone ; mouseX is trigger+let x = mouseX kr (-1) 1 Linear 0.1+    e = linen x 1 0.1 1 DoNothing+in mrg [sinOsc ar 440 0 * e,freeSelfWhenDone e]++-- freeSelfWhenDone ; mouseX is trigger ; using RemoveSynth doneAction+let x = mouseX kr (-1) 1 Linear 0.1+    e = linen x 1 0.1 1 RemoveSynth+in sinOsc ar 440 0 * e
+ Help/Ugen/freeVerb.help.hs view
@@ -0,0 +1,14 @@+-- freeVerb2 ; mouse control+let i = impulse ar 1 0+    c = lfCub ar 1200 0+    s = decay i 0.25 * c * 0.1+    x = mouseX kr 0 1 Linear 0.1+    y = mouseY kr 0 1 Linear 0.1+in freeVerb s y x 0.5++-- freeVerb2 ; process input channels ; warning=feedback+let i = soundIn (mce2 0 1)+    c = mceChannel+    x = mouseX kr 0 1 Linear 0.1+    y = mouseY kr 0 1 Linear 0.1+in freeVerb2 (c 0 i) (c 1 i) y x 0.5
+ Help/Ugen/freezer.help.hs view
@@ -0,0 +1,80 @@+-- freezer ; check buffer+let b = control kr "buf" 100+    s = bufRateScale kr b+in playBuf 1 ar b s 1 0 NoLoop RemoveSynth * 0.1++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.35 0.4 0.6 0.1 0.05 0.02 0.1 0 0 6++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.3 0.4 0.6 1 0 0 0 0 0 6++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.3 0.7 0.6 0.35 0 0.5 0.5 0 0 6++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.2500 0.2505 0.1 1 0 0.050 0.005 0 0 24++-- freezer ; k-rate instance+let b = control kr "buf" 100+    n f i j = linLin (lfNoise2 kr f) (-1) 1 i j+    left = n 1 0.3 0.8+    right = left + n 1 0.01 0.05+in X.freezer b left right 0.1 0.5 0.1 0.5 0.05 0 0 24++-- freezer ; k-rate instance ; id+let b = control kr "buf" 100+    nId z f i j = linLin (lfNoise2Id z kr f) (-1) 1 i j+    left = nId 'α' 1 0.3 0.8+    right = left + nId 'β' 1 0.01 0.05+in X.freezer b left right 0.1 0.5 0.1 0.5 0.05 0 0 24++-- freezer ; k-rate instance+let b = control kr "buf" 100+    n i j = linLin (lfNoise2 kr 0.1) (-1) 1 i j+in X.freezer b (n 0.3 0.4) (n 0.5 0.6) (n 0.3 0.6) (n 0.95 1.05) (n 0.05 0.15) (n 0.05 0.15) (n 0.05 0.15) 0 0 36++-- freezer ; k-rate instance ; id+let b = control kr "buf" 100+    nId z i j = linLin (lfNoise2Id z kr 0.1) (-1) 1 i j+in X.freezer b (nId 'α' 0.3 0.4) (nId 'β' 0.5 0.6) (nId 'γ' 0.3 0.6) (nId 'δ' 0.95 1.05) (nId 'ε' 0.05 0.15) (nId 'ζ' 0.05 0.15) (nId 'η' 0.05 0.15) 0 0 36++-- freezer ; controls+let b = control_m kr "buf" 100 (0,0,"lin")+    (lhs,rhs) = control_rng kr "wnd" (0,1) (0,1,"lin")+    amp = control_m kr "amp" 0.1 (0,1,"amp")+    incr = control_m kr "incr" 1 (0,4,"lin")+    incrO = control_m kr "incrO" 0 (0,1,"lin")+    incrR = control_m kr "incrR" 0 (0,1,"lin")+    wndR = control_m kr "wndR" 0 (0,1,"lin")+    syncPh = control_m kr "syncPh" 0 (0,1,"trigger")+    randPh = control_m kr "randPh" 0 (0,1,"trigger")+    dgr = control_m kr "numLp" 24 (1,64,"lin")+in X.freezer b lhs rhs amp incr incrO incrR wndR syncPh randPh dgr++---- ; allocate buffer 100, required for examples+import Sound.Sc3.Server.Command.MemCpy {- sc3-rdu -}+ld fn = b_allocReadOrSend 100 (sfResolve fn) 0 0 >>= (withSc3 . async)+ld "instr/crotales/crotale05(D).wav"+ld "saron-panerus-S-0-5.flac"+ld "saron-panerus-S-0-6.flac"+ld "saron-barung-S-0-1.flac"+ld "saron-demung-S-1-3.flac"+ld "saron-demung-S-1-5.flac"+ld "saron-demung-S-1-6.flac"+ld "bonang-barung-S-0-2.flac"+ld "bonang-barung-S-2-1.flac"+ld "gender-barung-S-1-2.flac"+ld "gender-barung-S-2-5.flac"+ld "gender-barung-S-3-3.flac"++{---- ; RFreeze ; concurrent loops at a signal buffer++Create a set of concurrent loops at a signal buffer.  This is the+dynamic and gestural variant of RLoopSet.  It was written after+reading the manual for the Grm Tools 'Freeze' plugin.+-}
+ Help/Ugen/freqShift.help.hs view
@@ -0,0 +1,31 @@+-- freqShift ; shifting a 100Hz tone by 1 Hz rising to 500Hz+let i = sinOsc ar 100 0+    s = xLine kr 1 500 5 RemoveSynth+in freqShift i s 0 * 0.1++-- freqShift ; Shifting a complex tone by 1 Hz rising to 500Hz+let d = klangSpec [101, 303, 606, 808] [1, 1, 1, 1] [1, 1, 1, 1]+    i = klang ar 1 0 d+    s = xLine kr 1 500 5 RemoveSynth+in freqShift i s 0 * 0.1++-- freqShift ; Modulating shift and phase+let s = lfNoise2Id 'α' ar 0.3+    i = sinOsc ar 10 0+    p = linLin (sinOsc ar 500 0) (-1) 1 0 (2 * pi)+in freqShift i (s * 1500) p * 0.1++-- freqShift ; Shifting bandpassed noise+let n1 = whiteNoiseId 'α' ar+    n2 = lfNoise0Id 'β' ar 5.5+    i = bpf n1 1000 0.001+    s = n2 * 1000+in freqShift i s 0 * 32++-- freqShift+let e = lfGauss ar 4 (1/8) 0 Loop DoNothing+    o = blip ar 60 4 * e+    a = o / 4 + localIn 2 ar 0+    s = freqShift a (lfNoise0Id 'α' kr (1/4) * 90) 0+    z = delayC s 1 0.1 * 0.9+in mrg2 s (localOut z)
+ Help/Ugen/friction.help.hs view
@@ -0,0 +1,30 @@+-- friction ; filters a sine wave ; chaotic result+let o = sinOsc ar 660 0+    s = X.friction ar o 0.0000541322 0.414 0.313 8.05501 1.0+in pan2 s 0 0.1++-- friction ; mouse control+let o = lag (sinOsc ar ((lfPulse kr 0.5 0 0.5 + lfPulse kr 0.33 0 0.5) * 440 + 220) 0) 0.1+    x = mouseX kr 0.00001 0.03 Exponential 0.2+    y = mouseY kr 0.2 10 Exponential 0.2+    s = X.friction ar o x 0.414 0.313 y 1.0+in (mce2 o s) * 0.5++-- friction ; control rate+let s = lfPar kr 33 0 + mouseX kr 0.01 10 Exponential 0.2+    y = mouseY kr 0 1 Linear 0.2+    o = X.friction kr s 0.0000541322 y 0.318 8.05501 1.0+in pan2 (sinOsc ar (o * 350 + 150) 0) 0 0.1++-- friction ; event control+let f (_,w,x,y,z,o,_,_,_,_,_) =+      let im = trig1 (k2a w) sampleDur * 0.1+          kl = ringz im (x * mce [800, 1071, 1153, 1723]) 1+          ru = X.friction ar kl (y * 0.000175584) 0.414 0.313 2.69789 1.0+      in pan2 (mix ru) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- mutantsounds 05 https://swiki.hfbk-hamburg.de/MusicTechnology/899+let x = mceFillInt 5 (\i -> clip (lfNoise2Id i kr 3) 0 1 * 0.03 + 0.00001)+    s = X.friction ar (lfTri ar 50 0) x 0.414 0.313 (x * 30000) 1+in splay s 1 1 0 True
+ Help/Ugen/gVerb.help.hs view
@@ -0,0 +1,17 @@+-- gVerb ; mono reverb+let i = impulse ar (mce2 1 2) 0+    c = lfCub ar (mce2 900 1200) 0+    s = decay i (mce2 0.05 0.25) * c * 0.05+in mix (gVerb s 10 3 0.5 0.5 15 1 0.7 0.5 300)++-- gVerb ; controls+let roomsize = control kr "roomsize" 10.0+    revtime = control kr "revtime" 3.0+    damping = control kr "damping" 0.5+    inputbw = control kr "inputbw" 0.5+    spread = control kr "spread" 15.0+    drylevel = control kr "drylevel" 1.0+    earlyreflevel = control kr "earlyreflevel" 0.7+    taillevel = control kr "taillevel" 0.5+    maxroomsize = control kr "maxroomsize" 300.0+in gVerb (soundIn 0) roomsize revtime damping inputbw spread drylevel earlyreflevel taillevel maxroomsize
+ Help/Ugen/gammatone.help.hs view
@@ -0,0 +1,101 @@+-- gammatone+X.gammatone (whiteNoiseId 'α' ar) 440 200 * 0.5++-- gammatone ; sweeping frequency of sine input+X.gammatone (sinOsc ar (mouseX kr 100 2000 Linear 0.2) 0) 1000 500 * 0.5++-- gammatone ; filters centered on 88 piano keys+let freqs = take 88 (map midiCps [21..])+    to_bw f = 24.7 * (f * 0.00437 + 1)+    bandwidths = map to_bw freqs+    -- calculated from ISO2002 100dB phon curve as approximation to sensitivity of outer ear+    outereargain = [0.080993772688853+                   ,0.089237063418603+                   ,0.097970525722848+                   ,0.10876266808815+                   ,0.12105360022674+                   ,0.13407538922284+                   ,0.14787149408674+                   ,0.16167718172822+                   ,0.17551213214451+                   ,0.19016975152285+                   ,0.20569895830538+                   ,0.22220242493157+                   ,0.2397154127401+                   ,0.2582697769952+                   ,0.27792744116278+                   ,0.29856170337058+                   ,0.32031587344117+                   ,0.34336361377938+                   ,0.36778184407609+                   ,0.39203618886184+                   ,0.41615498938524+                   ,0.44170796842+                   ,0.46878040665827+                   ,0.49446634124901+                   ,0.52001934250193+                   ,0.54709180427952+                   ,0.57577407840633+                   ,0.60165721569576+                   ,0.62782392863276+                   ,0.6555465952902+                   ,0.68491773749099+                   ,0.72411898089945+                   ,0.77354432147194+                   ,0.82590864573464+                   ,0.88138671475204+                   ,0.90157113760596+                   ,0.90157113760596+                   ,0.90157113760596+                   ,0.90157113760596+                   ,0.91510438365248+                   ,0.93321426408541+                   ,0.95240101404735+                   ,0.97272866753273+                   ,0.98926474289463+                   ,1.0053814152966+                   ,1.0224564349105+                   ,1.0405467880267+                   ,1.052760426677+                   ,1.061847894439+                   ,1.071475731154+                   ,1.0816760688321+                   ,1.0839269140212+                   ,1.0839269140212+                   ,1.0839269140212+                   ,1.0839269140212+                   ,1.0817917022137+                   ,1.0789305551391+                   ,1.0758992754061+                   ,1.0726877464002+                   ,1.0605734918597+                   ,1.0429115831426+                   ,1.0241994426808+                   ,1.0043746204451+                   ,0.95672713285027+                   ,0.89882037142901+                   ,0.83747029478932+                   ,0.77247215275345+                   ,0.75895909569467+                   ,0.74934344623004+                   ,0.73915602049396+                   ,0.72836281890006+                   ,0.75972195442662+                   ,0.81665861045357+                   ,0.87698089623035+                   ,0.94089013177825+                   ,1.022563004048+                   ,1.1129841925092+                   ,1.2087821046319+                   ,1.3102764570426+                   ,1.3485952672556+                   ,1.3833144995125+                   ,1.4200982447533+                   ,1.4590692653081+                   ,1.4180204618623+                   ,1.3674299412878+                   ,1.3138311518147+                   ,1.2570452124657+                   ,1.1677392221542]+in mix (X.gammatone (whiteNoiseId 'α' ar) (mce freqs) (mce bandwidths) * mce outereargain)+
+ Help/Ugen/gate.help.hs view
@@ -0,0 +1,2 @@+-- gate+let t = lfPulse ar 1 0 0.1 in gate (fSinOsc ar 500 0 * 0.25) t
+ Help/Ugen/gateReset.help.hs view
@@ -0,0 +1,6 @@+-- gateReset+let gt = 1+    tr = trig1 (dustId 'α' kr 1) 0+    e = envGen kr (gateReset gt tr) 1 0 1 DoNothing (envPerc 0.01 1)+in sinOsc ar 440 0 * e * 0.1+
+ Help/Ugen/gaussTrig.help.hs view
@@ -0,0 +1,6 @@+-- gaussTrig+let x = mouseX kr 0 0.9 Linear 0.2+    t1 = X.gaussTrig kr 10 x * abs (whiteNoiseId 'α' kr) * 0.5+    t2 = dustId 'β' kr 10 * 0.5+    n = pinkNoiseId 'γ' ar * decay (mce2 t1 t2) 0.02 * 0.5+in fold2 (ringz n 2000 0.02) 0.5
+ Help/Ugen/gbmanL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. GbmanN
+ Help/Ugen/gbmanN.help.hs view
@@ -0,0 +1,15 @@+-- gbmanN ; default initial params+let x = mouseX kr 20 sampleRate Linear 0.2+in gbmanN ar x 1.2 2.1 * 0.05++-- gbmanN ; change initial params+let x = mouseX kr 20 sampleRate Linear 0.2+in gbmanN ar x (-0.7) (-2.7) * 0.05++-- gbmanN ; wait+let x = mouseX kr 20 sampleRate Linear 0.2+in gbmanN ar x 1.2 2.0002 * 0.05++-- gbmanN ; as a frequency control+let f = gbmanN ar 40 1.2 2.1 * 400 + 500+in sinOsc ar f 0 * 0.1
+ Help/Ugen/gcd.help.hs view
@@ -0,0 +1,19 @@+-- gcd+let x = mouseX kr (-200) 200 Linear 0.2+    y = mouseY kr (-200) 200 Linear 0.2+in sinOsc ar ((sinOsc kr 0.3 0 * 20) `gcdE` mce2 x y * 30 + 500) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw ar 0.02 0 * 300 + 1+    b = lfSaw ar (1.24 + mce2 0 0.1) 0 * 200 + 1+in sinOsc ar (gcdE a b * 30 + 300) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw ar 0.012 0 * 300 + 1+    b = lfSaw ar (0.24 + mce2 0 0.01) 0 * 200 + 1+in sinOsc ar (gcdE a b * 30 + 300) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw kr 0.002 0 * 300 + 1+    b = lfSaw kr (0.024 + mce2 0 0.001) 0 * 200 + 1+in sinOsc ar (gcdE a b * 43 + 300) 0 * 0.1
+ Help/Ugen/gendy1.help.hs view
@@ -0,0 +1,80 @@+-- gend1 ; sc3 default parameters+gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 12 12 * 0.15++-- gendy1 ; wandering bass+gendy1Id 'α' ar 1 1 1.0 1.0 30 100 0.3 0.05 5 5 * 0.15++-- gendy1 ; play me+let x = mouseX kr 100 1000 Exponential 0.1+    g = gendy1Id 'α' ar 1 1 1.0 1.0 30 100 0.3 0.05 5 5+in rlpf g 500 0.3 * 0.1++-- gendy1 ; scream+let x = mouseX kr 220 440 Exponential 0.1+    y = mouseY kr 0.0 1.0 Linear 0.1+in gendy1Id 'α' ar 2 3 1 1 x (8 * x) y y 7 7 *0.3++-- gendy1 ; 1 CP = random noise+gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 1 1 * 0.15++-- gendy1 ; 2 CPs = an oscillator+gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 2 2 * 0.15++-- gendy1 ; used as an LFO+let ad = sinOsc kr 0.10 0 * 0.49 + 0.51+    dd = sinOsc kr 0.13 0 * 0.49 + 0.51+    as = sinOsc kr 0.17 0 * 0.49 + 0.51+    ds = sinOsc kr 0.19 0 * 0.49 + 0.51+    g = gendy1Id 'α' kr 2 4 ad dd 3.4 3.5 as ds 10 10+in sinOsc ar (g * 50 + 350) 0 * 0.3++-- gendy1 ; wasp+let ad = sinOsc kr 0.1 0 * 0.1 + 0.9+in gendy1Id 'α' ar 0 0 ad 1.0 50 1000 1 0.005 12 12 * 0.2++-- gendy1 ; modulate distributions ; distributions change the duration structure and spectrum+let x = mouseX kr 0 7 Linear 0.1+    y = mouseY kr 0 7 Linear 0.1+in gendy1Id 'α' ar x y 1 1 440 660 0.5 0.5 12 12 * 0.2++-- gendy1 ; modulate number of CPs+let x = mouseX kr 1 13 Linear 0.1+in gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 12 x * 0.2++-- gendy1 ; self modulation+let x = mouseX kr 1   13 Linear 0.1+    y = mouseY kr 0.1 10 Linear 0.1+    g0 = gendy1Id 'α' ar 5 4 0.3 0.7 0.1 y 1.0 1.0 5 5+in gendy1Id 'α' ar 1 1 1 1 440 (g0 * 500 + 600) 0.5 0.5 12 x * 0.2++-- gendy1 ; use SINUS to track oscillator and take CP positions from it ; use adParam and ddParam+let p = lfPulse kr 100 0 0.4+    s = sinOsc kr 30 0 * 0.5+in gendy1Id 'α' ar 6 6 p s 440 660 0.5 0.5 12 12 * 0.2++-- gendy1 ; near the corners are interesting+let x = mouseX kr 0 200 Linear 0.1+    y = mouseY kr 0 200 Linear 0.1+    p = lfPulse kr x 0 0.4+    s = sinOsc kr y 0 * 0.5+in gendy1Id 'α' ar 6 6 p s 440 660 0.5 0.5 12 12 * 0.2++-- gendy1 ; texture+let node e = let f = randId e 130 160.3+                 r0 = randId ('α',e) 0 6+                 r1 = randId ('β',e) 0 6+                 l = randId e (-1) 1+                 ad = sinOsc kr 0.10 0 * 0.49 + 0.51+                 dd = sinOsc kr 0.13 0 * 0.49 + 0.51+                 as = sinOsc kr 0.17 0 * 0.49 + 0.51+                 ds = sinOsc kr 0.19 0 * 0.49 + 0.51+                 g = gendy1Id 'γ' ar r0 r1 ad dd f f as ds 12 12+                 o = sinOsc ar (g * 200 + 400) 0+             in pan2 o l 0.1+in mix (mce (map node (id_seq 10 'δ')))++-- gendy1 ; try durscale 10 and 0 too+let x = mouseX kr 10 700 Linear 0.1+    y = mouseY kr 50 1000 Linear 0.1+    g = gendy1Id 'α' ar 2 3 1 1 1 x 0.5 0.1 10 10+in combN (resonz g y 0.1) 0.1 0.1 5 * 0.6
+ Help/Ugen/grainBuf.help.hs view
@@ -0,0 +1,40 @@+-- grainBuf ; requires=buf+let (buf, nc) = (control kr "buf" 100, 2)+    dur = 15+    lin a b = line kr a b dur RemoveSynth+    tr = impulse kr (lin 7.5 15) 0+    gd = lin 0.05 0.1+    r = lin 1 0.5 {- rate -}+    i = lin 0 1 {- read-location -}+    l = lin (-0.5) 0.5 {- stereo-location -}+in grainBuf nc tr gd buf r i 2 l (-1) 512 * control kr "gain" 0.25++-- grainBuf ; requires=buf ; mouse control+let (buf, nc) = (control kr "buf" 100, 2)+    e = -1+    x = mouseX kr (-1) 1 Linear 0.1+    y = mouseY kr 10 45 Linear 0.1+    i = impulse kr y 0+    r = linLin (lfNoise1Id 'α' kr 500) (-1) 1 0.5 2+    p = linLin (lfNoise2Id 'β' kr 0.1) (-1) 1 0 1+in grainBuf 2 i 0.1 buf r p 2 x e 512 * control kr "gain" 0.25++-- grainBuf ; requires=buf ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let (buf, nc) = (control kr "buf" 100, 2)+          e = -1+          tr = impulse ar (y * 60 + 10) 0+      in grainBuf nc tr (ry * 0.5) buf (1 + (rx * 0.1)) x 2 o e 512 * z * g+in mix (voicer 16 f) * control kr "gain" 2++---- ; load buffer+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "pf-c5.aif" -- mono+ld "metal.wav" -- mono+ld "instr/celeste/long/13-C4-long.wav" -- mono+ld "instr/celeste/long/25-C5-long.wav"+ld "instr/celeste/long/37-C6-long.wav"+ld "instr/celeste/long/49-C7-long.wav"++fn = "/home/rohan/uc/the-center-is-between-us/visitants/flac/f/y.flac"+withSc3 (async (b_allocRead 0 fn (48000 * 45) (48000 * 1)))
+ Help/Ugen/grainFM.help.hs view
@@ -0,0 +1,26 @@+-- grainFM+let d = 15+    lin a b = line kr a b d RemoveSynth+    l = lin (-0.5) 0.5+    f = lin 200 800+    t = impulse kr (lin 7.5 15) 0+    i = lin (-1) 1+in grainFM 2 t 0.1 f 200 i l (-1) 512 * 0.1++-- grainFM ; mouse control+let n1 = whiteNoiseId 'α' kr+    n2 = lfNoise1Id 'β' kr 500+    x = mouseX kr (-0.5) 0.5 Linear 0.1+    y = mouseY kr 0 400 Linear 0.1+    f = n1 * y + 440+    t = impulse kr 12.5 0+    i = linLin n2 (-1) 1 1 10+in grainFM 2 t 0.1 f 200 i x (-1) 512 * 0.1++-- grainFM ; event control+let f (_,g,x,y,z,o,rx,ry,p,px,_) =+      let tr = impulse ar (y * 64 + 10) 0+          cf = midiCps (p * 127 + px)+          mf = (cf * 1.5) + ((1 - x) * z * cf)+      in grainFM 2 tr (ry * 0.25) cf mf (1 + (rx * 0.25)) o (-1) 512 * z * lagUD g 0 2+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/grainIn.help.hs view
@@ -0,0 +1,5 @@+-- grainIn ; warning=feedback+let x = mouseX kr (-0.5) 0.5 Linear 0.1+    y = mouseY kr 5 25 Linear 0.1+    t = impulse kr y 0+in grainIn 2 t 0.1 (soundIn 0 + pinkNoiseId 'α' ar * 0.05) x (-1) 512 * 0.5
+ Help/Ugen/grainSin.help.hs view
@@ -0,0 +1,26 @@+-- grainSin ; mouse control+let n = whiteNoiseId 'α' kr+    x = mouseX kr (-0.5) 0.5 Linear 0.1+    y = mouseY kr 0 400 Linear 0.1+    f = n * y + 440+    t = impulse kr 10 0+in grainSin 2 t 0.1 f x (-1) 512 * 0.1++-- grainSin ; f0 https://www.listarc.bham.ac.uk/lists/sc-users/msg66911.html+let k = 16+    t = impulse ar (mouseY kr 1 999 Linear 0.2) 0+    f i = ((fromIntegral i ** range_hs (0.3,0.7) (lfNoise0Id i kr 1)) + 1) * 99+    l = mce (map f [0::Int .. k - 1])+in grainSin 2 t (mouseX kr 0.001 0.5 Exponential 0.2) (tChooseId 'α' t l) 0 (-1) 512 * 0.1++-- grainSin ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let tr = impulse ar (linLin y 0 1 6 72) 0+          du = linLin rx 0 1 0.01 0.15+      in grainSin 2 tr du (midiCps ((p * 127) + (ry * 2 - 1))) (o * 2 - 1) (-1) 512 * z * g+in mix (voicer 16 f) * control kr "gain" 1++-- grainSin ; mouse control+let overlap = mouseY kr 0 2 Linear 0.2+    f = mouseX kr 1 220 Linear 0.2+in grainSin 2 (impulse ar f 0) (overlap / f) 440 0 (-1) 512 * 0.1
+ Help/Ugen/grayNoise.help.hs view
@@ -0,0 +1,6 @@+-- grayNoise+grayNoiseId 'α' ar * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.025 (grayNoiseId 'γ' ar)+Sound.Sc3.Plot.Fft.plot_ugen_fft1 0.1 (grayNoiseId 'γ' ar)
+ Help/Ugen/greater_than.help.hs view
@@ -0,0 +1,3 @@+-- greater_than ; c.f. equal_to ; trigger an envelope+let e = envGen kr (sinOsc ar 1 0 `greater_than` 0) 1 0 1 DoNothing (envPerc 0.01 1)+in sinOsc ar 440 0 * e * 0.1
+ Help/Ugen/greyholeRaw.help.hs view
@@ -0,0 +1,3 @@+-- greyholeRaw+let (i1,i2) = (soundIn 0,soundIn 1)+in X.greyholeRaw i1 i2 0.0 2.0 0.5 0.9 0.1 2.0 1.0
+ Help/Ugen/hairCell.help.hs view
@@ -0,0 +1,5 @@+-- hairCell ; constantly self oscillates at 5 Hz+pan2 (X.hairCell (soundIn 0) 5.0 100 1000 0.99) 0 0.1++-- hairCell+pan2 (X.hairCell (saw ar (mouseX kr 1 10 Linear 0.2)) 0 (mouseY kr 0 10000 Linear 0.2) 1000 0.99) 0 0.5
+ Help/Ugen/harmonicOsc.help.hs view
@@ -0,0 +1,13 @@+-- harmonicOsc+let modulator = sinOsc kr 0.1 0+    freq = modulator `in_exprange` (10,1000)+    firstharmonic = 3+    amplitudes = X.randNId 16 'β' 0.01 0.1+    sig = X.harmonicOsc ar freq firstharmonic amplitudes+in pan2 sig modulator 0.2++-- harmonicOsc ; event control+let f (_,g,x,_,z,o,_,_,_,_,_) =+      let amplitudes = X.tRandNId 16 'α' 0.01 0.1 g+      in pan2 (X.harmonicOsc ar (midiCps (x * 25 + 36)) 1 amplitudes) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/hasher.help.hs view
@@ -0,0 +1,11 @@+-- hasher ; noise+hasher (line ar 0 1 1 RemoveSynth) * 0.2++-- hasher ; remap x+let x = mouseX kr 0 10 Linear 0.2+    f = hasher (roundTo x 1) * 300 + 500+in sinOsc ar f 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (400,1) 1.0 (hasher (line ar 0 1 1 RemoveSynth))+
+ Help/Ugen/henonC.help.hs view
@@ -0,0 +1,1 @@+---- c.f. henonN
+ Help/Ugen/henonL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. henonN
+ Help/Ugen/henonN.help.hs view
@@ -0,0 +1,29 @@+-- henonN ; with Sc3 default initial parameters+let x = mouseX kr 20 sampleRate Linear 0.1+in henonN ar x 1.4 0.3 0 0 * 0.1++-- henonN ; with mouse-control of parameters+let x = mouseX kr 1 1.4 Linear 0.1+    y = mouseY kr 0 0.3 Linear 0.1+in henonN ar (sampleRate / 4) x y 0 0 * 0.1++-- henonN ; with randomly modulated parameters+let n0 = lfNoise2Id 'α' kr 1 * 0.20 + 1.20+    n1 = lfNoise2Id 'β' kr 1 * 0.15 + 0.15+in henonN ar (sampleRate / 8) n0 n1 0 0 * 0.1++-- henonN ; as a frequency control+let x = mouseX kr 1 1.4 Linear 0.1+    y = mouseY kr 0 0.3 Linear 0.1+    f0 = 40+    f = henonN ar f0 x y 0 0 * 800 + 900+in sinOsc ar f 0 * 0.4++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (henonN ar 2500 1.4 0.3 0 0 * 0.1)++---- ; haskell+import qualified Sound.Sc3.Common.Math.Noise as Math {- hsc3 -}+henon_hs a b = map snd (iterate (Math.henon_f a b) (0.0,0.0))+Sound.Sc3.Plot.plot_p1_ln [take 600 (henon_hs 1.4 0.3)]+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (henonN ar 600 1.4 0.3 0 0)
+ Help/Ugen/hilbert.help.hs view
@@ -0,0 +1,3 @@+-- hilbert+hilbert (sinOsc ar 100 0) * 0.1+
+ Help/Ugen/hilbertFIR.help.hs view
@@ -0,0 +1,2 @@+-- hilbertFir+hilbertFIR (sinOsc ar 100 0 * dbAmp (-20)) (localBufId 'α' 2048 1)
+ Help/Ugen/hpf.help.hs view
@@ -0,0 +1,9 @@+-- hpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in hpf (saw ar 200 * 0.1) f++-- hpf ; cutoff at one hertz+hpf (whiteNoiseId 'α' ar) 1 * 0.1++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (hpf (whiteNoiseId 'α' ar) 12000)
+ Help/Ugen/hpz1.help.hs view
@@ -0,0 +1,15 @@+-- hpz1 ; violet noise (one point difference of white noise)+hpz1 (whiteNoiseId 'α' ar) * 0.1++-- hpz1 ; blue noise (one point difference of pink noise)+hpz1 (pinkNoiseId 'α' ar) * 0.2++-- hpz1 ; detect changes in a signal (see also hpz2)+let n = lfNoise0Id 'α' ar 1000+    h = hpz1 n+in mce [h,h `greater_than` 0,abs h `greater_than` 0]++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (hpz1 (whiteNoiseId 'α' ar))++
+ Help/Ugen/hpz2.help.hs view
@@ -0,0 +1,2 @@+-- hpz2+hpz2 (whiteNoiseId 'α' ar) * 0.1
+ Help/Ugen/hypot.help.hs view
@@ -0,0 +1,21 @@+-- hypot+let x = mouseX kr 0 0.1 Linear 0.1+    y = mouseY kr 0 0.1 Linear 0.1+in sinOsc ar 440 0 * hypot x y++-- hypot ; object travels 200 meters in 6 secs (=120kph) passing 10 meters from the listener+let x = 10+    y = lfSaw kr (1 / 6) 0 * 100+    d = hypot x y+    a = 10 / (squared d)+    v = slope d+    r = (344 - v) / 344 -- the speed of sound is 344 meters/sec+in fSinOsc ar (1000 * r) 0 * a++-- hypot+let x = 10+    y = lfSaw kr (1 / 6) 0 * 100+    d = hypot x y+    a = 40 / (squared d)+    s = rlpf (fSinOsc ar 200 0 * lfPulse ar 31.3 0 0.4) 400 0.3+in delayL s (110 / 344) (d / 344) * a
+ Help/Ugen/iEnvGen.help.hs view
@@ -0,0 +1,31 @@+-- iEnvGen+let e = let l = [0,0.6,0.3,1.0,0]+            t = [0.1,0.02,0.4,1.1]+            c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]+        in Envelope l t c Nothing Nothing 0+    x = mouseX kr 0 (envelope_duration e) Linear 0.2+    g = iEnvGen kr x e+in sinOsc ar (g * 500 + 440) 0 * 0.1++-- iEnvGen ; index with sinOsc ; mouse controls amplitude ; offset negative values of SinOsc+let e = let l = [-1,-0.7,0.7,1]+            t = [0.8666,0.2666,0.8668]+            c = [EnvLin,EnvLin]+        in Envelope l t c Nothing Nothing (-1)+    x = mouseX kr 0 1 Linear 0.2+    o = (sinOsc ar 440 0) * x+in iEnvGen ar o e * 0.1++-- iEnvGen ; index with amplitude of input ; control freq of SinOsc+let e = envXyc [(0, 330, EnvExp), (0.5, 440, EnvExp), (1.0, 1760, EnvLin)]+    pt = amplitude ar (soundIn 0) 0.01 0.2+in sinOsc ar (iEnvGen kr pt e) 0 * 0.2++-- iEnvGen ; using line to generate time signal ; ie. time can move faster and start near the end+let param = envPairs [(0,110),(4,220),(9,440),(11,220),(13,880),(19,110),(23,55),(27,55)] EnvExp+    (start,end,scale) = (11,27,1.5)+    time = line kr start end ((end - start) / scale) DoNothing+    freq = iEnvGen kr time param+    print_time = poll (impulse kr 1 0) time 0 (label "time")+    print_freq = poll (impulse kr 1 0) freq 0 (label "freq")+in mrg [pan2 (sinOsc ar 220 0 + sinOsc ar freq 0) 0 0.1,print_time,print_freq]
+ Help/Ugen/iRand.help.hs view
@@ -0,0 +1,4 @@+-- iRand+let f = iRandId 'α' 200 1200+    e = line kr 0.2 0 0.1 RemoveSynth+in fSinOsc ar f 0 * e
+ Help/Ugen/iRandN.help.hs view
@@ -0,0 +1,17 @@+-- riRandN ; two channel sin tones ; harmonic series+sinOsc ar (55 * X.randN 2 1 17) 0 * 0.1++-- riRandN ; 5-channel sin tones ; harmonic series+splay (sinOsc ar (55 * X.randN 15 1 5) 0) 1 0.1 0 True++-- riRandN ; 15-channel sin tones ; harmonic series+splay (sinOsc ar (55 * X.randN 12 1 17) 0) 1 0.1 0 True++-- riRandN ; two channel sin tones ; harmonic series ; id+sinOsc ar (55 * X.randNId 2 'α' 1 17) 0 * 0.1++-- riRandN ; 5-channel sin tones ; harmonic series ; id+splay (sinOsc ar (55 * X.randNId 15 'α' 1 5) 0) 1 0.1 0 True++-- riRandN ; 15-channel sin tones ; harmonic series ; id+splay (sinOsc ar (55 * X.randNId 12 'α' 1 17) 0) 1 0.1 0 True
+ Help/Ugen/ifft.help.hs view
@@ -0,0 +1,9 @@+-- ifft ; no modification+let z = whiteNoiseId 'α' ar+    c = fft (localBufId 'β' 1 2048) z 0.5 0 1 0+in ifft c 0 0 * 0.05++-- ifft ; variants with the default parameters+let z = whiteNoiseId 'α' ar+    c = fft' (localBufId 'β' 1 2048) z+in ifft' c * 0.05
+ Help/Ugen/iirFilter.help.hs view
@@ -0,0 +1,7 @@+-- iirFilter+let x = mouseX kr 20 12000 Exponential 0.2+    y = mouseY kr 0.01 1 Linear 0.2+    o = lfSaw ar (mce [x * 0.99,x * 1.01]) 0 * 0.1+    freq = sinOsc kr (sinOsc kr 0.1 0) (1.5 * pi) * 1550 + 1800+    s = X.iirFilter o freq y+in combN s 0.5 (mce2 0.4 0.35) 2 * 0.4 + s * 0.5
+ Help/Ugen/impulse.help.hs view
@@ -0,0 +1,21 @@+-- impulse ; note SC2 had no phase input+impulse ar 800 0 * 0.1++-- impulse+let f = xLine kr 800 10 5 RemoveSynth+in impulse ar f 0.0 * 0.1++-- impulse+let f = mouseY kr 4 8 Linear 0.1+    x = mouseX kr 0 1 Linear 0.1+in impulse ar f (mce [0,x]) * 0.1++-- impulse ; frequency 0 returns a single impulse+decay (impulse ar 0 0) 1 * brownNoiseId 'α' ar * 0.1++-- impulse ; non-bandlimited+let f = sinOsc ar 0.25 0.0 * 2500.0 + 2505.0+in impulse ar f 0.0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 1.0 (impulse ar 10 0)
+ Help/Ugen/in.help.hs view
@@ -0,0 +1,40 @@+-- in ; patching input to output (see also soundIn) ; in haskellId 'in' is a reserved keyword+in' 2 ar numOutputBuses++-- in ; patching input to output, with delay+let i = in' 2 ar numOutputBuses+    d = delayN i 0.5 0.5+in i + d++-- in ; write noise to first private bus, then read it out ; the multiple root graph is ordered+let n = pinkNoiseId 'α' ar * 0.1+    b = numOutputBuses + numInputBuses+    wr = out b n+    rd = out 0 (in' 1 ar b)+in mrg [rd,wr]++-- in ; there are functions to encapsulate the offset calculation, c.f. firstPrivateBus+let n = pinkNoiseId 'α' ar+    wr = privateOut 0 (n * 0.1)+    rd = out 0 (privateIn 1 ar 0)+in mrg [rd,wr]++-- in ; read control bus+let b = control kr "bus" 0+in sinOsc ar (in' 1 kr b) 0 * 0.1++-- in ; audio graph reading control buses 0 & 1 ; control graph writing buses+let wr = out 0 (mce2 (tRandId 'α' 220 2200 (dustId 'β' kr 1)) (dustId 'γ' kr 3))+in mrg2 (sinOsc ar (in' 1 kr 0) 0 * decay (in' 1 kr 1) 0.2 * 0.1) wr++-- in ; patch mono input to stereo output+pan2 (in' 1 ar numOutputBuses) 0 1++-- in ; make a control rate graph to write freq and gate values+let wr = out 10 (mce2 (tRandId 'α' 220 2200 (dustId 'β' kr 1)) (dustId 'γ' kr 3))+    rd = sinOsc ar (in' 1 kr 10) 0 * decay2 (in' 1 kr 11) 0.01 1 * 0.25+in mrg2 rd wr++---- ; set value on a control bus+withSc3 (Sound.OSC.sendMessage (c_set1 0 300))+withSc3 (Sound.OSC.sendMessage (c_set1 0 600))
+ Help/Ugen/inFeedback.help.hs view
@@ -0,0 +1,25 @@+-- inFeedback ; audio feedback modulation+let f = inFeedback 1 0 * 1300 + 300+in sinOsc ar f 0 * 0.2++-- inFeedback ; the two graphs below can be started in either order and both tones will sound+out 0 (inFeedback 1 firstPrivateBus)++-- inFeedback+let b  = firstPrivateBus+    s0 = out b (sinOsc ar 220 0 * 0.1)+    s1 = out 0 (sinOsc ar 660 0 * 0.1)+in mrg [s0, s1]++-- inFeedback ; in (no feed-back)+let b = firstPrivateBus in in' 1 ar b++-- inFeedback ; resonator at 440hz, see localOut for variant+let b = firstPrivateBus+    p = inFeedback 1 b+    i = impulse ar 1 0+    d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate)+in mrg [offsetOut b d, offsetOut 0 p]++-- inFeedback ; compare resonator tone with oscillator (at right)+out 1 (sinOsc ar 440 0 * 0.1)
+ Help/Ugen/inRange.help.hs view
@@ -0,0 +1,8 @@+-- inRange ; trigger noise burst+let n = brownNoiseId 'α' ar * 0.1+    x = mouseX kr 1 2 Linear 0.1+    o = sinOsc kr x 0 * 0.2+in inRange o (-0.15) 0.15 * n++-- inRange ; i-rate+sinOsc ar 440 0 * inRange (randId 'α' 0 1) 0.5 1.0 * 0.1
+ Help/Ugen/inTrig.help.hs view
@@ -0,0 +1,5 @@+-- inTrig ; oscillator with the trigger at bus ; dust & mouse button both set bus+let b = control kr "bus" 10+    t = inTrig 1 b+    e = envGen kr t t 0 1 DoNothing (envPerc 0.01 1)+in mrg2 (sinOsc ar 440 0 * e) (out b (mouseButton kr 0 1 0 + dustId 'α' kr 0.5))
+ Help/Ugen/index.help.hs view
@@ -0,0 +1,9 @@+-- index ; index buffer for frequency values+let b = asLocalBufId 'α' [50,100,200,400,800,1600]+    f = index b (range 0 6 (lfSaw kr 2 0))+in sinOsc ar (mce [f,f * 9]) 0 * 0.1++-- index ; mouse control+let b = asLocalBufId 'α' [200, 300, 400, 500, 600, 800]+    f = index b (mouseX kr 0 7 Linear 0.2)+in sinOsc ar f 0 * 0.1
+ Help/Ugen/indexInBetween.help.hs view
@@ -0,0 +1,15 @@+-- indexInBetween ; index into buffer for frequency values+let f0 = mouseX kr 200 900 Linear 0.1+    b = asLocalBufId 'α' [200,210,400,430,600,800]+    i = indexInBetween b f0+    l0 = index b i+    l1 = index b (i + 1)+    f1 = linLin (frac i) 0 1 l0 l1+in sinOsc ar (mce [f0,f1]) 0 * 0.1++-- indexInBetween+let from = asLocalBufId 'α' [1, 2, 4, 8, 16]+    to = asLocalBufId 'β' [0, 1, 0, -1, 0]+    x = mouseX kr 1 16 Linear 0.1+    i = indexL to (indexInBetween from x)+in sinOsc ar (linLin i (-1) 1 440 880) 0 * 0.1
+ Help/Ugen/indexL.help.hs view
@@ -0,0 +1,10 @@+-- indexL ; index buffer for frequency values+let b = asLocalBufId 'α' [50,100,200,400,800,1600]+    ph = 1 -- 0+    i = range 0 7 (lfSaw kr 0.1 ph)+in sinOsc ar (mce2 (indexL b i) (index b i)) 0 * 0.1++-- indexL ; mouse control+let b = asLocalBufId 'α' [200,300,400,500,600,800]+    x = mouseX kr 0 7 Linear 0.2+in sinOsc ar (mce2 (indexL b x) (index b x)) 0 * 0.1
+ Help/Ugen/integrator.help.hs view
@@ -0,0 +1,23 @@+-- integrator+let x = mouseX kr 0.001 0.999 Exponential 0.2+    o = lfPulse ar 300 0.2 0.1 * 0.1+in integrator o x++-- integrator ; used as an envelope+let i = lfPulse ar 3 0.2 0.0004+    o = sinOsc ar 700 0 * 0.1+in integrator i 0.999 * o++-- integrator ; scope+let x = mouseX kr 0.01 0.999 Exponential 0.2+    o = lfPulse ar (1500 / 4) 0.2 0.1+in integrator o x * 0.1++-- integrator ; a triangle wave is the integration of square wave+let f = mouseX kr 440 8800 Exponential 0.2+    o = pulse ar f 0.5+in integrator o 0.99 * 0.05++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0+Sound.Sc3.Plot.plot_ugen 0.006 (integrator (lfPulse ar (1500 / 4) 0.2 0.1) (mce [0.1,0.4,0.7]))
+ Help/Ugen/jPverbRaw.help.hs view
@@ -0,0 +1,14 @@+-- jPverbRaw ; default values+let (i1,i2) = (soundIn 0,soundIn 1)+in X.jPverbRaw i1 i2 0 0.707 2000 1 500 1 0.1 2 1 1 1++-- jPverbRaw ; dreamverb+let (i1,i2) = (soundIn 0,soundIn 1)+    rvb = X.jPverbRaw i1 i2 0.314 0.421 1024.0219 0.0 2450.082 0.843 4.639 0.103 0.706 2.793 60.0+in mce2 i1 i2 + rvb++-- ; jPverbRaw ; dreamverb ; controls+let k = control kr+    (i1,i2) = (soundIn 0,soundIn 1)+    rvb = X.jPverbRaw i1 i2 (k "damp" 0.314) (k "earlydiff" 0.421) (k "highband" 1024.02) (k "highx" 0.0) (k "lowband" 2450.08) (k "lowx" 0.844) (k "mdepth" 4.639) (k "mfreq" 0.103) (k "midx" 0.706) (k "size" 2.794) (k "t60" 60)+in mce2 i1 i2 + rvb
+ Help/Ugen/k2a.help.hs view
@@ -0,0 +1,11 @@+-- k2a+k2a (whiteNoiseId 'α' kr * 0.3)++-- k2a ; compare+mce2 (k2a (whiteNoiseId 'α' kr * 0.3)) (whiteNoiseId 'β' ar * 0.1)++-- k2a+let freq = (mouseX kr 0.1 40 Exponential 0.2) / blockSize * sampleRate;+    o1 = k2a (lfNoise0Id 'α' kr freq)+    o2 = lfNoise0Id 'β' ar freq+in mce2 o1 o2 * 0.1
+ Help/Ugen/keyState.help.hs view
@@ -0,0 +1,2 @@+-- keyState ; keycode 38 is the A key on some keyboards ; under X11 see xev(1) to determine layout+sinOsc ar 800 0 * keyState kr 38 0 0.1 0.5
+ Help/Ugen/keyTrack.help.hs view
@@ -0,0 +1,6 @@+-- keyTrack+let s = soundIn (mce2 0 1)+    t = fft' (localBufId 'α' 1 4096) (mix s)+    k = keyTrack kr t 2.0 0.5+    p = poll (impulse kr 1 0) k 0 (label "key")+in mrg2 s p
+ Help/Ugen/klang.help.hs view
@@ -0,0 +1,22 @@+-- klang ; note SC2 had mul/add inputs+let f = [440,550..1100]+    a = take 7 (cycle [0.05, 0.02])+    p = replicate 7 0+in klang ar 1 0 (klangSpec f a p)++-- klang+let s = klangSpec [800,1000,1200] [0.3,0.3,0.3] [pi,pi,pi]+in klang ar 1 0 s * 0.4++-- klang+let s = klangSpec [800,1000,1200] [1,1,1] [0,0,0]+in klang ar 1 0 s * 0.1++-- klang+let s = klangSpec_mce (X.randN 12 600 1000) (mceConst 12 1) (mceConst 12 0)+in klang ar 1 0 s * 0.02++-- klang ; id+let f = map (\z -> randId z 600 1000) ['a'..'l']+    s = klangSpec f (replicate 12 1) (replicate 12 0)+in klang ar 1 0 s * 0.02
+ Help/Ugen/klank.help.hs view
@@ -0,0 +1,26 @@+-- klank ; the klankSpec family of functions can help create the 'spec' entry+let impulse_freq = 0.125+    mk reson_freq = let ampl = 1+                        decay_time = 16+                        rp = replicate (length reson_freq)+                        k = klankSpec_k reson_freq (rp ampl) (rp decay_time)+                    in klank (impulse ar impulse_freq 0 * 0.1) 1 0 1 k+in mce (map mk [[221,614,1145,1804,2577,3456,4419]+               ,[977,1003,1390,1414,1432,1465,1748,1834,1919,1933,1987,2096,2107+                ,2202,2238,2280,2400,2435,2507,2546,2608,2652,2691,2708]]) * 0.1++-- klank ; there is a limited form of mce+let u = [1,1,1,1]+    p = [200,171,153,172]+    q = [930,971,953,1323]+    r = [8900,16062,9013,7892]+    k = mce [klankSpec_k p u u,klankSpec_k q u u,klankSpec_k r u u]+    s = mceTranspose k+    i = mce [2,2.07,2.13]+    t = impulse ar i 0 * 0.1+    l = mce [-1,0,1]+in mix (pan2 (klank t 1 0 1 s) l 0.25)++---- ; modal data+import Sound.Sc3.Data.Modal {- hsc3-data -}+Just reson_freq = lookup "Spinel sphere (diameter=3.6675mm)" modal_frequencies
+ Help/Ugen/ladspa.help.hs view
@@ -0,0 +1,244 @@+-- ladspa ; caps ; # 1767 C* ChorusI - Mono chorus/flanger+let s = soundIn 0+    x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    n1 = range 2.5 40 (lfNoise2Id 'α' kr 0.2)+    n2 = range 0.5 10 (lfNoise2Id 'β' kr 0.2)+in X.ladspa 1 ar 1767 [n1,n2,0.5,0.5,x,y,s]++-- ladspa ; caps ; # 1769 C* Click - Metronome+let x = roundE (mouseX kr 0 3 Linear 0.2)+    y = mouseY kr 4 240 Linear 0.2+in X.ladspa 1 ar 1769 [x,y,0.5,0.5]++-- ladspa ; caps ; # 1773 C* Eq10 - 10-band equaliser+let s = soundIn 0+    enumN n e = take n (enumFrom e)+    n = map (\z -> range (-24) 48 (lfNoise2Id z kr 0.2)) (enumN 10 'α')+in X.ladspa 1 ar 1773 (n ++ [s]) * 0.1++-- ladspa ; caps ; # 1771 C* Saturate - Various static nonlinearities, 8x oversampled+let s = soundIn 0+in X.ladspa 1 ar 1771 [1,0,0,s]++-- ladspa ; caps ; # 1771 C* Saturate - Various static nonlinearities, 8x oversampled+let s = soundIn 0+    x = roundE (mouseX kr 0 11 Linear 0.2)+    y = mouseY kr (-24) 72 Linear 0.2+in X.ladspa 1 ar 1771 [x,y,0.0,s]++-- ladspa ; caps ; # 1772 C* Compress - Compressor and saturating limiter+let s = soundIn 0+    x = roundE (mouseX kr 0 2 Linear 0.2)+    y = mouseY kr 0 1 Linear 0.2+in X.ladspa 1 ar 1772 [0.5,x,y,0.5,0.5,0.1,0,s]++-- ladspa ; caps ; # 1779 C* Plate - Versatile plate reverb+let s = soundIn 0+    x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+in X.ladspa 2 ar 1779 [x,y,0.5,0.5,s]++-- ladspa ; caps ; # 1788 C* Wider - Stereo image synthesis+let s = soundIn 0+    x = mouseX kr (-1) 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+in X.ladspa 2 ar 1788 [x,y,s]++-- ladspa ; caps ; # 2586 C* PhaserII - Mono phaser+let s = soundIn 0+    x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+in X.ladspa 1 ar 2586 [0.3,x,0.5,y,0.8,s]++-- ladspa ; caps ; # 2592 C* AmpVTS - Idealised guitar amplification+X.ladspa 1 ar 2592 [1,0.25,0.75,0.5,1,0.25,1,0.75,0.75,0.25,0.5,soundIn 0] * 0.1++-- ladspa ; caps ; # 2592 C* AmpVTS - Idealised guitar amplification+let s = soundIn 0+    x = roundE (mouseX kr 0 8 Linear 0.2)+    y = mouseY kr 0 1 Linear 0.2+    enumN n e = take n (enumFrom e)+    [n1,n2,n3,n4,n5,n6,n7,n8] = map (\z -> lfNoise2Id z kr 0.2) (enumN 8 'α')+in X.ladspa 1 ar 2592 [1,y,n1,n2,x,n3,n4,n5,n6,n7,n8,s]++-- ladspa ; caps ; # 2609 C* EqFA4p - 4-band parametric eq+let s = soundIn 0+    fId z m l r = m (lfNoise2Id z kr 0.2) (-1) 1 l r+    p = [fId 'α' linLin 0 1+        ,fId 'β' linExp 20 14000+        ,fId 'γ' linExp 0.125 8+        ,fId 'δ' linLin (-24) 24+        ,fId 'ε' linLin 0 1+        ,fId 'ζ' linExp 20 14000+        ,fId 'η' linExp 0.125 8+        ,fId 'θ' linLin (-24) 24+        ,fId 'ι' linLin 0 1+        ,fId 'κ' linExp 20 14000+        ,fId 'λ' linExp 0.125 8+        ,fId 'μ' linLin (-24) 24+        ,fId 'ν' linLin 0 1+        ,fId 'ξ' linExp 20 14000+        ,fId 'ο' linExp 0.125 8+        ,fId 'π' linLin (-24) 24+        ,0+        ,s]+in pan2 (X.ladspa 1 ar 2609 p) (fId 'ρ' linLin (-1) 1) 0.25++{---- ; Note: debian sc3-plugins doesn't build ladspalist, to build type:++    cd opt/src/sc3-plugins/source/LadspaUGen+    gcc -ldl search.c ladspalist.c -o ladspalist++CAPS = http://quitte.de/dsp/caps.html, http://packages.debian.org/stable/caps++    # 1767 C* ChorusI - Mono chorus/flanger+    > k: t (ms) (2.5 to 40)+    > k: width (ms) (0.5 to 10)+    > k: rate (Hz) (0.02 to 5)+    > k: blend (0 to 1)+    > k: feedforward (0 to 1)+    > k: feedback (0 to 1)+    > a: in (0 to 0)+    < a: out++    # 1769 C* Click - Metronome+    > k: model (0 to 3)+    > k: bpm (4 to 240)+    > k: volume (0 to 1)+    > k: damping (0 to 1)+    < a: out++    # 1773 C* Eq10 - 10-band equaliser+    > k: 31 Hz (-48 to 24)+    > k: 63 Hz (-48 to 24)+    > k: 125 Hz (-48 to 24)+    > k: 250 Hz (-48 to 24)+    > k: 500 Hz (-48 to 24)+    > k: 1 kHz (-48 to 24)+    > k: 2 kHz (-48 to 24)+    > k: 4 kHz (-48 to 24)+    > k: 8 kHz (-48 to 24)+    > k: 16 kHz (-48 to 24)+    > a: in (0 to 0)+    < a: out++    # 1771 C* Saturate - Various static nonlinearities, 8x oversampled+    > k: mode (0 to 11)+    > k: gain (dB) (-24 to 72)+    > k: bias (0 to 1)+    > a: in (0 to 0)+    < a: out++    # 1772 C* Compress - Compressor and saturating limiter+    > k: measure (0 to 1)+    > k: mode (0 to 2)+    > k: threshold (0 to 1)+    > k: strength (0 to 1)+    > k: attack (0 to 1)+    > k: release (0 to 1)+    > k: gain (dB) (-12 to 18)+    < k: state (dB)+    > a: in (-1 to 1)+    < a: out++    # 1779 C* Plate - Versatile plate reverb+    > k: bandwidth (0 to 1)+    > k: tail (0 to 1)+    > k: damping (0 to 1)+    > k: blend (0 to 1)+    > a: in (0 to 0)+    < a: out.l+    < a: out.r++    # 1788 C* Wider - Stereo image synthesis+    > k: pan (-1 to 1)+    > k: width (0 to 1)+    > a: in (0 to 0)+    < a: out.l+    < a: out.r++    # 2586 C* PhaserII - Mono phaser+    > k: rate (0 to 1)+    > k: lfo (0 to 1)+    > k: depth (0 to 1)+    > k: spread (0 to 1)+    > k: resonance (0 to 1)+    > a: in (0 to 0)+    < a: out++    # 2588 C* Scape - Stereo delay with chromatic resonances+    > k: bpm (30 to 164)+    > k: divider (2 to 4)+    > k: feedback (0 to 1)+    > k: dry (0 to 1)+    > k: blend (0 to 1)+    > k: tune (Hz) (415 to 467)+    > a: in (0 to 0)+    < a: out.l+    < a: out.r++    # 2592 C* AmpVTS - Idealised guitar amplification+    > k: over (0 to 2)+    > k: gain (0 to 1)+    > k: bright (0 to 1)+    > k: power (0 to 1)+    > k: tonestack (0 to 8)+    > k: bass (0 to 1)+    > k: mid (0 to 1)+    > k: treble (0 to 1)+    > k: attack (0 to 1)+    > k: squash (0 to 1)+    > k: lowcut (0 to 1)+    > a: in (0 to 0)+    < a: out++    # 2603 C* Spice - Not an exciter+    > k: lo.f (Hz) (50 to 400)+    > k: lo.compress (0 to 1)+    > k: lo.gain (0 to 1)+    > k: hi.f (Hz) (400 to 5000)+    > k: hi.gain (0 to 1)+    > a: in (0 to 0)+    < a: out++    # 2609 C* EqFA4p - 4-band parametric eq+    > k: a.act (0 to 1)+    > k: a.f (Hz) (20 to 14000)+    > k: a.bw (0.125 to 8)+    > k: a.gain (dB) (-24 to 24)+    > k: b.act (0 to 1)+    > k: b.f (Hz) (20 to 14000)+    > k: b.bw (0.125 to 8)+    > k: b.gain (dB) (-24 to 24)+    > k: c.act (0 to 1)+    > k: c.f (Hz) (20 to 14000)+    > k: c.bw (0.125 to 8)+    > k: c.gain (dB) (-24 to 24)+    > k: d.act (0 to 1)+    > k: d.f (Hz) (20 to 14000)+    > k: d.bw (0.125 to 8)+    > k: d.gain (dB) (-24 to 24)+    > k: gain (-24 to 24)+    < k: _latency+    > a: in (0 to 0)+    < a: out+-}++---- ladspa ; caps ; # 2588 C* Scape - Stereo delay with chromatic resonances+let s = soundIn 0 * 0.1+in X.ladspa 2 ar 2588 [30,2,0,0.1,0.5,415,s] * 0.1++---- ladspa ; caps ; # 2588 C* Scape - Stereo delay with chromatic resonances+let s = soundIn 0 * 0.1+    x = mouseX kr 30 164 Linear 0.2+    y = roundE (mouseY kr 2 4 Linear 0.2)+    n1 = lfNoise2Id 'α' kr 0.2 * 0.5 + 0.5+    n2 = lfNoise2Id 'β' kr 0.2 * 0.5 + 0.5+in X.ladspa 2 ar 2588 [x,y,n1,n2,0.5,440,s]++---- ladpsa ; caps ; # 2603 C* Spice - Not an exciter+let s = soundIn 0+    x = mouseX kr 50 400 Exponential 0.2+    y = mouseY kr 400 5000 Exponential 0.2+in X.ladspa 1 ar 2603 [x,0.5,0.5,y,0.5,s]
+ Help/Ugen/lag.help.hs view
@@ -0,0 +1,17 @@+-- lag ; mouse+let x = mouseX kr 220 440 Linear 0.2+in sinOsc ar (mce [x, lag x 1]) 0 * 0.1++-- lag ; noise+let n = lfNoise0Id 'α' kr 0.5+in sinOsc ar (220 + (lag n 1 * 220)) 0 * (lag n 2 * 0.1)++-- lag+lag (impulse ar 100 0) (mouseX kr 0.0 0.01 Linear 0.2)++-- lag+lag (lfPulse ar 50 0 0.5) (mouseX kr 0.0 (1/50) Linear 0.2) * 0.2++-- lag ; frequency plain at left and smoothed at right+let f = sinOsc kr 0.05 0.0 `in_range` (220,440)+in sinOsc ar (mce2 f (lag f 1)) 0 * 0.1
+ Help/Ugen/lag2.help.hs view
@@ -0,0 +1,6 @@+-- lag2 ; control+let x = mouseX kr 220 440 Exponential 0.1+in sinOsc ar (mce [x, lag2 x 1]) 0 * 0.1++-- lag2 ; audio+lag2 (impulse ar 100 0) (mouseX kr 0.0 0.01 Linear 0.2)
+ Help/Ugen/lag3.help.hs view
@@ -0,0 +1,13 @@+-- lag3 ; mouse control+let x = mouseX kr 220 440 Exponential 0.1+in sinOsc ar (mce [x, lag3 x 1]) 0 * 0.1++-- lag3 ; audio+lag3 (impulse ar 100 0) (mouseX kr 0.0 0.01 Linear 0.2)++-- lag3+lag3 (lfPulse ar 100 0 0.5 * 0.2) (mouseX kr 0.0 0.01 Linear 0.2)++-- lag3 ; written out+let x = mouseX kr 0.0 0.01 Linear 0.2+in lag (lag (lag (lfPulse ar 100 0 0.5 * 0.2) x) x) x
+ Help/Ugen/lagIn.help.hs view
@@ -0,0 +1,7 @@+-- lagIn ; oscillator reading frequency at control bus+sinOsc ar (lagIn 1 (control kr "bus" 10) 1) 0 * 0.1++---- ; set/reset frequency at control bus+import Sound.OSC {- hosc -}+withSc3 (sendMessage (c_set1 10 200))+withSc3 (sendMessage (c_set1 10 2000))
+ Help/Ugen/lagUD.help.hs view
@@ -0,0 +1,28 @@+-- lagUD ; lag pitch, slower down (5 seconds) than up (1 second)+let x = mouseX kr 220 440 Linear 0.2+in sinOsc ar (mce2 x (lagUD x 1 5)) 0 * 0.1++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+    y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (0 - saw ar 440) x y * 0.15++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+    y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (impulse ar (range 6 24 (lfNoise2Id 'α' kr 4)) 0) x y * 0.5++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+    y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (lfPulse ar 800 0 0.5 * 2 - 1) x y * 0.05++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+    y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (varSaw ar 220 0 (range 0 1 (sinOsc kr 0.25 0))) x y * 0.1++-- lagUD+let x = mouseX kr 0.0 (1/100) Linear 0.2+    y = mouseY kr 0.0 (3/100) Linear 0.2+in lagUD (lfPulse ar 50 0 0.25) x y * 0.1
+ Help/Ugen/lastValue.help.hs view
@@ -0,0 +1,8 @@+-- lastValue+let x = mouseX kr 100 400 Linear 0.1+in sinOsc ar (lastValue x 40) 0 * 0.1++-- lastValue ; difference between currrent and the last changed+let x = mouseX kr 0.1 4 Linear 0.1+    f = abs (lastValue x 0.5 - x) * 400 + 200+in sinOsc ar f 0 * 0.2
+ Help/Ugen/latch.help.hs view
@@ -0,0 +1,32 @@+-- latch ; sample & hold+let n = whiteNoiseId 'α' ar+    i = impulse ar 9 0+    l = latch n i+in blip ar (l * 400 + 500) 4 * 0.2++-- latch ; c.f. LFNoise0+let n1 = latch (whiteNoiseId 'α' ar) (impulse ar 9 0)+    n2 = lfNoise0Id 'α' kr 9+in blip ar (mce2 n1 n2 * 400 + 500) 4 * 0.2++-- latch ; http://create.ucsb.edu/pipermail/sc-users/2006-December/029991.html+let n0 = lfNoise2Id 'α' kr 8+    n1 = lfNoise2Id 'β' kr 3+    s = blip ar (n0 * 200 + 300) (n1 * 10 + 20)+    x = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.1+in latch s (impulse ar x 0)++-- latch ; density control for sample and hold of noise signal (c.f. dust)+let n0 = whiteNoiseId 'α' ar+    n1 = whiteNoiseId 'β' ar+    k = 1000+    c = control_m kr "density" 26 (0.01,k,"exp")+in latch n0 (n1 `greater_than` ((constant k - c) / constant k)) * 0.1++-- latch ; density control for sample and hold of noise signal+let n = whiteNoiseId 'α' ar+    c = control_m kr "density" 26 (0.01,8000,"exp")+in latch n (dustId 'γ' ar c) * 0.1++---- ; drawings+UI.ui_sc3_scope 2 0 4096 1 "audio" 0
+ Help/Ugen/latoocarfianC.help.hs view
@@ -0,0 +1,19 @@+-- latoocarfianC ; Sc3 default initial parameters+let x = mouseX kr 20 sampleRate Linear 0.1+in latoocarfianC ar x 1 3 0.5 0.5 0.5 0.5 * 0.1++-- latoocarfianC ; randomly modulate all parameters+let [n0,n1,n2,n3] = map (\e -> lfNoise2Id e kr 5) ['α','β','γ','δ']+    f = sampleRate / 4+    a = n0 * 1.5 + 1.5+    b = n1 * 1.5 + 1.5+    c = n2 * 0.5 + 1.5+    d = n3 * 0.5 + 1.5+in latoocarfianC ar f a b c d 0.5 0.5 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (latoocarfianC ar 600 1.0 3.0 0.5 0.5 0.5 0.5)++---- ; haskell implementation of equation+latoocarfian_hs a b c d = map fst (iterate (Sound.Sc3.Common.Math.Noise.latoocarfian_f a b c d) (0.5,0.5))+Sound.Sc3.Plot.plot_p1_ln [take 600 (latoocarfian_hs 1.0 3.0 0.5 0.5)]
+ Help/Ugen/lcm.help.hs view
@@ -0,0 +1,10 @@+-- lcm+let x = mouseX kr (-20) 20 Linear 0.2+    y = mouseY kr (-20) 20 Linear 0.2+in sinOsc ar ((sinOsc kr 0.3 0 * 20) `lcmE` mce2 x y * 30 + 500) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw ar 2 0 * 100+    b = lfSaw ar 1.2 0 * 100+in sinOsc ar (lcmE a b + 300) 0 * 0.1+
+ Help/Ugen/leakDC.help.hs view
@@ -0,0 +1,11 @@+-- leakDC+let a = lfPulse ar 800 0 0.5 * 0.1 + 0.5+in mce [a,leakDC a 0.995]++---- ; frequency response functions and tables+---- ; <http://www.listarc.bham.ac.uk/lists/sc-users/msg69555.html>+leak_dc_coef sample_rate cfreq = exp (-two_pi * (cfreq / sample_rate))+leak_dc_cfreq sample_rate coef = -log(coef) * (sample_rate / two_pi)+import Sound.Sc3.Plot {- hsc3-plot -}+plot_p2_ln [let x = [0,0.5 .. 200] in zip x (map (leak_dc_coef 48000) x)]+plot_p2_ln [let x = [0.9700,0.9725 .. 1.0000] in zip x (map (leak_dc_cfreq 48000) x)]
+ Help/Ugen/lfBrownNoise0.help.hs view
@@ -0,0 +1,4 @@+-- lfBrownNoise0+let n = X.lfBrownNoise0Id 'α' ar 10 0.05 0+    f = linExp n (-1) 1 64 9600+in sinOsc ar f 0 * 0.1
+ Help/Ugen/lfBrownNoise2.help.hs view
@@ -0,0 +1,21 @@+-- lfBrownNoise2+let freq = 1000+    dev = mouseX kr 0 1 Linear 0.2+    dist = mouseY kr 0 5 Linear 0.2+in X.lfBrownNoise2Id 'α' ar freq dev dist * 0.25++-- lfBrownNoise2 ; as frequency control+let freq = 8+    dev = mouseX kr 0 1 Linear 0.2+    dist = mouseY kr 0 5 Linear 0.2+    n1:n2:n3:_ = map (\z -> X.lfBrownNoise2Id z kr freq dev dist) ['α'..]+    o = impulse ar (range 6 24 n1) 0+in lagUD o (range 0.0001 0.001 n2) (range 0.0001 0.001 n3) * 0.5++-- lfBrownNoise2 ; as pan & volume controls ; warning=feedback+let s = soundIn 0+    freq = range 0.5 2 (X.lfBrownNoise2Id 'α' kr 2 0.1 5)+    dev = mouseX kr 0.01 0.35 Linear 0.2+    dist = mouseY kr 0 5 Linear 0.2+    n1:n2:_ = map (\z -> X.lfBrownNoise2Id z kr freq dev dist) ['β'..]+in pan2 s (range (-0.75) 0.75 n1) 1 * range 0.01 0.5 n2
+ Help/Ugen/lfClipNoise.help.hs view
@@ -0,0 +1,22 @@+-- lfClipNoise+lfClipNoiseId 'α' ar 1000 * 0.05++-- lfClipNoise ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfClipNoiseId 'α' ar f * 0.05++-- lfClipNoise ; use as frequency control+let n = lfClipNoiseId 'α' kr 4+in sinOsc ar (n * 200 + 600) 0 * 0.1++-- lfClipNoise ; c.f. lfDClipNoise+let x = mouseX kr 0.1 1000 Exponential 0.2+    n = lfClipNoiseId 'β' ar x+in sinOsc ar (n * 200 + 500) 0 * 0.05++-- lfClipNoise ; c.f. lfDClipNoise+let f = xLine kr 1000 20000 10 RemoveSynth+in lfClipNoiseId 'δ' ar f * 0.05++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfClipNoiseId 'α' ar 1000)
+ Help/Ugen/lfCub.help.hs view
@@ -0,0 +1,38 @@+-- lfCub ; c.f. lfPar+let g f = f ar (f kr (f kr 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfPar)++-- lfCub ; c.f. lfPar+let g f = f ar (f kr 0.2 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfPar)++-- lfCub ; c.f. lfPar+mce2 (lfCub ar 800 0 * 0.1) (lfPar ar 800 0 * 0.1)++-- lfCub ; c.f. lfPar+let g f = f ar (xLine kr 100 8000 30 DoNothing) 0 * 0.1 in mce2 (g lfCub) (g lfPar)++-- lfCub ; c.f. sinOsc+let g f = f ar (f kr (f kr 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g sinOsc)++-- lfCub ; c.f. sinOsc+let g f = f ar (f kr 0.2 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g sinOsc)++-- lfCub ; c.f. sinOsc+mce2 (lfCub ar 800 0 * 0.1) (sinOsc ar 800 0 * 0.1)++-- lfCub ; c.f. sinOsc+let g f = f ar (xLine kr 100 8000 30 DoNothing) 0 * 0.1 in mce2 (g lfCub) (g sinOsc)++-- lfCub ; c.f. lfTri+let g f = f ar (f kr (f kr 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfTri)++-- lfCub ; c.f. lfTri+let g f = f ar (f kr 0.2 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfTri)++-- lfCub ; c.f. lfTri+mce2 (lfCub ar 800 0 * 0.1) (lfTri ar 800 0 * 0.1)++-- lfCub ; c.f. lfTri+let g f = f ar (xLine kr 100 8000 30 DoNothing) 0 * 0.1 in mce2 (g lfCub) (g lfTri)++---- ; drawings+Sound.Sc3.Plot.plot_ugen 0.1 (mce2 (sinOsc ar 20 0) (lfCub ar 20 0))
+ Help/Ugen/lfGauss.help.hs view
@@ -0,0 +1,47 @@+-- lfGauss ; modulating duration+let d = xLine kr 0.1 0.001 10 DoNothing+in lfGauss ar d 0.03 0 Loop DoNothing * 0.2++-- lfGauss ; modulating width, freq=60Hz+let w = xLine kr 0.1 0.001 10 DoNothing+in lfGauss ar (1 / 60) w 0 Loop DoNothing * 0.2++-- lfGauss ; x=frequency, y=width ; note alisasing at high frequencies+let d = mouseX kr (1/8000) 0.1 Exponential 0.2+    w = mouseY kr 0.001 0.1 Exponential 0.2+in lfGauss ar d w 0 Loop DoNothing * 0.1++-- lfGauss ; amplitude modulator+let d = mouseX kr 1 0.001 Exponential 0.2+    g = lfGauss ar d 0.1 0 Loop DoNothing+    o = sinOsc ar 1000 0+in g * o * 0.1++-- lfGauss ; modulate iphase+let ph = mouseX kr (-1) 1 Linear 0.2+    g = lfGauss ar 0.001 0.2 (mce2 0 ph) Loop DoNothing+in mix g * 0.2++-- lfGauss ; very small width approach dirac function+let w = sampleDur * mouseX kr 10 3000 Exponential 0.2+in lfGauss ar 0.01 w 0 Loop DoNothing * 0.2++-- lfGauss ; dur and width can be modulated at audio rate+let x = mouseX kr 2 1000 Exponential 0.2+    d = range 0.0006 0.01 (sinOsc ar x 0 * mce2 1 1.1)+    w = range 0.01 0.3 (sinOsc ar (0.5 * (mce2 1 1.1)) 0)+in lfGauss ar d w 0 Loop DoNothing * 0.2++-- lfGauss ; several frequencies and widths combined+let x = mouseX kr 1 0.07 Exponential 0.2+    y = mouseY kr 1 3 Linear 0.2+    g = lfGauss ar x (y ** mce [-1,-2 .. -6]) 0 Loop DoNothing+    o = sinOsc ar (200 * (1.3 ** mce [0..5])) 0+in mix (g * o) * 0.1++---- ; drawings+let plot_f tm du ph = Sound.Sc3.Plot.plot_ugen1 tm (lfGauss ar du 0.12 ph Loop DoNothing)+plot_f 0.1 0.1 0 -- centred+plot_f 0.1 0.1 (-1) -- shifting left+plot_f 0.1 0.1 2 -- moving further away from the center+plot_f 0.3 0.065 0 -- several grains
+ Help/Ugen/lfNoise0.help.hs view
@@ -0,0 +1,25 @@+-- lfNoise0+lfNoise0Id 'α' ar 1000 * 0.05++-- lfNoise0 ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfNoise0Id 'α' ar f * 0.05++-- lfNoise0 ; as frequency control+let f = lfNoise0Id 'α' kr 4+in sinOsc ar (f * 400 + 450) 0 * 0.1++-- lfNoise0 ; lfdNoise0+lfNoise0Id 'α' ar (mouseX kr 0.1 1000 Exponential 0.2) * 0.1++-- lfNoise0 ; lfdNoise0+lfNoise0Id 'α' ar (xLine kr 0.5 10000 3 RemoveSynth)++-- lfNoise0 ; lfdNoise0+lfNoise0Id 'α' ar (xLine kr 1000 20000 10 RemoveSynth)++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen1 0.1 (lfNoise0Id 'γ' ar 1000)+plot_ugen1 0.1 (lfNoise1Id 'γ' ar 1000)+plot_ugen1 0.1 (lfNoise2Id 'γ' ar 1000)
+ Help/Ugen/lfNoise1.help.hs view
@@ -0,0 +1,11 @@+-- lfNoise1+lfNoise1Id 'α' ar 1000 * 0.05++-- lfNoise1 ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfNoise1Id 'α' ar f * 0.05++-- lfNoise1 ; as frequency control+let n = lfNoise1Id 'α' kr 4+    f = n * 400 + 450+in sinOsc ar f 0 * 0.1
+ Help/Ugen/lfNoise2.help.hs view
@@ -0,0 +1,13 @@+-- lfNoise2+lfNoise2Id 'α' ar 1000 * 0.05++-- lfNoise2 ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfNoise2Id 'α' ar f * 0.05++-- lfNoise2 ; as frequency control+let f = lfNoise2Id 'α' kr 4+in sinOsc ar (f * 400 + 450) 0 * 0.1++---- ; drawings ; lfNoise2 is bi-polar+Sound.Sc3.Plot.plot_ugen1 0.1 (lfNoise2Id 'α' ar 1000)
+ Help/Ugen/lfPar.help.hs view
@@ -0,0 +1,2 @@+---- ; drawings+Sound.Sc3.Plot.plot_ugen 0.1 (mce2 (sinOsc ar 20 0) (lfPar ar 20 pi))
+ Help/Ugen/lfPulse.help.hs view
@@ -0,0 +1,31 @@+-- lfPulse ; 50 Hz wave ; note SC2 had no initial phase argument+lfPulse ar 50 0 0.5 * 0.1++-- lfPulse ; modulating frequency+lfPulse ar (xLine kr 1 200 10 DoNothing) 0 0.2 * 0.1++-- lfPulse ; amplitude modulation+lfPulse kr (xLine kr 1 200 10 DoNothing) 0 0.2 * sinOsc ar 440 0 * 0.1++-- lfPulse ; used as both oscillator and lfo+lfPulse ar (lfPulse kr 3 0 0.3 * 200 + 200) 0 0.2 * 0.1++-- lfPulse ; mouse control of width+let x = mouseX kr 0 1 Linear 0.2 in lfPulse ar 220 0 x * 0.1++-- lfPulse ; compare with band limited pulse ugen+mce2 (pulse ar 100 0.3) (lfPulse ar 100 0 0.3) * 0.1++-- lfPulse ; as sum of sines ; for odd partials n amplitude is (1 / n), for even 0 ; phase is 0+let mk_freq f0 n = f0 * fromInteger n+    mk_amp n = if even n then 0 else 1 / fromInteger n+    mk_param f0 n = let m = [1,3 .. n] in zip (map (mk_freq f0) m) (map mk_amp m)+    x = midiCps (mouseX kr 20 72 Linear 0.2)+    y = mouseY kr 0.01 0.1 Exponential 0.2+    e = xLine kr 0.01 1 20 DoNothing -- xfade+    o1 = sum (map (\(fr,am) -> sinOsc ar fr 0 * am) (mk_param x 50)) * (1 - e)+    o2 = lfPulse ar x 0 0.5 * e+in mce2 o1 o2 * y++---- ; drawings ; pulse is unary, ie. range is (0,1)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfPulse ar (line kr 100 800 0.1 DoNothing) 0 0.5)
+ Help/Ugen/lfSaw.help.hs view
@@ -0,0 +1,45 @@+-- lfSaw ; note SC2 did not have the initial phase argument+lfSaw ar 500 1 * 0.025++-- lfSaw ; used as both Oscillator and LFO+lfSaw ar (lfSaw kr 4 0 * 400 + 400) 0 * 0.025++-- lfSaw ; output range is bi-polar+let f = mce [linLin (lfSaw kr 0.5 0) (-1) 1 200 1600, 200, 1600]+    a = mce [0.1,0.05,0.05]+in mix (sinOsc ar f 0 * a)++-- lfSaw ; saw-tooth wave as sum of sines, for all partials n amplitude is (1 / n) ; phase is always 0+let mk_freq f0 n = f0 * fromInteger n+    mk_amp n = 1 / fromInteger n+    mk_param f0 n = let m = [1,2 .. n] in zip (map (mk_freq f0) m) (map mk_amp m)+    x = midiCps (mouseX kr 20 72 Linear 0.2)+    y = mouseY kr 0.01 0.1 Exponential 0.2+    e = xLine kr 0.01 1 20 DoNothing -- cross-fade from sum to lfSaw+    o1 = sum (map (\(fr,am) -> sinOsc ar fr 0 * am) (mk_param x 25)) * (1 - e)+    o2 = lfSaw ar x 0 * e+in mce2 o1 o2 * y++-- lfSaw ; as phasor input to sin function+sin (range 0 two_pi (lfSaw ar 440 0)) * 0.1++-- lfSaw ; mixed with sin, then with distortions+let f = xLine kr 220 440 10 DoNothing+    o1 = sinOsc ar (f + mce2 0 0.7) 0+    o2 = lfSaw ar (f + mce2 0 0.7) 0 * 0.3+    o3 = o1 + o2+    o4 = cubed (distort (log (distort o3)))+in o4 * 0.05++-- lfSaw+let f = sinOsc kr (mce [0.16,0.33,0.41]) 0 * 10 + mce [1,1.1,1.5,1.78,2.45,6.7,8] * 220+in mix (lfSaw ar f 0) * 0.1++-- lfSaw ; ln 2021-04-08 https://lukasnowok.github.io/spectrology/ ; ~= [0.1,0.15,0.225,0.3375]+let o = lfSaw ar (lfSaw ar (mce (take 4 (iterate (* 1.5) 0.1))) 0 * 5000) 0 * 500+in mix (sinOsc ar (1000 + o) 0) * 1/4 * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2+Sound.Sc3.Plot.plot_ugen1 0.1 (lfSaw ar 50 0) -- ascending+Sound.Sc3.Plot.plot_ugen1 0.002 (lfSaw ar 5000 0)
+ Help/Ugen/lfTri.help.hs view
@@ -0,0 +1,27 @@+-- lfTri ; see <http://thread.gmane.org/gmane.comp.audio.supercollider.user/84719>+lfTri ar 500 1 * 0.1++-- lfTri ; used as both Oscillator and LFO+lfTri ar (lfTri kr 4 0 * 400 + 400) 0 * 0.1++-- lfTri ; multiple phases+let f = lfTri kr 0.4 (mce [0..3]) * 200 + 400+in mix (lfTri ar f 0 * 0.1)++-- lfTri ; mouse control+let x = midiCps (mouseX kr 20 72 Linear 0.2)+    e = xLine kr 0.01 1 20 DoNothing+    o1 = triAS 25 x * (1 - e)+    o2 = lfTri ar x 0 * e+in mce2 o1 o2 * 0.1++-- lfTri ; c.f. dpw3Tri fast sweeps+lfTri ar (mouseX kr 200 12000 Exponential 0.2) 0 * 0.1++-- lfTri ; c.f. dpw3Tri efficiency+let f = X.randNId 50 'α' 50 5000+in splay (lfTri ar f 0) 1 0.1 0 True++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfTri ar 40 0)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfTri ar (xLine kr 1 800 0.1 DoNothing) 0)
+ Help/Ugen/lfdClipNoise.help.hs view
@@ -0,0 +1,17 @@+-- lfdClipNoise ; for fast x lfClipNoise frequently seems stuck, lfdClipNoise changes smoothly+let x = mouseX kr 0.1 1000 Exponential 0.2+    n = lfdClipNoise ar x+in sinOsc ar (n * 200 + 500) 0 * 0.05++-- lfdClipNoise ; does not quantize time steps at high frequencies+let f = xLine kr 1000 20000 10 RemoveSynth+in lfdClipNoise ar f * 0.05++-- lfdClipNoise ; for fast x lfClipNoise frequently seems stuck, lfdClipNoise changes smoothly ; id+let x = mouseX kr 0.1 1000 Exponential 0.2+    n = lfdClipNoiseId 'α' ar x+in sinOsc ar (n * 200 + 500) 0 * 0.05++-- lfdClipNoise ; does not quantize time steps at high frequencies ; id+let f = xLine kr 1000 20000 10 RemoveSynth+in lfdClipNoiseId 'γ' ar f * 0.05
+ Help/Ugen/lfdNoise0.help.hs view
@@ -0,0 +1,13 @@+-- lfdNoise0 ; for fast x LFNoise frequently seems stuck, LFDNoise changes smoothly+lfdNoise0Id 'α' ar (mouseX kr 0.1 1000 Exponential 0.2) * 0.1++-- lfdNoise0 ; silent for 2 secs before going up in freq+lfdNoise0Id 'α' ar (xLine kr 0.5 10000 3 RemoveSynth)++-- lfdNoise0 ; LFNoise quantizes time steps at high freqs, LFDNoise does not+lfdNoise0Id 'α' ar (xLine kr 1000 20000 10 RemoveSynth)++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise0Id 'γ' ar 1000)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise1Id 'γ' ar 1000)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise3Id 'γ' ar 1000)
+ Help/Ugen/lfdNoise1.help.hs view
@@ -0,0 +1,5 @@+-- lfdNoise1 ; c.f. lfdNoise0 & lfdNoise3+lfdNoise1Id 'α' ar (xLine ar 1000 100 0.1 DoNothing)++---- ; drawings ; c.f. lfdNoise0 & lfdNoise3+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise1Id 'α' ar (xLine ar 1000 100 0.1 DoNothing))
+ Help/Ugen/lfdNoise3.help.hs view
@@ -0,0 +1,5 @@+-- lfdNoise3 ; c.f. lfdNoise0+lfdNoise3Id 'α' ar (xLine ar 1000 100 0.1 DoNothing)++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise3Id 'α' ar (xLine ar 1000 100 0.1 DoNothing))
+ Help/Ugen/limiter.help.hs view
@@ -0,0 +1,4 @@+-- limiter+let z = let i = impulse ar 8 0 * lfSaw kr 0.25 0 * (-0.6) + 0.7+        in decay2 i 0.001 0.3 * fSinOsc ar 500 0+in mce2 (z * 0.0001) (limiter z 0.4 0.01 * 0.1)
+ Help/Ugen/linCongC.help.hs view
@@ -0,0 +1,21 @@+-- linCongC ; default Sc3 initial parameters+linCongC ar 22050 1.1 0.13 1 0 * 0.1++-- linCongC ; mouse+let x = mouseX kr 20 sampleRate Linear 0.1+in linCongC ar x 1.1 0.13 1 0 * 0.1++-- linCongC ; randomly modulate parameters+let fr = [1,0.1,0.1,0.1]+    [n0,n1,n2,m] = map (\(i,j) -> lfNoise2Id i kr j) (zip ['α'..] fr)+    f = n0 * 1e4 + 1e4+    a = n1 * 0.5 + 1.4+    c = n2 * 0.1 + 0.1+in linCongC ar f a c m 0 * 0.1++---- ; drawings ; haskell implementation of equation+import Sound.Sc3.Common.Math.Noise {- hsc3 -}+import Sound.Sc3.Plot {- hsc3-plot -}+linCong_hs a c m = iterate (linCong_f a c m) 0+plot_p1_ln [take 600 (linCong_hs 1.1 0.13 1.0)]+plot_ugen_nrt (600,1) 1.0 (linCongC ar 600 1.1 0.13 1.0 0.0)
+ Help/Ugen/linCongL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. linCongC
+ Help/Ugen/linCongN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. linCongC
+ Help/Ugen/linExp.help.hs view
@@ -0,0 +1,16 @@+-- linExp+let mod = sinOsc kr (line kr 1 10 10 DoNothing) 0+in sinOsc ar (mce2 (mod * 400 + 500) (linExp mod (-1) 1 100 900)) 0 * 0.05++-- linExp+let f = linExp (mouseX kr 0 1 Linear 0.2) 0 1 440 660+in sinOsc ar f 0 * 0.1++-- linExp ; the destination range may be k-rate+let x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 220 440 Linear 0.2+    f = linExp x 0 1 y 660+in sinOsc ar f 0 * 0.1++-- linExp ; i-rate+sinOsc ar (linExp (randId 'α' 0 1) 0 1 220 440) 0 * 0.1
+ Help/Ugen/linLin.help.hs view
@@ -0,0 +1,16 @@+-- linLin ; linLin is a function for writing a MulAdd UGen.+let f = linLin (mouseX kr 0 1 Linear 0.2) 0 1 440 660+in sinOsc ar f 0 * 0.1++-- linLin ; the destination range may be k-rate+let x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 220 440 Linear 0.2+    f = linLin x 0 1 y 660+in sinOsc ar f 0 * 0.1++-- linLin ; modulating source and destination values+let n = lfNoise2Id 'α' ar 80+    x = mouseX kr 200 8000 Linear 0.2+    y = mouseY kr 200 8000 Linear 0.2+    f = linLin n (sinOsc kr 0.2 0) (sinOsc kr 0.2543 0) x y+in sinOsc ar f 0 * 0.1
+ Help/Ugen/linPan2.help.hs view
@@ -0,0 +1,5 @@+-- linPan2+let n = pinkNoiseId 'α' ar in linPan2 n (fSinOsc kr 2 0) 0.05++-- linPan2+linPan2 (fSinOsc ar 800 0) (fSinOsc kr 3 0) 0.05
+ Help/Ugen/linRand.help.hs view
@@ -0,0 +1,6 @@+-- linRand ; c.f. hsc3-lang/Sound/Sc3/Lang/Random/Gen.hs:linrand+let f = linRandId 'α' 200.0 10000.0 (mce [-1, 1])+    e = line kr 0.4 0 0.01 RemoveSynth+in fSinOsc ar f 0 * e++
+ Help/Ugen/linXFade2.help.hs view
@@ -0,0 +1,5 @@+-- linXFade2 ; Sc3 has multiplier pseudo input+linXFade2 (fSinOsc ar 800 0 * 0.1) (pinkNoiseId 'α' ar * 0.1) (fSinOsc kr 1 0) * 1++-- linXFade2+linXFade2 (saw ar 440) (sinOsc ar 440 0) (lfTri kr 0.1 0) * 0.05
+ Help/Ugen/line.help.hs view
@@ -0,0 +1,7 @@+-- line ; NOTE - Sc3 reorders the mul and add inputs to precede the doneAction input+let f = line kr 200 17000 5 RemoveSynth+in sinOsc ar f 0 * 0.05++-- line ; demonstrate RemoveGroup done-action+let f = line kr 200 (mce2 209 211) 5 RemoveGroup+in sinOsc ar f 0 * 0.05
+ Help/Ugen/linen.help.hs view
@@ -0,0 +1,17 @@+-- linen+let e = linen (impulse kr 2 0) 0.01 0.6 0.4 DoNothing+in e * sinOsc ar 440 0 * 0.1++-- linen ; mouseX is envelope trigger+let x = mouseX kr (-1) 1 Linear 0.1+    y = mouseY kr 0.01 0.25 Linear 0.1+    e = linen x 1 y 1.0 DoNothing+in sinOsc ar 440 0 * e++-- linen ; PauseSynth done action+let x = mouseX kr (-1) 1 Linear 0.1+    e = linen x 1 0.1 1 PauseSynth+in sinOsc ar 440 0 * e++---- ; run paused node (assuming no intermediate node is created)+withSc3 (Sound.OSC.sendMessage (n_run [(-1, True)]))
+ Help/Ugen/localBuf.help.hs view
@@ -0,0 +1,70 @@+-- localBuf ; allocate a buffer local to the synthesis graph, 1-channel, 2048+let nc = 1+    nf = 2048+    buf = localBufId 'α' nc nf+    f = fft' buf (whiteNoiseId 'β' ar)+    c = pv_BrickWall f (sinOsc kr 0.1 0 * 0.75)+in ifft' c * 0.1++-- localBuf ; Variant with two local buffers+let dup (p,q) f = mce2 (f p) (f q)+    n = dup ('α','β') (\z -> whiteNoiseId z ar)+    b = dup ('γ','δ') (\z -> localBufId z 1 2048)+    f = fft' b n+    c = pv_BrickWall f (sinOsc kr (mce2 0.1 0.11) 0 * 0.75)+in ifft' c * 0.1++-- localBuf ; not clearing the buffer accesses old data, slowly overwrite data with noise+let dup (p,q) f = mce2 (f p) (f q)+    b = localBufId 'α' 2 2048+    nf = bufFrames kr b+    x = mouseX kr 1 2 Linear 0.2+    r = playBuf 2 ar b x 1 0 Loop DoNothing * 0.1+    wr p i = bufWr b (linLin p (-1) 1 0 nf) Loop i+    n = dup ('β','γ') (\z -> whiteNoiseId z ar)+    ph = lfNoise0Id 'δ' ar 530+in mrg2 r (wr ph n)++-- localBuf ; bufCombC needs no clearing, because the delay line is filled by the ugen+let dup (p,q) f = mce2 (f p) (f q)+    d = dup ('α','β') (\z -> dustId z ar 1)+    n = whiteNoiseId 'γ' ar * 0.1+    z = decay d 0.3 * n+    l = xLine kr 0.0001 0.01 20 DoNothing+    sr = sampleRate+    b = dup ('δ','ε') (\z -> localBufId z 2 sr)+in bufCombC b z l 0.2++-- localBuf ; asLocalBuf combines localBuf and setBuf+let b = asLocalBuf [2,1,5,3,4,0]+    x = mouseX kr 0 (bufFrames kr b) Linear 0.2+    f = indexL b x * 100 + 40+in saw ar (f * mce2 1 1.1) * 0.1++-- localBuf ; asLocalBuf combines localBuf and setBuf ; id+let b = asLocalBufId 'α' [2,1,5,3,4,0]+    x = mouseX kr 0 (bufFrames kr b) Linear 0.2+    f = indexL b x * 100 + 40+in saw ar (f * mce2 1 1.1) * 0.1++-- localBuf ; detectIndex example using local buffer+let b = asLocalBufId 'α' [2,3,4,0,1,5]+    n = bufFrames kr b+    x = floorE (mouseX kr 0 n Linear 0.1)+    i = detectIndex b x+in sinOsc ar (linExp i 0 n 200 700) 0 * 0.1++-- localBuf ; degreeToKey example ('modal space') using local buffer+let n = lfNoise1Id 'α' kr (mce [3,3.05])+    x = mouseX kr 0 15 Linear 0.1+    b = asLocalBufId 'β' [0,2,3.2,5,7,9,10]+    k = degreeToKey b x 12+    mk_c bf = let f0 = midiCps (bf + k + n * 0.04)+                  o = sinOsc ar f0 0 * 0.1+                  f1 = midiCps (mce [48,55])+                  t = lfPulse ar f1 0.15 0.5+                  f2 = midiCps (sinOsc kr 0.1 0 * 10 + bf)+                  d = rlpf t f2 0.1 * 0.1+                  m = o + d+              in combN m 0.31 0.31 2 + m+in (mk_c 48 + mk_c 72) * 0.25
+ Help/Ugen/localIn.help.hs view
@@ -0,0 +1,25 @@+-- localIn ; ping pong ; warning=feedback+let z = soundIn 0+    a1 = localIn 2 ar 0 + mce [z,0]+    a2 = delayN a1 0.2 0.2+    a3 = mceEdit reverse a2 * 0.8+in mrg [z + a2,localOut a3]++-- localIn ; tape-delay ; mouse control ; warning=feedback+let rotate2_mce z p =+      case mceChannels z of+        [l,r] -> rotate2 l r p+        _ -> error "rotate2_mce"+    tape_delay dt fb z =+      let a = amplitude kr (mix z) 0.01 0.01+          z' = z * (a >** 0.02)+          l0 = localIn 2 ar 0+          l1 = onePole l0 0.4+          l2 = onePole l1 (-0.08)+          l3 = rotate2_mce l2 0.2+          l4 = delayN l3 dt dt+          l5 = leakDC l4 0.995+          l6 = softClip ((l5 + z') * fb)+      in mrg2 (l6 * 0.1) (localOut l6)+    y = mouseY kr 0.75 1.25 Linear 0.2+in tape_delay 0.25 y (soundIn 0)
+ Help/Ugen/localOut.help.hs view
@@ -0,0 +1,15 @@+-- localOut ; resonator, must subtract blockSize for correct tuning+let p = localIn 1 ar 0+    i = impulse ar 1 0+    d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate)+in mrg [offsetOut 0 p,localOut d]++-- localOut ; compare with oscillator+sinOsc ar 440 0 * 0.2++-- localOut ; ping pong+let n = decay (impulse ar 0.3 0) 0.1 * whiteNoiseId 'α' ar * 0.2+    l = localIn 2 ar 0 + mce2 n 0+    d = delayN l 0.2 0.2+    o = localOut (mceReverse d * 0.8)+in mrg2 d o
+ Help/Ugen/log.help.hs view
@@ -0,0 +1,2 @@+-- log+sinOsc ar (log (sinOsc kr 0.1 0) * 200 + 300) 0 * 0.05
+ Help/Ugen/logistic.help.hs view
@@ -0,0 +1,13 @@+-- logistic ; Sc3 default parameters+logistic ar 3 1000 0.5++-- logistic ; sample-rate+logistic ar 3.95 sampleRate 0.5++-- logistic ; onset of chaos+logistic ar (line kr 3.55 3.6 5 DoNothing) 1000 0.01 * 0.2++-- logistic ; mouse control+let x = mouseX kr 3 3.99 Linear 0.1+    y = mouseY kr 10 10000 Exponential 0.1+in logistic ar x y 0.25 * 0.2
+ Help/Ugen/loopBuf.help.hs view
@@ -0,0 +1,38 @@+-- loopBuf+let bf = control kr "bufnum" 0+    rt = control kr "rate" 1+    gl = control kr "glide" 0+    gt = control kr "gate" 1+    lr = control kr "loopRel" 0+    sp = control kr "startPos" 0+    sl = control kr "startLoop" 0 -- FRAME+    el = control kr "endLoop" 0 -- FRAME+    ip = control kr "ipol" 2+    am = control kr "amp" 0.1+    rt' = lag rt gl * bufRateScale kr bf+    e = let d = envAdsr 0.1 0.2 1 2 1 (EnvNum (-4)) 0+        in envGen ar gt 1 0 1 RemoveSynth d+    s = X.loopBuf 1 ar bf rt' (gt + lr) sp sl el ip+in s * e * am++---- ; read audio file into memory+let fn = "/home/rohan/rd/j/2019-04-21/FAIRLIGHT/IIX/REEDS/clarmdhi.snd"+withSc3 (async (b_allocRead 0 fn 0 0))++---- ; send control messages+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set 1 [("startLoop",5376),("endLoop",5504)]))+withSc3 (sendMessage (n_set1 1 "amp" 0.15)) -- louder+withSc3 (sendMessage (n_set1 1 "rate" (-1))) -- backwards+withSc3 (sendMessage (n_set1 1 "rate" 1)) -- forwards+withSc3 (sendMessage (n_set 1 [("startLoop",11000),("endLoop",11)])) -- change loop points+withSc3 (sendMessage (n_set 1 [("startLoop",5000),("endLoop",15000)])) -- change loop points+withSc3 (sendMessage (n_set1 1 "glide" 5)) -- 5 second glide+withSc3 (sendMessage (n_set1 1 "rate" 2)) -- up an octave+withSc3 (sendMessage (n_set1 1 "rate" (-1))) -- backwards+withSc3 (sendMessage (n_set1 1 "rate" 1)) -- back to normal+withSc3 (sendMessage (n_set1 1 "ipol" 1)) -- no interpolation+withSc3 (sendMessage (n_set1 1 "ipol" 2)) -- linear interpolation+withSc3 (sendMessage (n_set1 1 "ipol" 4)) -- cubic interpolation+withSc3 (sendMessage (n_set1 1 "gate" 0)) -- release gate to hear post-loop+withSc3 (sendMessage (n_set 1 [("loopRel",1),("gate",0)]) -- release instrument without post-loop
+ Help/Ugen/lorenzL.help.hs view
@@ -0,0 +1,23 @@+--lorenzL ; default parameters+lorenzL ar (sampleRate / 2) 10 28 2.667 0.05 0.1 0 0 * 0.2++-- lorenzL ; vary frequency+let x = mouseX kr 20 sampleRate Linear 0.1+in lorenzL ar x 10 27 2.667 0.05 0.1 0 0 * 0.3++-- lorenzL ; randomly modulate params+let nId e = lfNoise0Id e kr 0.5+    n0 = mul_add (nId 'α') 2 10+    n1 = mul_add (nId 'β') 20 38+    n2 = mul_add (nId 'γ') 1.5 2+in lorenzL ar sampleRate n0 n1 n2 0.05 0.1 0 0 * 0.2++-- lorenzL ; frequency control+let x = mouseX kr 1 200 Linear 0.1+    n = lorenzL ar x 10 28 2.667 0.05 0.1 0 0+in sinOsc ar (lag n 0.003 * 800 + 900) 0 * 0.4++-- lorenzL+let x = mouseX kr 1 200 Linear 0.1+    n = lorenzL ar x 10 28 2.667 0.05 0.1 0 0+in impulse ar (n * 4 + 8) 0 * 0.4
+ Help/Ugen/lorenzTrig.help.hs view
@@ -0,0 +1,18 @@+-- lorenzTrig ; randomly modulate params+let minfreq = 11025+    maxfreq = 44100+    s = lfNoise0Id 'α' kr 1 * 2 + 10+    b = lfNoise0Id 'β' kr 1 * 1.5 + 2+    r = 28+    h = 0.02+    x0 = 0.090879182417163+    y0 = 2.97077458055+    z0 = 24.282041054363+in X.lorenzTrig ar minfreq maxfreq s r b h x0 y0 z0 * 0.2++-- lorenzTrig ; as a frequency control+let x0 = 0.090879182417163+    y0 = 2.97077458055+    z0 = 24.282041054363+    n = X.lorenzTrig ar 1 8 10 28 28 0.02 x0 y0 z0+in sinOsc ar (decay n 1.0 * 800 + 900) 0 * 0.2
+ Help/Ugen/lores.help.hs view
@@ -0,0 +1,8 @@+-- lores+X.lores (whiteNoiseId 'α' ar * 0.5) 880 0.5++-- lores ; modulate param+let src = whiteNoiseId 'α' ar * 0.3+    freq = lfNoise0Id 'β' ar 4 * 500 + 600+    res = 0.9+in X.lores src freq res
+ Help/Ugen/loudness.help.hs view
@@ -0,0 +1,7 @@+-- loudness ; assume hop-size of half fft-size+let b = localBufId 'α' 1 1024+    x = mouseX kr 0.001 0.1 Exponential 0.2+    i = sinOsc ar 1000 0 * x+    f = fft' b i+    l = loudness f 0.25 6+in sinOsc ar (mce2 900 (l * 300 + 600)) 0 * 0.1
+ Help/Ugen/lpcAnalyzer.help.hs view
@@ -0,0 +1,17 @@+-- lpcAnalyzer+X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 256 50 0 0.999 0++-- lpcAnalyzer+X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 256 50 0 0.999 1++-- lpcAnalyzer+let x = mouseX kr 1 128 Linear 0.2+in X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 128 x 0 0.999 0++-- lpcAnalyzer+let x = mouseX kr 1 128 Linear 0.2+in X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 1024 x 0 0.999 1++-- lpcAnalyzer+let x = mouseX kr 1 256 Linear 0.2+in X.lpcAnalyzer (soundIn 0) (whiteNoiseId 'α' ar * 0.1) 256 x 0 0.999 0
+ Help/Ugen/lpf.help.hs view
@@ -0,0 +1,19 @@+-- lpf+let f = xLine kr 0.7 300 20 RemoveSynth+    ff = fSinOsc kr f 0 * 3600 + 4000+in lpf (saw ar 200 * 0.1) ff++-- lpf ; control rate filtering+let ctl = lpf (lfPulse kr 8 0 0.5) (mouseX kr 2 50 Exponential 0.1)+in sinOsc ar (ctl * 200 + 400) 0 * 0.1++-- lpf ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let f0 = unitCps p+      in pan2 (lpf (blip ar f0 (1 + y * 5)) (f0 * 0.25)) (o * 2 - 1) (lagUD g 0.05 1 * z)+in mix (voicer 16 f) * control kr "gain" 4++-- lpf+let k = 32+    n = mceFill k (\i -> lpf (dust2Id i ar (int_to_ugen i + 1 / 3)) 1500)+in splay n (lfNoise2Id 'α' kr 0.1 `in_range` (0,1)) 1 0 True
+ Help/Ugen/lpg.help.hs view
@@ -0,0 +1,38 @@+-- lpg+let tempo = 8+    envdur = 0.25+    trig = impulse kr tempo 0+    squ = demand trig 0 (dseqId 'α' dinf (mce [400,99,791,2000,200])) `lag` 0.01+    sig = sinOscFB ar squ 1.1 + whiteNoiseId 'β' ar * 0.1+    env = envGen kr trig 1 0 (envdur / tempo) DoNothing (envPerc 0.1 0.9)+    flt = let c_off = lfSaw kr 0.1 0 `in_range` (0,0.2)+              c_mul = lfNoise2Id 'γ' kr 0.1 `in_range` (0.4,0.95)+              vca = lfNoise2Id 'δ' kr 1 `in_range` (0,1)+          in X.lpg sig env c_off c_mul vca 1.1 1 0+in pan2 flt (0.5 * tRandId 'ε' (-1) 1 trig) 0.25++-- lpg+let freq = lfNoise2Id 'α' kr 1 `in_range` (1,4)+    tr = impulse kr freq 0+    env = envGen kr tr 1 0 (1 / freq * 0.05) DoNothing (envPerc 0.1 1.5)+    o1 = sinOsc kr (lag3 env 0.1 `in_range` (100,10)) 0+    o2 = sinOsc ar ((lfNoise2Id 'β' kr 1 `in_exprange` (200,1000)) * o1) 0+    sig = whiteNoiseId 'γ' ar * 0.2 + o2+    flt = let c_mul = lfNoise2Id 'δ' kr 10.1 `in_range` (0.5,0.95)+          in X.lpg sig env 0 c_mul 0.091 1.35 1 1+in pan2 flt (sinOsc kr 0.1 0 * 0.25) 0.25++-- lpg+let tempo = 8+    envdur = 0.91+    tr = impulse kr tempo 0+    squ = demand tr 0 (dseqId 'α' dinf (mce [200,291,420,191,320])) `lag` 0.01+    mdl = tWChooseId 'β' tr (mce [0.5,1.0,1.5]) (mce [0.75, 0.125, 0.125]) 0+    sig = sinOscFB ar (squ * mdl) 1.1 + whiteNoiseId 'γ' ar * 0.1+    rnd = tRandId 'δ' 0 1 tr+    env = envGen kr tr 1 0 (envdur / tempo) DoNothing (envPerc rnd (1 - rnd))+    flt = let c_off = lfSaw kr 0.1 0 `in_range` (0,0.2)+              c_mul = lfNoise2Id 'ε' kr 0.1 `in_range` (0.4,0.95)+              vca = lfNoise2Id 'ζ' kr 1 `in_range` (0,1)+          in X.lpg sig env c_off c_mul vca 1.1 1 0+in pan2 flt (0.5 * tRandId 'η' (-1) 1 tr) 0.25
+ Help/Ugen/lpz1.help.hs view
@@ -0,0 +1,2 @@+-- lpz1+let n = whiteNoiseId 'α' ar * 0.05 in mce2 (n * 0.25) (lpz1 n)
+ Help/Ugen/lpz2.help.hs view
@@ -0,0 +1,2 @@+-- lpz2+let n = whiteNoiseId 'α' ar in lpz2 (n * 0.05)
+ Help/Ugen/lti.help.hs view
@@ -0,0 +1,5 @@+-- lti+let a = [0.02,-0.01]+    b = [1,0.7,0,0,0,0,-0.8,0,0,0,0,0.9,0,0,0,-0.5,0,0,0,0,0,0,0.25,0.1,0.25]+    z = pinkNoiseId 'α' ar * 0.1+in X.lti ar z (asLocalBufId 'β' a) (asLocalBufId 'γ' b)
+ Help/Ugen/mantissaMask.help.hs view
@@ -0,0 +1,2 @@+-- mantissaMask+mantissaMask (sinOsc ar (sinOsc kr 0.2 0 * 400 + 500) 0 * 0.2) 3
+ Help/Ugen/max.help.hs view
@@ -0,0 +1,10 @@+-- max+(sinOsc ar 500 0 `max` sinOsc ar 0.1 0) * 0.1++-- max ; rate selection ; derive from left+let f = (sinOsc ar 0.2 0 `max` sinOsc kr 0.9 0) * 200 + 300+in sinOsc ar f 0 * 0.1++-- max ; rate selection ; derive from right+let f = (sinOsc kr 0.2 0 `max` sinOsc ar 0.9 0) * 200 + 300+in sinOsc ar f 0 * 0.1
+ Help/Ugen/mce.help.hs view
@@ -0,0 +1,24 @@+-- mce ; nested ; channel layout is L=440,441 and R=660,661+let f = mce2 (mce2 440 660) (mce2 441 661)+in mix (sinOsc ar f 0 * 0.1)++-- mceFill ; c.f. uclone_all+mceFillInt 2 (\z -> brownNoiseId z ar * 0.05)++-- mceFillId+mceFillId 'α' 2 (\z i -> brownNoiseId z ar * 0.025 * (i + 1))++-- mce ; one out ; two channels+sinOsc ar (mce2 440 441) 0 * 0.1++-- mce ; two out ; each single channel ; hence mono+sinOsc ar (mce1 (mce2 440 441)) 0 * 0.1++---- mce ; isList ; :set -XOverloadedLists (~/.ghci)+sinOsc ar [440,441] 0 * 0.1++---- mce ; isList ; :set -XOverloadedLists (~/.ghci) ; channel layout is L=440,441 and R=660,661+mix (sinOsc ar [[440,660],[441,661]] 0) * 0.1++---- ; c.f uclone_all+Protect.uclone_allId 'α' 2 (brownNoiseId 'β' ar) * 0.05
+ Help/Ugen/mdaPiano.help.hs view
@@ -0,0 +1,9 @@+-- mdaPiano ; trigger notes, three voices+let trigFreq = mce3 2 3 5+    freq = midiCps (lfNoise0Id 'α' kr trigFreq * 25 + 48) -- random note (internal rounding)+    gate = lfPulse kr trigFreq 0 0.5+    vel = lfPar kr (mce3 0.1 0.2 0.3) 0 * 35 + 55 -- varying velocity (0-127)+    hard = tRand 0.2 0.8 gate+    stereo = 0.5+    random = tRand 0 0.35 gate -- randomness of tuning+in mix (X.mdaPiano ar freq gate vel 0.8 hard 0.8 0.8 0.8 0.8 0.8 stereo 0.5 random 0.1 0) * 0.1
+ Help/Ugen/meddis.help.hs view
@@ -0,0 +1,5 @@+-- meddis ; passing a signal through the hair cell+X.meddis (sinOsc ar 440 0)++-- meddis ; recursive hair cell compression+X.meddis (X.meddis (soundIn 0))
+ Help/Ugen/median.help.hs view
@@ -0,0 +1,16 @@+-- median ; signal with impulse noise+let n = dust2Id 'α' ar 100+in median 3 (saw ar 500 * 0.1 + n * 0.9)++-- median ; length can be increased for longer duration noise+let n = dust2Id 'α' ar 100+in median 5 (saw ar 500 * 0.1 + lpz1 (n * 0.9))++-- median ; long filters begin chopping off the peaks of the waveform+let x = sinOsc ar 1000 0 * 0.2+in mce [x, median 31 x]++-- median ; median = high frequency noise ; leakDC = low frequency noise+let n = whiteNoiseId 'α' ar+    s = median 31 (n * 0.1 + sinOsc ar 800 0 * 0.1)+in leakDC s 0.9
+ Help/Ugen/membraneCircle.help.hs view
@@ -0,0 +1,20 @@+-- membraneCircle ; X = tension and impulse frequency, Y = duration, release-time and amplitude+let x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 1e-9 1 Exponential 0.2+    loss = linLin y 0 1 0.999999 0.999+    wobble = sinOsc kr 2 0+    tension = linLin x 0 1 0.01 0.1 + (wobble * 0.0001)+    p = envPerc 0.0001 y+    tr = impulse kr (linLin x 0 1 3 9) 0+    e = envGen kr tr (linLin y 0 1 0.05 0.25) 0 0.1 DoNothing p+in X.membraneCircle ar (pinkNoiseId 'α' ar * e) tension loss++-- membraneCircle ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let loss = linExp y 0 1 0.99999 0.99950+          wobble = sinOsc kr 2 0+          tension = linExp x 0 1 0.01 0.1 + (wobble * 0.0001)+          p = envPerc 0.0001 (1 - z)+          e = envGen kr g (z + y / 4) 0 0.1 DoNothing p+      in pan2 (X.membraneCircle ar (pinkNoiseId 'α' ar * e) tension loss) (o * 2 - 1) 1+in mix (voicer 6 f) * control kr "gain" 1
+ Help/Ugen/membraneHexagon.help.hs view
@@ -0,0 +1,14 @@+-- membraneHexagon ; mouse control+let mb = mouseButton kr 0 1 0.2+    mx = mouseX kr 0.01 0.1 Linear 0.2+    my = mouseY kr 0.999999 0.999 Exponential 0.2+    ex = pinkNoiseId 'α' ar * envGen kr mb 0.4 0 0.1 DoNothing (envPerc 0.01 1)+in X.membraneHexagon ar ex mx my++-- membraneHexagon ; event control ; requires=voicer+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let ex = pinkNoiseId 'α' ar * envGen kr g z 0 0.1 DoNothing (envPerc (0.02 * rx) 1)+          tn = x * 0.1+          ls = linExp y 0 1 0.999999 0.9999+      in pan2 (X.membraneHexagon ar ex tn ls) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/metro.help.hs view
@@ -0,0 +1,13 @@+-- metro+X.metro ar 60 1++-- metro+let b = xLine kr 60 120 5 DoNothing+    m = X.metro kr b 1+    o = sinOsc ar 440 0 * 0.1+in decay m 0.2 * o++-- metro+let b = range 30 240 (lfNoise2Id 'α' kr 0.2)+    n = dseqId 'β' dinf (mce [1,0.25,0.5,0.25])+in decay (X.metro kr b n) 0.2 * sinOsc ar 440 0 * 0.1
+ Help/Ugen/miBraids.help.hs view
@@ -0,0 +1,67 @@+-- MiBraids ; 6:SAW_SUB+X.miBraids ar 60 0.5 0.5 (X.miBraids_mode "SAW_SUB") 0 0 0 0 0 * 0.1++-- MiBraids ; 1:MORPH ; some modulation+let timb = lfNoise1Id 'α' kr 0.5 * 0.5 + 0.5+in X.miBraids ar 40 timb 0 (X.miBraids_mode "MORPH") 0 0 0 0 0 * 0.05++-- MiBraids ; 21:VOSIM+let pit = roundE (range 33 66 (lfNoise0Id 'α' kr 4))+    timb = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+    color = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+in X.miBraids ar pit timb color (X.miBraids_mode "VOSIM") 0 0 0 0 0 * 0.1++-- MiBraids ; 21:VOSIM ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let md = X.miBraids_mode "VOSIM"+          mnn = x * 24 + 36 -- x * 12 + 78+      in pan2 (X.miBraids ar mnn (y * 0.75) rx md 0 0 0 0 0) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1++-- MiBraids ; 31:FLUTED+let pit = 38;+    timb = mouseX kr 0.7 1 Linear 0.2+    color = mouseY kr 0 1 Linear 0.2+in X.miBraids ar pit timb color (X.miBraids_mode "FLUTED") 0 1 0 0 0 * 0.1++-- MiBraids ; scanning+let timb = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+    color = lfNoise1Id 'β' kr 0.3 * 0.5 + 0.5+    pit = mouseY kr 33 73 Linear 0.2+    model = mouseX kr 0 47 Linear 0.2+in X.miBraids ar pit timb color model 0 0 0 0 0 * 0.1++-- MiBraids ; 40:WAVE_PARAPHONIC+let timb = lfNoise1Id 'α' kr 0.03 * 0.5 + 0.5+    color = lfNoise1Id 'β' kr 0.05 * 0.5 + 0.5 -- chord+in X.miBraids ar 38 timb color (X.miBraids_mode "WAVE_PARAPHONIC") 0 1 0 0 0 * 0.1++-- MiBraids ; trigger (28:PLUCKED)+let tr = dustId 'α' kr 0.6+    pit = roundE (tRandId 'β' 45 72 tr)+    timb = 0.5+    color = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miBraids ar pit timb color (X.miBraids_mode "PLUCKED") tr 0 0 0 0 * 0.1++-- MiBraids ; 28:PLUCKED ; event control+let f (_,g,x,y,_,o,rx,_,_,_,_) =+      let tr = trig1 g controlDur+          pit = x * 24 + 45+          timb = latch y tr * 0.5 + 0.25+          color = latch rx tr * 0.25 + 0.65+          md = X.miBraids_mode "PLUCKED"+      in pan2 (X.miBraids ar pit timb color md tr 0 0 0 0) (o * 2 - 1) (trig1 g 16 * 0.1)+in mix (voicer 16 f) * control kr "gain" 1++-- MiBraids ; 34:KICK+let tr = impulse kr 4 0+    pit = roundE (range 30 50 (latch (pinkNoiseId 'α' kr) tr))+    timb = lfNoise1Id 'β' kr 0.4 * 0.5 + 0.5+    color = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miBraids ar pit timb color (X.miBraids_mode "KICK") tr 0 0 0 0 * 0.2++-- MiBraids ; sample rate, bit reduction and distortion+let tr = coinGateId 'α' 0.3 (impulse kr 4 0)+    decim = tRandId 'β' 1 32 tr+    dist = range 0 1 (lfTri kr 0.2 0)+in X.miBraids ar 40 0.7 0.7 (X.miBraids_mode "KICK") tr 2 decim 3 dist * 0.1
+ Help/Ugen/miClouds.help.hs view
@@ -0,0 +1,45 @@+-- MiClouds ; basic granulation ; requires=buf (stereo) ; 0=GRANULAR+let (buf, nc) = (control kr "buf" 100, 2)+    input = playBuf nc ar buf 1 1 0 Loop DoNothing+    dens = lfNoise1Id 'α' kr 0.3 `in_range` (0.3,0.45)+in X.miClouds ar 0 0 0 dens 0.5 1 1 0.5 0 0 0 (X.miClouds_mode "GRANULAR") 0 0 input++-- MiClouds+let imp = dustId 'α' ar (mce2 0.8 1.1)+    freq = midiCps (latch (pinkNoiseId 'β' ar * 24 + 80) imp)+    input = rlpf imp freq 0.002 * 4+    pit = lfNoise1Id 'γ' kr 0.3 * 12+    pos = lfNoise2Id 'δ' kr 0.4 * 0.5 + 0.5+    size = lfNoise1Id 'ε' kr 0.3 * 0.5 + 0.5+    dens = lfNoise1Id 'ζ' kr 0.3 * 0.5 + 0.5+    tex = lfNoise1Id 'η' kr 0.3 * 0.5 + 0.5+    frez = lfClipNoiseId 'θ' kr 0.3+in X.miClouds ar pit pos size dens tex 0.5 2 0.5 0.3 0.8 frez (X.miClouds_mode "GRANULAR") 1 0 input++-- MiClouds ; using external grain trigger ; requires=buf (stereo)+let (buf, nc) = (control kr "buf" 100, 2)+    input = playBuf nc ar buf 1 1 0 Loop DoNothing+    dens = 0.5+    tr = dustId 'α' kr 10+in X.miClouds ar (-5) 0 0.2 dens 0.5 1 1 0.5 0 0 0 (X.miClouds_mode "GRANULAR") 0 tr input++-- MiClouds ; 3=SPECTRAL ; (this mode causes high CPU peaks)+let (buf, nc) = (control kr "buf" 100, 2)+    input = playBuf nc ar buf 1 1 0 Loop DoNothing+    size = 0.35+    dens = 0.02+    tex = 0.3+in X.miClouds ar 0 0 size dens tex 1 1 0.5 0.8 0.8 0 (X.miClouds_mode "SPECTRAL") 0 0 input * 0.35++-- MiClouds ; spectral again ; watch volume+let (buf, nc) = (control kr "buf" 100, 2)+    input = playBuf nc ar buf 1 1 0 Loop DoNothing+    size = squared (range 0.1 0.5 (lfNoise1Id 'α' kr 0.2))+    dens = lfNoise1Id 'β' kr 0.3 * 0.5 + 0.5+    tex = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miClouds ar 0 0 size dens tex 1 1 0.5 0.6 0.6 0 (X.miClouds_mode "SPECTRAL") 1 0 input * 0.25++---- ; allocate buffer 0, required for examples+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "crotale05(D).wav"+ld "saron-panerus-S-0-5.flac"
+ Help/Ugen/miElements.help.hs view
@@ -0,0 +1,97 @@+-- miElements ; basic ; model=0=Modal+let inp = pinkNoiseId 'α' ar * 0.3+    gat = lfPulse kr 2 0 0.5+in X.miElements ar {-blow_in-} inp 0 gat 45 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 0.25 0.5 0.7 0.2 0.3 {-model-} 0 0++-- miElements ; ringing ; useId 'blow' input and contour set to 0.5+let inp = pinkNoiseId 'α' ar * 0.3+in X.miElements ar inp 0 1 48 0.5 {-contour-} 0.5 0 0 0 0.5 0.5 0.5 0.5 0.5 0.25 0.5 0.7 0.2 0.3 0 0++-- miElements ; ringing ; use theId 'strike' input (which bypasses the exciter section)+let inp = pinkNoiseId 'α' ar * 0.3+in X.miElements ar 0 {-strike_in-} inp 0 48 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 0.25 0.5 0.7 0.2 0.3 0 0++-- miElements ; bow+let pit = iRandId 'α' 32 44+    bow_timb = lfNoise1Id 'β' kr 0.3 * 0.5 + 0.5+in X.miElements ar 0 0 1 pit 0.5 0.5 1 0 0 0.5 0.5 bow_timb 0.5 0.5 0.25 0.5 0.7 0.2 0.3 0 0 * 0.25++-- miElements ; blow+let mod1 = lfNoise1Id 'α' kr 0.4 * 0.5 + 0.5+    mod2 = lfNoise1Id 'β' kr 0.2 * 0.5 + 0.5+    pit = lfNoise0Id 'γ' kr 0.1 `in_range` (32,44)+in X.miElements ar 0 0 1 pit 0.5 0.5 0 0.6 0 mod1 0.5 0.5 mod2 0.5 0.25 0.5 0.7 0.2 0.3 0 0 * 0.2++-- miElements ; blow ; contour+let gat = lfPulse kr 1 0.01 0.5+    pit = sinOsc kr 5 0 * 0.1 + 53+    cont = sinOsc kr 0.8 0 `in_range` (0,1)+    flow = lfNoise1Id 'α' kr 0.1 `in_range` (0,1)+in X.miElements ar 0 0 gat pit 0.5 cont 0 0.5 0 flow 0.5 0.5 0.3 0.5 0.25 0.3 0.8 0.2 0.3 0 0 * 0.25++-- miElements ; model=0=MODAL ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let tr = trig1 g controlDur+          pit = x * 24 + 56+          stre = ry * 0.5 + 0.25+          cont = y+          flo = o+          geo = 0.15 + (latch y tr * 0.35)+          bri = 0.5 - y * 0.35+          dmp = 1 - x * 0.25+          pos = o * 0.5+          spc = 0.5 - y * 0.5+          md = 0+      in X.miElements ar 0 0 g pit stre cont 0 z 0 flo 0.5 0.5 (0.25 + rx * 0.5) 0.5 geo bri dmp pos spc md 0 * 0.25+in mix (voicer 6 f) * control kr "gain" 1++-- miElements ; metal, bells+let tr = dustId 'α' ar 2.5+    inp = decay tr 0.01+    g = X.tBrownRandId 'β' 0.5 0.9 0.2 0 (coinGateId 'γ' 0.05 tr)+    space = range 0.5 1 (lfNoise1Id 'δ' kr 0.1)+in X.miElements ar 0 inp 0 40 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 g 0.4 0.9 0.2 space 0 0 * 0.35++-- miElements ; metal, bells ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let tr = trig1 (k2a g) sampleDur+          inp = decay (tr * z * 4) 0.01+          pit = latch x g * 12 + 36+          geo = latch y g * 0.4 + 0.5+          spc = o * 0.5 + 0.5+      in X.miElements ar 0 inp 0 pit 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 geo 0.4 0.9 0.2 spc 0 0+in mix (voicer 6 f) * control kr "gain" 1++-- miElements ; strike input ; playing chords ; model=2=Strings+let inp = decay (dustId 'α' ar 1) 0.01+    g = lfNoise1Id 'β' kr 0.1 * 0.5 + 0.5+in X.miElements ar 0 inp 0 {-pit-} 53 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 {-geom-} g {-bright-} 0.5 {-damp-} 0.9 0.2 0.3 {-model-} 2 0++-- miElements ; metal, bells ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let tr = trig1 (k2a g) sampleDur+          inp = decay tr 0.01+          pit = x * 12 + 48+          geo = latch o g -- lfNoise1Id 'β' kr 0.1 * 0.5 + 0.5+          bri = latch y g+          dam = latch (0.9 - z) g+          md = 2+      in X.miElements ar 0 inp 0 pit 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 geo bri dam 0.2 0.3 md 0+in mix (voicer 6 f) * control kr "gain" 1++-- miElements ; mallets, strength+let gat = coinGateId 'α' 0.4 (impulse kr 6 0)+    stren = tRandId 'β' 0 1 gat+    strike_timbre = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miElements ar 0 0 gat {-pit-} 40 stren 0.2 0 0 {-strike_level-} 0.5 0.5 {-mallet-} 0.7 0.5 0.5 strike_timbre 0.25 {-bright-} 0.3 {-damp-} 0.85 0.2 {-space-} 0.6 0 0 * 0.5++-- miElements ; mallets ; particles (mallet type=1 --> use internal model of bouncing particles)+let strike_timbre = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+    g = range 0.4 0.7 (lfNoise2Id 'β' kr 0.1)+    maltype = 1+in X.miElements ar 0 0 {-gate-} 1 {-pit-} 40 0.5 {-contour-} 0.5 0 0 {-strike_level-} 0.5 0.5 {-mallet-} maltype 0.5 0.5 strike_timbre {-geom-} g 0.5 0.7 0.2 0.3 0 0++-- miElements ; easteregg: 2x2-op FM synth+let n = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+    (r1,r2,r3) = (0.25,0.25,0.51)+in X.miElements ar 0 0 {-gate-} 1 48 {-strength-} 0.9 {-contour-} 0.5 {-bow_level-} r1 {-blow_level-} 0.6 {-strike_level-} 0.5 {-flow-} r2 {-mallet-} r3 {-bow_timb-} n {-blow_timb-} 0.3 {-strike_timb-} 0.6  {-geom-} 0.12 {-bright-} 0.6 {-damp-} 0.5 0.2 {-space-} 0.7 0 {-easteregg-} 1
+ Help/Ugen/miOmi.help.hs view
@@ -0,0 +1,18 @@+-- MiOmi ; basic+X.miOmi ar 0 0 {-pit-} 50 0.2 0.25 {-level1-} 1 {-level2-} 0.5 {-ratio1-} 0.49 0.5 {-fm1-} 0.5 0 0 0 0 0.5 0 0.5 0.5 0.2 0.5 * 0.25++-- MiOmi ; external FM+let fmfreq = mouseX kr 2 1000 Linear 0.2+    fmamp = mouseY kr 0 1 Linear 0.2+    extFM = sinOsc ar fmfreq 0 * fmamp+in X.miOmi ar extFM 0 {-pit-} 40 0.2 0.25 0.5 0.5 0.5 0.5 {-fm1-} 0.5 {-fm2-} 0.5 0 {-xfb-} 0.1 0 {-cutoff-} 0.9 0 0.5 0.5 0.2 0.5 * 0.5++-- MiOmi ; filter and cutoff modulation+let filtmod = range 0 1 (lfTri kr 0.23 0)+    gat = lfPulse kr 6 0 0.2+    cf = range 0 0.5 (lfTri kr 0.2 0)+in X.miOmi ar 0 gat 48 {-contour-} 0.1 0.25 0.5 0.5 0.5 0.5 {-fm1-} 0.5 {-fm2-} 0.5 {-fb-} 0.5 0 filtmod cf 0 {-strength-} 0 0.5 0.2 0.5++-- MiOmi ; cross feedback+let xfb = range 0 1 (lfTri kr 0.2 0)+in X.miOmi ar 0 0 {-pit-} 43 0.2 0.25 0.5 0.5 0.5 0.5 0 0 0 {-xfb-} xfb 0 0.5 0 0.5 0.5 0.2 0.5 * 0.25
+ Help/Ugen/miPlaits.help.hs view
@@ -0,0 +1,82 @@+-- MiPlaits ; basics ; 0=virtual_analog+X.miPlaits ar 35 (X.miPlaits_mode "virtual_analog") 0.252 0.5 0.2 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; Mouse control ; 2=fm+let harm = mouseX kr 0 1 Linear 0.2+    timb = mouseY kr 0 1 Linear 0.2+in X.miPlaits ar 48 (X.miPlaits_mode "fm") harm timb 0.5 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; some talking ; 7=speech+let ptch = mouseY kr 24 72 Linear 0.2+    harm = mouseX kr 0 1 Linear 0.2+    mrph = lfSaw ar 0.11 0 * 0.5 + 0.5+in X.miPlaits ar ptch (X.miPlaits_mode "speech") harm 0.5 mrph 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; scanning through some engines + vibrato+let pit = 50+    vib = sinOsc ar 6 0 * 0.3+    eng = lfNoise0Id 'α' kr 0.5 * 4 + 4+in X.miPlaits ar (pit + vib) eng 0.1 0.5 0.5 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; some FM+let harm = mouseX kr 0 1 Linear 0.2+    timbre = mouseY kr 0 1 Linear 0.2+    morph = range 0 1 (lfNoise2Id 'α' kr 0.2)+    trigger = impulse ar 8 0+in X.miPlaits ar 48 (X.miPlaits_mode "fm") harm timbre morph trigger 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; 5=wavetable+let trigger = impulse kr 8 0+    harm = lfNoise2Id 'α' kr 0.3 * 0.25 + 0.25+    timbre = lfNoise1Id 'α' kr 0.4 * 0.5 + 0.5+    dec = range 0.01 0.8 (lfNoise2Id 'α' kr 0.2)+in X.miPlaits ar 44 (X.miPlaits_mode "wavetable") harm timbre 0 trigger 0 0 0 0 dec 0.5 * 0.2++-- MiPlaits ; 6=chord+let harm = mouseY kr 0 1 Linear 0.2 -- select chord+    trigger = impulse kr 6 0+    lev = tRandId 'α' 0 1 trigger+in mceChannel 0 (X.miPlaits ar 40 (X.miPlaits_mode "chord") harm 0.5 0.5 trigger (lev * lev) 0 0.4 0 0.5 0.5) * 0.1++-- MiPlaits ; 8=swarm ; super saw+let pit = tiRandId 'α' 39 49 (dustId 'β' kr 0.5)+in mceChannel 0 (X.miPlaits ar pit (X.miPlaits_mode "swarm") 0.16 0 1 0 0 0 0 0 0.5 0.5) * 0.1++-- MiPlaits ; slow swarm+X.miPlaits ar 48 (X.miPlaits_mode "swarm") 0.9 0 0.5 0 0 0 0 0 0.5 0.5 * mce2 0.04 0.15++-- MiPlaits ; 11=string ; inharmonic+let harm = range 0 1 (lfNoise2Id 'α' kr 0.2)+in mceChannel 0 (X.miPlaits ar 60 (X.miPlaits_mode "string") harm 0 0.85 0 0 0 0 0 0.5 0.5)++-- MiPlaits ; 12=modal+let harm = range 0 1 (lfNoise2Id 'α' kr 0.2)+    trigger = impulse kr 1 0+    lev = squared (tRandId 'β' 0 1 trigger)+in mix (X.miPlaits ar 56 (X.miPlaits_mode "modal") harm 0 0.85 trigger lev 0 0 0 0.5 0.5)++-- MiPlaits ; snare drums+let harm = range 0 0.5 (lfNoise2Id 'α' kr 0.5)+    timbre = 0.173+    morph = 0.827+    trigger = impulse kr 8 0+    lev = squared (tRandId 'β' 0 1 trigger)+in X.miPlaits ar 47 14 harm timbre morph trigger lev 0.2 0.43 0 0.4 0.5 * 0.1++-- MiPlaits ; filtered noise+let harm = 0.575+    timbre = 0.02+    morph = range_hs (0.55,0.9) (lfNoise1Id 'α' kr 0.3) -- filter resonance+in X.miPlaits ar 62 9 harm timbre morph 0 0 0 0 0 0.5 0.5 * 0.25++-- MiPlaits ; something...+let trigger = dustId 'α' kr (range_hs (0.1,7) (lfNoise2Id 'β' kr 0.1))+    harmonics = sinOsc kr 0.03 0 * 0.5 + 0.5+    timbre = lfTri kr 0.07 0 * 0.5 + 0.5+    morph = lfTri kr 0.11 0 * 0.5 + 0.5+    pitch_ = tiRandId 'γ' 24 48 trigger+    engine = roundE (tRandId 'δ' 0 15 trigger)+    sub = sinOsc ar (midiCps pitch_) 0 * 0.1+    mi = X.miPlaits ar pitch_ engine harmonics timbre morph trigger 0 0 0 0 0.8 0.2 * 0.5+in (mi + sub) * 0.2+
+ Help/Ugen/miRings.help.hs view
@@ -0,0 +1,86 @@+-- MiRings ; basics ; 0=MODAL_RESONATOR+X.miRings ar (impulse ar 1 0) 0 60 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 1 0 0 0++-- MiRings ; basics ; 0=MODAL_RESONATOR ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let tr = trig1 g controlDur+          md = X.miRings_mode "MODAL_RESONATOR"+      in X.miRings ar 0+         tr (x * 24 + 36) (latch o tr * 0.75 + 0.25) (y * 0.65 + 0.15) (0.7 - latch rx tr) (0.25 + latch ry tr)+         md 1 0 0 0 * z+in mix (voicer 16 f) * control kr "gain" 4++-- MiRings ; basics+X.miRings ar (pinkNoiseId 'α' ar * 0.05) 0 40 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 1 0 0 0++-- MiRings ; using theId 'trig' input to excite the resonator ; 1=SYMPATHETIC_STRING+X.miRings ar 0 (dustId 'α' kr 0.7) 33 0.25 0.5 0.7 0.25 (X.miRings_mode "SYMPATHETIC_STRING") 1 0 0 0 * 0.2++-- MiRings ; basics ; 1=SYMPATHETIC_STRING ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let tr = trig1 g controlDur+          md = X.miRings_mode "SYMPATHETIC_STRING"+      in X.miRings ar 0+         tr (x * 24 + 36) (latch o tr * 0.75 + 0.25) (y * 0.65 + 0.15) (0.7 - latch rx tr) (0.25 + latch ry tr)+         md 1 0 0 0 * z+in mix (voicer 16 f) * control kr "gain" 2++-- MiRings ; using theId 'pit' input to set midi pitch and excite the resonator+X.miRings ar 0 0 (range 30 50 (lfNoise0Id 'α' kr 2)) 0.25 0.5 0.7 0.25 (X.miRings_mode "SYMPATHETIC_STRING") 1 0 0 0 * 0.2++-- MiRings ; 2=MODULATED/INHARMONIC_STRING+X.miRings ar 0 0 (range 30 50 (lfNoise0Id 'α' kr 2)) 0.25 0.5 0.7 0.25 (X.miRings_mode "MODULATED/INHARMONIC_STRING") 1 0 0 0 * 0.2++-- MiRings ; basics ; 2=MODULATED/INHARMONIC_STRING ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let tr = trig1 g controlDur+          md = X.miRings_mode "MODULATED/INHARMONIC_STRING"+      in X.miRings ar 0+         tr (x * 24 + 36) (0.25 + latch o tr * 0.15) (0.25 + y * 0.5) (0.7 - latch rx tr * 0.15) (0.25 + latch ry tr * 0.15)+         md 1 0 0 0 * z+in mix (voicer 16 f) * control kr "gain" 2++-- MiRings ; sympathetic strings+let tr = dustId 'α' kr 1+    pit = roundE (range 30 60 (latch (whiteNoiseId 'β' kr) tr))+    struct = range 0 1 (lfNoise2Id 'γ' kr 0.4)+in X.miRings ar 0 0 pit struct 0.5 0.7 0.25 (X.miRings_mode "SYMPATHETIC_STRING") 4 0 0 0 * 0.25++-- MiRings ; inharmonic string+let tr = dustId 'α' kr 3+    trPit = dustId 'β' kr 0.5+    pit = range 30 60 (latch (whiteNoiseId 'γ' kr) trPit)+    struct = range 0.1 1 (latch (pinkNoiseId 'δ' kr) tr)+in X.miRings ar 0 tr pit struct 0.5 0.8 0.25 (X.miRings_mode "MODULATED/INHARMONIC_STRING") 4 0 0 0 * 0.25++-- MiRings ; simple vibrato+let tr = dustId 'α' kr 0.5+    pit = range 36 48 (latch (whiteNoiseId 'β' kr) tr)+    vib = sinOsc kr 3 0+in X.miRings ar 0 0 (pit + vib) 0.2 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 1 0 0 0++-- MiRings ;Id 'intern_exciter' OFF+X.miRings ar (pinkNoiseId 'α' ar * 0.1) (impulse kr 1 0) 60 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 2 0 0 0 * 0.25++-- MiRings ;Id 'intern_exciter' ON+X.miRings ar (pinkNoiseId 'α' ar * 0.1) (impulse kr 1 0) 60 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 2 1 0 0 * 0.25++-- MiRings ; intern_exciter ON+let input = crackle ar 1.999 * 0.2+    tr = dustId 'α' ar 0.7+    bright = range 0.1 0.8 (lfNoise1Id 'β' kr 0.4)+    pos = range 0 1 (lfNoise2Id 'γ' kr 0.1)+in X.miRings ar input tr 56 0.1 bright 0.6 pos (X.miRings_mode "MODAL_RESONATOR") 3 1 0 0 * 0.35++-- MiRings ; 5=STRING_AND_REVERB --> spacey ; forceId 'internal exciter'+let md = X.miRings_mode "STRING_AND_REVERB"+    input = pinkNoiseId 'α' ar * 0.2+    tr = dustId 'β' kr 0.7+    struct = range 0 1 (lfNoise1Id 'γ' kr 0.4)+    pos = range 0 1 (lfNoise2Id 'δ' kr 0.1)+in X.miRings ar input tr 60 struct 0.5 0.7 pos md 4 1 0 0 * 0.25++-- MiRings ; easter egg --> drone ; set damp to 1.0 to get a sustaining sound that doesn't need to be triggered+let struct = range 0 1 (lfNoise2Id 'α' kr 0.2)+    brightness = range 0 1 (lfNoise1Id 'β' kr 0.5)+in X.miRings ar 0 0 40 struct brightness 1 0.9 (X.miRings_mode "MODULATED/INHARMONIC_STRING") 2 0 1 0 * 0.25
+ Help/Ugen/miRipples.help.hs view
@@ -0,0 +1,17 @@+-- MiRipples ; basic+X.miRipples (saw ar 60) 0.4 0.3 1++-- MiRipples+let cf = range 0 1 (lfNoise0Id 'α' kr 4)+in X.miRipples (saw ar 60) cf 0.6 1 * 0.5++-- MiRipples ; filter sweep + distortion+let cf = range 0.1 0.9 (lfTri kr 0.03 0)+in X.miRipples (saw ar 40) cf 0.8 4 * 0.2++-- MiRipples+let tr = impulse ar 4 0+    input = decay tr 0.1+    cf = tRandId 'α' 0.1 0.6 tr+    filt = rlpf cf 80 0.3+in X.miRipples input filt 0.8 3 * 0.5
+ Help/Ugen/miTides.help.hs view
@@ -0,0 +1,84 @@+-- MiTides ; shape+let shape = lfTri ar 0.11 0 `in_range` (0,1)+    c0 = mceChannel 0+in c0 (X.miTides ar 100 shape 0.5 0.5 0.2 0 0 {-output_mode:-} 2 1 9 1) * 0.25++-- MiTides ; slope+let slope = lfTri ar 0.11 0 `in_range` (0,1)+    c0 = mceChannel 0+in c0 (X.miTides ar 100 0.5 slope 0.5 0.2 0 0 {-output_mode:-} 2 1 9 1) * 0.25++-- MiTides ; phasing+let shape = 0.2+    slope_ = 0.0+    shift_ = lfNoise1Id 'α' ar 0.3 `in_range` (0,1) -- slightly shift phases+    smooth = lfNoise1Id 'β' kr 0.02 `in_range` (0.1,0.9)+    sig = X.miTides ar 70 shape slope_ smooth shift_ 0 0 {-output_mode:-} 2 1 9 1 * 0.15+in splay sig 1 1 0 True++-- MiTides ; chords ; tremolo+let shape = lfTri ar 0.11 0 `in_range` (0,1)+    slope_ = lfTri ar 0.2 0 `in_range` (0,1);+    chord = lfNoise1Id 'α' ar 0.1 `in_range` (0.5,1);+    smooth = sinOsc ar (lfNoise1Id 'β' kr 0.2 `in_range` (0.1,10)) 0 `in_range` (0,0.5)+    sig = X.miTides ar 200 shape slope_ smooth chord 0 0 {-output_mode:-} 3 1 9 1 * 0.25+in splay sig 1 1 0 True++-- MiTides ; amplitude mode+let freq = 0.15+    shape = 0.2+    slope_ = 0.2+    level = lfTri ar 0.1 0 `in_range` (0,1)+    env = X.miTides ar freq shape slope_ 0.3 level 0 0 {-output_mode:-} 1 {-ramp_mode:-} 1 9 1+    sines = sinOsc ar (mce [200,300,500,900]) 0+in splay (sines * env) 1 1 0 True++-- MiTides ; amplitude ; trigger input+let freq = lfNoise1Id 'α' ar 0.8 `in_range` (0.2,10)+    shape = 0.2+    slope_ = 0.2+    level = lfNoise1Id 'β' ar 0.3 `in_range` (0,1)+    tr = lfPulse ar 2 0 0.5+    env = X.miTides ar freq shape slope_ 0.3 level tr 0 {-output_mode:-} 1 {-ramp_mode:-} 0 9 1+    sines = sinOsc ar (mce [200,300,500,700]) 0+in splay (sines * env * 0.5) 1 1 0 True++-- MiTides ; phasing envs+let freq = 10+    shape = 0.2+    slope_ = 0.5+    shift_ = lfTri ar 0.1 0 `in_range` (0,1)+    trig = lfPulse ar 5 0 0.5+    env = X.miTides ar freq shape slope_ 0.5 shift_ trig 0 {-output_mode:-} 2 {-ramp_mode:-} 0 9 1+    sines = sinOsc ar (mce [200,300,500,700]) 0+in splay (sines * env * 0.25) 1 1 0 True++-- MiTides ; gate+let freq = 5 -- attack rate+    shape = lfTri ar 0.13 0 `in_range` (0,1)+    slope_ = 0.5+    smooth = lfTri ar 0.1 0 `in_range` (0,1)+    tr = lfPulse ar 1 0 0.5+    env = X.miTides ar freq shape slope_ smooth 0.8 tr 0 {-output_mode:-} 0 {-ramp_mode:-} 0 1 9+    sine = pmOsc ar 150 300 2 0+    c0 = mceChannel 0+in sine * c0 env++-- MiTides ; Lightbath -- Loom 4+let bpm = 140+    period = (60 / bpm) * 6+    speed = 1.0 / period+    del_times = period / mce2 6 8+    tr = impulse kr speed 0+    clock = phasor kr tr 1 0 1 0+    pit = tChooseId 'α' tr (mce [67, 60, 65])+    shape = lfTri kr 0.11 0 `in_range` (0,1)+    slope_ = lfTri kr 0.11 0 `in_range` (0.5,0.8)+    smooth = lfNoise1Id 'β' kr 0.07 `in_range` (0.25,0.7)+    chord = lfNoise1Id 'γ' kr 0.03 `in_range` (0.0,0.5)+    oscs = X.miTides ar (midiCps pit) shape slope_ smooth chord 0 0 3 1 9 1+    envs = X.miTides ar speed 0.35 0 0.46 0.92 0 clock 3 1 {-ratio:-} 9 {-rate:-} 0+    scaler = lfNoise1Id 'δ' kr (mce [0.1, 0.07, 0.11, 0.05])+    sig = splay (oscs * envs * scaler) 1 1 (lfTri kr 0.1 0) True+    del = combL sig 2 del_times 6 * 0.5+in sig + del
+ Help/Ugen/miVerb.help.hs view
@@ -0,0 +1,20 @@+-- MiVerb ; basic+X.miVerb 0.7 0.5 0.5 0.05 0 0.625 (impulse ar 1 0)++-- MiVerb ; stereo ; with freezing+let imp = dustId 'α' ar (mce2 0.7 0.8)+    freq = midiCps (latch (pinkNoiseId 'β' ar * 24 + 80) imp)+    input = rlpf imp freq 0.002 * 3+    freez = tRandId 'γ' (-1) 1 (dustId 'δ' kr 0.7)+    revtime = 0.8+    drywet = 0.5+    damping = 0.3+    diff = lfNoise1Id 'ε' kr 0.1 * 0.5 + 0.5+in X.miVerb revtime drywet damping 0.05 freez 0.625 input++-- MiVerb ; reverb time (> 1)+let freq = lfNoise0Id 'α' kr 0.3 `in_range` (400, 2500)+    input = rlpf (impulse ar 0.3 0) freq 0.1+    time = lfNoise2Id 'β' kr 0.3 * 0.1 + 1.03 -- modulate rev time above and below 1.0!+    damp = lfNoise2Id 'γ' kr 0.2 `in_range` (0, 0.7)+in X.miVerb time 0.9 damp 0.1 0 0.625 input * 0.25
+ Help/Ugen/midEQ.help.hs view
@@ -0,0 +1,8 @@+-- midEQ+let f = midiCps (fSinOsc kr 1 0 * 24 + 84)+in midEQ (saw ar 200 * 0.05) f 0.3 12++-- midEQ+let i = pinkNoiseId 'α' ar * 0.1 + sinOsc ar 600 0 * 0.05+    f = sinOsc kr 0.2 (0.5 * pi) * 2 + 600+in midEQ i f 0.01 (-24)
+ Help/Ugen/midiCPS.help.hs view
@@ -0,0 +1,5 @@+-- midiCps+saw ar (midiCps (line kr 24 108 10 DoNothing)) * 0.05++-- midiCps ; step+saw ar (midiCps (roundE (line kr 24 108 10 DoNothing))) * 0.05
+ Help/Ugen/min.help.hs view
@@ -0,0 +1,2 @@+-- min+(fSinOsc ar 500 0 `min` fSinOsc ar 0.1 0) * 0.1
+ Help/Ugen/mix.help.hs view
@@ -0,0 +1,21 @@+-- mix ; optimized summation (see sum_opt), ie. Sum3+mix (mce [pinkNoiseId 'α' ar,fSinOsc ar 801 0,lfSaw ar 40 0]) * 0.05++-- mix ; c.f. sum4+mix (sinOsc ar (mce (take 10 (iterate (* 2) 36))) 0) * 0.025++-- mix ; mixing stereo signals (mce)+mix (mce [sinOsc ar (mce2 330 990) 0 * 0.05,sinOsc ar (mce2 331 991) 0 * 0.05])++-- mix ; mixing stereo signals (mce) ; sums left with left and right with right+mix (mce2 (sinOsc ar (mce2 440 441) 0) (sinOsc ar (mce2 220 221) 0)) * 0.1++-- mix ; mixing stereo signals (pan) ; sums left with left and right with right+mix (mce2 (pan2 (sinOsc ar 440 0) (-1) 0.1) (pan2 (sinOsc ar 441 0) 1 0.1))++-- mix ; phase cancellation+mix (mce2 (sinOsc ar 440 0) (sinOsc ar 440 pi))++-- mix ; channel layout is L=440,441 and R=660,661+let f = mce2 (mce2 440 660) (mce2 441 661)+in mix (sinOsc ar f 0 * 0.1)
+ Help/Ugen/mod.help.hs view
@@ -0,0 +1,2 @@+-- mod+sinOsc ar 100 4 `modE` 1 * 0.1
+ Help/Ugen/modDif.help.hs view
@@ -0,0 +1,20 @@+-- modDif+fSinOsc ar 440 0 * (modDif 0.2 (fSinOsc ar 2 0 * 0.5) 1)++-- modDif ; different moduli+let sig = lfSaw ar 10 0+    dist = modDif sig 0 (mce [0..8] * mouseX kr 0 (1/5) Linear 0.2)+in splay (sinOsc ar (dist * 4000 + 400) 0) 1 1 0 True * 0.1++-- modDif ; wrapping amplitude crossfade+let nc = 12+    nc_u = constant nc+    x = sinOsc ar (X.randNId nc 'α' 300 800) 0+    d = modDif (mouseX kr 0 (nc_u * 2) Linear 0.2) (mce [0 .. nc_u - 1]) nc_u+in splay (x * max 0 (1 - d)) 1 1 0 True * 0.1++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen 0.01 (let a = line ar 0 4 0.01 DoNothing in mce2 a (modDif a 0 1))+plot_ugen 0.01 (let a = line ar 0 4 0.01 DoNothing in modDif a 0 (mce [1 .. 4]))+plot_ugen 0.01 (let a = line ar 0 4 0.01 DoNothing in modDif a (mce [0, 0.25 .. 1]) 1)
+ Help/Ugen/monoGrain.help.hs view
@@ -0,0 +1,4 @@+-- monoGrain+let x = mouseX kr 0.1 0.01 Linear 0.2+    y = mouseX kr 10 4 Linear 0.2+in X.monoGrain ar (soundIn 0) x y 0
+ Help/Ugen/moogFF.help.hs view
@@ -0,0 +1,22 @@+-- moogFF+let n = whiteNoiseId 'α' ar * 0.05+    freq = mouseX kr 100 10000 Exponential 0.1+    gain = mouseY kr 0 4 Linear 0.1+in moogFF n freq gain 0++-- moogFF ; note distortion at high gain+let x = mouseX kr 100 20000 Exponential 0.1+    y = mouseY kr 0.1 4.0 Linear 0.1+    i = mix (saw ar (mce [0.99, 1, 1.01] * 440)) * 0.2+in moogFF i x y 0++-- moogFF+let n = lfNoise0Id 'α' kr 0.43+    p = pulse ar (mce [40, 121]) (mce [0.3, 0.7])+    f0 = linLin n 0 1 0.001 2.2+    f = linLin (sinOsc kr f0 0) (-1) 1 30 4200+    y = mouseY kr 1 4 Linear 0.1+in moogFF p f (0.83 * y) 0++---- ; drawings+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/moogLadder.help.hs view
@@ -0,0 +1,31 @@+-- moogLadder+let o = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+    cf = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 180 8500+in X.moogLadder o cf 0.75++-- moogLadder+let n = dustId 'α' ar 3+in X.moogLadder n 2000 (mouseY kr 0 1 Linear 0.2)++-- moogLadder ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let f0 = unitCps p+          f1 = f0 * (1 + y * 8)+          res = rx + ry+          env = lagUD g 0.05 (2 - y * 2) * (2 - y) * z+      in pan2 (X.moogLadder (lfSaw ar f0 0) f1 res) (o * 2 - 1) env+in mix (voicer 16 f) * control kr "gain" 1++-- moogLadder ; wind (Id)+let mk k = let n = whiteNoiseId k ar+               force = lfNoise2Id k kr 0.25 `in_range` (0.25,0.75)+               freq = pianokey_to_cps (force * 88)+           in X.moogLadder n freq force+in splay (mceFillInt 6 mk) 1 1 0 True++-- moogLadder ; wind (Unsafe)+let mk _ = let n = whiteNoise ar+               force = lfNoise2 kr 0.25 `in_range` (0.25,0.75)+               freq = pianokey_to_cps (force * 88)+           in X.moogLadder n freq force+in splay (mceFill 6 mk) 1 1 0 True
+ Help/Ugen/moogVCF.help.hs view
@@ -0,0 +1,9 @@+-- moogVCF+let o = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+    cf = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 180 8500+in X.moogVCF o cf 0.75++-- moogVCF+let o = pulse ar (mce2 40 121) (mce2 0.3 0.7)+    cf = range 30 4200 (sinOsc kr (range 0.001 2.2 (lfNoise0Id 'α' kr 0.42)) 0)+in X.moogVCF o cf 0.8 * 0.25
+ Help/Ugen/mostChange.help.hs view
@@ -0,0 +1,5 @@+-- mostChange+let n = lfNoise0Id 'α' kr 1+    x = mouseX kr 200 300 Linear 0.1+    f = mostChange (n * 400 + 900) x+in sinOsc ar f 0 * 0.1
+ Help/Ugen/mouseButton.help.hs view
@@ -0,0 +1,5 @@+-- mouseButton ; amplitude envelope+sinOsc ar 800 0 * mouseButton kr 0 0.1 0.1++-- mouseButtonRand ; variant that randomly presses the button+sinOsc ar 800 0 * mouseButtonRand kr 0 0.1 0.1
+ Help/Ugen/mouseX.help.hs view
@@ -0,0 +1,7 @@+-- mouseX ; frequency control+let x = mouseX kr 40 10000 Exponential 0.2+in sinOsc ar x 0 * 0.1++-- mouseX ; variant with equal arguments but random traversal+let x = mouseXRand kr 40 10000 Exponential 0.2+in sinOsc ar x 0 * 0.1
+ Help/Ugen/mouseY.help.hs view
@@ -0,0 +1,9 @@+-- mouseY ; frequency at X axis, amplitude at Y axis+let freq = mouseX kr 20 2000 Exponential 0.1+    ampl = mouseY kr 0.01 0.1 Linear 0.1+in sinOsc ar freq 0 * ampl++-- mouseY ; variant with equal arguments but a random traversal+let freq = mouseXRand kr 20 2000 Exponential 0.1+    ampl = mouseYRand kr 0.01 0.1 Linear 0.1+in sinOsc ar freq 0 * ampl
+ Help/Ugen/mrg2.help.hs view
@@ -0,0 +1,19 @@+-- mrg2 ; defines a node indicating a multiple root graph.+let l = out 0 (sinOsc ar 300 0 * 0.1)+    r = out 1 (sinOsc ar 900 0 * 0.1)+in mrg2 l r++-- mrg2 ; there is a leftmost rule, so that mrg nodes need not be terminal+let l = sinOsc ar 300 0 * 0.1+    r = out 1 (sinOsc ar 900 0 * 0.1)+in mrg2 l r++-- mrg2 ; the leftmost node may be an mce node+let l = sinOsc ar (mce2 300 400) 0 * 0.1+    r = out 1 (sinOsc ar 900 0 * 0.1)+in mrg2 l r++-- mrg2 ; the implementation is not thorough+let l = sinOsc ar (mce2 300 400) 0 * 0.1+    r = out 1 (sinOsc ar 900 0 * 0.1)+in out 0 (mrg2 l r + mrg2 l r)
+ Help/Ugen/mul.help.hs view
@@ -0,0 +1,22 @@+-- mul+sinOsc ar 440 0 * 0.15++-- mul ; creates a beating effect (subaudio rate)+fSinOsc kr 10 0 * pinkNoiseId 'α' ar * 0.1++-- mul ; ring modulation+let p = sinOsc ar (xLine kr 100 1001 10 DoNothing) 0+    q = syncSaw ar 100 200+in p * q * 0.25++-- mul ; optimises identity+sinOsc ar 440 0 * 1 / 10++-- mul ; optimises identity+1 * sinOsc ar 440 0 / 10++-- mul ; gate ; control+let freq = control_m kr "freq" 220 (55,880,"exp")+    amp = control_m kr "amp" 0.1 (0,1,"amp")+    gate_ = control_m kr "gate" 0 (0,1,"switch")+in sinOsc ar freq 0 * amp * lag gate_ 0.1
+ Help/Ugen/mulAdd.help.hs view
@@ -0,0 +1,20 @@+-- mulAdd+mulAdd (sinOsc ar 440 0) 0.1 0.05++-- mulAdd ; optimisation of constant inputs of one and zero+mulAddOptimised (sinOsc ar 440 0) 1 0 * 0.1++-- mulAdd ; optimisation ; of * followed by ++sinOsc ar 440 0 * 0.1 + 0.05++-- mulAdd ; optimisation ; of + followed by * ; ugen at left+0.05 + sinOsc ar 440 0 * 0.1++-- mulAdd ; optimisations ; of + followed by * ; ugen at right+0.05 + 0.1 * sinOsc ar 440 0++-- mulAdd ; all ar inputs optimise ordinarily ; * then ++(sinOsc ar 440 0 * sinOsc ar 441 0 + sinOsc ar 442 0) * 0.1++-- mulAdd ; + then *+(sinOsc ar 440 0 + sinOsc ar 441 0 * sinOsc ar 442 0) * 0.1
+ Help/Ugen/nRand.help.hs view
@@ -0,0 +1,4 @@+-- nRand+let n = nRandId 'α' 1200.0 4000.0 (mce [2,5])+    e = line kr 0.2 0 0.1 RemoveSynth+in fSinOsc ar n 0 * e
+ Help/Ugen/neg.help.hs view
@@ -0,0 +1,2 @@+-- neg ; silence, draw graph to see operator+let o = sinOsc ar 440 0 in o + negate o
+ Help/Ugen/neoFormant.help.hs view
@@ -0,0 +1,15 @@+-- neoFormant+let modulator = sinOsc kr 0.1 0+    formantfreq = 150+    carrierfreq = lfNoise2Id 'α' kr 10 `in_exprange` (100,550)+    phaseshift = modulator `in_range` (0,1)+    sig = X.neoFormant ar formantfreq carrierfreq phaseshift+in pan2 sig modulator 0.1++-- neoFormant ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+      let carrierFreq = midiCps (x * 13 + 36)+          formantFreq = y `in_exprange` (100,550)+          phaseShift = lag rx 0.5 * 2+      in pan2 (X.neoFormant ar formantFreq carrierFreq phaseShift) (o * 2 - 1) (lagUD (z * g) 0 0.2)+in mix (voicer 16 f) * control kr "gain" 0.2
+ Help/Ugen/nestedAllpassC.help.hs view
@@ -0,0 +1,48 @@+-- nestedAllpassL+let sig = soundIn 0+    nc = 2+    nestedAllpassL_def s =+      let d1 = 0.036+          d2 = 0.030+      in X.nestedAllpassL s d1 d1 0.08 d2 d2 0.3+    doubleNestedAllpassL_def s =+      let d1 = 0.0047+          d2 = 0.022+          d3 = 0.0084+      in X.doubleNestedAllpassL s d1 d1 0.15 d2 d2 0.25 d3 d3 0.3+    fb = localIn nc ar 0+    lp0 = lpf sig 6000+    lp1 = delayL lp0 0.024 0.024+    ap1 = doubleNestedAllpassL_def (lp1 + (0.5 * fb))+    ap2 = nestedAllpassL_def ap1+    revout = ap1 * 0.5 + ap2 * 0.6+    locout = localOut (bpf (revout * 0.5) 1600 0.5)+    rev = mrg2 revout locout+in sig + (rev * 0.5)++-- nestedAllpassL+let sig = soundIn 0+    nc = 2+    fb = localIn nc ar 0+    lp = lpf sig 6000+    ap1 = X.doubleNestedAllpassL (lp + (0.5 * fb)) 0.0047 0.0047 0.25 0.0083 0.0083 0.35 0.022 0.022 0.45+    ap2 = delayL (X.nestedAllpassL (delayL ap1 0.05 0.05) 0.03 0.03 0.25952 0.03 0.03 0.3) 0.067 0.067+    ap3 = X.nestedAllpassL (lp + (delayL ap2 0.015 0.015 * 0.4)) 0.0292 0.0292 0.25 0.0098 0.0098 0.35+    revout = sum_opt [ap1,ap2,ap3] * 0.5+    locout = localOut (bpf (revout * 0.4) 1000 0.5)+    rev = mrg2 revout locout+in sig + (rev * 0.5)++-- nestedAllpassL+let sig = soundIn 0+    nc = 2+    fb = localIn nc ar 0+    lp = lpf sig 4000+    ap1 = allpassL (lp + (0.5 * fb)) 0.008 0.008 0.0459+    ap2 = delayL (allpassL ap1 0.012 0.012 0.06885) 0.004 0.004+    ap3 = delayL (X.nestedAllpassL (delayL ap2 0.017 0.017) 0.025 0.025 0.5 0.062 0.062 0.25) 0.031 0.031+    ap4 = X.doubleNestedAllpassL (delayL ap3 0.003 0.003) 0.120 0.120 0.5 0.076 0.076 0.25 0.030 0.030 0.25+    revout = sum_opt [ap4 * 0.8,ap3 * 0.8,ap2 * 1.5]+    locout = localOut (bpf (revout * 0.4) 1000 0.5)+    rev = mrg2 revout locout+in sig + (rev * 0.5)
+ Help/Ugen/nhHall.help.hs view
@@ -0,0 +1,5 @@+-- nhHall+let in1 = soundIn 0+    in2 = soundIn 1+    rt60 = mouseX kr 0.1 10.0 Linear 0.1+in X.nhHall in1 in2 rt60 0.5 200 0.5 4000 0.5 0.5 0.5 0.2 0.3
+ Help/Ugen/nodeId.help.hs view
@@ -0,0 +1,6 @@+-- nodeId ; except that negative nodeId are not reported+sinOsc ar (mce2 (-100) (nodeID ir * 100)) 0 * 0.1++---- ; specify node id+audition_at (-1,AddToHead,1,[]) (sinOsc ar (mce2 (-100) (nodeID ir * 100)) 0 * 0.1)+audition_at (8,AddToHead,1,[]) (sinOsc ar (mce2 (-100) (nodeID ir * 100)) 0 * 0.1)
+ Help/Ugen/normalizer.help.hs view
@@ -0,0 +1,5 @@+-- normalizer+let s = fSinOsc ar 500 0+    t = impulse ar 8 (lfSaw kr 0.25 (-0.6) * 0.7)+    z = decay2 t 0.001 0.3 * s+in mce [z, normalizer z 0.4 0.01]
+ Help/Ugen/numBuffers.help.hs view
@@ -0,0 +1,5 @@+-- numBuffers ; the number of audio buffers available at the server (by default 1024, printing only)+poll (impulse kr 1 0) numBuffers 0 (label "numBuffers")++-- numBuffers+let f = 110 + numBuffers in sinOsc ar f 0 * 0.1
+ Help/Ugen/numRunningSynths.help.hs view
@@ -0,0 +1,2 @@+-- numRunningSynths ; each concurrent audition increases oscillator frequency+sinOsc ar (numRunningSynths * 200 + 400) 0 * 0.1
+ Help/Ugen/obxdFilter.help.hs view
@@ -0,0 +1,42 @@+-- obxdFilter+let cutoff = mouseX kr 110.0 (110.0 * 16) Exponential 0.2+    resonance = 0.0+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) cutoff resonance 0.0 0.0 0.0++-- obxdFilter+let cutoff = mouseX kr 110.0 (110.0 * 16) Exponential 0.2+    resonance = mouseY kr 0.0 1.10 Linear 0.2+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) cutoff resonance 0.5 0.0 0.0++-- obxdFilter ; multimode selects the filter mode, the range is (0,1), there are four modes.+let cutoff = mouseX kr 110.0 (110.0 * 16) Exponential 0.2+    multimode = mouseY kr 0.0 1.0 Linear 0.2+    fourpole = 1.0+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) cutoff 0.0 multimode 0.0 fourpole++-- obxdFilter ; controls+let k = control kr+    c1 = k "cutoff" 440.0+    c2 = k "resonance" 0.0+    c3 = k "multimode" 0.5+    c4 = k "bandpass" 0.0+    c5 = k "fourpole" 0.0+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) c1 c2 c3 c4 c5++---- ; obxdFilter ; set controls+let set k v = withSc3 (Sound.Osc.sendMessage (n_set1 (-1) k v))+(set "cutoff" 880.0)+(set "resonance" 0.95)+(set "multimode" 0.75)+(set "bandpass" 1.0)+(set "fourpole" 1.0)++{---- RObxdFilter++cutoff    : FREQUENCY (CPS)         :+resonance : Q (0.0 - 1.0)           :+multimode : FILTER MODE (0.0 - 1.0) : LOW-NOTCH/BANDPASS-HIGH | 24DB - 6DB LOWPASS+bandpass  : 0 = FALSE, 1 = TRUE     : 0 = NOTCH, 1 = BANDPASS+fourpole  : 0 = FALSE, 1 = TRUE     : 0 = 12/DB MULTI-MODE, 1 = 24/DB LOWPASS++-}
+ Help/Ugen/offsetOut.help.hs view
@@ -0,0 +1,9 @@+-- offsetOut+let a = offsetOut 0 (impulse ar 5 0)+    b = out 0 (sinOsc ar 60 0 * 0.1)+in mrg2 a b++-- offsetOut ; c.f. out+let a = out 0 (impulse ar 5 0)+    b = out 0 (sinOsc ar 60 0 * 0.1)+in mrg [a,b]
+ Help/Ugen/onePole.help.hs view
@@ -0,0 +1,10 @@+-- onePole+let n = whiteNoiseId 'α' ar in onePole (n * 0.1) 0.95++-- onePole+let n = whiteNoiseId 'α' ar in onePole (n * 0.1) (-0.95)++-- onePole+let n = whiteNoiseId 'α' ar+    c = line kr (-0.99) 0.99 10 RemoveSynth+in onePole (n * 0.1) c
+ Help/Ugen/oneZero.help.hs view
@@ -0,0 +1,10 @@+-- oneZero+let n = whiteNoiseId 'α' ar in oneZero (n * 0.1) 0.5++-- oneZero+let n = whiteNoiseId 'α' ar in oneZero (n * 0.1) (-0.5)++-- oneZero+let n = whiteNoiseId 'α' ar+    c = line kr (-0.5) 0.5 10 RemoveSynth+in oneZero (n * 0.1) c
+ Help/Ugen/onsets.help.hs view
@@ -0,0 +1,17 @@+-- onsets ; x varies threshold ; detector triggers new random oscillator frequency+let x = mouseX kr 0 1 Linear 0.2+    i = mix (soundIn (mce2 0 1))+    c = fft' (localBufId 'γ' 1 512) i+    o = onsetsDefault c x (onsetType "rcomplex")+in sinOsc ar (midiCps (tiRandId 'a' 40 72 o)) 0 * 0.1++-- onsets ; generative signal with distinct onsets ; x varies threshold ; detector triggers noise+let e = linLin (saw ar 2) (-1) 1 0 1+    p = let f = midiCps (tiRandId 'α' 63 75 (impulse kr 2 0)) in pulse ar f 0.5 * 0.1+    f = linExp (lfNoise2Id 'β' kr 0.5) (-1) 1 100 10000+    z = lpf p f * e+    c = fft' (localBufId 'γ' 1 512) z+    x = mouseX kr 0 1 Linear 0.2+    o = onsetsDefault c x (onsetType "rcomplex")+    n = let d = envPerc 0.001 0.1 in whiteNoiseId 'δ' ar * envGen kr o 0.2 0 1 DoNothing d+in pan2 z (-0.75) 0.2 + pan2 n 0.75 1
+ Help/Ugen/osc.help.hs view
@@ -0,0 +1,59 @@+-- osc ; fixed frequency wavetable oscillator ; c.f. bGen+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl 220 0 * 0.1++-- osc ; mouse frequency control+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl (mouseX kr 110 220 Exponential 0.2) 0 * 0.1++-- osc ; modulate frequency+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl (xLine kr 2000 200 1 DoNothing) 0 * 0.1++-- osc ; as frequency modulator+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl (osc ar tbl (xLine kr 1 1000 9 RemoveSynth) 0 * 200 + 800) 0 * 0.1++-- osc ; as phase modulator+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl 800 (osc ar tbl (xLine kr 20 8000 10 RemoveSynth) 0 * 2 * pi) * 0.1++-- osc ; requires=tbl ; fixed frequency wavetable oscillator+let b = control kr "tbl" 0+in osc ar b 220 0 * 0.1++-- osc ; requires=tbl ; mouse frequency control+let b = control kr "tbl" 0+in osc ar b (mouseX kr 110 220 Exponential 0.2) 0 * 0.1++-- osc ; requires=tbl ;  modulate frequency+let b = control kr "tbl" 0+    f = xLine kr 2000 200 1 DoNothing+in osc ar b f 0 * 0.1++-- osc ; requires=tbl ; as frequency modulator+let b = control kr "tbl" 0+    f = osc ar b (xLine kr 1 1000 9 RemoveSynth) 0 * 200 + 800+in osc ar b f 0 * 0.1++-- osc ; requires=tbl ; as phase modulator+let b = control kr "tbl" 0+    p = osc ar b (xLine kr 20 8000 10 RemoveSynth) 0 * 2 * pi+in osc ar b 800 p * 0.1++---- ; setup ; allocate and generate wavetable buffer ; sin+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1,b_gen_sine1 0 [Normalise,Wavetable,Clear] [1]])++---- ; setup ; allocate and generate wavetable buffer ; sin harmonics+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1,b_gen_sine1 0 [Normalise,Wavetable,Clear] [1, 1/2, 1/3, 1/4, 1/5]])++---- ; setup ; change the wavetable while its playing+withSc3 (maybe_async (b_gen_sine1 0 [Normalise,Wavetable,Clear] [1, 0.6, 1/4]))++---- ; setup ; send calculated wavetable+import Sound.Sc3.Common.Math.Window {- hsc3 -}+let tbl = window_table TableOpen 4096 triangular+withSc3 (maybe_async (b_setn1 0 0 (Sound.Sc3.Common.Buffer.to_wavetable tbl)))++---- ; drawings+withSc3 (Sound.Sc3.Plot.plot_wavetable 0)
+ Help/Ugen/osc1.help.hs view
@@ -0,0 +1,23 @@+-- osc1 ; composite UGen+let tbl0 = asLocalBuf (Gen.sine1Tbl 2048 (map recip [13, 8, 55, 34, 5, 21, 3, 1, 2]))+    tbl1 = asLocalBuf (Gen.sine1Tbl 2048 (map recip [55, 34, 1, 3, 2, 13, 5, 8, 21]))+    env = linLin (osc1 ar (mce2 tbl0 tbl1) 8 RemoveSynth) (-1) 1 0 1+in lfSaw ar (mce2 110 164) 0 * env * 0.1++-- osc1 ; requires=tbl ; composite UGen+let b0 = control kr "tbl0" 0+    b1 = control kr "tbl1" 1+    env = linLin (osc1 ar (mce2 b0 b1) 8 RemoveSynth) (-1) 1 0 1+in lfSaw ar (mce2 110 164) 0 * env * 0.1++---- ; setup+withSc3 (mapM_ maybe_async [b_alloc 0 4096 1, b_gen_sine1 0 [Normalise, Wavetable, Clear] (map recip [13, 8, 55, 34, 5, 21, 3, 1, 2])])+withSc3 (mapM_ maybe_async [b_alloc 1 4096 1, b_gen_sine1 1 [Normalise, Wavetable, Clear] (map recip [55, 34, 1, 3, 2, 13, 5, 8, 21])])++---- ; drawings (buffers)+withSc3 (Sound.Sc3.Plot.plot_wavetable 0)+withSc3 (Sound.Sc3.Plot.plot_wavetable 1)++---- ; drawings (lists, pre wavetable transform)+Sound.Sc3.Plot.plot_p1_ln [Gen.sine1_nrm 2048 (map recip [13, 8, 55, 34, 5, 21, 3, 1, 2])]+Sound.Sc3.Plot.plot_p1_ln [Gen.sine1_nrm 2048 (map recip [55, 34, 1, 3, 2, 13, 5, 8, 21])]
+ Help/Ugen/oscN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. osc
+ Help/Ugen/oteyPianoStrings.help.hs view
@@ -0,0 +1,10 @@+-- oteyPianoStrings+let k = control kr+    freq = k "freq" 440+    gate_ = k "gate" 1+    amp = k "amp" 0.5+    rho = k "rho" 1+    env = envGen ar gate_ 1 0 1 RemoveSynth (envAsr 0 1 0.1 EnvLin)+    loc = linLin freq (midiCps 36) (midiCps 90) (-0.75) 0.75+    s = X.oteyPianoStrings ar freq amp 0 0.35 2 4 8 1 0.07 1.4 (-4) 4 rho 1 1 0 1 0.2 1 1 0.142 1 0.0003 1+in X.oteySoundBoard (pan2 (s * env) loc 0.1) 20 20 0.8
+ Help/Ugen/oteySoundBoard.help.hs view
@@ -0,0 +1,13 @@+-- oteySoundBoard+let loc = mouseX kr (-1) 1 Linear 0.2+in X.oteySoundBoard (pan2 (soundIn 0) loc 0.1) 20 20 0.8++-- oteySoundBoard+let d = dustId 'α' ar 1+    n = whiteNoiseId 'β' ar+    i = decay (d * 0.5) 0.2 * n+    loc = mouseX kr (-1) 1 Linear 0.2+    c1 = 20+    c3 = 20+    mix = 0.8+in X.oteySoundBoard (pan2 i loc 0.1) c1 c3 mix
+ Help/Ugen/out.help.hs view
@@ -0,0 +1,35 @@+-- out ; oscillators at outputs zero (330hz) and one (331hz)+out 0 (sinOsc ar (mce2 330 331) 0 * 0.1)++-- out ; an out node is implicitly added by various hsc3 functions if not given+sinOsc ar (mce2 330 331) 0 * 0.1++-- out ; out is a summing output, see replaceOut for over-writing output+mrg [out 0 (sinOsc ar (mce2 330 990) 0 * 0.05)+    ,out 0 (sinOsc ar (mce2 331 991) 0 * 0.05)]++-- out ; summing (phase cancellation)+mrg [out 0 (sinOsc ar 440 0),out 0 (sinOsc ar 440 pi)]++-- out ; summing ; non phase cancellation+mce [sinOsc ar (mce [440,441]) (mce [0,pi]),sinOsc ar (mce [440,441]) (mce [pi,0])] * 0.1++-- out ; summing / transpose ; phase cancellation+mceTranspose (mce [sinOsc ar (mce [440,441]) (mce [0,pi]),sinOsc ar (mce [440,441]) (mce [pi,0])])++-- out ; multiple out ; channel layout is L=440,660 and R=441,661+let f = mce2 (mce2 440 660) (mce2 441 661)+in out 0 (sinOsc ar f 0 * 0.1)++-- out ; kr ; see drawings section below for UI+let freq = mce [1,2,3,5,7,9,11,13,17,19,23]+    mul = control kr "mul" 0.1+    amp = control kr "amp" 0.1+in out 12000 (sinOsc kr (freq * mul) 0 * amp)++-- out ; nested mce ; multiple out+out 0 (sinOsc ar (mce1 (mce2 110 220)) 0 * 0.1)++---- ; drawings+UI.ui_sc3_scope 12 12000 (2 ^ 14) 0 "control" 0+UI.ui_sc3_ctl_plot 900 11 12000 900 (1/25) 5
+ Help/Ugen/packFFT.help.hs view
@@ -0,0 +1,15 @@+-- packFFT+let b = localBufId 'α' 512 1+    n = 100+    square a = a * a+    r1 z = range 0 1 (fSinOsc kr (expRandId (z,'β') 0.1 1) 0)+    m1 = map r1 (id_seq n 'γ')+    m2 = zipWith (*) m1 (map square [1.0, 0.99 ..])+    r2 z = lfPulse kr (2 ** iRandId (z,'δ') (-3) 5) 0 0.3+    i = map r2 (id_seq n 'ε')+    m3 = zipWith (*) m2 i+    p = replicate n 0.0+    c1 = fft' b (fSinOsc ar 440 0)+    c2 = packFFT c1 512 0 (n - 1) 1 (packFFTSpec m3 p)+    s = ifft' c2+in mce2 s s
+ Help/Ugen/pan2.help.hs view
@@ -0,0 +1,15 @@+-- pan2 ; note level input is control rate only+let n = pinkNoiseId 'α' ar in pan2 n (fSinOsc kr 2 0) 0.1++-- pan2+let n = pinkNoiseId 'α' ar * 0.1+    x = mouseX kr (-1) 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+in pan2 n x y++-- pan2 ; ctl=freq:220,220,440,exp;amp:0.1,0,1,amp;pan:0,-1,1,lin+pan2 (sinOsc ar (control kr "freq" 220) 0) (control kr "pan" 0) (control kr "amp" 0.1)++-- pan2 ; ctl=pan[:-0.1,-1,1,lin;pan]:0.1,-1,1,lin+let loc = sinOsc kr 0.5 0 `in_range` (control kr "pan[" 0,control kr "pan]" 0)+in pan2 (pinkNoiseId 'α' ar) loc 0.05
+ Help/Ugen/panAz.help.hs view
@@ -0,0 +1,5 @@+-- panAz+let o = pinkNoiseId 'α' ar+    nc = 4+    fr = 0.15+in panAz nc o (lfSaw kr fr 0) 0.1 2 0.5
+ Help/Ugen/pause.help.hs view
@@ -0,0 +1,15 @@+-- pause+let f = control kr "f" 440+    g = control kr "g" 1+in mrg [sinOsc ar f 0 * 0.1,pause g 1001]++---- ; control+g = mrg [sinOsc ar (control kr "f" 440) 0 * 0.1,pause (control kr "g" 1) 1001]+audition_at (1001,AddToTail,1,[]) g+audition_at (1002,AddToTail,1,[("f",880)]) g++---- ; request that node 1002 pause node 1001+withSc3 (Sound.OSC.sendMessage (n_set 1002 [("g",0)]))++---- ; restart node 1001+withSc3 (Sound.OSC.sendMessage (n_set 1002 [("g",1)]))
+ Help/Ugen/pauseSelf.help.hs view
@@ -0,0 +1,7 @@+-- pauseSelf+let x = mouseX kr (-1) 1 Linear 0.1+    o = sinOsc ar 440 0 * 0.1+in mrg [o,pauseSelf x]++---- ; run paused node (assuming no intermediate node is created)+withSc3 (Sound.OSC.sendMessage (n_run [(-1, True)]))
+ Help/Ugen/pauseSelfWhenDone.help.hs view
@@ -0,0 +1,8 @@+-- pauseSelfWhenDone+let x = mouseX kr (-1) 1 Linear 0.1+    e = linen x 1 0.1 1 DoNothing+    o = sinOsc ar 440 0 * e+in mrg [o,pauseSelfWhenDone e]++---- ; run paused node (assuming no intermediate node is created)+withSc3 (Sound.OSC.sendMessage (n_run [(-1, True)]))
+ Help/Ugen/peak.help.hs view
@@ -0,0 +1,5 @@+-- peak+let t = dustId 'α' ar 20+    r = impulse ar 0.4 0+    f = peak t r * 500 + 200+in sinOsc ar f 0 * 0.2
+ Help/Ugen/peakFollower.help.hs view
@@ -0,0 +1,17 @@+-- peakFollower ; no decay+let d = dustId 'α' ar 20 * line kr 0 1 4 DoNothing+in sinOsc ar (peakFollower d 1 * 1500 + 200) 0 * 0.1++-- peakFollower ; a little decay+let d = dustId 'α' ar 20 * line kr 0 1 4 DoNothing+in sinOsc ar (peakFollower d 0.999 * 1500 + 200) 0 * 0.1++-- peakFollower ; mouse x controls decay+let dcy = mouseX kr 0.99 1.00001 Linear 0.2 `min` 1+    d = dustId 'α' ar 20+in sinOsc ar (peakFollower d dcy * 1500 + 200) 0 * 0.1++-- peakFollower ; follow a sine lfo, decay controlled by mouse x+let dcy = mouseX kr 0 1.1 Linear 0.2 `min` 1+    sig = sinOsc kr 0.2 0+in sinOsc ar (mce2 sig (peakFollower sig dcy) * 200 + 500) 0 * 0.1
+ Help/Ugen/perlin3.help.hs view
@@ -0,0 +1,4 @@+-- perlin3+let x = integrator (k2a (mouseX kr 0 0.1 Linear 0.2)) 1.0+    y = integrator (k2a (mouseY kr 0 0.1 Linear 0.2)) 1.0+in X.perlin3 ar x y 0 * 0.1
+ Help/Ugen/phasor.help.hs view
@@ -0,0 +1,72 @@+-- phasor ; controls sine frequency, end frequency matches second sine+let rate = mouseX kr 0.2 2 Exponential 0.1+    tr = impulse ar rate 0+    sr = sampleRate+    x = phasor ar tr (rate / sr) 0 1 0+    f = mce [linLin x 0 1 600 1000, 1000]+in sinOsc ar f 0 * 0.1++-- phasor ; control two sine frequencies, mouse y controls resetPos of the second+let rate = mouseX kr 1 200 Linear 0.1+    tr = impulse ar rate 0+    sr = sampleRate+    x = phasor ar tr (rate / sr) 0 1 (mce2 0 (mouseY kr 0 1 Linear 0.2))+in sinOsc ar (x * 500 + 500) 0 * 0.1++-- phasor ; as phase input to bufRd ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+    ph = phasor ar 0 (bufRateScale kr b) 0 (bufFrames kr b) 0+in bufRd nc ar b ph Loop NoInterpolation++-- phasor ; audio rate oscillator as phase input to bufRd ; requires=buf (non-wavetable format)+let (b, nc) = (control kr "buf" 100, 2)+    f = 440+    fr = bufFrames kr b+    rt = f * (fr / sampleRate)+    ph = phasor ar b (rt * bufRateScale kr b) 0 fr 0+in bufRdL nc ar b ph Loop * 0.1++-- phasor ; as impulse with reset+let impulse_reset freq reset =+        let ph = phasor ar reset (freq / sampleRate) 0 1 0+        in hpz1 ph <** 0+    x = mouseX kr 0 1 Linear 0.2 >** 0.5+    ck = impulse ar 3 0+    im = impulse_reset 3 x+    x' = sinOsc ar 440 0 * x * 0.05+    im' = sinOsc ar 220 0 * decay2 (ck + im) 0.01 0.5 * 0.1+in mce2 x' im'++-- phasor ; as sinOsc+let f0 = midiCps (mouseX kr 36 96 Linear 0.2)+    ph = phasor ar 0 (f0 * sampleDur) 0 1 0 * two_pi+in sin ph * 0.1++-- phasor ; as sinOsc with trigger ; triggers cause discontinuities (precision?)+let f0 = midiCps (mouseX kr 36 96 Linear 0.2)+    ph = phasor ar (impulse ar f0 0) (f0 * sampleDur) 0 1 0 * two_pi+in sin ph * 0.1++-- phasor ; as saw+let f0 = midiCps (mouseX kr 36 96 Linear 0.2)+in phasor ar 0 (f0 * sampleDur) (-1) 1 0 * 0.1++-- phasor ; approximation of square wave ; sync ; http://listarc.bham.ac.uk/lists/sc-users/msg69869.html+let freq = mouseX kr 200 4000 Exponential 0.2+    syncFreq = mouseY kr 50 800 Exponential 0.2+    syncSig = sinOsc ar syncFreq 0+    phase = phasor ar syncSig (freq * sampleDur) 0 1 0 * 2 * pi+    k = 12000 * (sampleRate / 48000) / (freq * log10 freq)+    width = sinOsc kr 0.1 0 `in_range` (0,1)+    sinSig = sinOsc ar 0 phase - (width * 2 - 1)+    squareSig = tanh (sinSig * k)+in pan2 (leakDC squareSig 0.995) 0 0.05++---- ; load sound file to buffer zero+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))++---- ; allocate and generate (non-wavetable) buffer (see osc for wavetable oscillator)+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1,b_gen_sine1 0 [Normalise,Clear] [1]])++---- ; drawings+UI.ui_sc3_scope 2 0 4096 1 "audio" 0
+ Help/Ugen/phasorModal.help.hs view
@@ -0,0 +1,23 @@+-- phasorModal+let input = lpf (dust2Id 'α' ar 3) 1500+    freq = control kr "freq" 100.0+    decay = control kr "decay" 0.25+    damp = control kr "damp" 1.0+    amp = control kr "amp" 0.5+    phase = control kr "phase" 0.0+in X.phasorModal input freq decay damp amp phase++-- phasorModal+let pitchstretch = -0.1+    f0 = 80+    k = 32+    n = mceFill+        k+        (\i -> let sig = lpf (dust2Id i ar (int_to_ugen (i + 1) / 3)) 1500+                   freq = (int_to_ugen i + 1) * (pitchstretch + 1) * f0+                   decay_ = randId i 0.225 0.35+                   damp = 1 -- control kr ("damp" ++ show i) 1+                   amp = lfNoise2Id i kr 1 `in_range` (0.25,0.45)+                   phase = 0+               in X.phasorModal sig freq decay_ damp amp phase)+in splay n (lfNoise2Id 'α' kr 0.1 `in_range` (0,1)) 1 0 True
+ Help/Ugen/pinkNoise.help.hs view
@@ -0,0 +1,31 @@+-- pinkNoise ; plain+pinkNoiseId 'α' ar * 0.1++-- pinkNoise ; monadic constructor+uid_st_eval (fmap (* 0.05) (pinkNoiseM ar))++-- pinkNoise ; c.f. whiteNoise+uid_st_eval (fmap (* 0.05) (whiteNoiseM ar))++-- pinkNoise ; c.f. whiteNoise+uid_st_eval (fmap (* 0.05) (brownNoiseM ar))++-- pinkNoise ; speaker balance+let n = pinkNoiseId 'γ' ar * 0.05 in mce2 n n++-- pinkNoise ; speaker balance ; mouse control+let x = mouseX kr 0 1 Linear 0.2+    x' = 1 - x+    n = pinkNoiseId 'δ' ar * 0.05+in mce2 (n * x') (n * x)++-- pinkNoise ; identifiers & referential transparency ; L = silence, R = pink-noise+mce2 (pinkNoiseId 'α' ar - pinkNoiseId 'α' ar) (pinkNoiseId 'α' ar - pinkNoiseId 'β' ar) * 0.1++-- pinkNoise ; silence+let n = pinkNoiseId 'α' ar in (n - n) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (pinkNoiseId 'ε' ar)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (pinkNoiseId 'ζ' ar)+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/pitch.help.hs view
@@ -0,0 +1,38 @@+-- pitch+let x = mouseX kr 220 660 Linear 0.1+    y = mouseY kr 0.05 0.25 Linear 0.1+    s = sinOsc ar x 0 * y+    a = amplitude kr s 0.05 0.05+    f = pitch s 440 60 4000 100 16 7 0.02 0.5 1 0+in mce [s, sinOsc ar (mceChannel 0 f / 2) 0 * a]++-- pitch ; live input tracking, carelessly+let s = hpf (soundIn 0) 90+    a = lag (amplitude kr s 0.01 0.01) 0.2+    [f,_] = mceChannels (pitch s 440 60 4000 100 16 1 0.02 0.5 1 0)+    fq = midiCps (roundE (lag (cpsMidi f) 0.1))+in mce [s * 0.1, lfTri ar f 0 * lag a 0.2 * lag (f >** 90 * f <** 500) 0.2]++-- pitch ; comparison of input frequency (x) and tracked oscillator frequency (f)+let x = mouseX kr 440 880 Exponential 0.1+    o = sinOsc ar x 0 * 0.1+    [f,_] = mceChannels (pitch o 440 60 4000 100 16 7 0.02 0.5 1 0)+    r = sinOsc ar f 0 * 0.1+    t = impulse kr 4 0+    pf = poll t f 0 (label "f")+    px = poll t x 0 (label "x")+in mce [out 0 (mce2 o r),pf,px]++-- pitch ; control param+let initFreq = control kr "initFreq" 440.0+    minFreq = control kr "minFreq" 60.0+    maxFreq = control kr "maxFreq" 4000.0+    execFreq = control kr "execFreq" 100.0+    maxBinsPerOctave = control kr "maxBinsPerOctave" 16.0+    median = control kr "median" 1.0+    ampThreshold = control kr "ampThreshold" 0.01+    peakThreshold = control kr "peakThreshold" 0.5+    downSample = control kr "downSample" 1.0+    clar = control kr "clar" 0.0+    p = pitch (soundIn 0) initFreq minFreq maxFreq execFreq maxBinsPerOctave median ampThreshold peakThreshold downSample clar+in sinOsc ar (mceChannel 0 p) 0 * 0.1
+ Help/Ugen/pitchShift.help.hs view
@@ -0,0 +1,11 @@+-- pitchShift+let s = sinOsc ar 440 0 * 0.1+    r = mouseX kr 0.5 2.0 Linear 0.1+    d = mouseY kr 0.0 0.1 Linear 0.1+in pitchShift s 0.2 r d 0++-- pitchShift+let s = soundIn 0+    pd = mouseX kr 0.0 0.1 Linear 0.1+    td = mouseY kr 0.0 0.1 Linear 0.1+in pitchShift s 0.2 (mce2 1.0 1.5) pd td
+ Help/Ugen/playBuf.help.hs view
@@ -0,0 +1,55 @@+-- playBuf ; requires=buf ; once only+let (b, nc) = (control kr "buf" 100, 2)+in playBuf nc ar b (bufRateScale kr b) 1 0 NoLoop RemoveSynth++-- playBuf ; requires=buf ; infinite loop+let (b, nc) = (control kr "buf" 100, 2)+in playBuf nc ar b (bufRateScale kr b) 1 0 Loop DoNothing++-- playBuf ; requires=buf ; trigger playback at each pulse+let (b, nc) = (control kr "buf" 100, 2)+    t = impulse kr 2 0+    s = bufRateScale kr 0+in playBuf nc ar b s t 0 NoLoop DoNothing++-- playBuf ; requires=buf ; trigger playback at each pulse (diminishing intervals)+let (b, nc) = (control kr "buf" 100, 2)+    f = xLine kr 0.1 100 10 RemoveSynth+    t = impulse kr f 0+    s = bufRateScale kr b+in playBuf nc ar b s t 0 NoLoop DoNothing++-- playBuf ; requires=buf ; loop playback, accelerating pitch+let (b, nc) = (control kr "buf" 100, 2)+    r = xLine kr 0.1 100 60 RemoveSynth+in playBuf nc ar b r 1 0 Loop DoNothing++-- playBuf ; requires=buf ; sine wave control of playback rate, negative rate plays backwards+let (b, nc) = (control kr "buf" 100, 2)+    f = xLine kr 0.2 8 30 RemoveSynth+    r = fSinOsc kr f 0 * 3 + 0.6+    s = bufRateScale kr b * r+in playBuf nc ar b s 1 0 Loop DoNothing++-- playBuf ; requires=buf ; channel mismatch message in server log ; can acquire second channel (subsequent load)+let (b, nc) = (control kr "buf" 100, 1)+in playBuf (nc + 1) ar b (bufRateScale kr b) 1 0 Loop DoNothing++-- playBuf ; requires=buf ; scan sequence of buffers+let n_buf = 61+    t = impulse kr 1 0+    b = mouseX kr 0 n_buf Linear 0.2+    r = bufRateScale kr b+in playBuf 1 ar b r t 0 Loop DoNothing * 0.5++---- ; setup ; nc=1+withSc3 (async (b_allocRead 0 (sfResolve "metal.wav") 0 0))++---- ; setup ; nc=2+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))++---- ; setup ; dir ; cnt=61+dir = "/home/rohan/data/audio/instr/celeste/long/"+dir_ls <- System.Directory.getDirectoryContents dir+fn_seq = zip [0..] (sort (filter ((== ".wav") . System.FilePath.takeExtension) dir_ls))+withSc3 (mapM_ async (map (\(ix,fn) -> b_allocRead ix (dir System.FilePath.</> fn) 0 0) fn_seq))
+ Help/Ugen/playBufCF.help.hs view
@@ -0,0 +1,20 @@+-- playBufCF ; wslib ; CF = cross-fade ; control-rate trigger and start-position inputs+let b = control kr "buf" 100+    r = bufRateScale kr b+    tr = impulse kr 2 0+    wn = whiteNoiseId 'α' kr+    sp = linLin wn (-1) 1 0 (bufFrames kr b - (0.5 * 44100))+    o = playBufCF 1 b r tr sp NoLoop 0.1 2+    o' = playBuf 1 ar b r tr sp NoLoop DoNothing+in mce2 o o'++-- playBufCF ; demand ugens inputs+let b = control kr "buf" 100+    r = drandId 'α' dinf (mce [0.95,1,1.05])+    tr = dwhiteId 'β' dinf 0.1 0.3+    sp = dbrownId 'γ' dinf 0 0.95 0.1 * bufFrames kr b+in playBufCF 1 b r tr sp NoLoop 2 5++---- ; load sound file to buffer zero (single channel file required for examples)+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "a11wlk01.wav") 0 0))
+ Help/Ugen/pluck.help.hs view
@@ -0,0 +1,57 @@+-- pluck ; excitation signal is white noise, triggered twice a second with varying OnePole coef+let n = whiteNoiseId 'α' ar+    t = impulse kr 9 0+    x = mouseX kr (-0.999) 0.999 Linear 0.1+    y = mouseY kr 0.1 1 Linear 0.1+    dl = 1 / 440+in pluck (n * 0.25) t dl (dl * y) 10 x++-- pluck+let n = 50+    f = X.randNId n 'α' 0.05 0.2+    p = X.randNId n 'β' 0 1+    w = mceFillId 'γ' n (\z _ -> whiteNoiseId z ar)+    fi = X.randNId n 'δ' 10 12+    coef = randId 'ε' 0.01 0.2+    l = X.randNId n 'ζ' (-1) 1+    x = mouseX kr 60 1000 Exponential 0.1+    o = linLin (sinOsc kr f p) (-1) 1 x 3000+    i = impulse kr fi 0+    ks = pluck (w * 0.1) i 0.01 (1 / o) 2 coef+in leakDC (mix (pan2 ks l 1)) 0.995++-- pluck ; event control+let f (c,g,x,y,z,o,_,_,_,_,_) =+      let n = whiteNoiseId (c,'α') ar * z+          dl_max = 1 / 220+          dl = dl_max * (1 - x * 0.9)+          sig = pluck n g dl_max dl 10 (y / 3)+      in pan2 sig (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- pluck ; event control ; gateReset+let f (_,g,x,y,z,o,_,_,p,_,_) =+      let n = whiteNoiseId 'α' ar * z+          dl_max = 1 / 8+          (gt,tr) = ccEventGateReset g p+          dx = x - latch x tr+          dl = 1 / midiCps (p * 127 + dx * 8)+      in pan2 (pluck n gt dl_max dl 10 (y / 3)) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- pluck ; event control ; gateReset ; p+px+let f (_,g,_,y,z,o,_,_,p,px,_) =+      let n = whiteNoiseId 'α' ar * z+          dl_max = 1 / 8+          (gt,tr) = ccEventGateReset g p+          dl = 1 / midiCps (p * 127 + px * 1)+      in pan2 (pluck n gt dl_max dl 10 (y / 3)) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- pluck ; https://scsynth.org/t/4318/17+let tr = impulse ar (lfNoise2 kr 1 `in_exprange` (1,100)) 0+    frq = map (midiCps . (+ 60.5)) [0, 2, 4, 5, 7, 9, 10]+    dlt = 1 / mce frq+    dct = mouseX kr 0.5 2 Linear 0.2+    sig = mix (leakDC (pluck (hasher (sweep ar tr 1) * dbAmp (-10)) tr dlt dlt dct 0.5) 0.995)+in pan2 (moogFF sig (lfNoise2 kr 1 `in_exprange` (500,16000)) 0 0) 0 1
+ Help/Ugen/pmOsc.help.hs view
@@ -0,0 +1,30 @@+-- pmOsc ; composite of sinOsc, ie. sinOsc r cf (sinOsc r mf mp * pm) ; modulate carfreq+pmOsc ar (line kr 600 900 5 DoNothing) 600 3 0 * 0.1++-- pmOsc ; modulate modfreq+pmOsc ar 300 (line kr 600 900 5 DoNothing) 3 0 * 0.1++-- pmOsc ; modulate index+pmOsc ar 300 550 (line kr 0 20 8 DoNothing) 0 * 0.1++-- pmOsc ; random parameters, linear modulation index motion over n seconds+let n = 2+    cf = randId 'α' 0 2000+    mf = randId 'β' 0 800+    pme = randId 'γ' 0 12+    l = randId 'δ' (-1) 1+    pm = line kr 0 pme n DoNothing+in linPan2 (pmOsc ar cf mf pm 0) l 0.05++-- pmOsc ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+      let cps = midiCps (x * 24 + 42)+          cps' = vibratoId 'θ' ar (k2a cps) (y * 4 + 4) 0.02 0 0 0.04 0.1 0.0 0.0+          sig = pmOsc ar cps'+                (urange 1.01 2.01 (lfPulse kr (1/8) 0 0.5) * cps)+                (envGen kr g 1 0 1 DoNothing (envelope [3,3,0] [0, 0.2] [EnvNum (-4)]))+                0+          c = ampCompA kr cps 0 0.32 1+      in sig * c * z * g+    rvb s = xFade2 s (gVerb (bpf s (midiCps 90) 1) 50 8 0.5 0.5 15 0 0.7 0.5 300) 0.2 1+in rvb (mix (voicer 16 f)) * control kr "gain" 1
+ Help/Ugen/poll.help.hs view
@@ -0,0 +1,32 @@+-- poll+let t = impulse kr 10 0+    l = line kr 0 1 1 RemoveSynth+in poll t l 0 (label "polling...")++-- poll ; multichannel expansion (requires labels be equal length...)+let t = impulse kr (mce2 10 5) 0+    l = line kr 0 (mce2 1 5) (mce2 1 2) DoNothing+in poll t l 0 (mce2 (label "t1") (label "t2"))++-- poll ; will not poll once with a trigger of one, use impulse with frequency zero+let k = control kr "k" 0.3+    x = negate (k * 1.1)+    t = impulse kr 0 0 {- 1 -}+in mrg2 x (poll t x (-1) (label "x"))++-- poll ; at trigger control+let t = trigControl "t" 0.3+    f1 = lfNoise2Id 'α' ar 0.25 * 100 + 110+    f2 = lfNoise2Id 'β' ar 0.25 * 200 + 220+    s = gendy1Id 'γ' ar 1 1 1 1 f1 f2 0.5 0.5 12 0 * 0.1+    p = poll t (mce2 f1 f2) (-1) (mce2 (label "f1") (label "f2"))+in mrg2 s p++-- poll ; print oscillator frequency+let x = mouseX kr 200 260 Exponential 0.2+    o = sinOsc ar x 0 * 0.25+    t = impulse kr 2 0+in mrg2 o (poll t x 0 (label "polling..."))++---- ; set t control+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "t" 1))
+ Help/Ugen/pow.help.hs view
@@ -0,0 +1,15 @@+-- pow+let a = fSinOsc ar 100 0 * 0.1 in mce2 a (a ** 10)++-- pow ; see also http://create.ucsb.edu/pipermail/sc-users/2006-December/029998.html+let n0 = lfNoise2Id 'α' kr 8+    n1 = lfNoise2Id 'β' kr 3+    s = blip ar (n0 * 200 + 300) (n1 * 10 + 20)+    x = mouseX kr 1000 (sampleRate * 0.5) Exponential 0.1+    y = mouseY kr 1 24 Exponential 0.1+    d = latch s (impulse ar x 0)+    b = roundUp d (0.5 ** y)+in mce2 d b * 0.2++-- pow ; optimises identity+(sinOsc ar 440 0 ** 1) * 0.1
+ Help/Ugen/pulse.help.hs view
@@ -0,0 +1,13 @@+-- pulse ; modulate frequency+let f = xLine kr 40 4000 6 RemoveSynth+in pulse ar f 0.1 * 0.1++-- pulse ; modulate width, 0.5 = square wave+let w = line kr 0.01 0.99 8 RemoveSynth+in pulse ar 200 w * 0.1++-- pulse ; two band limited square waves through a resonant low pass filter+let p = pulse ar (mce2 100 250) 0.5 * 0.1+    f = xLine kr 8000 400 5 DoNothing+in rlpf p f 0.05+
+ Help/Ugen/pulseCount.help.hs view
@@ -0,0 +1,17 @@+-- pulseCount+let c = pulseCount (impulse ar 10 0) (impulse ar 0.4 0)+in sinOsc ar (c * 200) 0 * 0.05++-- pulseCount ; printer (silent, see console)+let b = localBuf 11 1+    t = impulse ar 10 0+    p = pulseCount t 0+    d = demand t 0 (dbufwr (-666) b p NoLoop)+in mrg [dc ar 0,poll t p 0 (label "p")]++-- pulseCount ; printer (silent, see console) ; id+let b = localBufId 'α' 11 1+    t = impulse ar 10 0+    p = pulseCount t 0+    d = demand t 0 (dbufwrId 'α' (-666) b p NoLoop)+in mrg [dc ar 0,poll t p 0 (label "p")]
+ Help/Ugen/pulseDPW.help.hs view
@@ -0,0 +1,5 @@+-- pulseDPW+X.pulseDPW ar (xLine kr 2000 20 10 DoNothing) 0.5 * 0.1++-- pulseDPW+X.pulseDPW ar (mouseX kr 200 12000 Exponential 0.2) 0.5 * 0.1
+ Help/Ugen/pulseDivider.help.hs view
@@ -0,0 +1,6 @@+-- pulseDivider+let p = impulse ar 8 0+    d = pulseDivider p (mce [4,7]) 0+    a = sinOsc ar 1200 0 * decay2 p 0.005 0.1+    b = sinOsc ar  600 0 * decay2 d 0.005 0.5+in (a + b) * 0.1
+ Help/Ugen/pv_BinBufRd.help.hs view
@@ -0,0 +1,9 @@+-- pv_BinBufRd ; play analysis back ; c.f. pv_RecordBuf help file+let snd_buf = control kr "buf" 100+    rec_buf = control kr "rec" 10+    fft_buf = localBufId 'α' 1 1024+    x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 5 100 Linear 0.2+    c0 = fft' fft_buf (playBuf 1 ar snd_buf (bufRateScale kr snd_buf) 1 0 Loop DoNothing)+    c1 = X.pv_BinBufRd c0 rec_buf x 10 3 y 1+in ifft c1 1 0
+ Help/Ugen/pv_BinScramble.help.hs view
@@ -0,0 +1,21 @@+-- pv_BinScramble+let b = control kr "buf" 100+    a = playBuf 1 ar b (bufRateScale kr b) 1 0 Loop DoNothing+    f = fft' (localBufId 'α' 2048 1) a+    x = mouseX kr 0.0 1.0 Linear 0.1+    y = mouseY kr 0.0 1.0 Linear 0.1+    g = pv_BinScrambleId 'β' f x y (impulse kr 4 0)+in pan2 (ifft' g) 0 0.5++-- pv_BinScramble ; warning=feedback+let a = soundIn 0+    f = fft' (localBufId 'γ' 2048 1) a+    x = mouseX kr 0.15 1 Linear 0.1+    y = mouseY kr 0.15 1 Linear 0.1+    i = impulse kr (lfNoise0Id 'δ' kr 2 * 8 + 10) 0+    g = pv_BinScrambleId 'ε' f x y i+    h = ifft' g+in pan2 h 0 1++---- ; load sndfile+withSc3 (async (b_allocRead 0 "/home/rohan/data/audio/pf-c5.aif" 0 0))
+ Help/Ugen/pv_BinShift.help.hs view
@@ -0,0 +1,10 @@+-- pv_BinShift ; default values+ifft' (pv_BinShift (fftAllocId 'α' 2048 (soundIn 0) 0.5 0 1 0) 1 0 0) * 0.25++-- pv_BinShift ; mouse control+let z = soundIn 0+    x = mouseX kr (-10) 100 Linear 0.1 -- shift+    y = mouseY kr 1 4 Linear 0.1 -- stretch+    b = mouseButton kr 0 1 0.2+    pv = pv_BinShift (fftAllocId 'β' 2048 z 0.5 0 1 0) y x b+in ifft' pv * 0.25
+ Help/Ugen/pv_BinWipe.help.hs view
@@ -0,0 +1,8 @@+-- pv_BinWipe+let z = soundIn 0+    n = whiteNoiseId 'α' ar * 0.1+    f = fft' (localBufId 'β' 2048 1) n+    g = fft' (localBufId 'γ' 2048 1) z+    x = mouseX kr 0.0 1.0 Linear 0.1+    h = pv_BinWipe f g x+in pan2 (ifft' h) 0 0.5
+ Help/Ugen/pv_BrickWall.help.hs view
@@ -0,0 +1,28 @@+-- pv_BrickWall+let z = soundIn 0+    x = mouseX kr (-1) 1 Linear 0.1+    c = fft' (localBufId 'α' 2048 1) z+in ifft' (pv_BrickWall c x)++-- pv_BrickWall ; ln 2021-04-12 https://lukasnowok.github.io/spectrology/+let c0 = localBufId 'α' 1 1024+    c1 = fft' c0 (whiteNoiseId 'β' ar)+    c2 = pv_BrickWall c1 (line ar (-1) 1 20 DoNothing)+in ifft' c2 * 0.1++-- pv_BrickWall ; ln 2021-04-18 https://lukasnowok.github.io/spectrology/+let e1 = envGen ar (impulse kr 1.1 0) 1 0 1 DoNothing (envPerc 0 1.2)+    o1 = ifft' (pv_BrickWall (fft' (localBufId 'α' 1 1024) (whiteNoiseId 'β' ar * e1)) 0.601)+    e2 = envGen ar (impulse kr 0.7 0) 1 0 1 DoNothing (envPerc 1 0)+    o2 = ifft' (pv_BrickWall (fft' (localBufId 'γ' 1 1024) (whiteNoiseId 'δ' ar * e2 * xLine ar 0.01 1 20 DoNothing)) (-0.5))+    o3 = lfTri ar 12000  0+in (o1 + o2 + o3) * 0.1++-- pv_BrickWall ; ln 2021-04-19 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+    s = mix (sinOsc ar (geom 100 20000 1.1 * line ar 1 0 20 DoNothing) 0 * 0.1)+    w = lfSaw ar (xLine ar 4 0.1 20 DoNothing) 0+in ifft' (pv_BrickWall (fft' (localBufId 'α' 1 1024) s) w) * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/pv_BufRd.help.hs view
@@ -0,0 +1,6 @@+-- pv_BufRd ; play analysis back ; c.f. pv_RecordBuf help file+let rec_buf = control kr "rec" 10+    fft_buf = localBufId 'α' 1 1024+    x = mouseX kr 0 1 Linear 0.2+    c0 = X.pv_BufRd fft_buf rec_buf x+in ifft c0 1 0
+ Help/Ugen/pv_Compander.help.hs view
@@ -0,0 +1,15 @@+-- pv_Compander ; mostly compress+let z = decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3 * mix (pulse ar (mce [80, 81]) 0.3)+    x = mouseX kr 1 50 Linear 0.2+in mce [z, ifft' (X.pv_Compander (fft' (localBufId 'α' 2048 1) z) x 1.2 0.25)]++-- pv_Compander ; mostly expand+let z = decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3 * mix (pulse ar (mce [80, 81]) 0.3)+    x = mouseX kr 1 50 Linear 0.1+in mce [z, ifft' (X.pv_Compander (fft' (localBufId 'β' 2048 1) z) x 2.0 0.85)]++-- pv_Compander ; sustainer+let z = decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3 * mix (pulse ar (mce [80, 81]) 0.3)+    x = mouseX kr 1 80 Linear 0.1+    s = ifft' (X.pv_Compander (fft' (localBufId 'γ' 2048 1) z) x 0.5 1.0)+in mce [z, limiter s 0.999 0.05]
+ Help/Ugen/pv_ConformalMap.help.hs view
@@ -0,0 +1,13 @@+-- pv_ConformalMap+let i = soundIn 0+    x = mouseX kr (-1) 1 Linear 0.1+    y = mouseY kr (-1) 1 Linear 0.1+in pan2 (ifft' (pv_ConformalMap (fft' (localBufId 'α' 1024 1) i) x y)) 0 1++-- pv_ConformalMap ; with filtering+let z = soundIn 0+    x = mouseX kr 0.01  2.0 Linear 0.1+    y = mouseY kr 0.01 10.0 Linear 0.1+    c = fft' (localBufId 'β' 2048 1) z+    m = ifft' (pv_ConformalMap c x y)+in pan2 (combN m 0.1 0.1 10 * 0.5 + m) 0 0.5
+ Help/Ugen/pv_Diffuser.help.hs view
@@ -0,0 +1,12 @@+-- pv_Diffuser ; trigger revised phase shifts with MouseX crossing center of screen+let b = control kr "buf" 100+    z = playBuf 1 ar b (bufRateScale kr b) 0 0 Loop DoNothing+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 1 Linear 0.1+    h = pv_Diffuser f (x `greater_than` 0.5)+in mce2 z (ifft' h * 0.5)++---- ; load buf+let fn = "/usr/share/SuperCollider/sounds/a11wlk01.wav"+let fn = "/home/rohan/data/audio/instr/bosendorfer/064/C5.aif"+withSc3 (async (b_allocRead 0 fn 0 0))
+ Help/Ugen/pv_Freeze.help.hs view
@@ -0,0 +1,5 @@+-- pv_Freeze+let f = fft' (localBufId 'α' 2048 1) (soundIn 0)+    x = mouseX kr 0 1 Linear 0.1+    h = X.pv_Freeze f (x `greater_than` 0.5)+in ifft' h * 0.5
+ Help/Ugen/pv_HainsworthFoote.help.hs view
@@ -0,0 +1,16 @@+-- pv_HainsworthFoote+let i = soundIn 0+    b = localBufId 'α' 2048 1+    f = fft' b i+    x = mouseX kr 0.5 1.25 Linear 0.2+    h = pv_HainsworthFoote f 1 0 x 0.04+    o = sinOsc ar (mrg2 440 445) 0 * decay (h * 0.1) 0.1 * 0.1+in o + i++-- pv_HainsworthFoote ; spot note transitions+let s = lfSaw ar (lfNoise0Id 'β' kr 1 * 90 + 400) 0 * 0.5+    b = localBufId 'γ' 2048 1+    f = fft' b s+    d = pv_HainsworthFoote f 1.0 0.0 0.9 0.5+    t = sinOsc ar 440 0 * decay (d * 0.1) 0.1 * 0.1+in mce2 (s * 0.05) t
+ Help/Ugen/pv_Invert.help.hs view
@@ -0,0 +1,11 @@+-- pv_Invert+let z = sinOsc ar 440 0 * 0.4 + pinkNoiseId 'α' ar * 0.1+    c0 = fft' (localBufId 'β' 2048 1) z+    c1 = X.pv_Invert c0+in mce2 z (ifft' c1) * 0.5++-- pv_Invert+let z = soundIn 0+    c0 = fft' (localBufId 'β' 2048 1) z+    c1 = X.pv_Invert c0+in mce2 z (ifft' c1) * 0.5
+ Help/Ugen/pv_JensenAndersen.help.hs view
@@ -0,0 +1,6 @@+-- pv_JensenAndersen ; propsc=0.25 prophfe=0.25 prophfc=0.25 propsf=0.25 threshold=1.0 waittime=0.04+let i = soundIn 0+    f = fft' (localBufId 'α' 2048 1) i+    x = mouseX kr 0.01 1.0 Linear 0.2+    h = pv_JensenAndersen f 0.25 0.25 0.25 0.25 x 0.04+in sinOsc ar (mrg2 440 445) 0 * decay (h * 0.1) 0.1 * 0.1
+ Help/Ugen/pv_LocalMax.help.hs view
@@ -0,0 +1,6 @@+-- pv_LocalMax+let z = soundIn 0+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 100 Linear 0.1+    h = pv_LocalMax f x+in ifft' h * 0.5
+ Help/Ugen/pv_MagAbove.help.hs view
@@ -0,0 +1,13 @@+-- pv_MagAbove+let z = soundIn 0+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 64 Linear 0.1+    h = pv_MagAbove f x+in ifft' h * 0.5++-- pv_MagAbove ; synthesised input+let z = sinOsc ar (sinOsc kr (squared (sinOsc kr 0.08 0 * 6 + 6.2)) 0 * 100 + 800) 0+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 512 Linear 0.1+    h = pv_MagAbove f x+in ifft' h * 0.1
+ Help/Ugen/pv_MagBelow.help.hs view
@@ -0,0 +1,13 @@+-- pv_MagBelow ; c.f. pv_MagAbove+let z = soundIn 0+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 64 Linear 0.1+    h = pv_MagBelow f x+in ifft' h * 0.5++-- pv_MagBelow ; synthesised input+let z = sinOsc ar (sinOsc kr (squared (sinOsc kr 0.08 0 * 6 + 6.2)) 0 * 100 + 800) 0+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 512 Linear 0.1+    h = pv_MagBelow f x+in ifft' h * 0.1
+ Help/Ugen/pv_MagClip.help.hs view
@@ -0,0 +1,6 @@+-- pv_MagClip+let f = fft' (localBufId 'α' 2048 1) (soundIn 0)+    c = 128+    x = mouseX kr 0 c Linear 0.1+    h = pv_MagClip f x+in ifft' h * 0.5
+ Help/Ugen/pv_MagFreeze.help.hs view
@@ -0,0 +1,14 @@+-- pv_MagFreeze ; mouseX is trigger to freeze+let b = control kr "buf" 100+    z = playBuf 1 ar b (bufRateScale kr b) 0 0 Loop DoNothing+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 1 Linear 0.1+    h = pv_MagFreeze f (x >** 0.5)+in ifft' h * 0.5++-- pv_MagFreeze ; mouseX is trigger to freeze+let z = soundIn 0+    f = fft' (localBufId 'α' 2048 1) z+    x = mouseX kr 0 1 Linear 0.1+    h = pv_MagFreeze f (x >** 0.5)+in ifft' h * 0.5
+ Help/Ugen/pv_MagGate.help.hs view
@@ -0,0 +1,8 @@+-- pv_MagGate+let (lhs,rhs) = (-50,0) -- (0,100)+    i = soundIn 0+    c = fft' (localBufId 'α' 2048 1) i+    x = mouseX kr lhs rhs Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    h = X.pv_MagGate c x y+in ifft' h * 0.5
+ Help/Ugen/pv_MagMul.help.hs view
@@ -0,0 +1,6 @@+let z = soundIn 0+    y = lfSaw ar (midiCps 43) 0 * 0.2+    c0 = fft' (localBufId 'α' 2048 1) y+    c1 = fft' (localBufId 'β' 2048 1) z+    c2 = pv_MagMul c0 c1+in ifft' c2 * 0.1
+ Help/Ugen/pv_MagSmear.help.hs view
@@ -0,0 +1,6 @@+-- pv_MagSmear+let i = soundIn 0+    c = fft' (localBufId 'α' 2048 1) i+    x = mouseX kr 0 100 Linear 0.2+    h = pv_MagSmear c x+in ifft' h * 0.5
+ Help/Ugen/pv_Morph.help.hs view
@@ -0,0 +1,8 @@+-- pv_Morph+let o1 = pulse ar 180 (lfCub kr 1 0 * 0.1 + 0.3) * 0.2+    o2 = varSaw ar 190 0 (lfCub kr 0.8 0 * 0.4 + 0.5) * 0.5+    c1 = fft' (localBufId 'α' 2048 1) o1+    c2 = fft' (localBufId 'β' 2048 1) o2+    x = mouseX kr 0 1 Linear 0.2+    h = X.pv_Morph c1 c2 x+in ifft' h * 0.5
+ Help/Ugen/pv_Mul.help.hs view
@@ -0,0 +1,7 @@+-- pv_Mul+let o1 = sinOsc ar 500 0+    o2 = sinOsc ar (line kr 50 400 5 RemoveSynth) 0+    c1 = fft' (localBufId 'α' 2048 1) o1+    c2 = fft' (localBufId 'β' 2048 1) o2+    h = pv_Mul c1 c2+in ifft' h * 0.1
+ Help/Ugen/pv_PlayBuf.help.hs view
@@ -0,0 +1,13 @@+-- pv_PlayBuf ; c.f. pv_RecordBuf+let rec_buf = control kr "rec" 10+    fft_buf = localBufId 'α' 1024 1+    x = mouseX kr (-1) 1 Linear 0.2+    c = X.pv_PlayBuf fft_buf rec_buf x 50 1+in ifft c 1 0++-- pv_PlayBuf+let rec_buf = control kr "rec" 10+    fft_buf = localBufId 'β' 1024 1+    n = range (-1) 2 (lfNoise2Id 'γ' kr 0.2)+    c = X.pv_PlayBuf fft_buf rec_buf n 0 1+in ifft c 1 0
+ Help/Ugen/pv_RandComb.help.hs view
@@ -0,0 +1,18 @@+-- pv_RandComb+let z = soundIn 0+    t = impulse kr 0.5 0+    x = mouseX kr 0.6 0.95 Linear 0.1+    c = pv_RandCombId 'α' (fft' (localBufId 'α' 2048 1) z) x t+in pan2 (ifft' c) 0 1++-- pv_RandComb ; ln 2021-04-07 https://lukasnowok.github.io/spectrology/+let c0 = localBufId 'α' 1 1024+    tr = impulse kr 7 0+    env = envGen kr tr 1 0 1 DoNothing (Envelope [0,1,1,0] [0,0.1,0] [] Nothing Nothing 0)+    c1 = fft' c0 (whiteNoiseId 'β' ar)+    c2 = pv_RandCombId 'γ' c1 (line kr 0.6 1 20 DoNothing) tr+    c3 = pv_BrickWall c2 0.05+in (ifft' c3 * env + sinOsc ar 1000 0 * 0.2) * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/pv_RandWipe.help.hs view
@@ -0,0 +1,15 @@+-- pv_RandWipe+let z1 = let n0 = randomRs (400.0, 1000.0) (mkStdGen 0)+             o0 = map (\n -> lfSaw ar n 0 * 0.1) (take 6 n0)+         in sum_opt o0+    z2 = let n1 = randomRs (80.0, 400.0) (mkStdGen 1)+             n2 = randomRs (0.0, 8.0) (mkStdGen 2)+             o1 = map (\n -> lfPulse ar n 0.0 0.2) (take 6 n1)+             o2 = map (\n -> sinOsc kr n 0 * 0.2) (take 6 n2)+         in sum_opt (zipWith (\p s -> p * (max s 0.0)) o1 o2)+    f1 = fft' (localBufId 'α' 2048 1) z1+    f2 = fft' (localBufId 'β' 2048 1) z2+    x = mouseX kr 0 1 Linear 0.1+    y = mouseY kr 0 1 Linear 0.1+    h = pv_RandWipeId 'γ' f1 f2 x (y `greater_than` 0.5)+in pan2 (ifft' h) 0 0.5
+ Help/Ugen/pv_RecordBuf.help.hs view
@@ -0,0 +1,15 @@+-- pv_RecordBuf ; analyse signal and store to buffer+let snd_buf = control kr "buf" 0+    rec_buf = control kr "rec" 10+    fft_buf = localBufId 'α' 1 1024+    i = playBuf 1 ar snd_buf (bufRateScale kr snd_buf) 1 0 NoLoop RemoveSynth+    c0 = fft fft_buf i 0.25 1 1 0+    c1 = X.pv_RecordBuf c0 rec_buf 0 1 0 0.25 1+in mrg2 i c1++---- ; load soundfile+fn = sfResolve "a11wlk01.wav"+withSc3 (async (b_allocRead 0 fn 0 0))++---- ; allocate analysis buffer ; duration=5, frame-size=1024, hop-size=0.25, sample-rate=48000+withSc3 (async (b_alloc 10 (pv_calcPVRecSize 5 1024 0.25 48000) 1))
+ Help/Ugen/pv_RectComb.help.hs view
@@ -0,0 +1,15 @@+-- pv_RectCommb ; mouse control+let z = soundIn 0+    b = localBufId 'β' 2048 1+    x = mouseX kr 0 0.5 Linear 0.1+    y = mouseY kr 0 0.5 Linear 0.1+    c = pv_RectComb (fft' b z) 8 x y+in pan2 (ifft' c) 0 1++-- pv_RectCommb ; lfo control+let z = soundIn 0+    b = localBufId 'γ' 2048 1+    p = lfTri kr 0.097 0 *   0.4  + 0.5+    w = lfTri kr 0.240 0 * (-0.5) + 0.5+    c = pv_RectComb (fft' b z) 8 p w+in pan2 (ifft' c) 0 1
+ Help/Ugen/pv_SpectralMap.help.hs view
@@ -0,0 +1,21 @@+-- pv_SpectralMap+let y = mouseY kr (-1) 1 Linear 0.2+    x = mouseX kr (-1) 1 Linear 0.2+    b = control kr "buf" 100+    c1 = fft' (localBufId 'α' 2048 1) (soundIn 0)+    c2 = fft' (localBufId 'β' 2048 1) (playBuf 1 ar b 1 1 0 Loop DoNothing)+    c3 = X.pv_SpectralMap c1 c2 0.0 y x 1 0+in ifft' c3++-- pv_SpectralMap ; https://scsynth.org/t/share-your-delay-reverb-designs/2206/6+let freeze = control kr "freeze" 0+    mode = control kr "mode" 1+    roomsize = control kr "roomsize" 10+    revtime = control kr "revtime" 6+    c1 = fft' (localBufId 'α' 2048 1) (soundIn 0)+    c2 = fft' (localBufId 'β' 2048 1) (soundIn 1)+    c3 = X.pv_SpectralMap c1 c2 0.0 freeze mode 1 0+in gVerb (ifft' c3) roomsize revtime 0.5 0.5 15 1 0.7 0.5 300++---- ; load sndfile+withSc3 (async (b_allocRead 0 (sfResolve "metal.wav") 0 0))
+ Help/Ugen/pv_Split.help.hs view
@@ -0,0 +1,63 @@+-- pv_Split+let sz = 1024 * 2+    op = (-)+    z = soundIn 0+    c0 = fft' (localBufId 'α' sz 1) z+    (c1,c2) = X.pv_SplitUnpack c0 (localBufId 'β' sz 1)+in ifft' c1 `op` ifft' c2++-- pv_Split+let sz = 1024 * 16+    op = (+)+    z = soundIn 0+    c0 = fft' (localBufId 'α' sz 1) z+    (c1,c2) = X.pv_SplitUnpack c0 (localBufId 'β' sz 1)+in ifft' c1 `op` ifft' c2++-- pv_Split+let sz = 1024 * 16+    op = (-)+    z = lfClipNoiseId 'α' ar 100 * 0.1+    c0 = fft' (localBufId 'α' sz 1) z+    (c1,c2) = X.pv_SplitUnpack c0 (localBufId 'β' sz 1)+in ifft' c1 `op` ifft' c2++-- pv_Split ; pv_splita is a variant that allocates a local buffer, deriving the size from the input graph+let s = whiteNoiseId 'α' ar * 0.1+    c1 = fftAllocId 'β' 2048 s 0.5 0 1 0+    (c2,c3) = X.pv_SplitAllocUnpackId 'γ' c1+    c4 = pv_BrickWall c2 (-0.85)+    c5 = pv_BrickWall c3 0.45+in ifft c4 0 0 * 0.15 + ifft c5 0 0++-- pv_Split ; pv_splita works with external buffers as well+let b = control kr "buf" 0+    z = soundIn 0+    c1 = fft b z 0.5 0 1 0+    (c2,c3) = X.pv_SplitAllocUnpackId 'γ' c1+    c4 = pv_BrickWall c2 (-0.85)+    c5 = pv_BrickWall c3 0.45+in ifft c4 0 0 * 0.15 + ifft c5 0 0++---- ; pv_Split ; leaving out pv_split gives an invalid graph (ie. this expression is an error)+let s = whiteNoiseId 'α' ar * 0.1+    c1 = fftAllocId 'β' 2048 s 0.5 0 1 0+    c4 = pv_BrickWall c1 (-0.85)+    c5 = pv_BrickWall c1 0.45+in ifft c4 0 0 * 0.15 + ifft c5 0 0++{---- Variant of `PV_Copy` that returns both signal paths.++`PV_Copy` graphs have two linear orderings that are not equivalent.++... -> fft -> ... .-> pv_copy -> pv1 -> ifft -> ...+                  |+                  .-> pv2 -> ifft -> ...++`PV_Split` graphs also have two _equivalent_ linear orderings.++                              .-> pv1 -> ifft1 -> ...+... -> fft -> ... -> pv_split |+                              .-> pv2 -> ifft2 -> ...++-}
+ Help/Ugen/pv_xFade.help.hs view
@@ -0,0 +1,8 @@+-- pv_xFade+let o1 = pulse ar 180 (lfCub kr 1 0 * 0.1 + 0.3) * 0.2+    o2 = varSaw ar 190 0 (lfCub kr 0.8 0 * 0.4 + 0.5) * 0.5+    c1 = fft' (localBufId 'α' 2048 1) o1+    c2 = fft' (localBufId 'β' 2048 1) o2+    x = mouseX kr 0 1 Linear 0.2+    h = X.pv_xFade c1 c2 x+in ifft' h * 0.5
+ Help/Ugen/quadC.help.hs view
@@ -0,0 +1,12 @@+-- quadC+quadC ar (sampleRate / 2) 1 (-1) (-0.75) 0 * 0.1++-- quadC+let x = mouseX kr 3.5441 4 Linear 0.1+in quadC ar 4000 (negate x) x 0 0.1 * 0.2++-- quadC+let x = mouseX kr 3.5441 4 Linear 0.1+    f = quadC ar 4 (negate x) x 0 0.1 * 800 + 900+in sinOsc ar f 0 * 0.1+
+ Help/Ugen/quadL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. quadC
+ Help/Ugen/quadN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. quadC
+ Help/Ugen/rDelayMap.help.hs view
@@ -0,0 +1,35 @@+-- rDelayMap+let a = mce [-1,0,0,0.5,1,-1,0,1]+    b = clearBuf (localBufId 'α' 1 88200)+    x = mouseX kr 110 440 Linear 0.1+    y = mouseY kr 0.0 0.2 Linear 0.1+    o = sinOsc ar x 0 * y+in mce [X.rDelayMap b o 0 a,o]++-- rDelayMap ; simple feedback circuit (static)+let n = whiteNoiseId 'α' ar+    b = clearBuf (localBufId 'β' 1 88200)+    s = decay (impulse ar (5/4) 0) 0.1 * n * 0.2+    a = mce [-1,0,0,1,1/9,0,1,8/9,1,-1,0,1]+in X.rDelayMap b s 0 a++-- rDelayMap ; simple feedback circuit (dynamic)+let n = whiteNoiseId 'α' ar -- soundIn 0+    s = decay (impulse ar (mce [1/3,5/4]) 0) 0.1 * n * 0.2+    x = mouseX kr 0.05 1.05 Linear 0.1+    y = mouseY kr 0.05 0.95 Linear 0.1+    a = mce [-1,0,0,1,y,0,1,x,1,-1,0,1]+    b = clearBuf (localBufId 'β' 1 88200)+in X.rDelayMap b s 1 a++---- ; Network of delay line maps++{- Create a network of delay line maps.  A map is defined by a+quadruple: source location, destination location, operation and+gain.  The locations are specified in seconds, a negative location+specifies theId 'input' location for sources and theId 'output'+location for destinations.  The operation is specified as an+integer, zero is move, one is add, two is subtract, three is+multiply, four is divide.  The gain is linear.  This UGen is+useful for implementing nested filters, as described by William+Gardner in his MS thesis "The Virtual Acoustic Room", MIT 1992. -}
+ Help/Ugen/rDelaySet.help.hs view
@@ -0,0 +1,6 @@+-- rDelaySet; three one second delays+let x = mouseX kr 110 660 Linear 0.2+    y = mouseY kr 0 0.1 Linear 0.2+    s = sinOsc ar x 0 * y+    d = X.rDelaySet s (mce [1,1,1/5,2,1/2,1/10,3,1/3,1/15])+in mce2 s d
+ Help/Ugen/rDelaySetBuf.help.hs view
@@ -0,0 +1,7 @@+-- rDelaySetB ; three one second delays+let x = mouseX kr 110 660 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    s = sinOsc ar x 0 * y+    b = clearBuf (localBufId 'α' 1 (5 * 44100))+    d = X.rDelaySetBuf ar b s (mce [1,1,1/5,2,1/2,1/10,3,1/3,1/15])+in mce2 s d * 0.1
+ Help/Ugen/rLagC.help.hs view
@@ -0,0 +1,21 @@+-- ; rLagC+let x = mouseX kr 220 440 Linear 0.2+in sinOsc ar (mce2 x (X.rLagC x 1 0 5 0)) 0 * 0.1++-- ; rLagC+let p = range 220 440 (lfPulse kr 0.1 0 0.5)+    x = mouseX kr (-8) 8 Linear 0.2+    y = mouseY kr (-8) 8 Linear 0.2+in sinOsc ar (mce2 p (X.rLagC p 0.75 x 1.5 y)) 0 * 0.1++---- ; ar is not working+let o = lfPulse ar 50 0 0.25+in mce2 o (rLagC o (1/500) 0 (1/500) 0) * 0.2++let o = lfPulse ar 50 0 0.25+    x = mouseX kr 0.0 (1/100) Linear 0.2+    y = mouseY kr 0.0 (3/100) Linear 0.2+in mce2 o (rLagC o x 0 y 0) * 0.2++let o = sinOsc ar 50 0+in mce2 o (rLagC o 0.01 0 0.01 0) * 0.2
+ Help/Ugen/rLoopSet.help.hs view
@@ -0,0 +1,23 @@+{----++Concurrent loops at a signal buffer++Create a set of concurrent loops at a signal buffer.  This is the+static and composed variant of RFreezer.  There are five global+inputs, the buffer and then: left, right, gain and increment.  The+first two are initialization rate, the second two control rate.+Each loop is defined by a quadruple: left, right, gain and+increment.  The left and right values are in the range [0,1) and+refer to the segment of the buffer established by the group left+and right values, which are in the range [0,1) in relation to the+signal buffer.++Buffer Left                                  Buffer Right+|                                                       |+|      Group Left              Group Right              |+|      |                                 |              |+|------|----|-----------------------|----|--------------|+            |                       |+            Loop Left      Loop Right++-}
+ Help/Ugen/rShufflerL.help.hs view
@@ -0,0 +1,28 @@+-- RShufflerL+X.rShufflerL (sinOsc ar 1200 0 * 0.1) 0.02 0.04++-- RShufflerL ; mouse control+let x = mouseX kr 0.0001 0.02 Linear 0.2+    y = mouseY kr 0.001 0.25 Linear 0.2+    o = sinOsc ar (mce2 440 441) 0 * 0.2+in X.rShufflerL o x y++-- RShufflerL ; arrayed+let n = 6+    x = mouseX kr 0.0001 0.02 Linear 0.2+    y = mouseY kr 0.001 0.25 Linear 0.2+    f = x * X.randNId n 'α' 0 4+    d = y * X.randNId n 'β' 0 4+    o = sinOsc ar (mce2 440 441) 0 * 0.1+in splay (X.rShufflerL o f d) 1 1 0 True++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 0.1 (X.rShufflerL (sinOsc ar 1200 0) 0.02 0.04)++{---- Linear input shuffler++A hamming window of durationId 'fragmentSize' is applied to the input signal.+The inter-offset time is a linear random value between 0 andId 'maxDelay'.+c.f. grainIn, monoGrain++-}
+ Help/Ugen/rSmplrIndex.help.hs view
@@ -0,0 +1,57 @@+-- rSmplrIndex ; event control ; stereo ; requires=b0 ; loaded bosendorfer (or equivalent) sample data+let f (_,g,x,y,z,_,_,_,_,_,_) =+      let s_mnn = [21,23,24,26,28,29,31,33,35,36,38,40,41,43,45,47,48,50,52,53,55,57,59+                  ,60,62,64,65,67,69,71,72,74,76,77,79,81,83,84,86,88,89,91,93,95,96,98+                  ,100,101,103,105,107,108]+          tbl = asLocalBufId 'α' s_mnn+          mnn = x * 88 + 21+          mnn0 = latch mnn g+          rt = midiRatio ((mnn - mnn0) * y)+          (buf,rt0) = unmce2 (X.rSmplrIndex kr tbl (bufFrames kr tbl) mnn0)+          b0 = control kr "b0" 100+          sig = playBuf 2 ar (b0 + buf) (bufRateScale kr (b0 + buf) * rt0 * rt) g 0 NoLoop DoNothing+      in sig * z * lagUD g 0 4+in mix (voicer 16 f) * control kr "gain" 1++-- rSmplrIndex ; event control ; stereo ; requires=tbl,b0 ; data table and loaded sample data+let f (_,g,x,y,z,_,_,_,_,_,_) =+      let tbl = control kr "tbl" 0+          lhs = bufRd 1 kr tbl 0 NoLoop NoInterpolation+          rhs = bufRd 1 kr tbl (bufFrames kr tbl - 1) NoLoop NoInterpolation+          mnn = x * (rhs - lhs) + lhs+          mnn0 = latch mnn g+          rt = midiRatio ((mnn - mnn0) * y)+          (buf,rt0) = unmce2 (X.rSmplrIndex kr tbl (bufFrames kr tbl) mnn0)+          b0 = control kr "b0" 100+          sig = playBuf 2 ar (b0 + buf) (bufRateScale kr (b0 + buf) * rt0 * rt) g 0 NoLoop DoNothing+      in sig * z * lagUD g 0 4+in mix (voicer 16 f) * control kr "gain" 1++-- rSmplrIndex ; event control ; mono ; requires=tbl,b0 data table and loaded sample data+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let tbl = control kr "tbl" 0+          lhs = bufRd 1 kr tbl 0 NoLoop NoInterpolation+          rhs = bufRd 1 kr tbl (bufFrames kr tbl - 1) NoLoop NoInterpolation+          mnn = x * (rhs - lhs) + lhs+          mnn0 = latch mnn g+          rt = midiRatio ((mnn - mnn0) * y)+          (buf,rt0) = unmce2 (X.rSmplrIndex kr tbl (bufFrames kr tbl) mnn0)+          b0 = control kr "b0" 100+          sig = playBuf 1 ar (b0 + buf) (bufRateScale kr (b0 + buf) * rt0 * rt) g 0 NoLoop DoNothing+      in pan2 sig (o * 2 - 1) (z * lagUD g 0.01 0.01)+in mix (voicer 16 f) * control kr "gain" 8++---- ; load bosdendorfer sample data+hsc3-smplr load pf --dyn=008 --b0=100++---- ; load SFZ sample data+import Sound.Osc {- hosc -}+import Sound.Sc3.Data.Sfz {- hsc3-data -}+sfz_fn = sfResolve "instr/bosendorfer/008.sfz"+sfz_fn = sfResolve "instr/farfisa/aad/dolce-8.sfz"+sfz_fn = sfResolve "instr/casacota/zell_1737_415_MeanTone5/8_i.sfz"+(ctl,glb,rgn) <- sfz_load_data sfz_fn+tbl = map ((\(k,_,_) -> k) . sfz_region_key) rgn+withSc3 (sendMessage (b_alloc_setn1 0 0 (map fromIntegral tbl)))+alloc_msg = zipWith (\b fn -> b_allocRead b fn 0 0) [100..] (map (sfz_region_sample_resolve sfz_fn ctl) rgn)+withSc3 (mapM_ async alloc_msg)
+ Help/Ugen/rTracePlay.help.hs view
@@ -0,0 +1,17 @@+-- rTracePlay ; traverse a diamond in equal time increments+let t = [0,-1,1/4,0, 1/4,0,1/2,0, 1/2,1,1/4,0, 3/4,0,0,0, 1,-1,1/4,0]+    b = asLocalBufId 'α' t+    o = sinOsc ar 440 0 * 0.1+    l = X.rTracePlay kr b 4 (mouseX kr 1 20 Linear 0.1) 1+in pan2 o l 1++-- rTracePlay ; X of trace is (-1 0 1 0 -1) ; Y is (1/4 1/2 1/4 0 1/4)+let t = [0,-1,1/4,0, 1/4,0,1/2,0, 1/2,1,1/4,0, 3/4,0,0,0, 1,-1,1/4,0]+    b = asLocalBufId 'α' t+    o = sinOsc ar 440 0 * 0.1+    tr f n = X.rTracePlay kr b 4 (f kr 1 20 Linear 0.1) n+    l = tr mouseX 1+    g = tr mouseY 2+in pan2 o l g++---- Play a buffer that is arranged as a trace.  A trace is a sequence of tuples (T,X,Y,Z).
+ Help/Ugen/rTraceRd.help.hs view
@@ -0,0 +1,45 @@+-- rTraceRd ; printing only+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+    ph = mouseX kr 0 1 Linear 0.05+    tr = X.rTraceRd kr b 3 ph 1+    labels = mce . map label+    pr = poll (impulse kr 5 0) (mce2 ph tr) 0 (labels ["ph","tr"])+in mrg2 (out 0 (dc ar 0)) pr++-- rTraceRd ; listening ; X is (-1 0 1 0 -1)+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+    o = sinOsc ar 440 0 * 0.1+    x = X.rTraceRd kr b 3 (lfSaw kr 1 0 * 0.5 + 0.5) 1+in pan2 o x 1++-- rTraceRd+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+    x = X.rTraceRd kr b 3 (lfSaw kr 1 0 * 0.5 + 0.5) 1+    o = sinOsc ar (linLin x (-1) 1 440 880) 0 * 0.1+in pan2 o 0 1++-- rTraceRd ; Y is (1/4 1/2 1/4 0 1/4)+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+    o = sinOsc ar 440 0 * 0.1+    tr n = X.rTraceRd kr b 3 (lfSaw kr 1 0 * 0.5 + 0.5) n+    l = tr 1+    g = tr 2+in pan2 o l g++---- ; loading data from a CSV trace file+import qualified Sound.Sc3.Data.Trace as T {- hsc3-data -}+let fn = "/home/rohan/sw/hsc3-data/data/csv/trace/b.csv"+tr <- T.trace_load_csv2 fn+length tr == 3017+let tr' = T.trace_normalise_t tr+let d = concatMap (\(t,(x,y)) -> [t,x,y]) tr'+length d == length tr * 3+withSc3 (async (b_alloc_setn1 0 0 d) >> return ())++{----++UGens to read a buffer that is arranged as a trace.  A trace is a+sequence of tuples (T,X...) where the number of data points (including+T) is given by theId 'degree' input at the UGen.++-}
+ Help/Ugen/radiansPerSample.help.hs view
@@ -0,0 +1,3 @@+-- radiansPerSample ; two pi divided by the nominal sample rate (ie. a very small number)+let f = mce2 radiansPerSample ((2 * pi) / sampleRate) * 5000000+in sinOsc ar f 0 * 0.1
+ Help/Ugen/ramp.help.hs view
@@ -0,0 +1,20 @@+-- ramp ; lag pitch+let o = lfPulse kr 4 0 0.5 * 50 + 400+    l = line kr 0 1 15 DoNothing+    f = ramp o l+in sinOsc ar f 0 * 0.3++-- ramp ; mouse control+let x1 = mouseX kr 220 440 Exponential 0+    x2 = ramp x1 (300 / 1000)+in sinOsc ar (mce2 x1 x2) 0 * 0.1++-- ramp ; control inputs+let db = control kr "db" (-60)+    dur = control kr "dur" 0.1+in sinOsc ar 110 0 * ramp (dbAmp db) dur++---- ; initiate ramps+withSc3 (Sound.OSC.sendMessage (n_set 1 [("db",-6),("dur",1)]))+withSc3 (Sound.OSC.sendMessage (n_set 1 [("db",-90),("dur",1)]))+
+ Help/Ugen/rand.help.hs view
@@ -0,0 +1,9 @@+-- rand+let f = randId 'α' 200 1200+    l = randId 'β' (-1) 1+    e = line kr 0.2 0 0.1 RemoveSynth+    o = fSinOsc ar f 0+in pan2 (o * e) l 1++-- rand+sinOsc ar (lfNoise1Id 'α' kr (6 + mce2 (randId 'β' (-4) 4) (randId 'γ' (-4) 4)) * 100 + 200) 0 * 0.1
+ Help/Ugen/rand2.help.hs view
@@ -0,0 +1,2 @@+-- rand2 ; composite ugen+sinOsc ar (220 + rand2 110) 0 * 0.1
+ Help/Ugen/randN.help.hs view
@@ -0,0 +1,16 @@+-- randN ; two channel sin tones+sinOsc ar (X.randN 2 440 442) 0 * 0.1++-- randN ; two channel sin tones ; id+sinOsc ar (X.randNId 2 'α' 440 442) 0 * 0.1++-- randN ; n node klang synthesis ; id+let n = 240+    f = X.randNId n 'α' 40 18000+    a = X.randNId n 'β' 0.1 0.3+    p = X.randNId n 'γ' (-1) 1+    s = klangSpec_mce f a p+in klang ar 1 0 s * 0.05++-- randN ; mce...+let f = X.randNId 2 'α' (mce2 440 441) 442 in sinOsc ar f 0 * 0.1
+ Help/Ugen/randSeed.help.hs view
@@ -0,0 +1,20 @@+-- randSeed ; start a sound that includes noise ugens+let n = mceFillId 'α' 2 (\z _ -> whiteNoiseId z ar * 0.05 + dust2Id z ar 70)+    f = lfNoise1Id 'β' kr 3 * 5500 + 6000+in resonz (n * 5) f 0.5 + n * 0.5++---- ; CRASH+-----  WidthFirstUGen : LocalBuf SetBuf ClearBuf IFFT PV_ChainUGen RandSeed RandID++-- randSeed ; reset the seed at a variable rate (CRASH)+let s = control kr "seed" 1956+    i = impulse kr (mouseX kr 0.1 100 Linear 0.2) 0+in wrapOut Nothing $ randSeed kr i s++-- randSeed ; always the same (for a given seed)... (CRASH)+let sd = 1957+    n = tiRandId 'α' 4 12 (dustId 'β' kr 1)+    f = n * 150 + (mce [0,1])+    r = randSeed ir 1 sd+in mrg2 (sinOsc ar f 0 * 0.1) r+
+ Help/Ugen/rcd.help.hs view
@@ -0,0 +1,11 @@+-- rcd ; rotating clock divider+let freqs = mce (map (\i -> midiCps (i * 5 + 50)) [0 .. 8])+    amps = mce [1, 0.5, 0.3, 0.3, 0.3, 0.2, 0.2, 0.2]+    tr = lfPulse ar 7 0 0.01+    rot = -2+    spread = tiRandId 'α' 0 1 (impulse kr 0.13 0)+    dv = tiRandId 'β' 0 3 (impulse kr 0.1 0)+    pulses = X.rcd tr rot 0 dv spread 0 0 0 1+    oscs = sinOsc ar freqs 0 * pulses * amps+    sig = splay (mceRotate 3 oscs) 1 0.25 0 True+in sig  + combN sig 2 (mce [2, 1]) 3 * 0.3
+ Help/Ugen/rdl.help.hs view
@@ -0,0 +1,30 @@+-- rdl+X.rdl ar 2 (mce2 0 0)++---- ; notes++rdl is a host for [hdf](?t=hdf) generated DSP codes.++rdl codes can read buffers and control signals.  Required resources+must be correctly pre-allocated.++rdl nodes are instantiated with a fixed number of channels, it is an+error to load incompatible codes.++Codes are loaded using u_cmd, which requires the ugenIndex of the+rdl node.++> import Sound.Sc3.UGen.Graph {- hsc3 -}+> ug_ugen_indices "RDL" (ugen_to_graph (X.rdl 2 (mce2 0 0))) == [0]++When created, the node has no code loaded.++hdf includes a u_cmd_g_load function.  Codes can be replaced while+the rdl node is running.  The graphs below are given as examples at+hdf.++> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/analog-bubbles.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/silence.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/moto-rev.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/sprinkler.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/lfo-modulation.so"))
+ Help/Ugen/rdx7Env.help.hs view
@@ -0,0 +1,13 @@+-- rdx7Env+let gate_ = control kr "gate" 0+    data_ = control kr "data" 0+    [r1,r2,r3,r4] = map (\k -> control kr ('r':show k) 99) [1 .. 4]+    [l1,l2,l3,l4] = map (\(k,v) -> control kr ('l':show k) v) (zip [1 .. 4] [99,99,99,00])+    ol = control kr "ol" 99+in sinOsc ar 440 0 * X.rdx7Env ar gate_ data_ r1 r2 r3 r4 l1 l2 l3 l4 ol++---- ; env set+withSc3 (Sound.OSC.sendMessage (n_set (-1) [("r1",35.0),("r2",65),("r3",55),("r4",25)]))+withSc3 (Sound.OSC.sendMessage (n_set (-1) [("l1",99.0),("l2",65),("l3",75),("l4",0)]))+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "gate" 1.0))+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "gate" 0.0))
+ Help/Ugen/recordBuf.help.hs view
@@ -0,0 +1,21 @@+-- recordBuf ; requires=buf ; record for four seconds (until end of buffer)+let b = control kr "buf" 0+    o = formant ar (xLine kr 400 1000 4 DoNothing) 2000 800 * 0.125+in mrg2 o (recordBuf ar b 0 1 0 1 NoLoop 1 RemoveSynth o)++-- recordBuf ; requires=buf ; play recorded buffer back (ie. test)+let (b, nc) = (control kr "buf" 0, 1)+in playBuf nc ar b 1 1 0 NoLoop RemoveSynth++-- recordBuf ; mix second signal equally with existing signal, replay to hear+let b = control kr "buf" 0+    o = formant ar (xLine kr 200 1000 4 DoNothing) 2000 800 * 0.125+in mrg2 o (recordBuf ar b 0 0.5 0.5 1 NoLoop 1 RemoveSynth o)++-- recordBuf ; mce+let b = control kr "buf" 0+    o = sinOsc ar (mce2 110 220) 0 * 0.1+in mrg2 o (recordBuf ar (mce2 b b) 0 0.5 0.5 1 NoLoop 1 RemoveSynth (mce1 o))++---- ; setup+withSc3 (async (b_alloc 0 (48000 * 4) 1))
+ Help/Ugen/redPhasor.help.hs view
@@ -0,0 +1,17 @@+-- redPhasor ; no looping & it will play through once ; mouse x acts as trigger+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor kr tr 0.3 400 800 0 500 600) 0 * 0.2++-- redPhasor ; start value greater than end value, positive rate, c.f. redPhasor2+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor kr tr 0.3 800 400 0 500 600) 0 * 0.2++-- redPhasor ; mouse y controls looping on/off, mouse x trigger+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+    lp = mouseY kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor kr tr 0.3 400 800 lp 500 600) 0 * 0.2++-- redPhasor ; mouse x controls loop rate, mouse y scales the start loop-point+let x = mouseX kr 0 5 Linear 0.2+    y = mouseY kr 200 500 Linear 0.2+in sinOsc ar (X.redPhasor kr 0 x 400 800 1 y 600) 0 * 0.2
+ Help/Ugen/redPhasor2.help.hs view
@@ -0,0 +1,7 @@+-- redPhasor2 ; no looping & it will play through once ; mouse x acts as trigger+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor2 kr tr 0.3 400 800 0 500 600) 0 * 0.2++-- redPhasor2 ; start value greater than end value, negative rate, c.f. redPhasor+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor2 kr tr (-0.3) 800 400 0 500 600) 0 * 0.2
+ Help/Ugen/replaceOut.help.hs view
@@ -0,0 +1,15 @@+-- replaceOut+replaceOut 0 (sinOsc ar 440 0 * 0.1)++-- replaceOut ; send signal to a bus, overwrite existing signal+--            ; mrg nodes are ordered right to left, so below b replaces c and then a is summed+let a = sinOsc ar (mce [120, 121]) 0 * 0.1+    b = sinOsc ar (mce [330, 331]) 0 * 0.1+    c = sinOsc ar (mce [880, 881]) 0 * 0.1+in mrg [out 0 a, replaceOut 0 b, out 0 c]++-- replaceOut ; a writes noise to bus 24, b reads 24 and replaces with filtered variant, c reads 24 and writes to 0+let a = pinkNoiseId 'α' ar * 0.1+    b = bpf (in' 1 ar 24) 440 1+    c = in' 1 ar 24+in mrg [out 0 c, replaceOut 24 b, out 24 a]
+ Help/Ugen/resonator.help.hs view
@@ -0,0 +1,28 @@+-- resonator+let pan = 0+    trig = impulse kr 1 0+    snare = X.analogSnareDrum ar trig 0 0.1 200 0.5 (tRandId 'α' 0.1 0.5 trig) 0.5+    freq = tExpRandId 'β' 25 250 trig+    position = 0+    resolution = 24+    structure = sinOsc kr 0.01 0 `in_range` (0,1)+    brightness = sinOsc kr 0.01 (0.5 * pi) `in_range` (0,0.5)+    damping = tRandId 'γ' 0.2 0.8 trig+    sig = X.resonator snare freq position resolution structure brightness damping+in pan2 (tanh sig) pan 0.1++-- resonator ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let tr = trig g controlDur+          freq = midiCps (x * 25 + 36)+          snare = X.analogSnareDrum ar tr 0 z 200 0.5 (tRandId 'α' 0.1 0.5 tr) 0.5+          sig = X.resonator snare freq 0 24 y rx (0.2 + ry)+      in pan2 (tanh sig) (o * 2 - 1) (lagUD g 0 6)+in mix (voicer 16 f) * control kr "gain" 0.1++-- resonator ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 25 + 36)+          sig = X.resonator (pinkNoiseId 'α' ar * z) freq 0 24 y rx (0.2 + ry)+      in pan2 (tanh sig) (o * 2 - 1) (lagUD g 0 2)+in mix (voicer 16 f) * control kr "gain" 0.1
+ Help/Ugen/resonz.help.hs view
@@ -0,0 +1,60 @@+-- resonz+resonz (whiteNoise ar * 0.5) 2000 0.1++-- resonz ; modulate frequency+let f = xLine kr 1000 8000 10 RemoveSynth+in resonz (whiteNoise ar * 0.5) f 0.05++-- resonz ; modulate bandwidth+let bw = xLine kr 1 0.001 8 RemoveSynth+in resonz (whiteNoise ar * 0.5) 2000 bw++-- resonz ; modulate bandwidth opposite direction+let bw = xLine kr 0.001 1 8 RemoveSynth+in resonz (whiteNoise ar * 0.5) 2000 bw++-- resonz ; mouse control (1/Q = bandwidth / center-frequency)+let m = mouseX kr 36 85 Linear 0.2 {- midi note -}+    w = mouseY kr 0.1 5 Linear 0.2 {- bandwidth -}+    f = midiCps (floorE m) {- centre frequency -}+    rq = w / f {- 1/Q (reciprocal of Q) -}+in resonz (pinkNoise ar) f rq++-- resonz ; pinkNoise ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+      pan2 (resonz (pinkNoise ar) (unitCps p) (y * 0.25) * 24) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1++-- resonz ; pinkNoise ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+      let (gt,_) = ccEventGateReset g p+          e = envGen kr gt 1 0 1 DoNothing (envPerc 0.01 (1 + rx))+          f = unitCps p {- centre frequency -}+          rq = linLin y 0 1 0.05 0.25 / f {- 1/Q (reciprocal of Q) -}+          scl = 900+      in pan2 (resonz (pinkNoise ar) f rq * scl * z) (o * 2 - 1) e+in mix (voicer 16 f) * control kr "gain" 1++{---- ; Q+The Q factor of a resonator is defined as the center-frequency (cf) divided by the bandwidth (bw).++> let q cf bw = cf / bw++The higher the Q the narrower the filter.++> let bw_set = [1,4,10,100,200,400]+> map (q 400) bw_set == [400,100,40,4,2,1]++Q multipled by the band-width gives the center-frequency.++> map (\bw -> q 400 bw * bw) bw_set == replicate (length bw_set) 400++The third argument to resonz is the reciprocal of Q (rq).++> let rq cf = recip . q cf+> map (rq 400) [1,4,10,100,200,400] == [1/400,1/100,1/40,1/4,1/2,1]++1/Q multiplied by the center-frequency gives the bandwidth.++> map (\bw -> rq 400 bw * 400) bw_set == bw_set+-}
+ Help/Ugen/rhpf.help.hs view
@@ -0,0 +1,7 @@+-- rhpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in rhpf (saw ar 200 * 0.1) f 0.2++-- rhpf+let c = rhpf (lfSaw kr 2 0) (sinOsc kr (xLine kr 0.7 30 20 RemoveSynth) 0 * 35 + 40) 0.05+in sinOsc ar (c * 200 + 500) 0 * 0.25
+ Help/Ugen/ring1.help.hs view
@@ -0,0 +1,9 @@+-- ring1+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring1 a b * 0.125++-- ring1 ; written out+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ((a * b) + a) * 0.125
+ Help/Ugen/ring2.help.hs view
@@ -0,0 +1,9 @@+-- ring2+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring2 a b * 0.125++-- ring2 ; written out+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ((a * b) + a + b) * 0.125
+ Help/Ugen/ring3.help.hs view
@@ -0,0 +1,9 @@+-- ring3+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring3 a b * 0.125++-- ring3 ; written out+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (a * a * b) * 0.125
+ Help/Ugen/ring4.help.hs view
@@ -0,0 +1,9 @@+-- ring4+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring4 a b * 0.125++-- ring4 ; written out+let a = fSinOsc ar 800 0+    b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (((a * a * b) - (a * b * b))) * 0.125
+ Help/Ugen/ringz.help.hs view
@@ -0,0 +1,22 @@+-- ringz+ringz (dustId 'α' ar 3 * 0.3) 2000 2++-- ringz+ringz (whiteNoiseId 'α' ar * 0.005) 2000 0.5++-- ringz ; modulate frequency+let n = whiteNoiseId 'α' ar+    f = xLine kr 100 3000 10 RemoveSynth+in ringz (n * 0.005) f 0.5 * 0.2++-- ringz+let f = xLine kr 100 3000 10 RemoveSynth+in ringz (impulse ar 6 0.3) f 0.5 * 0.1++-- ringz ; modulate ring time+let rt = xLine kr 4 0.04 8 RemoveSynth+in ringz (impulse ar 6 0.3) 2000 rt * 0.1++-- ringz ; modulate ring time opposite direction+let rt = xLine kr 0.04 4 8 RemoveSynth+in ringz (impulse ar 6 0.3) 2000 rt * 0.1
+ Help/Ugen/rlpf.help.hs view
@@ -0,0 +1,32 @@+-- rlpf+let n = whiteNoiseId 'α' ar+    f = sinOsc ar 0.5 0 * 40 + 220+in rlpf n f 0.1++-- rlpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in rlpf (saw ar 200 * 0.1) f 0.2++-- rlpf+let ctl = rlpf (saw ar 5 * 0.1) 25 0.03+in sinOsc ar (ctl * 200 + 400) 0 * 0.1++-- rlpf ; mouse-control+let x = mouseX kr 2 200 Exponential 0.2+    y = mouseY kr 0.01 1 Exponential 0.2+    ctl = rlpf (saw ar 5 * 0.1) x y+in sinOsc ar (ctl * 200 + 400) 0 * 0.1++-- rlpf ; c.f. rlpfd+let s = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+    f = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 1500+    rq = mouseX kr 0.05 0.5 Linear 0.2+in rlpf s f rq * 0.1++-- rlpf ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let f0 = unitCps p+          f1 = f0 * 0.5 * (1 + y * 6)+          rq = linLin (rx * ry) 0 0.25 0.1 0.6+      in pan2 (rlpf (lfTri ar f0 0) f1 rq) (o * 2 - 1) (lagUD g 0.05 (2 - y) * (2 - y) * z)+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/rlpfd.help.hs view
@@ -0,0 +1,4 @@+-- rlpfd+let s = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+    f = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 1500+in X.rlpfd s f 0.6 0.5
+ Help/Ugen/rmShelf.help.hs view
@@ -0,0 +1,12 @@+-- rmShelf2 ; default parameters ; rm=regalia-mitra freq=cut-off frequency (hz) k=gain (db)+X.rmShelf2 ar (whiteNoiseId 'α' ar * 0.1) 440 0++-- rmShelf2 ; freq=mouse-x+let freq = mouseX kr 55 3520 Exponential 0.2+in X.rmShelf2 ar (whiteNoiseId 'α' ar * 0.1) freq 0++-- rmShelf2 ; k=mouse-y+let freq = mouseX kr 55 3520 Exponential 0.2+    k = mouseY kr (-12) 12 Linear 0.2+in X.rmShelf2 ar (whiteNoiseId 'α' ar * 0.1) freq k * 0.1+
+ Help/Ugen/rmeq.help.hs view
@@ -0,0 +1,8 @@+-- rmeq ; default param ; rm=regalia-mitra freq=cut-off frequency (hz) rq=reciprocal-of-Q k=gain (db)+X.rmeq (pinkNoiseId 'α' ar * 0.1) 440 1 0++-- rmeq ; rapid param changes fail at low frequencies+let freq = mouseX kr 55 3520 Exponential 0.2+    rq = mouseY kr 0.01 2.0 Linear 0.2+    k = 3+in X.rmeq (pinkNoiseId 'α' ar * 0.1) freq rq k
+ Help/Ugen/rongs.help.hs view
@@ -0,0 +1,32 @@+-- rongs+let tr_freq = sinOsc kr 0.1 (pi/2) `in_exprange` (10.1,1.0)+    tr = dust2Id 'α' kr tr_freq+    sig = let f0 = mce2 1.0 1.01 * tExpRandId 'β' 0.001 0.100 tr * sampleRate / 2+              structure = tRandId 'γ' 0.25 0.75 tr+              brightness = tRandId 'δ' 0.25 0.75 tr+              damping = tRandId 'ζ' 0.15 0.65 tr+              accent = 0.9+              stretch = tRandId 'ε' 0.1 0.99 tr+              position = 0.15+              loss = tRandId 'η' 0.1 0.5 tr+              modeNum = 2+              cosFreq = 0.25+          in X.rongs ar tr tr f0 structure brightness damping accent stretch position loss modeNum cosFreq+in splay (leakDC sig 0.995) 0.25 1 (tRandId 'θ' (-1) 1 tr) True++-- rongs ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let tr = trig1 g controlDur+          f0 = midiCps (x * 88 + 20)+          structure = 0.5 + ry * tRandId 'α' (-1) 1 tr+          brightness = 0.5 + rx * tRandId 'β' (-1) 1 tr+          damping = y * 0.25+          accent = 0.99+          stretch = 0.5 + z * tRandId 'γ' (-0.5) 0.5 tr+          position = y * 0.5+          loss = 0.25 + o * tRandId 'δ' (-0.1) 0.1 tr+          modeNum = 2+          cosFreq = 0.25+          sig = X.rongs ar tr tr f0 structure brightness damping accent stretch position loss modeNum cosFreq+      in pan2 (leakDC sig 0.995) (o * 2 - 1) (lagUD z 0 2)+in mix (voicer 6 f) * control kr "gain" 1
+ Help/Ugen/rotate2.help.hs view
@@ -0,0 +1,10 @@+-- rotate2 ; rotation of stereo sound, via LFO+let x = pinkNoiseId 'α' ar+    y = lfTri ar 800 0 * lfPulse kr 3 0 0.3+in rotate2 x y (lfSaw kr 0.1 0) * 0.1++-- rotate2 ; rotation of stereo sound, via mouse ; rotateStereo is MCE form+let x = mix (lfSaw ar (mce [198..201]) 0) * 0.25+    y = sinOsc ar 900 0 * lfPulse kr 3 0 0.3+    p = mouseX kr 0 2 Linear 0.2+in rotateStereo (mce2 x y) p * 0.1
+ Help/Ugen/roundUp.help.hs view
@@ -0,0 +1,8 @@+-- roundUp+let x = mouseX kr 60 4000 Linear 0.1+    f = roundUp x 100+in sinOsc ar f 0 * 0.1++-- roundUp+let n = line kr 24 108 6 RemoveSynth+in saw ar (midiCps (roundUp n 1)) * 0.2
+ Help/Ugen/rpvDecayTbl.help.hs view
@@ -0,0 +1,11 @@+-- RPVDecayTbl ; random decay multipliers+let b0 = clearBuf (localBuf 1 2048)+    b1 = asLocalBuf (mceChannels (X.randN 1024 0.5 0.975))+    b2 = clearBuf (localBuf 1 1024)+in ifft' (X.rpvDecayTbl (fft' b0 (soundIn 0)) b1 b2)++-- RPVDecayTbl ; random decay multipliers ; id+let b0 = clearBuf (localBufId 'α' 1 2048)+    b1 = asLocalBufId 'β' (mceChannels (X.randNId 1024 'γ' 0.5 0.975))+    b2 = clearBuf (localBufId 'δ' 1 1024)+in ifft' (X.rpvDecayTbl (fft' b0 (soundIn 0)) b1 b2)
+ Help/Ugen/runningMax.help.hs view
@@ -0,0 +1,16 @@+-- runningMax+let n = dust ar 20+    t = impulse ar 0.4 0+    f = runningMax n t * 500 + 200+in t + sinOsc ar f 0 * 0.2++-- runningMax ; follow a sine lfo, reset rate controlled by mouse x+let t = impulse kr (mouseX kr 0.01 2 Linear 0.1) 0+    f = runningMax (sinOsc kr 0.2 0) t * 500 + 200+in t + sinOsc ar f 0 * 0.2++-- runningMax ; id+let n = dustId 'α' ar 20+    t = impulse ar 0.4 0+    f = runningMax n t * 500 + 200+in t + sinOsc ar f 0 * 0.2
+ Help/Ugen/runningMin.help.hs view
@@ -0,0 +1,12 @@+-- runningMin ; follow a sine lfo, reset rate controlled by mouseX+let o = sinOsc kr 2 pi+    x = mouseX kr 0.01 10 Exponential 0.1+    t = impulse ar x 0+    f = runningMin o t * 500 + 200+in t + sinOsc ar f 0 * 0.1++-- runningMin+let n = dustId 'α' ar 20+    t = impulse ar 0.4 0+    f = runningMin n t * 500 + 200+in sinOsc ar f 0 * 0.2
+ Help/Ugen/runningSum.help.hs view
@@ -0,0 +1,18 @@+-- runningSum ; distorts of course, would need scaling+runningSum (soundIn 0 * 0.1) 40++-- runningSum ; running average over x samples+let x = 100 in runningSum (lfSaw ar 440 0 * 0.1) x * recip x++-- runningSum ; rms power+let input = lfSaw ar 440 0 * 0.1+    numsamp = 30+in runningSum (input * input) numsamp / (sqrt numsamp)++-- runningSum ; composite UGen+runningSumRMS (soundIn 0) 40 * 0.1++-- runningSum+let z = soundIn 0+    a = runningSum z 40+in sinOsc ar 440 0 * a * 0.1
+ Help/Ugen/sampleDur.help.hs view
@@ -0,0 +1,3 @@+-- sampleDur ; the reciprocal of the nominal sample rate of the server+let f = mce2 sampleRate (recip sampleDur) * 0.01+in sinOsc ar f 0 * 0.1
+ Help/Ugen/sampleRate.help.hs view
@@ -0,0 +1,7 @@+-- sampleRate ; the current nominal sample rate of the server+let sr = 48000 {- 44100 -}+    f = mce2 sampleRate sr * 0.01+in sinOsc ar f 0 * 0.1++---- ; server status ; extract nominal and actual sample rates from the synthesis server+withSc3 (Control.Monad.liftM2 (,) serverSampleRateNominal serverSampleRateActual)
+ Help/Ugen/sanitize.help.hs view
@@ -0,0 +1,3 @@+-- sanitize ; when frequency is nan set to 220+let freq = tChoose (impulse kr 1 0) (mce2 440 (0 / 0))+in sinOsc ar (sanitize freq 220) 0 * 0.1
+ Help/Ugen/saw.help.hs view
@@ -0,0 +1,25 @@+-- saw ; Sc3 saw is descending+saw ar (xLine kr 40 4000 6 RemoveSynth) * 0.1++-- saw ; negation is ascending+negate (saw ar (xLine kr 40 4000 6 RemoveSynth) * 0.1)++-- saw ; compare to the non-bandlimited lfSaw+lfSaw ar (xLine kr 40 4000 6 RemoveSynth) 0 * 0.1++-- saw ; two band limited sawtooth waves thru a resonant low pass filter+let f = xLine kr 8000 400 5 DoNothing+in rlpf (saw ar (mce2 100 250) * 0.1) f 0.05++-- saw ; not useful as a phasor, see lfSaw or phasor+sin (range 0 two_pi (negate (saw ar 440))) * 0.2++-- saw ; ln 2021-04-16 https://lukasnowok.github.io/spectrology/+let tr = impulse ar (xLine ar 1 1000 20 DoNothing) 0+    e = envGen ar tr 1 0 1 DoNothing (envPerc 0 0.1)+in saw ar (tRandId 'a' 50 (xLine ar 50 5000 20 DoNothing) tr) * e * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2+Sound.Sc3.Plot.plot_ugen1 0.1 (saw ar 50) -- descending+Sound.Sc3.Plot.plot_ugen1 0.002 (saw ar 5000) -- ragged
+ Help/Ugen/sawDPW.help.hs view
@@ -0,0 +1,5 @@+-- sawDPW+X.sawDPW ar (xLine kr 2000 20 10 DoNothing) 0 * 0.1++-- sawDPW+X.sawDPW ar (mouseX kr 200 12000 Exponential 0.2) 0 * 0.1
+ Help/Ugen/scaleNeg.help.hs view
@@ -0,0 +1,8 @@+-- scaleNeg+scaleNeg (fSinOsc ar 500 0) (line ar 1 (-1) 4 RemoveSynth) * 0.1++-- scaleNeg ; written out+let o = fSinOsc ar 500 0+    l = line ar 1 (-1) 4 RemoveSynth+    c = o `less_than` 0+in (c * (o * l) + (1 - c) * o) * 0.1
+ Help/Ugen/schmidt.help.hs view
@@ -0,0 +1,4 @@+-- schmidt ; threshold octave jumps+let n = lfNoise1Id 'α' kr 3+    o = schmidt n (-0.15) 0.15 + 1+in sinOsc ar (n * 200 + 500 * o) 0 * 0.1
+ Help/Ugen/select.help.hs view
@@ -0,0 +1,44 @@+-- select+let n = 3/2+    a = mce [sinOsc ar 440 0, saw ar 440, pulse ar 440 0.1]+in select (lfSaw kr 1 0 * n + n) a * 0.1++-- select ; as sequencer+let n = 10+    a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]+    c = n / 2+    f = select (lfSaw kr 0.5 0 * c + c) a+in saw ar f * 0.1++-- select ; i-rate+let a = mce [rand 110 220,rand 220 440,rand 440 880]+in sinOsc ar (select (rand 0 3) a) 0 * 0.1++-- select ; i-rate ; id+let a = mce [randId 'α' 110 220,randId 'β' 220 440,randId 'γ' 440 880]+in sinOsc ar (select (randId 'δ' 0 3) a) 0 * 0.1++-- select ; nested mce+let n = 10+    a = mce [mce [517, 403, 89], mce [562, 816, 107], mce [241, 145, 90, 224]]+    c = n / 2+    f = select (lfSaw kr (mce [0.5, 0.75]) 0 * c + c) a+in saw ar f * 0.1++-- select ; buffer segment player ; requires=buf+let (buf, nc) = (control kr "buf" 100, 2)+    n_segments = control_m kr "nseg" 32 (1, 64, "lin")+    sel = control_m kr "sel" 0 (0,3,"lin")+    buf_size = bufFrames kr buf+    segment_size = bufFrames kr buf / n_segments+    tr = impulse kr (n_segments / bufDur kr buf) 0+    phase = phasor ar tr (bufRateScale kr buf) 0 (segment_size - 1) 0+    ix = mce [dseriesId 'α' dinf 0 1 `modE` n_segments -- play segments in sequence (reconstruct)+             ,n_segments - 1 - (dseriesId 'β' dinf 0 1 `modE` n_segments) -- play segments in reverse sequence+             ,dbrownId 'γ' dinf 0 (n_segments - 1) 1+             ,dwhiteId 'δ' dinf 0 (n_segments - 1)]+    zero = select sel (demand tr 0 (ix * segment_size))+in bufRdN nc ar buf (zero + phase) NoLoop * 0.1++---- ; buffer setup (nc = 2)+withSc3 (async (b_allocRead 0 (sfResolve "amen.wav") 0 0))
+ Help/Ugen/selectX.help.hs view
@@ -0,0 +1,12 @@+-- selectX ; composite ugen graph+let n = 3/2+    f = mce2 440 441+    a = mce [sinOsc ar f 0, saw ar f, pulse ar f 0.1]+in mix (selectX (lfSaw kr 1 0 * n + n) a * 0.1)++-- selectX ; as sequencer+let n = 10+    a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]+    c = n / 2+    f = selectX (lfSaw kr 0.5 0 * c + c) a+in saw ar f * 0.1
+ Help/Ugen/sendReply.help.hs view
@@ -0,0 +1,8 @@+-- sendReply+let s0 = lfNoise0Id 'α' kr 5+    s1 = lfNoise0Id 'β' kr 5+    o = sinOsc ar (s0 * 200 + 500) 0 * s1 * 0.1+in mrg [o,sendReply s0 0 "/send-reply" [s0,s1]]++---- ; receive reply+withSc3 (withNotifications (Sound.OSC.waitReply "/send-reply"))
+ Help/Ugen/sensoryDissonance.help.hs view
@@ -0,0 +1,6 @@+-- sensoryDissonance ; noteId 'norm' input calculation+let sig = soundIn 0+    chn = fft' (localBufId 'α' 1 2048) sig+    maxpeaks = 100+    dissonance = X.sensoryDissonance kr chn 100 0.1 (0.01 / maxpeaks) 1+in pan2 (blip ar 100 (sqrt dissonance * 200)) 0 0.1
+ Help/Ugen/setResetFF.help.hs view
@@ -0,0 +1,12 @@+-- setResetFF ; d0 is the set trigger, d1 the reset trigger+let d0 = dustId 'β' ar 5+    d1 = dustId 'γ' ar 5+in brownNoiseId 'α' ar * setResetFF d0 d1 * 0.1++-- setResetFF ; silence+let tr = setResetFF (impulse kr 5 0) (impulse kr 10 0)+in brownNoiseId 'α' ar * decay2 tr 0.01 0.05 * 0.1++-- setResetFF ; duty cycle+let tr = 1 - setResetFF (impulse kr 10 0) (impulse kr 5 0)+in brownNoiseId 'α' ar * decay2 tr 0.01 0.05 * 0.1
+ Help/Ugen/shaper.help.hs view
@@ -0,0 +1,55 @@+-- shaper ; hear waveshaper at pure (sin) tone ; generate table at client and use localBuf+let z = sinOsc ar 300 0 * line kr 0 1 12 DoNothing+    c = Gen.cheby 256 [1, 0, 1, 1, 0, 1]+    t = to_wavetable_nowrap c+    b = asLocalBufId 'α' t+in shaper b z * 0.1++-- shaper ; hear waveshaper at pure (sin) tone ; local wavetable+let z = sinOsc ar 300 0 * line kr 0 1 6 DoNothing+    t = Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1]+in shaper (asLocalBuf t) z * 0.1++-- shaper ; minor variation+let z = sinOsc ar 400 (pi / 2) * line kr 0 1 6 DoNothing+in shaper (asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])) z * 0.1++-- shaper ; mouse control+let z = sinOsc ar 400 (pi / 2) * mouseY kr 0.01 1 Exponential 0.2+    t = asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])+in shaper t z * 0.1++-- shaper ; sound in ; mouse control ; warning=feedback+let z = soundIn 0+    x = mouseX kr (-1) 1 Linear 0.2+    t = asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])+in xFade2 z (shaper t z) x 0.5++-- shaper ; hear waveshaper at pure (sin) tone ; requires=tbl see b_gen_cheby at b_gen help file+let z = sinOsc ar 300 0 * line kr 0 1 6 DoNothing+in shaper (control kr "tbl" 10) z * 0.1++-- shaper ; minor variation ; requires=tbl+let z = sinOsc ar 400 (pi / 2) * line kr 0 1 6 DoNothing+in shaper (control kr "tbl" 10) z * 0.1++-- shaper ; wave shape external signal ; requires=tbl+let z = soundIn 0+    x = sinOsc kr (1/4) 0+in xFade2 z (shaper (control kr "tbl" 10) z) x 0.5++-- shaper ; mouse control ; requires=tbl+let z = soundIn 0+    x = mouseX kr (-1) 1 Linear 0.2+in xFade2 z (shaper (control kr "tbl" 10) z) x 0.5++-- shaper ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let s = sinOsc ar (unitCps p) 0 * y+          b = asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])+      in pan2 (shaper b s) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1.0++---- ; drawings+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [1, 0, 1, 1, 0, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1]]
+ Help/Ugen/shufflerB.help.hs view
@@ -0,0 +1,39 @@+-- playBuf ; check buffer+let b = control kr "buf" 100+    s = bufRateScale kr b+in playBuf 1 ar b s 1 0 NoLoop RemoveSynth * 0.1++-- shufflerB ; static+let b = control kr "buf" 100+in X.shufflerB b 0 0.05 0.95 1.05 0.035 0.05 0.1 0.2 0.4 0.6 0.4 0.6 0 1 0.005 0.01 1 0 0++-- shufflerB ; static, quantized+let b = control kr "buf" 100+in X.shufflerB b 0 1 0.5 2 0.025 0.075 0.2 0.6 0.1 0.9 0.1 0.9 0 1 0.005 0.05 0 0.5 0.005++-- shufflerB ; static, pointilist+let b = control kr "buf" 100+in X.shufflerB b 0.4 0.5 0.5 2 0.05 0.15 0.2 0.5 0.3 0.7 0.3 0.7 0 1 0.05 0.25 0 0 0++-- shufflerB ; controls+let b = control_m kr "buf" 100 (0,10,"lin")+    k nm def = control_m kr nm def+    k2 nm (d1,d2) = control_rng kr nm (d1,d2)+    k2_mul m (c1,c2) = (c1 * m,c2 * m)+    shufflerB_grp p1 (p2,p3) (p4,p5) (p6,p7) (p8,p9) (p10,p11) (p12,p13) (p14,p15) (p16,p17) p18 p19 p20 = X.shufflerB p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20+in shufflerB_grp b+   (k2 "loc" (0.0,0.5) (0,1,"lin"))+   (k2 "incr" (0.99975,1.00025) (0.25,4,"lin"))+   (k2_mul 0.001 (k2 "dur" (250,300) (0.1,1000,"exp")))+   (k2 "amp" (0.8,0.9) (0.5,1.0,"amp"))+   (k2 "shape" (0.5,0.6) (0,1,"lin"))+   (k2 "skew" (0.4,0.6) (0,1,"lin"))+   (k2 "pan" (0.0,1.0) (0,1,"lin")) -- ie. not (-1,1)+   (k2_mul 0.001 (k2 "iot" (50,52.5) (0.01,500,"exp")))+   (k "locIncr" 1.0 (0.25,4.0,"lin"))+   (k "incrQ" 0.0 (0,1,"lin"))+   (k "iotQ" 0.0 (0,1,"lin"))++---- ; load buffer+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "instr/crotales/crotale05(D).wav"
+ Help/Ugen/silent.help.hs view
@@ -0,0 +1,2 @@+-- silent ; c.f. dc+silent 2
+ Help/Ugen/sin.help.hs view
@@ -0,0 +1,3 @@+---- ; Drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "Sin"+Sound.Sc3.Plot.plot_fn_r1_ln sin (0,2 * pi)
+ Help/Ugen/sinGrain.help.hs view
@@ -0,0 +1,13 @@+-- sinGrain+X.sinGrain ar (impulse kr 10 0) 0.1 (range 440 880 (whiteNoiseId 'α' kr)) * 0.1++-- sinGrain ; mouse control+let x = mouseX kr 0.001 0.2 Linear 0.1+    y = mouseX kr 90 600 Linear 0.1+in X.sinGrain ar (dustId 'β' kr 25) x y * 0.1++-- sinGrain ; ln 2021-04-13 https://lukasnowok.github.io/spectrology/+X.sinGrain ar (impulse ar (sinOsc ar (1/6) 0 `in_range` (8,4000)) 0) 0.005 10000++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/sinOsc.help.hs view
@@ -0,0 +1,154 @@+-- sinOsc ; fixed frequency (hz) and initial-phase (radians)+sinOsc ar (midiCps 69) 0 * 0.1 -- 415 440++-- sinOsc ; control input for frequency ; ie. withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "mnn" 64))+sinOsc ar (midiCps (control kr "mnn" 69)) 0 * 0.25++-- sinOsc ; modulate freq+sinOsc ar (xLine kr 2000 200 1 RemoveSynth) 0 * 0.5++-- sinOsc ; modulate freq+let f1 = xLine kr 1 1000 9 RemoveSynth+    f2 = sinOsc ar f1 0 * 200 + 800 -- (-1,1) ; (-200,200) ; (600,1000)+in sinOsc ar f2 0 * 0.25++-- sinOsc ; modulate phase ; modulator here is in (-2pi,2pi)+let ph = sinOsc ar (xLine kr 20 8000 10 RemoveSynth) 0 * 2 * pi+in sinOsc ar 800 ph * 0.1++-- sinOsc ; phase input only+let ph = sinOsc ar (xLine kr 20 8000 10 RemoveSynth) 0 * pi+in sinOsc ar 0 ph * 0.1++-- sinOsc ; mouse control+let x = mouseX kr 40 10000 Exponential 0.2+    y = mouseY kr 0.01 0.25 Exponential 0.2+in sinOsc ar x 0 * y++-- sinOsc ; simple bell-like tone+let f = mce [0.5,1,1.19,1.56,2,2.51,2.66,3.01,4.1]+    a = mce [0.25,1,0.8,0.5,0.9,0.4,0.3,0.6,0.1]+    o = sinOsc ar (500 * f) 0 * a+    e = envGen kr 1 0.1 0 1 RemoveSynth (envPerc 0.01 10)+in mix o * e++-- sinOsc ; "When two pure tones of slightly different frequency are superposed, our ears+-- perceive audible beats at a rate given by the difference of the two frequencies."+let f0 = 220+    f1 = 221.25+    d = abs (f1 - f0)+    i = impulse ar d 0 * max (sinOsc kr 0.05 0 * 0.1) 0+in sinOsc ar (mce2 f0 f1) 0 * 0.1 + i++-- sinOsc ; "When two tones are sounded together, a tone of lower frequency is+-- frequently heard. Such a tone is called a combination tone.  The most+-- commonly heard combination tone occurs at a frequency f2 - f1."+let f1 = 300+    f2 = 300 * 3/2 {- 450 -}+    f3 = abs (f2 - f1) {- 150 -}+    a3 = max (sinOsc kr 0.05 0 * 0.1) 0+in mix (sinOsc ar (mce3 f1 f2 f3) 0 * mce3 0.1 0.1 a3)++-- sinOsc ; with frequency of zero, operates as table lookup variant of sin+let mk_phasor (l,r) f = phasor ar 0 ((r - l) * f / sampleRate) l r l+    ph = mk_phasor (0,two_pi) 440+    o1 = sinOsc ar 440 0+    o2 = sinOsc ar 0 ph+    o3 = sin ph+in mce2 o1 (xFade2 o2 o3 (lfTri kr 0.1 0) 1) * 0.1++-- sinOsc ; sync ; i.e. <https://www.listarc.bham.ac.uk/lists/sc-dev/msg58316.html>+let dt = mce2 1.0 1.003+    freq = mouseX kr (100 * dt) (3000 * dt) Exponential 0.2+    sync_freq = mouseY kr 100 500 Exponential 0.2+    ph_freq = impulse ar sync_freq 0 + impulse ar freq 0+    o = sinOsc ar 0 (phasor ar ph_freq (freq / sampleRate) 0 1 0 * 2 * pi)+in o * 0.15++-- sinOsc ; reverse sync+let dt = mce2 1.0 1.003+    freq = mouseX kr (100 * dt) (3000 * dt) Exponential 0.2+    sync_freq = mouseY kr 100 500 Exponential 0.2+    direction = toggleFF (impulse ar sync_freq 0) * (-2) + 1+    o = sinOsc ar 0 (wrap (sweep ar (impulse ar freq 0) (direction * freq)) 0 (2 * pi))+in o * 0.15++-- sinOsc ; reverse cycle & reverse sync+let freq = mouseX kr (100 * mce2 1.0 1.003) (3000 * mce2 1.0 1.003) Exponential 0.2+    sync_freq = mouseY kr 100 500 Exponential 0.2+    direction = toggleFF (impulse ar sync_freq 0 + impulse ar freq 0) * (-2) + 1+    o = sinOsc ar 0 (wrap (sweep ar 0 (direction * freq)) 0 (2 * pi))+in o * 0.5++-- sinOsc ; 15.5 khz+pan2 (sinOsc ar 15500 0) 0 0.75++-- sinOsc ; 12 khz - 15.5 khz sweep+pan2 (sinOsc ar (range_hs (12000,15500) (sinOsc kr (1/6) 0)) 0) 0 0.75++-- sinOsc ; fm+let f0 = 220+    cR = 1 -- carrier ratio+    mR = 2 -- modulator ratio+    mA = mouseY kr 0.01 4000 Exponential 0.2 -- moduluation amplitude+in sinOsc ar ((f0 * cR) + (sinOsc ar (f0 * mR) 0 * mA)) 0 * 0.1++-- sinOsc ; fm+let f0 = 220+    cR = 1 -- carrier ratio+    mR = 2 -- modulator ratio+    mI = mouseY kr 0.01 10 Exponential 0.2 -- moduluation index+in sinOsc ar ((f0 * cR) + (sinOsc ar (f0 * mR) 0 * mI * (f0 * mR))) 0 * 0.1++-- sinOsc ; event control+let f (c,g,_,_,z,o,rx,_,p,_,_) =+      let freq_mod = sinOsc kr (tRand 0.02 0.06 g) 0 * tRand 0.1 2 g+          amp_mod = sinOsc kr (tRand 1 3 g / 60) 0 `in_range` (0.2, 0.5)+          s = sinOsc ar (lag (unitCps p) (rx * 2) + freq_mod) (tRand 0 (2 * pi) g)+          l = sinOsc kr o (tRand 0 pi g) * tRand 0.1 0.99 g+      in pan2 s l (lagUD g 0 1 * z * amp_mod)+in mix (voicer 16 f) * control kr "gain" 1.5++-- sinOsc ; event control ; id+let f (c,g,_,_,z,o,rx,_,p,_,_) =+      let freq_mod = sinOsc kr (tRandId (c,'α') 0.02 0.06 g) 0 * tRandId (c,'β') 0.1 2 g+          amp_mod = sinOsc kr (tRandId (c,'γ') 1 3 g / 60) 0 `in_range` (0.2, 0.5)+          s = sinOsc ar (lag (unitCps p) (rx * 2) + freq_mod) (tRandId (c,'δ') 0 (2 * pi) g)+          l = sinOsc kr o (tRandId (c,'ε') 0 pi g) * tRandId (c,'ζ') 0.1 0.99 g+      in pan2 s l (lagUD g 0 1 * z * amp_mod)+in mix (voicer 16 f) * control kr "gain" 1.5++-- sinOsc ; control_m inputs+let f = control_m kr "mnn" 69 (0,127,"lin")+    a = control_m kr "amp" 0.25 (0,1,"amp")+in sinOsc ar (midiCps f) 0 * a++-- sinOsc ; ln 2021-04-05 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+    o1 = sinOsc ar 10000 0 * geom 4 0.01 8+    o2 = sinOsc ar (lfSaw ar (geom 4 0.05 2) 0 * geom 4 1000 2) 0+in mix (o1 * o2) * 1/4 * 0.1++-- sinOsc ; ln 2021-04-17 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+    mkenv l t = envGen ar 1 1 0 1 DoNothing (envelope l t [EnvSin,EnvSin])+    o1 = mix (sinOsc ar (geom 10 1000 1.4) 0 * mkenv [1,0,1] [10,10]) * 0.2+    o2 = mix (sinOsc ar (geom 10 800 1.4) 0 * mkenv [0,1,0] [10,10]) * 0.2+    o3 = pulse ar (1/4) 0.5+in (o1 + o2 + o3) * 0.1++-- sinOsc ; https://scsynth.org/t/what-kind-of-synthesis-is-this/4318/30+let mratio = 4+    amp = 0.2+    boost = 2+    tr = impulse ar (lfNoise2 kr 1 `in_exprange` (1, 100)) 0+    envgen x = let c = EnvNum (-8) in envGen ar tr 1 0 1 DoNothing (envPerc_c 0.0001 x 1 (c,c))+    freq = (midiCps 60.5 / 16) * (linExp (envgen 0.4) 0 1 1 40)+    ix = mouseY kr 0 2 Linear 0.1+    sig = sinOsc ar freq (sinOsc ar (freq * mratio) 0 * ix)+in tanh (pan2 sig 0 boost) * envgen 1 * amp++---- ; drawings+Ui.ui_baudline (4096 * 1) 50 "linear" 2+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 1.0 (sinOsc ar 1 0)+(midiCps 60.5 / 16)
+ Help/Ugen/sinOscFB.help.hs view
@@ -0,0 +1,13 @@+-- sinOscFB+let x = mouseX kr 0 4 Linear 0.2+in sinOscFB ar (mce2 400 301) x * 0.1++-- sinOscFB+let y = mouseY kr 10 1000 Exponential 0.2+    x = mouseX kr (pi/2) pi Linear 0.2+in sinOscFB ar y x * 0.1++-- sinOscFB+let y = mouseY kr 1 1000 Exponential 0.2+    x = mouseX kr (pi/2) pi Linear 0.2+in sinOscFB ar (100 * sinOscFB ar y 0 + 200) x * 0.1
+ Help/Ugen/sineShaper.help.hs view
@@ -0,0 +1,5 @@+-- sineShaper+X.sineShaper (sinOsc ar (mce2 400 404) 0 * 0.2) (mouseX kr 0 1 Linear 0.2)++-- sineShaper+X.sineShaper (soundIn 0) (mouseX kr 0 1 Linear 0.2)
+ Help/Ugen/sinh.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "SinH"+Sound.Sc3.Plot.plot_fn_r1_ln sinh (-4,4)
+ Help/Ugen/slew.help.hs view
@@ -0,0 +1,15 @@+-- slew+let z = lfPulse ar 800 0 0.5 * 0.1 in mce2 z (slew z 4000 4000)++-- slew+let z = saw ar 800 * 0.1 in mce2 z (slew z 400 400)++-- slew+let x = mouseX kr 200 12000 Exponential 0.2+    y = mouseY kr 200 12000 Exponential 0.2+in mce2 (slew (0 - saw ar 440) x y * 0.05) (slew (lfPulse ar 800 0 0.5) x y * 0.1)++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.025 (lfPulse ar 800 0 0.5)+Sound.Sc3.Plot.plot_ugen1 0.025 (slew (lfPulse ar 800 0 0.5) 4000 4000)+Sound.Sc3.Plot.plot_ugen1 0.025 (slew (lfPulse ar 800 0 0.5) 500 500)
+ Help/Ugen/slope.help.hs view
@@ -0,0 +1,11 @@+-- slope+let a = lfNoise2Id 'α' ar 2 {- quadratic noise -}+    b = slope a {- first derivative, line segments -}+    c = slope b {- second derivative, constant segments -}+    s = 0.0002+    f = mce [a, b * s, c * s * s] * 220 + 220+in mix (sinOsc ar f 0 * 0.1)++---- ; drawings+let {a = lfNoise2Id 'α' ar 2000;b = slope a;c = slope b;m = 0.0002}+Sound.Sc3.Plot.plot_ugen 0.05 (mce [a,b * m,c * m * m])
+ Help/Ugen/sms.help.hs view
@@ -0,0 +1,9 @@+-- sms ; sine reconstruction left channel, noises on right (sample rate must be 44100)+let z = soundIn 0+    y = mouseY kr 1 50 Linear 0.2+    x = mouseX kr 0.5 4 Linear 0.2+in X.sms {- ar -} z 50 y 8 0.3 x 0 0 0 1 (-1)++-- sms ; default param+let z = soundIn 0+in X.sms {- ar -} z 80 80 4 0.2 1 0 0 0 1 (-1)
+ Help/Ugen/sndfileIn.help.hs view
@@ -0,0 +1,14 @@+-- sndfileDiskIn ; either diskIn or vDiskIn with "brackets" to allocate and read and then close and free the sndfile buffer+sinOsc ar 440 0 * 0.05 + sndfileDiskIn ("dsk", 0, [0, 1]) "20.2-LW+RD.flac" Nothing Loop++-- sndfileIn ; diskIn form of sndfileDiskIn+sinOsc ar 440 0 * 0.05 + sndfileIn ("dsk", 0, []) "20.2-LW+RD.flac" Loop++-- sndfileVarIn ; vDiskIn with "brackets" ; if readChan is empty all channels are read+sinOsc ar 440 0 * 0.05 + sndfileVarIn ("dsk", 0, []) "20.2-LW+RD.flac" (sinOsc kr 0.1 0 * 0.015 + 1) Loop++-- sndfileIn ; requires=buf ; a sndfileIn graph is equal to the below, excepting that here the number of channels is written out+sinOsc ar 440 0 * 0.05 + diskIn 2 (control kr "dsk" 0) Loop++---- ; print scsynth, the interpreter value that holds the reference that stores the end brackets+scsynthPrint scsynth
+ Help/Ugen/sndfileRead.help.hs view
@@ -0,0 +1,21 @@+---- sndfileRead ; buffer identifier with "brackets" to hold b_allocRead and b_free messages+let (buf, nc, _, _) = sndfileRead ("buf", 0, []) "metal.wav" -- metal.wav is mono ; pf-c5.aif is stereo+    tr = impulse ar (bufSampleRate kr buf / bufFrames kr buf) 0+    ph = phasor ar tr (bufSampleRate kr buf / sampleRate) 0 (bufFrames kr buf) 0+in bufRdL nc ar buf ph NoLoop++---- sndfileRead ; as above but use constants for sample rate and frame count+let (buf, nc, sr, nf) = sndfileRead ("buf", 0, []) "pf-c5.aif" -- metal.wav is mono ; pf-c5.aif is stereo+    tr = impulse ar (sr / nf) 0+    ph = phasor ar tr (sr / sampleRate) 0 nf 0+in bufRdL nc ar buf ph NoLoop++-- sndfileRead ; sine wave control of playback rate, negative rate plays backwards+let (buf, nc, _, _) = sndfileRead ("buf", 0, []) "pf-c5.aif"+    f = xLine kr 0.2 8 30 RemoveSynth+    r = fSinOsc kr f 0 * 3 + 0.6+    s = bufRateScale kr buf * r+in playBuf nc ar buf s 1 0 Loop DoNothing++---- ; print scsynth, the interpreter value that holds the reference that stores the end brackets+scsynthPrint scsynth
+ Help/Ugen/softClip.help.hs view
@@ -0,0 +1,2 @@+-- softClip+softClip (fSinOsc ar 500 0 * xLine kr 0.1 10 10 RemoveSynth) * 0.25
+ Help/Ugen/softClipAmp.help.hs view
@@ -0,0 +1,6 @@+-- softClipAmp4+X.softClipAmp4 (sinOsc ar 220 0 * 0.1) (mouseX kr 1 16 Linear 0.2)++-- softClipAmp4+X.softClipAmp4 (soundIn 0) (mouseX kr 1 8 Linear 0.2)+
+ Help/Ugen/sonLPC.help.hs view
@@ -0,0 +1,21 @@+-- sonLPC+let nf = 1024 * 2+    hop = 1 / 4+    poles = mouseY kr 4 80 Linear 0.2 -- MAXPOLES=80+    sig = soundIn 0+    chain = X.sonLPC ar (localBufId 'α' 1 nf) sig hop poles+    freq = mouseX kr 50 200 Linear 0.2+    exci = saw ar freq+in pan2 (X.sonLPCSynthIn ar chain exci) 0 1++-- sonLPC ; event control+let f (c,g,x,y,z,o,_,_,_,_,_) =+      let nf = 1024 * 2+          hop = 1 / 4+          poles = linLin y 0 1 5 80+          sig = soundIn 0 * 4+          chain = X.sonLPC ar (localBufId c 1 nf) sig hop poles+          freq = midiCps (x * 24 + 36)+          exci = saw ar freq * z * g+      in pan2 (X.sonLPCSynthIn ar chain exci) (o * 2 - 1) 1+in mix (voicer 4 f) * control kr "gain" 1
+ Help/Ugen/sortBuf.help.hs view
@@ -0,0 +1,7 @@+-- sortBuf ; gradual erosion+let bufnum = 0+in pan2 (X.sortBuf ar bufnum (lfNoise0 kr 5 * 50000 + 60000) 0) 0 0.1++---- ; load sndfile+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "a11wlk01.wav") 0 0))
+ Help/Ugen/sos.help.hs view
@@ -0,0 +1,45 @@+-- sos ; same as twopole+let theta = line kr (0.2 * pi) pi 5 RemoveSynth+    rho = line kr 0.6 0.99 5 RemoveSynth+    b1 = 2 * rho * cos theta+    b2 = - (rho * rho)+in sos (lfSaw ar 200 0 * 0.1) 1 0 0 b1 b2++-- sos ; http://www.earlevel.com/main/2011/01/02/biquad-formulas/+let fc = 100+    sr = 48000+    k = tan (pi * fc / sr)+    q = 0.707+    norm = 1 / (1 + k / q + k * k)+    a0 = k * k * norm+    a1 = 2 * a0+    a2 = a0+    b1 = 2 * (k * k - 1) * norm+    b2 = (1 - k / q + k * k) * norm+in sos (whiteNoiseId 'α' ar * 0.2) a0 a1 a2 (- b1) (- b2)++-- sos+let b1 = mouseY kr 1.45 1.998 Linear 0.2+    b2 = mouseX kr (-0.999) (-0.9998) Linear 0.2+in sos (impulse ar 2 0) 0.0 0.05 0.0 b1 b2++-- sos+let f (_,w,x,y,z,o,_,_,_,_,_) =+      let b1 = linLin y 0 1 1.45 1.998+          b2 = linLin x 0 1 (-0.999) (-0.9998)+      in pan2 (sos (trig (k2a w) 0) 0.0 0.05 0.0 b1 b2) (o * 2 - 1) 8+in mix (voicer 16 f) * control kr "gain" 1++-- sos+let f (_,w,x,y,z,o,_,_,_,_,_) =+      let freq = midiCps (x * 25 + 48)+          rq = 0.002 + (y * 0.004)+          b1 = 1.987 * 0.9889999999 * cos 0.09+          b2 = -0.998057+          im = decay (trig1 (k2a w) sampleDur) 0.1+          s1 = sos im 0.3 0.0 0.0 b1 b2+          s2 = rhpf (s1 * 0.8) freq rq+          s3 = s2 + delayC (rhpf (s1 * 0.9) (freq * 0.99999) (rq * 0.999)) 0.02 0.01223+          s4 = decay2 s3 0.4 0.3 * s2+      in pan2 s4 (o * 2 - 1) 0.1+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/soundIn.help.hs view
@@ -0,0 +1,14 @@+-- soundIn ; composite of in' and numOutputBuses+soundIn 0 * 0.5++-- soundIn ; copy input from 1 & 0 to outputs 0 & 1.+soundIn (mce2 1 0) * 0.5++-- ; io matrix (0->0,1->2,2->1,3->3)+--+--   0 1 2 3+-- 0 *+-- 1     *+-- 2   *+-- 3       *+soundIn (mce [0, 2, 1, 3])
+ Help/Ugen/specCentroid.help.hs view
@@ -0,0 +1,8 @@+-- specCentroid ; as the number of harmonics increases, the centroid is pushed higher+let f0 = mouseY kr 1000 100 Exponential 0.2+    nh = mouseX kr 1 100 Exponential 0.2+    z = blip ar f0 nh+    f = fft' (localBufId 'α' 2048 1) z+    c = specCentroid kr f+    p = pollExt (impulse kr 1 0) c 0 (label "c")+in sinOsc ar p 0 * 0.1
+ Help/Ugen/specFlatness.help.hs view
@@ -0,0 +1,8 @@+-- specFlatness+let z = soundIn 0+    g = 1 {- gain, set as required -}+    a = pollExt 1 (X.wAmp kr z 0.05) 0 (label "a")+    f = fft' (localBufId 'α' 2048 1) z+    c = pollExt 1 (specCentroid kr f) 0 (label "c")+    w = pollExt 1 (specFlatness kr f) 0 (label "w")+in bpf (pinkNoiseId 'a' ar) c w * a * g
+ Help/Ugen/spectralEntropy.help.hs view
@@ -0,0 +1,12 @@+-- spectralEntropy ; note numChannels and numBands must be equal+let sig = soundIn 0+    chn = fft' (localBufId 'α' 1 2048) sig+    entropy = X.spectralEntropy 1 kr chn 2048 1+in pan2 (blip ar 100 (sqrt entropy * 10)) 0 0.1++-- spectralEntropy+let sig = soundIn 0+    amp = amplitude kr sig 0.01 0.01+    chn = fft' (localBufId 'α' 1 1024) sig+    entropy = X.spectralEntropy 10 kr chn 1024 10 * (min amp 0.2) * 5+in splay (blip ar (sqrt entropy * 200) (sqrt entropy)) 1 0.1 0 True
+ Help/Ugen/splay.help.hs view
@@ -0,0 +1,41 @@+-- splay+splay (sinOsc ar (mce [110,220,440,880]) 0 * 0.1) 1 1 0 True++-- splay+mix (splay (pan2 (sinOsc ar (mce [110,220,440,880]) 0) 0 0.075) 1 1 0 True)++-- splay ; composite UGen ; inArray spread=1 level=1 center=0 levelComp=true ; mouse control+let i = 6+    r = map (\e -> randId e 10 20) (take i ['α'..])+    n = lfNoise2Id 'β' kr (mce r)+    x = mouseX kr (-1) 1 Linear 0.1+    y = mouseY kr 1 0 Linear 0.1+    ci = constant . fromIntegral+    f = mce [1 .. ci i] + 3 * 100+    o = sinOsc ar (n * 200 + f) 0+in splay o y 0.2 x True++-- splay ; single channel input+let x = mouseX kr (-1) 1 Linear 0.1+    y = mouseY kr 1 0 Linear 0.1+    o = sinOsc ar (lfNoise2Id 'α' kr 6 * 9 + 440) 0 * 0.1+in splay o y 0.2 x True++-- splay ; n_set control+let i = 10+    s = control kr "spread" 1+    l = control kr "level" 0.2+    c = control kr "center" 0+    r = map (\e -> randId e 10 20) (take i ['α'..])+    ci = constant . fromIntegral+    f = mce [1 .. ci i] + 3 * 100+    n = lfNoise2Id 'β' kr (mce r) * 200 + f+in splay (sinOsc ar n 0) s l c True++---- ; n_set control+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set (-1) [("spread",1),("center",0)])) -- full stereo+withSc3 (sendMessage (n_set (-1) [("spread",0.5),("center",0)])) -- less wide+withSc3 (sendMessage (n_set (-1) [("spread",0),("center",0)])) -- mono center+withSc3 (sendMessage (n_set (-1) [("spread",0.5),("center",0.5)])) -- from center to right+withSc3 (sendMessage (n_set (-1) [("spread",0),("center",-1)])) -- all left
+ Help/Ugen/spreader.help.hs view
@@ -0,0 +1,15 @@+-- spreader+let theta = pi / 2+    filtsPerOctave = 8+in X.spreader ar (pinkNoiseId 'α' ar * 0.1) theta filtsPerOctave++-- spreader+let theta = mouseX kr 0 (pi / 2) Linear 0.2+    filtsPerOctave = 8+in X.spreader ar (pinkNoiseId 'α' ar * 0.1) theta filtsPerOctave++-- spreader+let in_ = sinOsc ar (mouseX kr 110 880 Exponential 0.2) 0 * 0.1+    theta = pi / 2+    filtsPerOctave = 8+in X.spreader ar in_ theta filtsPerOctave
+ Help/Ugen/spring.help.hs view
@@ -0,0 +1,51 @@+-- spring ; mouse control ; button=gate ; x=spring-constant ; y=damping+let inforce = k2a (mouseButton kr 0 1 0) `greater_than` 0+    k = mouseX kr 0.1 20 Exponential 0.2+    d = mouseY kr 0.00001 0.1 Exponential 0.2+    outforce = spring ar inforce k d+    freq = outforce * 400 + 500 -- modulate frequency with the force+in sinOsc ar freq 0 * 0.1++-- spring ;several springs in series+let inforce = k2a (mouseButton kr 0 1 0) `greater_than` 0+    k = mouseX kr 0.1 20 Exponential 0.2+    d = mouseY kr 0.00001 0.1 Exponential 0.2+    m0 = spring ar inforce k 0.01+    m1 = spring ar m0 (0.5 * k) d+    m2 = spring ar m0 (0.6 * k + 0.2) d+    m3 = spring ar (m1 - m2) 0.4 d+in sinOsc ar (m3 * 200 + 500) 0 * 0.1 -- modulate frequency with the force++-- spring ; modulating a resonating string+let k = mouseX kr 0.5 100 Exponential 0.2+    d = mouseY kr 0.0001 0.1 Exponential 0.2+    t = dustId 'α' ar 2+    m0 = spring ar (toggleFF t) k 0.01+    m1 = spring ar m0 (0.5 * k) d+    m2 = spring ar m0 (0.6 * k) d+    m3 = spring ar (mce2 m1 m2) (0.4 * k) d+    m4 = spring ar (m3 - m1 + m2) (0.1 * k) d+in combL t 0.1 (linLin m4 (-10) 10 (1/8000) (1/100)) 12++-- spring ; event control+let f (_,w,x,y,z,o,rx,_,_,_,_) =+      let k = linExp x 0 1 0.1 20+          d = linExp y 0 1 0.00001 0.065+          s = spring ar (k2a w) k d+          freq = midiCps (x * 24 + 48) + (s * 800 * rx) -- modulate frequency with the force+      in pan2 (sinOsc ar freq 0) (o * 2 - 1) (w * z * z)+in mix (voicer 16 f) * control kr "gain" 2++-- spring ; event control+let f (_,w,x,y,z,_,_,_,_,_,_) =+      let k = linExp x 0 1 0.5 100+          d = linExp y 0 1 0.0001 0.1+          t = trig (k2a w) 0+          m0 = spring ar (k2a w) k 0.01+          m1 = spring ar m0 (0.5 * k) d+          m2 = spring ar m0 (0.6 * k) d+          m3 = spring ar (mce2 m1 m2) (0.4 * k) d+          m4 = spring ar (m3 - m1 + m2) (0.1 * k) d+          dt = linLin m4 (-10) 10 (x/8000) (x/100)+      in combL (trig (k2a w) (z * 0.05)) 0.1 dt ((latch y w + 1) * 9)+in mix (voicer 16 f) * control kr "gain" 2
+ Help/Ugen/sqrDif.help.hs view
@@ -0,0 +1,2 @@+-- sqrDif+(fSinOsc ar 800 0 `sqrDif` fSinOsc ar (xLine kr 200 500 5 DoNothing) 0) * 0.1
+ Help/Ugen/sqrSum.help.hs view
@@ -0,0 +1,2 @@+-- sqrSum+(fSinOsc ar 800 0 `sqrSum` fSinOsc ar (xLine kr 200 500 5 DoNothing) 0) * 0.1
+ Help/Ugen/squiz.help.hs view
@@ -0,0 +1,25 @@+-- squiz ; of sin oscillator+let zmax = 10+    x = mouseX kr 1 10 Exponential 0.2+    y = mouseY kr 1 zmax Linear 0.2+in X.squiz (sinOsc ar 440 0) x y 0.1 * 0.1++-- squiz ; of soundin+let zmax = 100+    s = sinOsc ar 440 0+    x = mouseX kr 1 10 Exponential 0.2+    y = mouseY kr 1 zmax Linear 0.2+in X.squiz (soundIn 0) x y 0.1 * 0.1++-- squiz ; of buffer ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+    zmax = 100+    s = sinOsc ar 440 0+    x = mouseX kr 1 10 Exponential 0.2+    y = mouseY kr 1 zmax Linear 0.2+    r = bufRateScale kr b+    p = playBuf nc ar b (r * 0.5) 1 0 Loop DoNothing+in X.squiz p x y 0.1 * 0.1++---- ; setup ; nc=2+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/standard2DL.help.hs view
@@ -0,0 +1,11 @@+-- standard2DL ; mouse-controlled param+let x0 = 4.9789799812499+    y0 = 5.7473416156381+in X.standard2DL ar 11025 44100 (mouseX kr 0.9 4 Linear 0.2) x0 y0 * 0.3++-- standard2DL ; as a frequency control+let x0 = 4.9789799812499+    y0 = 5.7473416156381+    k = mouseX kr 0.9 4 Linear 0.2+    f = X.standard2DL ar 10 20 k x0 y0 * 800 + 900+in sinOsc ar f 0 * 0.3
+ Help/Ugen/standardL.help.hs view
@@ -0,0 +1,11 @@+-- standardL+standardL ar (sampleRate / 2) 1.0 0.5 0 * 0.1++-- standardL ; vary frequency+standardL ar (mouseX kr 20 sampleRate Linear 0.2) 1 0.5 0 * 0.1++-- standardL ; mouse-controlled param+standardL ar (sampleRate / 2) (mouseX kr 0.9 4 Linear 0.2) 0.5 0 * 0.1++-- standardL ; frequency control+sinOsc ar (standardL ar 40 (mouseX kr 0.9 4 Linear 0.2) 0.5 0 * 800 + 900) 0 * 0.1
+ Help/Ugen/stepper.help.hs view
@@ -0,0 +1,40 @@+-- stepper+let i = impulse kr 10 0+    f = stepper i 0 4 16 (-3) 4 * 100+in sinOsc ar f 0 * 0.1++-- stepper ; mouse button press increments integer frequency multiplier+let tr = trig1 (mouseButton kr 0 1 0) controlDur+    fr = 55 * stepper tr 0 1 17 1 1+in sinOsc ar fr 0 * 0.1++-- stepper ; with bufRd for sequencing+let compose = foldl (flip (.)) id+    rvbId z0 s =+      let f z1 i =+            let dly = mce [randId ((z0,z1),'α') 0 0.5+                          ,randId ((z0,z1),'β') 0 0.5]+            in allpassN i 0.05 dly (randId z1 1.5 2)+      in compose (map f (id_seq 5 'γ')) s+    rate = mouseX kr 1.75 2.25 Exponential 0.1+    clock = impulse kr rate 0+    envl = decay2 clock 0.002 2.5+    indx = stepper clock 0 0 15 1 0+    freq_l = [97.999,195.998,523.251,466.164,195.998+             ,233.082,87.307,391.995,87.307,261.626+             ,195.998,77.782,233.082,195.998,97.999+             ,155.563]+    freq_b = asLocalBufId 'a' freq_l+    freq = bufRdN 1 kr freq_b indx Loop+    ffreq = lag2 freq 0.1 + mce [0,0.3]+    lfo = sinOsc kr 0.2 (mce [0,pi/2]) * 0.0024 + 0.0025+    top = mix (lfPulse ar (freq * mce [1,1.5,2]) 0 0.3)+    chn = [\s -> rlpf s ffreq 0.3 * envl+          ,\s -> rlpf s ffreq 0.3 * envl+          ,\s -> s * 0.5+          ,\s -> combL s 1 (0.66 / rate) 2 * 0.8 + s+          ,\s -> s + (rvbId 'γ' s * 0.3)+          ,\s -> leakDC s 0.1+          ,\s -> delayL s 0.1 lfo + s+          ,\s -> onePole s 0.9]+in compose chn top
+ Help/Ugen/stkBandedWG.help.hs view
@@ -0,0 +1,23 @@+-- stkBandedWG ; default param+X.stkBandedWG ar 440.0 0.0 0.0 0.0 0.0 64.0 0.0 0.0 1.0++-- stkBandedWG ; default param ; instr=3+X.stkBandedWG ar 440.0 3.0 0.0 0.0 0.0 64.0 0.0 0.0 1.0++-- stkBandedWG+let tr = impulse kr (mouseX kr 0.5 12 Linear 0.2) 0 - 0.5+    freq = midiCps (tExpRandId 'α' 24 96 tr)+    instr = 3 -- Uniform Bar = 0, Tuned Bar = 1, Glass Harmonica = 2, Tibetan Bowl = 3+    modalresonance = tRandId 'ζ' 0 127 tr+in X.stkBandedWG ar freq instr 0 0 0 modalresonance 0 0 tr++-- stkBandedWG ; texture=overlap,4,3,4,inf+let freq = randId 'α' 110 440+    instr = iRandId 'β' 1 3+    bowpressure = iRandId 'γ' 32 96+    bowmotion = randId 'δ' 32 96+    integration = randId 'ε' 0 64+    modalresonance = randId 'ζ' 32 96+    bowvelocity = randId 'η' 64 96+    setstriking = 127 -- setstriking: 0 = Plucked, 127 = Bowed+in X.stkBandedWG ar freq instr bowpressure bowmotion integration modalresonance bowvelocity setstriking 1
+ Help/Ugen/stkInst.help.hs view
@@ -0,0 +1,119 @@+-- stkInst ; bowed ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Bowed.html+let f (_,g,_,y,z,o,rx,_,p,_,_) =+      let kBowPressure = 2+          kBowPosition = 4+          kVibratoFrequency = 11+          kVibratoGain = 1+          kVolume = 128+          args = [kBowPressure,1 + z * 127+                 ,kBowPosition,1 + y * 127+                 ,kVibratoFrequency,50+                 ,kVibratoGain,1+                 ,kVolume,1 + z * 127]+          s = X.stkInst ar (unitCps p) g (1 - rx) 0.5 (X.stkAt "Bowed") (mce args)+      in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; brass ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Brass.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let kLipTension = 2+          kSlideLength = 4+          kVibratoFrequency = 11+          kVibratoGain = 1+          kVolume = 128+          args = [kLipTension,latch rx g * 127+                 ,kSlideLength,latch y g * 127+                 ,kVibratoFrequency,ry * 48+                 ,kVibratoGain,1+                 ,kVolume,6 + z * 24]+          s = X.stkInst ar (unitCps p) g (1 - rx) 0.5 (X.stkAt "Brass") (mce args)+      in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 2++-- stkInst ; clarinet ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Clarinet.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let kReedStiffness = 2+          kNoiseGain = 4+          kVibratoFrequency = 11+          kVibratoGain = 1+          kBreathPressure = 128+          args = [kReedStiffness,y * 32+                 ,kNoiseGain,rx * 32+                 ,kVibratoFrequency,50+                 ,kVibratoGain,1+                 ,kBreathPressure,linLin z 0 1 48 64]+          s = X.stkInst ar (unitCps p) g (1 - ry) 0.5 (X.stkAt "Clarinet") (mce args)+      in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; flute ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Flute.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let kJetDelay = 2+          kNoiseGain = 4+          kVibratoFrequency = 11+          kVibratoGain = 1+          kBreathPressure = 128+          args = [kJetDelay,y * 128+                 ,kNoiseGain,rx * 64+                 ,kVibratoFrequency,(1 - ry) * 64+                 ,kVibratoGain,ry * 16+                 ,kBreathPressure,linLin z 0 1 48 96]+          s = X.stkInst ar (unitCps p) g 0.75 0.5 (X.stkAt "Flute") (mce args)+      in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 0.5++-- stkInst ; mandolin ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Mandolin.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let kBodySize = 2+          kPluckPosition = 4+          kStringDetuning = 1+          args = [kBodySize,ry * 127+                 ,kPluckPosition,y * 127+                 ,kStringDetuning,rx * 127]+          s = X.stkInst ar (unitCps p * 1.5) g (z * 2) 0.5 (X.stkAt "Mandolin") (mce args)+      in pan2 s (o * 2 - 1) (lagUD g 0 5)+in mix (voicer 16 f) * control kr "gain" 2++-- stkInst ; mesh2D ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Mesh2D.html+let f (_,g,x,y,z,o,rx,ry,p,_,_) =+      let kXDimension = 2+          kYDimension = 4+          kMeshDecay = 11+          kXYInputPosition = 1+          args = [kXDimension,latch x g * 127+                 ,kYDimension,latch y g * 127+                 ,kMeshDecay,(1 - z) * 127+                 ,kXYInputPosition,rx * 127]+          s = X.stkInst ar (unitCps p) g (z * 2) 0 (X.stkAt "Mesh2D") (mce args)+      in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- stkInst ; plucked ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Plucked.html+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let args = [0] -- cannot be []...+          s = X.stkInst ar (unitCps p) g (0.5 + z * 0.5) (y * 0.01) (X.stkAt "Plucked") (mce args)+      in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; sitar ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Sitar.html+let f (_,g,_,y,z,o,_,_,p,_,_) =+      let args = [0] -- cannot be []...+          s = X.stkInst ar (unitCps (latch p g)) g (0.5 + z * 0.5) (y * 0.01) (X.stkAt "Sitar") (mce args)+      in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; voicForm ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1VoicForm.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+      let kVoicedUnvoicedMix = 2+          kVowelPhonemeSelection = 4+          kVibratoFrequency = 11+          kVibratoGain = 1+          kLoudness = 128+          args = [kVoicedUnvoicedMix,lag rx 0.2 * 127+                 ,kVowelPhonemeSelection,lag y 0.2 * 16]+          s = X.stkInst ar (unitCps p) g 1 0 (X.stkAt "VoicForm") (mce args)+      in pan2 s (o * 2 - 1) (z * lagUD g 0.1 2)+in mix (voicer 16 f) * control kr "gain" 1++---- ; set globals+X.stkGlobals ar 1 1 (label "/home/rohan/opt/src/supercollider/sc3-plugins/external_libraries/stk/rawwaves")
+ Help/Ugen/stkMandolin.help.hs view
@@ -0,0 +1,25 @@+-- stkMandolin+let x = mouseX kr 0.25 16 Linear 0.2+    tr = impulse kr x 0 - 0.5+    freq = midiCps (tiRandId 'α' 32 96 tr)+    bodysize = tRandId 'β' 0 127 tr+    pickposition = tRandId 'γ' 0 127 tr+    stringdamping = tRandId 'δ' 0 127 tr+    stringdetune = tRandId 'ε' 0 127 tr+    aftertouch = tRandId 'ζ' 0 127 tr+    m = X.stkMandolin ar freq bodysize pickposition stringdamping stringdetune aftertouch tr+in pan2 m (tRandId 'η' (-1) 1 tr) 0.5++-- stkMandolin+let x = mouseX kr 3 16 Linear 0.2+    tr = impulse kr x 0 - 0.5 -- trig+    tr3 = pulseDivider tr 3 0+    freq = midiCps (tiRandId 'α' 54 66 tr)+    bodysize = tRandId 'β' 72 94 tr3+    pickposition = tRandId 'γ' 32 42 tr3+    stringdamping = tRandId 'δ' 64 72 tr3+    stringdetune = tRandId 'ε' 0 4 tr3+    aftertouch = tRandId 'ζ' 2 8 tr3+    m = X.stkMandolin ar freq bodysize pickposition stringdamping stringdetune aftertouch tr+in pan2 m (tRandId 'η' (-1) 1 tr) 0.5+
+ Help/Ugen/stkModalBar.help.hs view
@@ -0,0 +1,35 @@+-- stkModalBar ; https://ccrma.stanford.edu/software/stk/classstk_1_1ModalBar.html+let x = mouseX kr 0.25 12 Linear 0.2+    tr = impulse kr x 0 - 0.5+    freq = midiCps (tiRandId 'α' 25 96 tr)+    instrument = tiRandId 'β' 0 9 tr -- Marimba, Vibraphone, Agogo, Wood1, Reso, Wood2, Beats, Two Fixed, Clump+    stickhardness = tRandId 'γ' 0 127 tr+    stickposition = tRandId 'δ' 0 127 tr+    vibratogain = tRandId 'ε' 0 127 tr+    vibratofreq = tRandId 'ζ' 0 127 tr+    directstickmix = tRandId 'η' 0 127 tr+    volume = tRandId 'θ' 0 127 tr+in X.stkModalBar ar freq instrument stickhardness stickposition vibratogain vibratofreq directstickmix volume tr++-- stkModalBar+let x = mouseX kr 1 12 Linear 0.2+    tr = impulse kr x 0 - 0.5+    tr3 = pulseDivider tr 3 0+    freq = midiCps (tiRandId 'α' 52 64 tr)+    instrument = 1+    stickhardness = tRandId 'β' 10 50 tr3+    stickposition = tRandId 'γ' 40 80 tr3+    vibratogain = tRandId 'δ' 66 98 tr3+    vibratofreq = tRandId 'ε' 4 12 tr3+    directstickmix = tRandId 'ζ' 0 1 tr3+    volume = tRandId 'η' 16 48 tr3+in X.stkModalBar ar freq instrument stickhardness stickposition vibratogain vibratofreq directstickmix volume tr++-- stkModalBar ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+      let tr = g - 0.5+          freq = unitCps p+          instr = control kr "instrument" 4+          sig = X.stkModalBar ar freq instr ((1 - y) * 127) (y * 127) 64 64 (rx * 127) 127 tr+      in pan2 sig (o * 2 - 1) (latch z g * 3)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/stkMoog.help.hs view
@@ -0,0 +1,44 @@+-- stkMoog ; mouse trigger+let tr = mouseButton kr 0 1 0 - 0.5+    freq = midiCps (tiRandId 'α' 12 96 tr)+    filterQ = tRandId 'β' 0 127 tr+    sweeprate = tRandId 'γ' 0 127 tr+    vibfreq = tRandId 'δ' 0 127 tr+    vibgain = tRandId 'ε' 0 127 tr+    gain = tRandId 'ζ' 0 127 tr+in X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain tr * 0.5++-- stkMoog ; mouse control+let x = mouseX kr 0.25 16 Linear 0.2+    tr = impulse kr x 0 - 0.5+    freq = midiCps (tiRandId 'α' 24 72 tr)+    filterQ = tRandId 'β' 0 32 tr+    sweeprate = tRandId 'γ' 0 32 tr+    vibfreq = tRandId 'δ' 0 96 tr+    vibgain = tRandId 'ε' 0 16 tr+    gain = tRandId 'ζ' 0 127 tr+in X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain tr * 0.5++-- stkMoog ; sequence+let nsigId z l r f = range l r (lfNoise2Id z kr f)+    scl = asLocalBufId 'α' [0,2,3.2,5,7,9,10]+    mnn = 48 + degreeToKey scl (nsigId 'β' 0 15 0.35) 12+    freq = midiCps mnn+    filterQ = nsigId 'γ' 0 64 0.5+    sweeprate = nsigId 'δ' 0 64 0.5+    vibfreq = nsigId 'ε' 0 64 0.5+    vibgain = nsigId 'ζ' 0 16 0.5+    gain = nsigId 'η' 16 96 0.5+in X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain 1++-- stkMoog ; event control+let f (_,g,_,y,z,o,rx,ry,p,px,_) =+      let freq = midiCps (p * 127 + px)+          filterQ = y * 128+          sweeprate = rx * 16+          vibfreq = y * 64+          vibgain = ry * 4+          gain = linLin z 0 1 16 96+          sig = X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain 1+      in pan2 sig (o * 2 - 1) (lagUD g 0.01 0.25)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/stkPluck.help.hs view
@@ -0,0 +1,9 @@+-- stkPluck ; default param+let delete_when_silent s a t = mrg2 s (detectSilence s a t RemoveSynth)+in delete_when_silent (X.stkPluck ar 440 0.99) 0.001 0.5++-- stkPluck ; rand param ; texture=spawn,1,inf+let freq = midiCps (iRandId 'α' 32 96)+    decay_ = randId 'β' 0.95 0.99+    s = leakDC (X.stkPluck ar freq decay_) 0.995+in mrg2 s (detectSilence s 0.001 0.5 RemoveSynth)
+ Help/Ugen/stkShakers.help.hs view
@@ -0,0 +1,21 @@+-- stkShakers ; default param ; https://ccrma.stanford.edu/software/stk/classstk_1_1Shakers.html+X.stkShakers ar 0.0 64.0 64.0 64.0 64.0++-- stkShakers ; random param+let x = mouseX kr 0.25 4 Linear 0.2+    tr = impulse kr x 0 - 0.5+    instr = tRandId 'α' 0 23 tr+    energy = tRandId 'β' 0 127 tr+    decay_ = tRandId 'γ' 0 127 tr+    objects = tRandId 'δ' 0 127 tr+    resfreq = tRandId 'ε' 0 127 tr+in X.stkShakers ar instr energy decay_ objects resfreq++-- stkShakers ; noise param+let walkId z = linLin (lfNoise2Id z kr 0.75) (-1) 1+    instr = walkId 'α' 0 23+    energy = walkId 'β' 0 127+    decay_ = walkId 'γ' 0 127+    objects = walkId 'δ' 0 127+    resfreq = walkId 'ε' 0 127+in pan2 (X.stkShakers ar instr energy decay_ objects resfreq) (lfNoise2Id 'ζ' kr 0.75) 1
+ Help/Ugen/streson.help.hs view
@@ -0,0 +1,11 @@+-- streson ; http://www.csounds.com/manual/html/streson.html+let z = lfSaw ar (mce2 220 180) 0 * 0.2+    dt = recip (linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 377)+in X.streson z dt 0.9 * 0.1++-- streson ; c.f. Sound.Sc3.Data.Modal.modal_frequency_ratios+let dt = recip (linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 377)+in X.streson (soundIn 0) dt 0.9 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (20,1) 16.0 (recip (linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 377))
+ Help/Ugen/stringVoice.help.hs view
@@ -0,0 +1,19 @@+-- stringVoice+let pan = 0+    freq = 100+    trig = dust2Id 'α' kr 7+    infsustain = 0+    accent = tRandId 'β' 0 1 trig+    structure = tRandId 'γ' 0 1 trig+    brightness = tRandId 'δ' 0 0.5 trig+    damping = tRandId 'ε' 0.1 0.5 trig+    sig = X.stringVoice ar trig infsustain freq accent structure brightness damping+in pan2 sig pan 1++-- stringVoice ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = midiCps (x * 25 + 36)+          tr = trig g controlDur+          sig = X.stringVoice ar tr 0 freq z y rx (ry * 2)+      in pan2 sig (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/sub.help.hs view
@@ -0,0 +1,10 @@+-- sub (-)+let o = fSinOsc ar 800 0+    n = pinkNoiseId 'α' ar+in (o - n) * 0.1++-- sub ; dc offset+fSinOsc ar 440 0 * 0.1 - 0.5++-- sub ; optimise identity+(sinOsc ar 440 0 - 0) * 0.1
+ Help/Ugen/subsampleOffset.help.hs view
@@ -0,0 +1,13 @@+-- subsampleOffset; impulse train that can be moved between samples+let i = impulse ar 2000 0+    z = 4+    o = (1 - subsampleOffset) + mouseX kr 0 (z - 1) Linear 0.1+    r = delayC i (sampleDur * z) (sampleDur * o)+in mrg2 (out 0 (pan2 i (-1) 0.1)) (offsetOut 0 (pan2 r 1 0.1))++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 100 "audio" 0++{- Create two pulse trains and move one relative to the other.  When+cursor is at the left, the impulses are adjacent, on the right, they+are z samples apart.  View this with an oscilloscope. -}
+ Help/Ugen/sum3.help.hs view
@@ -0,0 +1,8 @@+-- sum3+sum3 (sinOsc ar 440 0) (sinOsc ar 441 0) (sinOsc ar 442 0) * 0.1++-- sum3 ; optimiser/re-writer applicable at ADD+(sinOsc ar 440 0 + sinOsc ar 441 0 + sinOsc ar 442 0) * 0.1++-- sum3+mix (sinOsc ar (mce [440 .. 442]) 0) * 0.1
+ Help/Ugen/sum4.help.hs view
@@ -0,0 +1,5 @@+-- sum4+sum4 (sinOsc ar 440 0) (sinOsc ar 441 0) (sinOsc ar 442 0) (sinOsc ar 443 0) * 0.1++-- sum4 ; optimiser/re-writer applicable at ADD+mix (sinOsc ar (mce [440 .. 443]) 0) * 0.1
+ Help/Ugen/sumSqr.help.hs view
@@ -0,0 +1,9 @@+-- sumSqr+let o1 = fSinOsc ar 800 0+    o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in sumSqr o1 o2 * 0.125++-- sumSqr ; written out+let o1 = fSinOsc ar 800 0+    o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (o1 * o1 + o2 * o2) * 0.125
+ Help/Ugen/summer.help.hs view
@@ -0,0 +1,7 @@+-- summer+sinOsc ar (X.summer (impulse kr 5 0) 1.5 0 0 * 100) 0 * 0.1++-- summer+let s_trig = dustId 'α' kr 5+    s_reset = impulse kr 0.5 0+in sinOsc ar (X.summer s_trig (mce2 0.5 0.25) s_reset 1 * 100) 0 * 0.1
+ Help/Ugen/svf.help.hs view
@@ -0,0 +1,33 @@+-- svf ; state variable filter+let signal = lfSaw ar (range 110 35 (lfSaw kr 2 0)) 0+    cutoff = mouseX kr 20 20000 Exponential 0.2+    res = mouseY kr 1 0 Linear 0.2+    k = control kr+    low = k "low" 0.1+    band = k "band" 0.0+    high = k "high" 0.0+    notch = k "notch" 0.0+    peak_ = k "peak" 0.0+in X.svf signal cutoff res low band high notch peak_++-- svf ; event control+let f (c,g,x,y,z,o,rx,_,p,px,_) =+      let signal = lfSaw ar (midiCps (p * 127 + px)) 0+          cutoff = linExp x 0 1 20 20000+          res = y+          ty = constant c+          low = (ty + 0) `modE` 5 * z+          band = (ty + 1) `modE` 5 * z+          high = (ty + 2) `modE` 5 * z+          notch = (ty + 3) `modE` 5 * z+          peak_ = (ty + 4) `modE` 5 * z+      in pan2 (X.svf signal cutoff res low band high notch peak_) (o * 2 - 1) (lagUD g 0.1 (rx * 9))+in mix (voicer 16 f) * control kr "gain" 0.2++---- ; control edits+msg k v = withSc3 (Sound.OSC.sendMessage (n_set1 (-1) k v))+msg "low" 0.0+msg "band" 0.0+msg "high" 0.0+msg "notch" 0.0+msg "peak" 0.1
+ Help/Ugen/svfBp.help.hs view
@@ -0,0 +1,17 @@+-- svfBp ; changing F+let f = xLine kr 20 20000 20 DoNothing+in X.svfBp (whiteNoiseId 'α' ar * 0.1) f 1++-- svfBp ; changing Q+let q = line kr 10 0.0001 20 RemoveSynth+in X.svfBp (whiteNoiseId 'α' ar * 0.1) 400 q++-- svfBp ; controls+X.svfBp (saw ar 200 * control kr "amp" 0.1) (control kr "freq" 440) (control kr "q" 1)++-- svfBp+let f = sinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in X.svfBp (saw ar 200 * 0.1) f (control kr "q" 1)++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (X.svfBp (whiteNoiseId 'α' ar) 900 1)
+ Help/Ugen/svfHp.help.hs view
@@ -0,0 +1,17 @@+-- svfHp ; changing F+let f = xLine kr 20000 20 20 RemoveSynth+in X.svfHp (whiteNoiseId 'α' ar * 0.1) f 1++-- svfHp ; changing Q+let q = line kr 2 0.0001 20 RemoveSynth+in X.svfHp (whiteNoiseId 'α' ar * 0.1) 12000 q++-- svfHp ; controls+X.svfHp (saw ar 200 * control kr "amp" 0.1) (control kr "freq" 440) (control kr "q" 1)++-- svfHp+let f = sinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in X.svfHp (saw ar 200 * 0.1) f (control kr "q" 1)++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (X.svfHp (whiteNoiseId 'α' ar) 12000 1)
+ Help/Ugen/svfLp.help.hs view
@@ -0,0 +1,17 @@+-- svfLp ; changing F+let f = xLine kr 20 20000 20 RemoveSynth+in X.svfLp (whiteNoiseId 'α' ar * 0.1) f 1++-- svfLp ; changing Q+let q = line kr 2 0.0001 20 RemoveSynth+in X.svfLp (whiteNoiseId 'α' ar * 0.1) 400 q++-- svfLp ; controls+X.svfLp (saw ar 200 * control kr "amp" 0.1) (control kr "freq" 440) (control kr "q" 1)++-- svfLp+let f = sinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in X.svfLp (saw ar 200 * 0.1) f (control kr "q" 1)++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (X.svfLp (whiteNoiseId 'α' ar) 900 1)
+ Help/Ugen/sweep.help.hs view
@@ -0,0 +1,54 @@+-- sweep ; using sweep to modulate sine frequency+let x = mouseX kr 0.5 20 Exponential 0.1+    t = impulse kr x 0+    f = sweep kr t 700 + 500+in sinOsc ar f 0 * 0.2++-- sweep ; using sweep to index into a buffer ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+    x = mouseX kr 0.5 20 Exponential 0.1+    t = impulse ar x 0+    p = sweep ar t (bufSampleRate kr b)+in bufRdL nc ar b p NoLoop++-- sweep ; backwards, variable offset ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+    n = lfNoise0Id 'α' kr 15+    x = mouseX kr 0.5 10 Exponential 0.1+    t = impulse ar x 0+    r = bufSampleRate kr b+    p = sweep ar t (negate r) + (bufFrames kr b * n)+in bufRdL nc ar b p NoLoop++-- sweep ; raising rate ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+    x = mouseX kr 0.5 10 Exponential 0.1+    t = impulse ar x 0+    r = sweep ar t 2 + 0.5+    p = sweep ar t (bufSampleRate kr b * r)+in bufRdL nc ar b p NoLoop++-- sweep ; f0 (sc-users, 2012-02-09)+let lf = range 0.01 1.25 (lfNoise2Id 'α' kr 1)+    du = duty ar lf 0 DoNothing lf+    tr = abs (hpz1 du) `greater_than` 0+    ph = sweep ar tr (1/du)+    fr = linExp ph 0 1 400 800+in sinOsc ar fr 0 * 0.2++-- sweep ; line segments, set start & end values, transition time and trigger, stops at end time+let tr = trigControl "tr" 1+    st = control kr "st" 440+    en = control kr "en" 880+    tm = control kr "tm" 2+    rt = ((en - st) / tm)+    sw = gate (sweep kr tr rt + st) (trig tr tm)+in sinOsc ar sw 0 * 0.2++---- ; send new line segments to running sweeper+withSc3 (Sound.Osc.sendMessage (n_set 1 [("st",660),("en",550),("tm",4),("tr",1)]))+withSc3 (Sound.Osc.sendMessage (n_set 1 [("st",110),("en",990),("tm",1),("tr",1)]))+withSc3 (Sound.Osc.sendMessage (n_set 1 [("tr",1)]))++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/switchDelay.help.hs view
@@ -0,0 +1,10 @@+-- switchDelay ; simple feedback delay+X.switchDelay (soundIn 0) 1 1 1 0.99 20++-- switchDelay ; simple feedback delay+X.switchDelay (soundIn 0) 1 0.7 0.4 0.6 20++-- switchDelay ; change the buffer read pointer periodically.+let ix = stepper (impulse kr 0.5 0) 0 0 3 1 0+    dt = select ix (mce [0.02,0.1,0.725,0.25])+in X.switchDelay (soundIn 0) 1 0.6 dt 0.7 20
+ Help/Ugen/syncSaw.help.hs view
@@ -0,0 +1,8 @@+-- syncSaw+let f = line kr 100 800 12 RemoveSynth+in syncSaw ar 100 f * 0.1++-- syncSaw ; mouse control+let sy_f = mouseY kr 80 220 Exponential 0.2+    sw_f = sy_f * mouseX kr 1 3 Linear 0.2+in syncSaw ar sy_f sw_f * 0.1
+ Help/Ugen/t2a.help.hs view
@@ -0,0 +1,15 @@+-- t2a+let tr = impulse kr (mouseX kr 1 100 Exponential 0.2) 0+in ringz (t2a tr 0) 800 0.01 * 0.4++-- t2a ; compare with k2a (oscilloscope)+let tr = impulse kr 200 0+in lag (mce2 (t2a tr 0) (k2a tr)) 0.001++-- t2a ; removing jitter by randomising offset+let tr = impulse kr (mouseX kr 1 100 Exponential 0.2) 0+    o = range 0 (blockSize - 1) (whiteNoiseId 'α' kr)+in ringz (t2a tr o) 880 0.1 * 0.4++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0
+ Help/Ugen/t2k.help.hs view
@@ -0,0 +1,2 @@+-- t2k+trig (t2k (dustId 'α' ar 4)) 0.1 * sinOsc ar 800 0 * 0.1
+ Help/Ugen/tBall.help.hs view
@@ -0,0 +1,19 @@+-- tBall ; x = step noise modulation rate ; y = gravity+let sf = lfNoise0Id 'α' ar (mouseX kr 0.5 100 Exponential 0.2)+    g = mouseY kr 0.01 10 Exponential 0.2+    t = tBall ar sf g 0.01 0.002+in ringz (t * 4) (mce2 600 645) 0.3++-- tBall ; x = sine modulation rate ; y = friction+let fr = mouseX kr 1 1000 Exponential 0.2+    h = mouseY kr 0.0001 0.001 Exponential 0.2+    g = lfNoise0Id 'α' kr 0.1 * 3 + 5+    f = tBall ar (sinOsc ar fr 0) g 0.01 h+in pan2 (ringz f 1400 0.04) 0 5++-- tBall ; x = friction ; y = gravity+let fr = linExp (sinOsc kr 0.1 0) (-1) 1 1 600+    h = mouseY kr 0.0001 0.001 Exponential 0.2+    g = mouseX kr 1 10 Exponential 0.2+    f = tBall ar (sinOsc ar fr 0) g 0.01 h+in pan2 (ringz f 1400 0.04) 0 5
+ Help/Ugen/tBetaRand.help.hs view
@@ -0,0 +1,17 @@+-- tBetaRand+let t = dustId 'α' kr 10+    f = X.tBetaRandId 'β' 300 3000 0.1 0.1 t+in sinOsc ar f 0 * 0.1++---- ; ERROR ; tBetaRand ; mouse control of parameters (...scsynth -> 100% CPU -> CRASH)+let t = dustId 'α' ar 10+    p1 = mouseX kr 1 5 Linear 0.2+    p2 = mouseY kr 1 5 Linear 0.2+    f = X.tBetaRandId 'β' 300 3000 p1 p2 t+in sinOsc ar f 0 * 0.1++---- ; ERROR ; audio rate crashes server+let t = dustId 'α' ar 100+    p1 = mouseX kr 1 5 Linear 0.2+    p2 = mouseY kr 1 5 Linear 0.2+in lag (X.tBetaRandId 'β' (-1) 1 p1 p2 t) (10 / 48000)
+ Help/Ugen/tBrownRand.help.hs view
@@ -0,0 +1,19 @@+-- tBrownRand+let t = dustId 'α' kr 10+    dist = mouseX kr 0 5 Linear 0.2+    f = X.tBrownRandId 'β' 300 3000 1 dist t+in sinOsc ar f 0 * 0.1++-- tBrownRand+let t = dustId 'α' kr 10+    n = X.tBrownRandId 'β' 0 1 0.2 0 t+    f = linExp n 0 1 300 3000+    o = sinOsc ar f 0+    l = X.tBrownRandId 'γ' (-1) 1 1 4 t+in pan2 o l 0.1++-- tBrownRand ; audio rate noise+let x = mouseX kr 500 5000 Exponential 0.2+    y = mouseY kr 10 500 Exponential 0.2+    t = dustId 'α' ar x+in lag (X.tBrownRandId 'β' (-1) 1 0.2 0 t) (y / 48000)
+ Help/Ugen/tChoose.help.hs view
@@ -0,0 +1,9 @@+-- tChoose ; composite of tiRand and select+let x = mouseX kr 1 1000 Exponential 0.1+    t = dustId 'a' ar x+    f = midiCps (tiRandId 'b' 48 60 t)+    o = let a = mce [sinOsc ar f 0+                    ,saw ar (f * 2)+                    ,pulse ar (f * 0.5) 0.1]+        in tChooseId 'c' t a+in o * 0.1
+ Help/Ugen/tDelay.help.hs view
@@ -0,0 +1,5 @@+-- tDelay+let z = impulse ar 2 0+    z' = tDelay z 0.5+    o = sinOsc ar 440 0 * 0.1+in mce [z * 0.1,toggleFF z' * o]
+ Help/Ugen/tDuty.help.hs view
@@ -0,0 +1,30 @@+-- tDuty ; rhythm+let d = dseqId 'α' dinf (mce [0.1, 0.2, 0.4, 0.3])+in tDuty ar d 0 DoNothing 1 0++-- tDuty ; amplitude changes+let d0 = dseqId 'α' dinf (mce [0.1, 0.2, 0.4, 0.3])+    d1 = dseqId 'β' dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])+in ringz (tDuty ar d0 0 DoNothing d1 1) 1000 0.1++-- tDuty ; mouse control+let d = dseqId 'α' dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])+    x = mouseX kr 0.003 1 Exponential 0.1+in ringz (tDuty ar x 0 DoNothing d 1) 1000 0.1 * 0.5++-- tDuty ; note that the 440 is the shorter pitch, since gap is set to false+let d0 = dserId 'α' 12 (mce [0.1, 0.3])+    d1 = dserId 'β' 12 (mce [440, 880])+    t = tDuty ar d0 0 RemoveSynth d1 0+in sinOsc ar (latch t t) 0 * 0.1++-- tDuty ; abstraction+let bp n d act = let (e,t) = unzip d+                     mkId z l = dserId z n (mce l)+                     sq = tDuty ar (mkId 'α' t) 0 act (mkId 'β' e) 0+                 in latch sq sq+    bp' d = bp (genericLength d) d+    tm m = let f (e,t) = (e,t * m) in map f+    f1 = midiCps (bp 35 (tm 0.125 [(60,1),(63,1),(67,2),(68,1),(62,1)]) RemoveSynth)+    f2 = midiCps (bp' [(60,1),(63,0.5),(67,0.5),(68,1),(62,1)] DoNothing)+in sinOsc ar (mce2 f1 f2) 0 * 0.1
+ Help/Ugen/tExpRand.help.hs view
@@ -0,0 +1,8 @@+-- tExpRand+let f = tExpRandId 'α' 300.0 3000.0 (dustId 'β' kr 10)+in sinOsc ar f 0 * 0.1++-- tExpRand ; monadic form+uid_st_eval+  (do f <- tExpRandM 300.0 3000.0 =<< dustM kr 10+      return (sinOsc ar f 0 * 0.1))
+ Help/Ugen/tExpRandN.help.hs view
@@ -0,0 +1,4 @@+-- tExpRandN ; n sine tones, set to exponentially-distributed random frequencies on trigger+let n = 12+    tr = impulse kr 1 0+in splay (sinOsc ar (X.tExpRandNId n 'α' 440 880 tr) 0) 1 0.1 0 True
+ Help/Ugen/tGaussRand.help.hs view
@@ -0,0 +1,7 @@+-- tGaussRand ; c.f. tRand+let t = dustId 'α' kr 10+    f = X.tGaussRandId 'β' 300 3000 t+    o = sinOsc ar f 0+    l = X.tGaussRandId 'γ' (-1) 1 t+in pan2 o l 0.1+
+ Help/Ugen/tGrains.help.hs view
@@ -0,0 +1,74 @@+-- tGrains ; mouse control ; requires=buf+let b = control kr "buf" 100+    tRate = mouseY kr 2 200 Exponential 0.1+    ctr = mouseX kr 0 (bufDur kr b) Linear 0.1+    tr = impulse ar tRate 0+in tGrains 2 tr b 1 ctr (4 / tRate) 0 0.25 2++-- tGrains ; mouse control ; requires=buf+let b = control kr "buf" 100+    rt = mouseY kr 8 120 Exponential 0.1+    dur = 4 / rt+    clk = dustId 'α' ar rt+    r = tRandId 'β' 0 0.01 clk+    pan = whiteNoiseId 'γ' kr * 0.6+    x = mouseX kr 0 (bufDur kr b) Linear 0.1+    pos = x + r+in tGrains 2 clk b 1 pos dur pan 0.25 2++-- tGrains ; mouse control ; requires=buf+let b = control kr "buf" 100+    rt = mouseY kr 2 120 Exponential 0.1+    dur = 1.2 / rt+    clk = impulse ar rt 0+    pos = mouseX kr 0 (bufDur kr b) Linear 0.1+    n0 = whiteNoiseId 'α' kr+    n1 = whiteNoiseId 'β' kr+    rate = 1.2 ** (roundTo (n0 * 3) 1) -- or shiftLeft in place of **+in tGrains 2 clk b rate pos dur (n1 * 0.6) 0.25 2++-- tGrains ; demand UGens as inputs ; requires=buf+--         ; (Warning: empty sequence in Dseq - ServerId 'localhost' exited with exit code 0)+--         ; (also at sclang graph)+let b = control kr "buf" 100+    rt = mouseX kr 1 100 Exponential 0.2+    dId uid = dwhiteId uid 1 0.1 0.2+    zId u0 u1 u2 u3 u4 u5 u6 u7 = drandId u1 1 (mce [dgeomId u2 (diwhiteId u3 1 20 40) 0.1 (1 + dId u4)+                                                    ,dgeomId u5 (diwhiteId u6 1 20 40) 1 (1 - dId u7)])+    clk = impulse ar rt 0+    dsqId e xs = dseqId e dinf (mce xs)+    rate = dsqId 'α' [1,1,zId 'β' 'γ' 'δ' 'ε' 'ζ' 'η' 'θ' 'ι',0.5,0.5,0.2,0.1,0.1,0.1,0.1] * 2 + 1+    pos = dsqId 'κ' (Protect.uclone_seq (const False) 'λ' 8 (zId 'μ' 'ν' 'ξ' 'ο' 'π' 'ρ' 'σ' 'τ'))+    dur = dsqId 'υ' [1,dId 'φ',1,zId 'χ' 'ψ' 'ω' 'Α' 'Β' 'Γ' 'Δ' 'Ε',0.5,0.5,0.1,zId 'Ζ' 'Η' 'Θ' 'Ι' 'Κ' 'Λ' 'Μ' 'Ν'] * 2 / rt+    pan = dsqId 'Ξ' [1,1,1,0.5,0.2,0.1,0,0,0] * 2 - 1+    amp = dsqId 'Ο' [1,0,zId 'Π' 'Ρ' 'Σ' 'Τ' 'Υ' 'Φ' 'Χ' 'Ψ',0,2,1,1,0.1,0.1]+in tGrains 2 clk b rate pos dur pan amp 2++-- tGrains ; sync oscillator ; requires=buf+--         ; http://sc-users.bham.ac.narkive.com/sj4Tw3ub/sync-osc#post5 (jmcc)+--         ; "A wavetable windowed sync oscillator could be written.+--         ;  You can actually do a version of this with TGrains."+let b = control kr "buf" 100+    freq = 100+    dur = 2 / freq+    clk = impulse ar freq 0+    x = mouseX kr 0.5 16 Exponential 0.2+in tGrains 2 clk b x (0.3 * bufDur kr b) dur 0 0.1 2++-- tGrains ; requires=buf ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let b = control kr "buf" 100+          tRate = linExp y 0 1 2 200+          ctr = x * bufDur kr b+          du = (ry * 8) / tRate+          tr = impulse ar (y * 60 + 10) 0+      in tGrains 2 tr b (1 + (rx * 0.5)) ctr du o (z * g) 4+in mix (voicer 16 f) * control kr "gain" 2++---- ; setup+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "instr/crotales/crotale05(D).wav"+ld "metal.wav" -- mono+ld "instr/celeste/long/22-A4-long.wav" -- mono+ld "instr/celeste/long/25-C5-long.wav" -- mono+ld "instr/celeste/long/37-C6-long.wav" -- mono
+ Help/Ugen/tLine.help.hs view
@@ -0,0 +1,5 @@+-- tLine ; start and end reset randomly every 4 seconds, ramp every trigger+let tr = impulse kr (1/4) 0+    f0 = tExpRandId 'α' 110 450 tr+    f1 = tExpRandId 'β' 110 440 tr+in splay (sinOsc ar (mce [f0,tLine kr f0 f1 4 tr,f1]) 0) 1 1 0 True * mce [0.05,0.1,0.05]
+ Help/Ugen/tRand.help.hs view
@@ -0,0 +1,22 @@+-- tRand+let t = dustId 'α' kr (mce2 5 12)+    f = tRandId 'β' (mce2 200 1600) (mce2 500 3000) t+in sinOsc ar f 0 * 0.1++-- tRand ; monadic variant+uid_st_eval (+  do t <- dustM kr (mce2 5 12)+     f <- tRandM (mce2 200 1600) (mce2 500 3000) t+     return (sinOsc ar f 0 * 0.1))++-- tRand ; c.f. X.tGaussRand+let t = dustId 'α' kr 10+    f = tRandId 'β' 300 3000 t+    o = sinOsc ar f 0+    l = tRandId 'γ' (-1) 1 t+in pan2 o l 0.1++-- tRand ; equal (sanity)+let t = dustId 'α' kr 1+    f = tRandId 'β' 120 240 t+in sinOsc ar (mce2 f f) 0 * 0.1
+ Help/Ugen/tRandN.help.hs view
@@ -0,0 +1,4 @@+-- tRandN ; n sine tones, set to uniform-random frequencies on trigger+let n = 12+    tr = impulse kr 1 0+in splay (sinOsc ar (X.tRandNId n 'α' 440 880 tr) 0) 1 0.1 0 True
+ Help/Ugen/tScramble.help.hs view
@@ -0,0 +1,8 @@+-- tScramble ; two channel sin tones, channels scramble on impulse, scramble may be identity+let tr = impulse kr 1 0+in sinOsc ar (X.tScrambleId 'α' tr (mce2 440 880)) 0 * 0.1++-- tScramble ; c-major sin tones across stereo field, scrambles on impulse+let tr = impulse kr 1 0+    f = X.tScrambleId 'α' tr (mce (map midiCps [60,62,64,65,67,69,71,72]))+in splay (sinOsc ar f 0 * 0.1) 1 1 0 True
+ Help/Ugen/tWindex.help.hs view
@@ -0,0 +1,13 @@+-- tWindex+let p = mce [1/5, 2/5, 2/5]+    a = mce [400, 500, 600]+    t = impulse kr 6 0+    i = tWindexId 'α' t 0 p+in sinOsc ar (select i  a) 0 * 0.1++-- tWindex ; modulating probability values+let p = mce [1/4, 1/2, sinOsc kr 0.3 0 * 0.5 + 0.5]+    a = mce [400, 500, 600]+    t = impulse kr 6 0+    i = tWindexId 'α' t 1 p+in sinOsc ar (select i a) 0 * 0.1
+ Help/Ugen/tXLine.help.hs view
@@ -0,0 +1,5 @@+-- tXLine ; start and end reset randomly every 4 seconds, ramp every trigger+let tr = impulse kr (1/4) 0+    f0 = tExpRandId 'α' 110 450 tr+    f1 = tExpRandId 'β' 110 440 tr+in splay (sinOsc ar (mce [f0,tXLine kr f0 f1 4 tr,f1]) 0) 1 1 0 True * mce [0.05,0.1,0.05]
+ Help/Ugen/tan.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "Tan"+Sound.Sc3.Plot.plot_fn_r1_ln (Sound.Sc3.clip_hs (-6,6) . tan) (0,2 * pi)
+ Help/Ugen/tanh.help.hs view
@@ -0,0 +1,8 @@+-- tanh+let e = xLine kr 0.1 10 10 DoNothing+    o = fSinOsc ar 500 0.0+in tanh (o * e) * 0.25++---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "TanH"+Sound.Sc3.Plot.plot_fn_r1_ln tanh (-4,4)
+ Help/Ugen/tap.help.hs view
@@ -0,0 +1,6 @@+-- tap+let b = clearBuf (localBufId 'α' 1 48000) -- sample-rate+    src = soundIn 0 -- use headphones+    put = bufWr b (phasor ar 0 1 0 (bufFrames kr b) 1) Loop src+    get = tap 1 ar b (mce2 0.1 0.9)+in mrg2 get put
+ Help/Ugen/tartini.help.hs view
@@ -0,0 +1,24 @@+-- tartini ; comparison of input frequency (x) and tracked oscillator frequency (f).+let x = mouseX kr 440 880 Exponential 0.1+    o = lfSaw ar x 0 * 0.05 {- sinOsc ar x 0 * 0.1 -}+    [f,_e] = mceChannels (X.tartini kr o 0.2 2048 0 1024 0.5)+    r = sinOsc ar f 0 * 0.1+    t = impulse kr 4 0+    pf = poll t f 0 (label "f")+    px = poll t x 0 (label "x")+in mrg [out 0 (mce2 o r),pf,px]++-- tartini ; test live pitch tracking, not careful with amplitude of input+let z = hpf (soundIn 0) 90+    [f,e] = mceChannels (X.tartini kr z 0.2 2048 0 1024 0.5)+in mce2 (z * 0.1) (lfTri ar f 0 * 0.2 * lag e 0.2 * lag (f >** 90 * f <** 500) 0.2)++-- tartini ; printer for pitch tracker+let i = soundIn 0+    [f,_e] = mceChannels (X.tartini kr i 0.2 2048 0 1024 0.5)+    r = sinOsc ar f 0 * 0.1+    t = impulse kr 4 0+    pf = poll t f 0 (label "f")+in mrg [out 0 (mce2 i r),pf]++---- ; ZELL = C4 - C5 = 247 259 277 295 309 331 345 369 387 415 441 462 493 (hz)
+ Help/Ugen/thresh.help.hs view
@@ -0,0 +1,2 @@+-- thresh+(lfNoise0Id 'α' ar 50 * 0.15) `thresh` 0.1
+ Help/Ugen/tiRand.help.hs view
@@ -0,0 +1,15 @@+-- tiRand+let l = tiRandId 'α' (-1) 1 (dustId 'β' kr 10)+in pan2 (pinkNoiseId 'γ' ar * 0.1) l 1++-- tiRand ; monadic variant+uid_st_eval+ (do l <- tiRandM (-1) 1 =<< dustM kr 10+     n <- pinkNoiseM ar+     return (pan2 (n * 0.1) l 1))++-- tiRand ; osc frequency+uid_st_eval+ (do n <- tiRandM 4 12 =<< dustM kr 10+     let f = n * 150 + (mce [0,1])+     return (sinOsc ar f 0 * 0.1))
+ Help/Ugen/timer.help.hs view
@@ -0,0 +1,3 @@+-- timer+let t = impulse kr (mouseX kr 0.5 20 Exponential 0.1) 0+in sinOsc ar (timer t * 500 + 500) 0 * 0.2
+ Help/Ugen/toggleFF.help.hs view
@@ -0,0 +1,4 @@+-- toggleFF ; c.f. setResetFF+let tr = dustId 'α' ar (xLine kr 1 1000 60 DoNothing)+    fr = toggleFF tr * 400 + 800+in sinOsc ar fr 0 * 0.1
+ Help/Ugen/trig.help.hs view
@@ -0,0 +1,8 @@+-- trig+let d = dustId 'α' ar 1+    o = fSinOsc ar 800 0 * 0.5+in o * trig d 0.2++-- trig ; if duration is set to zero it is reset to one frame (at ar & kr) ; 3.11.2+let env = decay2 (trig (mce2 (sinOsc kr 10 0 * 10) (sinOsc ar 9 0 * 1000)) 0) 0.01 0.2+in sinOsc ar (mce2 440 441) 0 * env * 0.1
+ Help/Ugen/trig1.help.hs view
@@ -0,0 +1,11 @@+-- trig1 ; timed gate, duration in seconds+let d = dustId 'α' ar 1+    o = fSinOsc ar 800 0 * 0.1+in o * trig1 d 1.25++-- trig1+sinOsc ar 440 0 * trig1 (impulse kr 10 0) 0.1 * 0.1++-- trig1 ; if duration is set to zero it is reset to one frame (at ar & kr) ; 3.11.2+let env = decay2 (trig1 (mce2 (sinOsc kr 10 0) (sinOsc ar 9 0)) 0) 0.01 0.2+in sinOsc ar (mce2 440 441) 0 * env * 0.1
+ Help/Ugen/trigAvg.help.hs view
@@ -0,0 +1,9 @@+-- trigAvg+let x = mouseX kr 0 1000 Linear 0.2+    b = mouseButton kr 0 1 0.2+    n = X.trigAvg kr (roundTo x 100) b+in sinOsc ar n 0 * 0.1++-- trigAvg+let n = X.trigAvg kr (sinOsc ar 0.1 0) (impulse kr 0.2 0)+in sinOsc ar 220 0 * n * 0.25
+ Help/Ugen/trigControl.help.hs view
@@ -0,0 +1,7 @@+-- trigControl ; graph with the three types of non-audio controls ; trigger controls are drawn cyan+let freq = control kr "freq" 440+    phase = control ir "phase" 0+    gate' = trigControl "gate" 1+    amp = control kr "amp" 0.1+    e = envGen kr gate' amp 0 1 DoNothing (envAsr 0.01 1 1 EnvLin)+in sinOsc ar freq phase * e
+ Help/Ugen/twChoose.help.hs view
@@ -0,0 +1,9 @@+-- tWChoose ; composite of tWindex and select+let x = mouseX kr 1 1000 Exponential 0.1+    d = dustId 'α' ar x+    a = mce [sinOsc ar 220 0+            ,saw ar 440+            ,pulse ar 110 0.1]+    w = mce [0.5, 0.35, 0.15]+    o = tWChooseId 'β' d a w 0+in o * 0.1
+ Help/Ugen/twoPole.help.hs view
@@ -0,0 +1,7 @@+-- twoPole+let n = whiteNoiseId 'α' ar in twoPole (n * 0.005) 2000 0.95++-- twoPole+let n = whiteNoiseId 'α' ar+    f = xLine kr 800 8000 8 RemoveSynth+in twoPole (n * 0.005) f 0.95
+ Help/Ugen/twoTube.help.hs view
@@ -0,0 +1,20 @@+-- twoTube+let dly1 = 100+    dly2 = 40+    env = envelope [1,1,0] [(dly1 + dly2) / sampleRate,0.0] [EnvLin]+    x = mouseX kr (-1) 1 Linear 0.2+    y = mouseY kr 1 4 Linear 0.2+    src = whiteNoiseId 'α' ar * envGen ar (impulse kr y 0) 1 0 1 DoNothing env+in X.twoTube ar src x 0.99 dly1 dly2 * 0.5++-- twoTube+let tr = impulse kr (mouseX kr 1 16 Linear 0.2) 0+    dly1 = tRandId 'α' 1 300 tr+    dly2 = tRandId 'β' 1 300 tr+    loss = tRandId 'γ' 0.9 0.999 tr+    dur = tRandId 'δ' 0.1 5 tr+    pan = tRandId 'ε' (-1) 1 tr+    k = tRandId 'ζ' (-1) 1 tr+    env = envelope [1,1,0,0] [(dly1 + dly2) / sampleRate,0,1] [EnvLin]+    src = whiteNoiseId 'η' ar * envGen ar tr 1 0 1 DoNothing env+in pan2 (X.twoTube ar src k loss dly1 dly2) pan (mouseY kr 0.1 0.4 Exponential 0.2)
+ Help/Ugen/twoZero.help.hs view
@@ -0,0 +1,4 @@+-- twoZero+let n = whiteNoiseId 'α' ar * 0.1+    f = xLine kr 20 20000 8 RemoveSynth+in twoZero (n * 0.125) f 1
+ Help/Ugen/vDiskIn.help.hs view
@@ -0,0 +1,10 @@+-- vDiskIn+let b = control kr "buf" 0+    nc = 2+in vDiskIn nc 0 (sinOsc kr 0.25 0 * 0.25 + 1) Loop 0++---- ; allocate and read file, leave open+let fn = sfResolve "pf-c5.aif"+let nc = sfNumChannels fn+withSc3 (mapM_ async [b_alloc 0 8192 nc,b_read 0 fn 0 (-1) 0 True])+
+ Help/Ugen/vOsc.help.hs view
@@ -0,0 +1,18 @@+-- vOsc ; oscillator at eight consecutive wavetable buffers, mouse selects ; requires=tbl+let n = 8+    b = control kr "tbl" 0+    x = mouseX kr b (b + n - 1) Linear 0.1+    y = mouseY kr 0.01 0.2 Exponential 0.2+in vOsc ar x (mce [120, 121]) 0 * y++---- ; setup ; allocate and fill tables 0 to 7+gen_harm i = let {square a = a * a ; n = square (fromIntegral i + 1) ; f j = square ((n - j) / n) } in map f [0 .. n - 1]+gen_setup i = [b_alloc i 1024 1,b_gen_sine1 i [Normalise,Wavetable,Clear] (gen_harm i)]+withSc3 (mapM_ maybe_async (concatMap gen_setup [0 .. 7]))++---- ; drawings+Sound.Sc3.Plot.plot_p1_imp [gen_harm 7]++---- ; setup ; reallocate buffers while oscillator is running+resetTable i = do {h <- Sound.Sc3.Lang.Random.IO.nrrand 12 0 1; Sound.OSC.sendMessage (b_gen_sine1 i [Normalise,Wavetable,Clear] h)}+withSc3 (mapM_ resetTable [0 .. 7])
+ Help/Ugen/vOsc3.help.hs view
@@ -0,0 +1,19 @@+-- vOsc3 ; mouse selects buffer and set amplitude ; see vOsc help for setup+let n = 8+    b = control kr "tbl" 0+    x = mouseX kr b (b + n - 1) Linear 0.1+    y = mouseY kr 0.01 0.2 Exponential 0.2+    o1 = vOsc3 ar x 120 121 129+    o2 = vOsc3 ar x 119 123 127+in mce2 o1 o2 * y++-- vOsc3 ; event control ; see vOsc help for setup+let f (_,g,_,y,z,_,_,_,p,_,_) =+      let n = 8+          f0 = unitCps p+          b = control kr "tbl" 0+          pos = linLin y 0 1 b (b + n - 1)+          o1 = vOsc3 ar pos f0 (f0 + 1) (f0 + 9)+          o2 = vOsc3 ar pos (f0 - 1) (f0 + 3) (f0 + 4)+      in mce2 o1 o2 * g * z+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/varLag.help.hs view
@@ -0,0 +1,4 @@+-- varLag ; the varLag UGen is not working ; there is varLag_env instead+let sqr = linLin (lfPulse kr 1 0 0.5) 0 1 100 400+    crv = varLag_env sqr 0.2 (EnvNum (line kr (-8) 8 15 RemoveSynth)) Nothing+in sinOsc ar crv 0 * 0.3
+ Help/Ugen/varSaw.help.hs view
@@ -0,0 +1,43 @@+-- varSaw+let x = mouseX kr 0 1 Linear 0.2 in varSaw ar 220 0 x * 0.1++-- varSaw+let f = lfPulse kr (mce2 3 3.03) 0 0.3 * 200 + 200+    w = linLin (lfTri kr 1 0) (-1) 1 0 1+in varSaw ar f 0 w * 0.1++-- varSaw ; compare with lfPulse at ar+let f = lfPulse kr 3 0 0.3 * 200 + 200+in mce [varSaw ar f 0 0.2+       ,lfPulse ar f 0 0.2] * 0.1++-- varSaw ; per-note width modulation+let d = linLin (lfNoise2Id 'α' kr 0.1) (-1) 1 0.05 0.5+    t = impulse ar (1 / d) 0+    w0 = tRandId 'β' 0 0.35 t+    w1 = tRandId 'γ' 0.65 1 t+    w = phasor ar t ((w1 - w0) * sampleDur) w0 w1 0+    e = decay2 t 0.1 d+    f = midiCps (tRandId 'δ' 36 72 t)+    o = varSaw ar f 0 w * e * 0.1+    l = tRandId 'ε' (-1) 1 t+in pan2 o l 1++-- varSaw ; http://sc-users.bham.ac.narkive.com/sj4Tw3ub/sync-osc#post6+let freq = control kr "freq" 110+    factor = control kr "factor" 1+    x = mouseX kr 0 1.0 Linear 0.2+    y = mouseY kr (mce2 23 17) 0 Linear 0.2+    t = impulse kr 0.5 0+    ph = varSaw ar (freq * factor * tChooseId 'α' t (mce [0.125,0.5,1.3,1.5,23.0])) 0 x * y+in sinOsc ar (freq * mce2 1.001 1) ph * 0.1++-- varSaw ; slow indeterminate modulation of width, http://sccode.org/1-5as+let midinote = 60+    gate_ = 1+    amp = 0.25+    asr = envAsr 0.1 1 0.1 (EnvNum (-4))+    env = envGen kr gate_ 1 0 1 RemoveSynth asr+    freq = midiCps midinote+    width = range 0.2 0.8 (lfNoise2Id 'α' kr 1) * range 0.7 0.8 (sinOsc kr 5 (randId 'β' 0.0 1.0))+in varSaw ar freq 0 width * env * amp
+ Help/Ugen/varShapeOsc.help.hs view
@@ -0,0 +1,9 @@+-- varShapeOsc+let modulator = sinOsc kr (lfNoise2Id 'a' kr 4 * 10) 0+    freq = 100+    pw = sinOsc kr 0.01 0 `in_range` (0,1)+    waveshape = lag modulator 0.1 `in_range` (0,1)+    sync_ = 1+    syncfreq = 182+    sig = X.varShapeOsc ar freq pw waveshape sync_ syncfreq+in pan2 sig modulator 0.1
+ Help/Ugen/vbFourses.help.hs view
@@ -0,0 +1,24 @@+-- vbFourses ; a simple triangle wave ; supplying only one freq pair+let freqs = mce [150, 150]+    src = X.vbFourses ar 0.5 freqs+in leakDC (mceChannel 0 src) 0.995 * 0.4++-- vbFourses ; feeding it an array of frequencies ; mix to stereo+let freqs = mceFillInt 8 (\z -> randId z 1 500)+    src = X.vbFourses ar 0.1 freqs+in mixTo 2 (leakDC src 0.995 * 0.3)++-- vbFourses ; modulate inputs ; splay+let freqs = lfNoise0Id 'α' ar (mce [4, 3, 2, 1, 1, 2, 3, 4]) `in_range` (1,1200)+    src = X.vbFourses ar 0.7 freqs+in splay (leakDC src 0.995) 1 0.3 0 True++-- vbFourses ; smoothing is an i-Rate input+let w = lfPulse ar 1 0 0.5 * 100 + 100+    freqs = mce [w, 200]+    src = X.vbFourses ar 0.9 freqs -- mouseX kr 0.4 0.9 Linear 0.1+in leakDC (mceChannel 0 src) 0.995 * 0.4++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen_nrt (48000,64) 1 (X.vbFourses ar 0.5 (mce [800, 30, 710, 3, 10, 1, 7, 11]))
+ Help/Ugen/vbJonVerb.help.hs view
@@ -0,0 +1,15 @@+-- vbJonVerb ; default param+X.vbJonVerb (dust ar 2) 0.7 0.3 0.8 0.5 0.5++-- vbJonVerb+let freq = mce (map (* 1000) [1,2.1,2.9])+    src = mix (resonz (mixFill 3 (\_ -> dust ar 0.25)) freq 0.01) * 10+in X.vbJonVerb src 0.8 0.3 0.8 0.1 0.5 + src++-- vbJonVerb ; default param ; id+X.vbJonVerb (dustId 'α' ar 2) 0.7 0.3 0.8 0.5 0.5++-- vbJonVerb ; id+let freq = mce (map (* 1000) [1,2.1,2.9])+    src = mix (resonz (mixFill 3 (\z -> dustId (z::Int) ar 0.25)) freq 0.01) * 10+in X.vbJonVerb src 0.8 0.3 0.8 0.1 0.5 + src
+ Help/Ugen/vbSlide.help.hs view
@@ -0,0 +1,10 @@+-- vbSlide+let src = lfNoise0Id 'α' ar 3 `in_range` (0,1)+    flt = X.vbSlide src 500 1500+    gen x = sinOsc ar (midiCps (x `in_range` (30,80))) 0 * 0.1+in mce2 (gen flt) (gen src)++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen_nrt (48000,64) 0.07 (let src = lfPulse ar 10 0 0.2 in mce2 src (X.vbSlide src 100 500))+
+ Help/Ugen/vibrato.help.hs view
@@ -0,0 +1,24 @@+-- vibrato ; at 1 Hz, note the use of DC.ar+let v = vibratoId 'α' ar (dc ar 400) 1 0.02 0 0 0.04 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; compare, k-rate freq input can be a constant+let v = vibratoId 'α' kr 400 1 0.02 0 0 0.04 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; control rate and rateVariation+let x = mouseX kr 2 100 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    v = vibratoId 'α' ar (dc ar 400) x 0.1 1 1 y 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; control depth and depthVariation+let n = lfNoise1Id 'α' kr 1 * 3 + 7+    x = mouseX kr 0 1 Linear 0.2+    y = mouseY kr 0 1 Linear 0.2+    v = vibratoId 'β' ar (dc ar 400) n x 1 1 y 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; mce+let v = vibratoId 'α' ar (dc ar (mce2 (mce2 411 440) (mce2 419 440.5))) 1 0.02 0 0 0.04 0.1 0 0+in mix (sinOsc ar v 0 * 0.1)
+ Help/Ugen/vosim.help.hs view
@@ -0,0 +1,33 @@+-- vosim+let trg = impulse ar 100 0+    frq = mouseX kr 440 880 Exponential 0.2+    n_cycles = 3+    dcy = 0.1+in X.vosim ar trg frq n_cycles dcy * 0.25++-- vosim+let p = tRandId 'α' 0 1 (impulse ar 6 0)+    f0 = linLin (lfNoise2Id 'β' kr 4) (-1) 1 3 9+    t = impulse ar (f0 * (1 + (p `greater_than` 0.95))) 0+    x = mouseX kr 0.25 2 Linear 0.2+    y = mouseY kr 0.25 0.75 Linear 0.2+    z = 9+    rng i = linLin i (-1) 1+    mk_nId e = rng (lfNoise2Id e kr z) 0.25 2+    tRId e ll rl = tRandId e (mce ll) (mce rl)+    f = tRId 'γ' [40,120,220] [440,990,880] t+    n = tRId 'δ' [4] [8,16,32] t+    d = tRId 'ε' [0.2,0.4,0.6] [0.6,0.8,1] t+    a = tRId 'ζ' [0] [0.05,0.15,0.25] t+    l = tRId 'η' [-1] [1] t+    xn = mk_nId 'θ'+    yn = mk_nId 'ι'+    v = X.vosim ar t (f * x * xn) n (d * y * yn) * a+in pan2 (mix v) l 1++-- vosim ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+      let trg = impulse ar (unitCps p) 0+          frq = linExp y 0 1 440 880+      in pan2 (X.vosim ar trg frq 1 rx) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/vosimOsc.help.hs view
@@ -0,0 +1,15 @@+-- vosimOsc+let freq = sinOsc kr (sinOsc kr 0.01 0) 0 `in_exprange` (10,800)+    form1freq = sinOsc kr (mce2 0.5 0.1) 0 `in_exprange` (100,1000)+    form2freq = sinOsc kr 0.39 0 `in_exprange` (100,1000)+    shape = sinOsc kr 10 0+in X.vosimOsc ar freq form1freq form2freq shape * 0.1++-- vosimOsc ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let freq = x * 40 + 10+          form1freq = y * 900 + 100+          form2freq = rx * 900 + 100+          shape = ry+      in pan2 (X.vosimOsc ar freq form1freq form2freq shape) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/warp1.help.hs view
@@ -0,0 +1,33 @@+-- warp1 ; requires=buf ; interp=2=linear ; nc=2+let (b, nc) = (control kr "buf" 100, 2)+    p = linLin (lfSaw kr 0.05 0) (-1) 1 0 1+    x = mouseX kr 0.5 2 Linear 0.1+in warp1 nc b p x 0.1 (-1) 8 0.1 2 * 0.5++-- warp1 ; real-time (delayed) input, localBuf+let sz = 8192+    b = clearBuf (localBufId 'α' 1 sz)+    i = soundIn 0+    r = recordBuf ar b 0 1 0 1 Loop 1 DoNothing i+    ph = (sz / sampleRate) * 2 * pi+    p = lfSaw kr (1 / bufDur kr b) ph * 0.5 + 0.5+    x = mouseX kr 0.5 2 Linear 0.2+    y = mouseY kr 0.01 0.2 Linear 0.2+    w = warp1 1 b p x 0.1 (-1) 8 y 4+in mrg2 (i + w) r++-- warp1 ; requires=buf ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+      let b = control kr "buf" 100+          p = linLin (lfSaw kr 0.05 0) (-1) 1 0 1+          dur = linLin y 0 1 0.01 0.2+          freqScale = linLin ry 0 1 0.75 1.25+          ol = linLin rx 0 1 2 16+      in pan2 (warp1 1 b x freqScale dur (-1) ol (ry * 0.75) 2) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 2++---- ; setup+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "pf-c5.aif" -- stereo+ld "instr/celeste/long/13-C4-long.wav" -- mono+ld "instr/celeste/long/25-C5-long.wav" -- mono
+ Help/Ugen/weaklyNonlinear2.help.hs view
@@ -0,0 +1,21 @@+-- weaklyNonlinear2 ; mouseY controls input strength of forcing oscillator+let input = saw ar 261.626 * mouseY kr 0.0001 1 Exponential 0.1+    freq = mouseX kr 100 400 Linear 0.1+in pan2 (X.weaklyNonlinear2 ar input 0 1 1 freq 0 0 0 0 0 0) 0 0.1++-- weaklyNonlinear2 ; van der Pol equation+let input = sinOsc ar (mouseX kr 10 2000 Linear 0.1) 0 * 0.1+    reset = impulse kr (mouseY kr 0 100 Linear 0.1) 0+in pan2 (X.weaklyNonlinear2 ar input reset 1 1 440 0 0 (-0.01) 2 (-1) 1) 0 0.1++-- weaklyNonlinear2 ; duffing equation+let input = sinOsc ar (mouseX kr 1 1000 Exponential 0.1) 0 * 0.1+    freq = mouseY kr 1 1000 Exponential 0.1+in pan2 (X.weaklyNonlinear2 ar input 0 1 1 freq 0 0 (-0.001) 3 0 0) 0 0.1++-- weaklyNonlinear2 ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+      let input = saw ar 261.626 * linExp y 0 1 0.0001 1+          freq = x * 300 + 100+      in pan2 (X.weaklyNonlinear2 ar input 0 1 1 freq 0 0 0 0 0 0) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/whiteNoise.help.hs view
@@ -0,0 +1,70 @@+-- whiteNoise+let n = whiteNoiseId 'α' ar * 0.05 in mce2 n n++-- whiteNoise ; monad constructor+uid_st_eval (fmap (* 0.05) (whiteNoiseM ar))++-- whiteNoise ; random filtered noise bursts+let n = whiteNoiseId 'α' ar+    t = dustId 'β' ar (mce [3, 7])+    f = tExpRandId 'γ' 20 1800 t+    bw = tExpRandId 'δ' 0.001 1 t+    e = decay2 t 0.01 0.2+in resonz (n * e) f bw++-- whiteNoise ; monadic form+uid_st_eval (do+  n <- whiteNoiseM ar+  t <- dustM ar (mce [3, 7])+  f <- tExpRandM 20 1800 t+  bw <- tExpRandM 0.001 1 t+  let e = decay2 t 0.01 0.2+  return (resonz (n * e) f bw))++-- whiteNoise ; monadic form, without using do notation+uid_st_eval (+  whiteNoiseM ar >>= \n ->+  dustM ar (mce [3, 7]) >>= \t ->+  tExpRandM 20 1800 t >>= \f ->+  tExpRandM 0.001 1 t >>= \bw ->+  let e = decay2 t 0.01 0.2+  in return (resonz (n * e) f bw))++-- whiteNoise ; speaker balance+let n = whiteNoiseId 'α' ar * 0.1 in mce2 n n++-- whiteNoise ; speaker balance+let x = mouseX kr 0.1 2 Linear 0.2+    y = mouseY kr (-90) (-30) Linear 0.2+    l = sinOsc kr x 0+    n = whiteNoiseId 'α' ar+in pan2 n l (dbAmp y)++-- whiteNoise ; hpz1+hpz1 (whiteNoiseId 'α' ar * 0.01)++-- whiteNoise ; frequency control+sinOsc ar (whiteNoiseId 'α' kr * 300 + 500) 0 * 0.1++-- whiteNoise ; monad constructor ; clone+uid_st_eval (fmap ((* mce [0.02,0.04]) . mce) (replicateM 2 (whiteNoiseM ar)))++-- whiteNoiseM ; Control.Monad.ap+uid_st_eval+(do x <- return (-) `ap` whiteNoiseM ar `ap` whiteNoiseM ar+    return (x * 0.05))++-- white noise ; noise+(whiteNoise ar - whiteNoise ar) * 0.05++-- whiteNoise ; silence+let n = whiteNoise ar in (n - n) * 0.05++-- whitenoise ; violetnoise (one point difference)+hpz1 (whiteNoiseId 'α' ar) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.01 (whiteNoiseId 'γ' ar)+Sound.Sc3.Plot.plot_ugen1 0.05 (lpf (whiteNoiseId 'γ' ar) 500)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (whiteNoiseId 'α' ar)+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/wrap.help.hs view
@@ -0,0 +1,6 @@+-- wrap ; ln 2021-04-15 https://lukasnowok.github.io/spectrology/+let s = sinOsc ar (sinOsc ar (1 / 40) 0 * 100 + 20000) 0+in wrap s (xLine ar (-1.0) (-0.01) 20 DoNothing) 1 * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/wrap2.help.hs view
@@ -0,0 +1,2 @@+-- c.f. sc3_wrap_ni+wrap2 (fSinOsc ar 1000 0) (line kr 0 1.01 8 DoNothing) * 0.1
+ Help/Ugen/wrapIndex.help.hs view
@@ -0,0 +1,5 @@+-- wrapIndex ; c.f. index+let b = asLocalBufId 'α' [200,300,400,500,600,800]+    x = mouseX kr 0 18 Linear 0.1+    f = wrapIndex b x+in sinOsc ar f 0 * 0.1
+ Help/Ugen/xFade2.help.hs view
@@ -0,0 +1,2 @@+-- xFade2 ; c.f. linXFade2+xFade2 (saw ar 440) (sinOsc ar 440 0) (lfTri kr 0.1 0) 0.1
+ Help/Ugen/xLine.help.hs view
@@ -0,0 +1,3 @@+-- xLine ; sc3 reorders mul and add inputs to precede the doneAction input+let f = xLine kr 200 17000 10 RemoveSynth+in sinOsc ar f 0 * 0.1
+ Help/Ugen/xOut.help.hs view
@@ -0,0 +1,8 @@+-- xOut ; send signal to a bus, crossfading with existing contents+let p a b = sinOsc ar (mce2 a b) 0 * 0.1+    x = mouseX kr 0 1 Linear 0.1+    y = mouseY kr 0 1 Linear 0.1+in mrg [out  0   (p 220 221)+       ,xOut 0 x (p 330 331)+       ,xOut 0 y (p 440 441)+       ,out  0   (p 120 121)]
+ Help/Ugen/zOsc.help.hs view
@@ -0,0 +1,8 @@+-- zOsc+let modulator = sinOsc kr 0.1 0+    freq = lfNoise2Id 'α' kr 10 `in_exprange` (10,1000)+    formantfreq = lfNoise2Id 'β' kr 1 `in_exprange` (700,1500)+    shape = modulator+    mode = sinOsc kr 0.91 0+    sig = X.zOsc ar freq formantfreq shape mode+in pan2 sig modulator 0.1
+ Help/Ugen/zeroCrossing.help.hs view
@@ -0,0 +1,7 @@+-- zeroCrossing+let a = sinOsc ar (sinOsc kr 1 0 * 600 + 700) 0 * 0.1+in mce [a, impulse ar (zeroCrossing a) 0 * 0.25]++-- zeroCrossing+let a = soundIn 0+in mce [a, sinOsc ar (zeroCrossing a) 0 * 0.1]
+ Help/Ugen/zitaRev.help.hs view
@@ -0,0 +1,37 @@+-- zitaRev ; http://kokkinizita.linuxaudio.org/linuxaudio/zita-rev1-doc/quickguide.html+let i = soundIn 0+    in_delay = 60+    eq1_freq = 315+    eq2_freq = 1500+    dry_wet_mix = 0.5+    level = 0+in X.zitaRev i i in_delay 200 3 2 6000 eq1_freq 0 eq2_freq 0 dry_wet_mix level++-- zitaRev ; longer+let i = soundIn 0+    in_delay = 80+    low_rt60 = 6+    mid_rt60 = 4+    eq1_freq = 190+    eq1_level = -6+    eq2_freq = 3500+    eq2_level = 6+    dry_wet_mix = 0+    level = 0+in X.zitaRev i i in_delay 200 low_rt60 mid_rt60 6000 eq1_freq eq1_level eq2_freq eq2_level dry_wet_mix level++-- zitaRev ; longer still+let i = soundIn 0+    k (nm,df,m) = control_m kr nm df m+    in_delay = k ("in_delay",100,(20,100,"lin"))+    low_rt60 = k ("low_rt60",6,(1,8,"exp"))+    mid_rt60 = k ("mid_rt60",2,(1,8,"exp"))+    eq1_freq = k ("eq1_freq",190,(40,2500,"exp"))+    eq1_level = k ("eq1_level",-6,(-15,15,"lin"))+    eq2_freq = k ("eq2_freq",3500,(160,10000,"exp"))+    eq2_level = k ("eq2_level",6,(-15,15,"lin"))+    dry_wet_mix = k ("dry_wet_mix",0.5,(0,1,"lin"))+    level = k ("level",-20,(-9,9,"lin"))+in X.zitaRev+   i i+   in_delay 200 low_rt60 mid_rt60 6000 eq1_freq eq1_level eq2_freq eq2_level dry_wet_mix level
− README
@@ -1,57 +0,0 @@-hsc3 - haskell supercollider-------------------------------[hsc3][hsc3] provides `Sound.SC3`, a module for using [Haskell][hs] as-a client to the [SuperCollider][sc3] synthesis server.  hsc3 requires-[hosc](?t=hosc).--For installation and configuration information see the-[tutorial][tutorial] at [hsc3-texts][hsc3-texts].--There are a number of related projects:--- [hsc3-dot](?t=hsc3-dot): UGen Graph Drawing-- [hsc3-graphs](?t=hsc3-graphs): UGen Graphs-- [hsc3-lang](?t=hsc3-lang): SC3 Language-- [hsc3-cairo](?t=hsc3-cairo) & [hsc3-plot](?t=hsc3-plot): Drawing & Plotting-- [hsc3-rec](?t=hsc3-rec) & [hsc3-unsafe](?t=hsc3-rec): UGen Variants-- [hsc3-db](?t=hsc3-db): UGen Database-- [hsc3-rw](?t=hsc3-rw): UGen Graph Re-writing-- [hsc3-forth](?t=hsc3-forth): FORTH SuperCollider-- [hsc3-lisp](?t=hsc3-lisp): LISP SuperCollider--The hsc3 interaction environment ([hsc3.el](?t=hsc3&e=emacs/hsc3.el))-is written for [GNU][gnu] [Emacs][emacs].--## cli--[scsyndef-stat](?t=hsc3&e=md/scsyndef-stat.md),-[scsyndef-to-hs](?t=hsc3&e=md/scsyndef-to-hs.md),-[scsynth](?t=hsc3&e=md/scsynth.md),-[setup](?t=hsc3&e=md/setup.md)--© [rohan drape][rd] and others, 2005-2017, [gpl][gpl].-with contributions by:--- henning thielemann-- stefan kersten-- alex mclean-- brent yorgey-- shae erisson--see the [darcs][darcs] [history](?t=hsc3&q=history) for details--initial announcement:-[[2005-11-29/haskell-cafe](?t=hsc3&e=md/announce.text),- [haskell.org](http://www.haskell.org/pipermail/haskell-cafe/2005-November/012483.html)]--[rd]: http://rd.slavepianos.org/-[hsc3]: http://rd.slavepianos.org/?t=hsc3-[hs]: http://haskell.org/-[sc3]: http://audiosynth.com/-[tutorial]: http://rd.slavepianos.org/?t=hsc3-texts&e=lhs/hsc3-tutorial.lhs-[hsc3-texts]: http://rd.slavepianos.org/?t=hsc3-texts-[gnu]: http://gnu.org/-[emacs]: http://gnu.org/software/emacs/-[darcs]: http://darcs.net/-[gpl]: http://gnu.org/copyleft/
+ README.md view
@@ -0,0 +1,85 @@+hsc3 - haskell supercollider+----------------------------++[hsc3](http://rohandrape.net/?t=hsc3)+provides `Sound.SC3`, a module for using+[Haskell](http://haskell.org/)+as a client to the+[SuperCollider](http://audiosynth.com/)+synthesis server.+hsc3 requires+[hosc](http://rohandrape.net/?t=hosc).++There is an+[introduction](http://rohandrape.net/?t=hsc3-texts&e=1.1-introduction.md)+and a+[tutorial](http://rohandrape.net/?t=hsc3-texts&e=2.1-tutorial.md)+at+[hsc3-texts](http://rohandrape.net/?t=hsc3-texts).++There are a number of related projects:++- [hsc3-util](http://rohandrape.net/?t=hsc3-util): hsc3 & related utilities (2020)+- [stsc3](http://rohandrape.net/?t=stsc3): Smalltalk SuperCollider (2019)+- [hsc3-m](http://rohandrape.net/?t=hsc3-m): UGen variants (2018)+- [hsc3-forth](http://rohandrape.net/?t=hsc3-forth): Forth SuperCollider (2014)+- [hsc3-lisp](http://rohandrape.net/?t=hsc3-lisp): Lisp SuperCollider (2014)+- [hsc3-plot](http://rohandrape.net/?t=hsc3-plot): Plotting (2013)+- [hsc3-data](http://rohandrape.net/?t=hsc3-data): Data formats &etc. (2013)+- [hsc3-rw](http://rohandrape.net/?t=hsc3-rw): UGen Graph Re-writing (2013)+- [hsc3-cairo](http://rohandrape.net/?t=hsc3-cairo): Drawing (2012)+- [hsc3-sf-hsndfile](http://rohandrape.net/?t=hsc3-sf-hsndfile): Sound file Io (libsndfile) (2010)+- [hsc3-auditor](http://rohandrape.net/?t=hsc3-auditor): Simple sound event auditioner (2010)+- [hsc3-rec](http://rohandrape.net/?t=hsc3-rec): Record UGens (2008)+- [smlsc3](http://rohandrape.net/?t=smlsc3): Standard Ml SuperCollider (2008)+- [hsc3-lang](http://rohandrape.net/?t=hsc3-lang): SC3 language (2007)+- [hsc3-graphs](http://rohandrape.net/?t=hsc3-graphs): UGen graph collection (2006)+- [hsc3-db](http://rohandrape.net/?t=hsc3-db): UGen Database (2006)+- [hsc3-dot](http://rohandrape.net/?t=hsc3-dot): UGen graph drawing (2006)+- [hsc3-sf](http://rohandrape.net/?t=hsc3-sf): Sound file Io (2006)+- [hsc3-unsafe](http://rohandrape.net/?t=hsc3-unsafe): Unsafe UGen variants (2006)+- [rsc3](http://rohandrape.net/?t=rsc3): Scheme SuperCollider (2004)+- [sc3-rdu](http://rohandrape.net/?t=sc3-rdu): SuperCollider UGens (1998)++The hsc3 interaction environment ([hsc3.el](http://rohandrape.net/?t=hsc3&e=emacs/hsc3.el))+is written for+[Gnu](http://gnu.org/)+[Emacs](http://gnu.org/software/emacs/).++<!--+There is also, more obliquely related:+-->++## help++[UGen Index](http://rohandrape.net/?t=hsc3&e=Help/Ugen/ix.md)++[Rohan Drape](http://rohandrape.net/)+and others, 2005-2024,+[Gpl-3](http://gnu.org/copyleft/)++With contributions by:++- Henning Thielemann+- Stefan Kersten+- Alex McLean+- Brent Yorgey+- Shae Erisson++See the+[git](https://git-scm.com/)+[history](http://rohandrape.net/?t=hsc3&q=history)+for details++Initial announcement:+[[2005-11-29/haskell-cafe](http://rohandrape.net/?t=hsc3&e=md/announce.text),+ [haskell.org](http://www.haskell.org/pipermail/haskell-cafe/2005-November/012483.html)]++* * *++```+$ doctest Sound/Sc3+Examples: 370  Tried: 370  Errors: 0  Failures: 0+$+```
− Sound/SC3.hs
@@ -1,8 +0,0 @@--- | Composite of "Sound.SC3.Common", "Sound.SC3.Server.Monad",--- "Sound.SC3.UGen" and "Sound.SC3.UGen.Bindings".-module Sound.SC3 (module M) where--import Sound.SC3.Common as M-import Sound.SC3.Server.Monad as M-import Sound.SC3.UGen as M-import Sound.SC3.UGen.Bindings as M
− Sound/SC3/Common.hs
@@ -1,6 +0,0 @@-module Sound.SC3.Common (module M) where--import Sound.SC3.Common.Buffer as M-import Sound.SC3.Common.Envelope as M-import Sound.SC3.Common.Math as M-import Sound.SC3.Common.Monad as M
− Sound/SC3/Common/Buffer.hs
@@ -1,184 +0,0 @@--- | Signals & wavetables-module Sound.SC3.Common.Buffer where--import Data.List {- base -}--import qualified Sound.SC3.Common.Math as S {- hsc3 -}--{- | /z/ ranges from 0 (for /i/) to 1 (for /j/).--> > 1.5.blend(2.0,0.50) == 1.75-> > 1.5.blend(2.0,0.75) == 1.875--> blend 0.50 1.5 2 == 1.75-> blend 0.75 1.5 2 == 1.875--}-blend :: Num a => a -> a -> a -> a-blend z i j = i + (z * (j - i))---- | Variant of '(!!)' but values for index greater than the size of--- the collection will be clipped to the last index.-clipAt :: Int -> [a] -> a-clipAt ix c =-    if ix > length c - 1-    then last c-    else c !! ix---- | 'abs' of '(-)'.-absdif :: Num a => a -> a -> a-absdif i j = abs (j - i)---- | 'blendAt' with @clip@ function as argument.-blendAtBy :: (Integral i,RealFrac n) => (i -> t -> n) -> n -> t -> n-blendAtBy f ix c =-    let m = floor ix-        m' = fromIntegral m-    in blend (absdif ix m') (f m c) (f (m + 1) c)---- | @SequenceableCollection.blendAt@ returns a linearly interpolated--- value between the two closest indices.  Inverse operation is--- 'indexInBetween'.------ > > [2,5,6].blendAt(0.4) == 3.2------ > blendAt 0 [2,5,6] == 2--- > blendAt 0.4 [2,5,6] == 3.2-blendAt :: RealFrac a => a -> [a] -> a-blendAt = blendAtBy clipAt---- | Resampling function, /n/ is destination length, /r/ is source--- length, /f/ is the indexing function, /c/ is the collection.-resamp1_gen :: (Integral i,RealFrac n) => i -> i -> (i -> t -> n) -> t -> i -> n-resamp1_gen n r f c =-    let n' = fromIntegral n-        fwd = (fromIntegral r - 1) / (n' - 1)-        gen i = blendAtBy f (fromIntegral i * fwd) c-    in gen---- | @SequenceableCollection.resamp1@ returns a new collection of the--- desired length, with values resampled evenly-spaced from the--- receiver with linear interpolation.------ > > [1].resamp1(3) == [1,1,1]--- > > [1,2,3,4].resamp1(12)--- > > [1,2,3,4].resamp1(3) == [1,2.5,4]------ > resamp1 3 [1] == [1,1,1]--- > resamp1 12 [1,2,3,4]--- > resamp1 3 [1,2,3,4] == [1,2.5,4]-resamp1 :: RealFrac n => Int -> [n] -> [n]-resamp1 n c =-    let gen = resamp1_gen n (length c) clipAt c-    in map gen [0 .. n - 1]---- | @ArrayedCollection.normalizeSum@ ensures sum of elements is one.------ > > [1,2,3].normalizeSum == [1/6,1/3,0.5]--- > normalizeSum [1,2,3] == [1/6,2/6,3/6]-normalizeSum :: (Fractional a) => [a] -> [a]-normalizeSum l =-    let n = sum l-    in map (/ n) l---- | Variant that specifies range of input sequence separately.-normalise_rng :: Fractional n => (n,n) -> (n,n) -> [n] -> [n]-normalise_rng (il,ir) (l,r) = map (\e -> S.linlin e il ir l r)---- | @ArrayedCollection.normalize@ returns a new Array with the receiver--- items normalized between min and max.------ > > [1,2,3].normalize == [0,0.5,1]--- > > [1,2,3].normalize(-20,10) == [-20,-5,10]------ > normalize 0 1 [1,2,3] == [0,0.5,1]--- > normalize (-20) 10 [1,2,3] == [-20,-5,10]-normalize :: (Fractional n, Ord n) => n -> n -> [n] -> [n]-normalize l r c = normalise_rng (minimum c,maximum c) (l,r) c---- | List of 2-tuples of elements at distance (stride) /n/.------ > t2_window 3 [1..9] == [(1,2),(4,5),(7,8)]-t2_window :: Integral i => i -> [t] -> [(t,t)]-t2_window n x =-    case x of-      i:j:_ -> (i,j) : t2_window n (genericDrop n x)-      _ -> []---- | List of 2-tuples of adjacent elements.------ > t2_adjacent [1..6] == [(1,2),(3,4),(5,6)]--- > t2_adjacent [1..5] == [(1,2),(3,4)]-t2_adjacent :: [t] -> [(t,t)]-t2_adjacent = t2_window (2::Int)---- | List of 2-tuples of overlapping elements.------ > t2_overlap [1..4] == [(1,2),(2,3),(3,4)]-t2_overlap :: [b] -> [(b,b)]-t2_overlap x = zip x (tail x)---- | Concat of 2-tuples.------ > t2_concat (t2_adjacent [1..6]) == [1..6]--- > t2_concat (t2_overlap [1..4]) == [1,2,2,3,3,4]-t2_concat :: [(a,a)] -> [a]-t2_concat x =-    case x of-      [] -> []-      (i,j):x' -> i : j : t2_concat x'--{- | A Signal is half the size of a Wavetable, each element is the sum-of two adjacent elements of the Wavetable.--> from_wavetable [-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5] == [0.0,0.5,1.0,0.5]-> let s = [0,0.5,1,0.5] in from_wavetable (to_wavetable s) == s--}-from_wavetable :: Num n => [n] -> [n]-from_wavetable = map (uncurry (+)) . t2_adjacent--{- | A Wavetable has /n * 2 + 2/ elements, where /n/ is the number-of elements of the Signal.  Each signal element /e0/ expands to the-two elements /(2 * e0 - e1, e1 - e0)/ where /e1/ is the next-element, or zero at the final element.  Properly wavetables are-only of power of two element signals.--> > Signal[0,0.5,1,0.5].asWavetable == Wavetable[-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5]--> to_wavetable [0,0.5,1,0.5] == [-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5]--}-to_wavetable :: Num a => [a] -> [a]-to_wavetable =-    let f (e0,e1) = (2 * e0 - e1,e1 - e0)-    in t2_concat . map f . t2_overlap . (++ [0])--{- | Variant of 'sineFill' that gives each component table.--> let t = sineGen 1024 (map recip [1,2,3,5,8,13,21,34,55]) (replicate 9 0)-> map length t == replicate 9 1024--> import Sound.SC3.Plot-> plotTable t--}-sineGen :: (Floating n,Enum n) => Int -> [n] -> [n] -> [[n]]-sineGen n =-    let incr = (2 * pi) / fromIntegral n-        ph partial = take n [0,incr * partial ..]-        f h amp iph = map (\z -> sin (z + iph) * amp) (ph h)-    in zipWith3 f [1..]--{- | @Signal.*sineFill@ is a table generator.  Frequencies are-partials, amplitudes and initial phases are as given.  Result is-normalised.--> let t = let a = [[21,5,34,3,2,13,1,8,55]->                 ,[13,8,55,34,5,21,3,1,2]->                 ,[55,34,1,3,2,13,5,8,21]]->         in map (\amp -> sineFill 1024 (map recip amp) (replicate 9 0)) a--> import Sound.SC3.Plot-> plotTable t--}-sineFill :: (Ord n,Floating n,Enum n) => Int -> [n] -> [n] -> [n]-sineFill n amp iph =-    let t = sineGen n amp iph-    in normalize (-1) 1 (map sum (transpose t))
− Sound/SC3/Common/Buffer/Array.hs
@@ -1,31 +0,0 @@--- | 'A.Array' variants of "Sound.SC3.Common.Buffer".-module Sound.SC3.Common.Buffer.Array where--import qualified Data.Array as A {- array -}--import qualified Sound.SC3.Common.Buffer as SC3---- | 'SC3.clipAt'.-clipAt :: Int -> A.Array Int a -> a-clipAt ix c =-    let (l,r) = A.bounds c-        f = (A.!) c-    in if ix < l then f l else if ix > r then f r else f ix---- | 'C.blendAtBy' of 'clipAt'.------ > blendAt 0 (A.listArray (0,2) [2,5,6]) == 2--- > blendAt 0.4 (A.listArray (0,2) [2,5,6]) == 3.2-blendAt :: RealFrac a => a -> A.Array Int a -> a-blendAt = SC3.blendAtBy clipAt---- | 'C.resamp1'.------ > resamp1 12 (A.listArray (0,3) [1,2,3,4])--- > resamp1 3 (A.listArray (0,3) [1,2,3,4]) == A.listArray (0,2) [1,2.5,4]-resamp1 :: RealFrac n => Int -> A.Array Int n -> A.Array Int n-resamp1 n c =-    let (_,r) = A.bounds c-        gen = SC3.resamp1_gen n (r + 1) clipAt c-        rs = map gen [0 .. n - 1]-    in A.listArray (0,n - 1) rs
− Sound/SC3/Common/Buffer/Gen.hs
@@ -1,82 +0,0 @@--- | Implementaion of server b_gen routines.------ The naming scheme is: _p generates one partial, _l generates a list--- of partials, _nrm is the unit normalised form.-module Sound.SC3.Common.Buffer.Gen where--import Data.List {- base -}--import Sound.SC3.Common.Buffer {- hsc3 -}-import Sound.SC3.Common.Math {- hsc3 -}---- | Sum (mix) multiple tables into one.-sum_l :: Num n => [[n]] -> [n]-sum_l = map sum . transpose---- | Unit normalisation.-nrm_u :: (Fractional n,Ord n) => [n] -> [n]-nrm_u = normalize (-1) 1---- * sine1--sine1_p :: (Enum n,Floating n) => Int -> (n,n) -> [n]-sine1_p n (pfreq,ampl) = sine3_p n (pfreq,ampl,0)--sine1_l :: (Enum n,Floating n) => Int -> [n] -> [[n]]-sine1_l n ampl = map (sine1_p n) (zip [1..] ampl)---- > import Sound.SC3.Plot--- > plotTable1 (sine1 256 [1,0.95 .. 0.5])-sine1 :: (Enum n,Floating n) => Int -> [n] -> [n]-sine1 n = sum_l . sine1_l n---- > plotTable1 (sine1_nrm 256 [1,0.95 .. 0.5])-sine1_nrm :: (Enum n,Floating n,Ord n) => Int -> [n] -> [n]-sine1_nrm n = nrm_u . sine1 n---- * sine2--sine2_l :: (Enum n,Floating n) => Int -> [(n,n)] -> [[n]]-sine2_l n = map (sine1_p n)---- > plotTable1 (sine2 256 (zip [1,2..] [1,0.95 .. 0.5]))--- > plotTable1 (sine2 256 (zip [1,1.5 ..] [1,0.95 .. 0.5]))-sine2 :: (Enum n,Floating n) => Int -> [(n,n)] -> [n]-sine2 n = sum_l . sine2_l n--sine2_nrm :: (Enum n,Floating n,Ord n) => Int -> [n] -> [n]-sine2_nrm n = nrm_u . sine1 n---- * sine3--sine3_p :: (Enum n,Floating n) => Int -> (n,n,n) -> [n]-sine3_p n (pfreq,ampl,phase) =-    let incr = (two_pi / (fromIntegral n - 1)) * pfreq-    in map ((*) ampl . sin) (take n [phase,phase + incr ..])--sine3_l :: (Enum n,Floating n) => Int -> [(n,n,n)] -> [[n]]-sine3_l n = map (sine3_p n)---- > plotTable1 (sine3 256 (zip3 [1,1.5 ..] [1,0.95 .. 0.5] [0,pi/7..]))-sine3 :: (Enum n,Floating n) => Int -> [(n,n,n)] -> [n]-sine3 n = sum_l . sine3_l n---- * cheby--{- | Generate Chebyshev waveshaping table, see b_gen_cheby.--> import Sound.SC3.Plot-> plotTable1 (gen_cheby 256 [1,0,1,1,0,1])---}-gen_cheby :: (Enum n, Floating n, Ord n, Integral i) => i -> [n] -> [n]-gen_cheby n =-    let acos' x = if x > 1 then 0 else if x < -1 then pi else acos x-        c k x = cos (k * acos' x)-        ix = [-1,-1 + (2 / (fromIntegral n - 1)) .. 1]-        mix = map sum . transpose-        c_normalize x = let m = maximum (map abs x) in map (* (recip m)) x-    in c_normalize . mix . map (\(k,a) -> map ((* a) . (c k)) ix) . zip [1..]--cheby :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]-cheby = gen_cheby
− Sound/SC3/Common/Buffer/Vector.hs
@@ -1,30 +0,0 @@--- | 'V.Vector' variants of "Sound.SC3.Common.Buffer".-module Sound.SC3.Common.Buffer.Vector where--import qualified Data.Vector as V {- vector -}--import qualified Sound.SC3.Common.Buffer as C {- hsc3 -}---- | 'C.clipAt'.-clipAt :: Int -> V.Vector a -> a-clipAt ix c =-    let r = V.length c-        f = (V.!) c-    in if ix > r - 1 then f (r - 1) else f ix---- | 'C.blendAtBy' of 'clipAt'.------ > blendAt 0 (V.fromList [2,5,6]) == 2--- > blendAt 0.4 (V.fromList [2,5,6]) == 3.2--- > blendAt 2.1 (V.fromList [2,5,6]) == 6-blendAt :: RealFrac a => a -> V.Vector a -> a-blendAt = C.blendAtBy clipAt---- | 'C.resamp1'.------ > resamp1 12 (V.fromList [1,2,3,4])--- > resamp1 3 (V.fromList [1,2,3,4]) == V.fromList [1,2.5,4]-resamp1 :: RealFrac n => Int -> V.Vector n -> V.Vector n-resamp1 n c =-    let gen = C.resamp1_gen n (V.length c) clipAt c-    in V.generate n gen
− Sound/SC3/Common/Envelope.hs
@@ -1,466 +0,0 @@--- | Envelope generators.-module Sound.SC3.Common.Envelope where--import Data.List {- base -}-import Data.Maybe {- base -}--import qualified Sound.SC3.Common.Prelude as P-import qualified Sound.SC3.Common.Math.Interpolate as I---- * Curve---- | Envelope curve indicator input.-data Envelope_Curve a = EnvStep-                      | EnvLin-                      | EnvExp-                      | EnvSin-                      | EnvWelch -- ^ Note: not implemented at SC3-                      | EnvNum a-                      | EnvSqr-                      | EnvCub-                      | EnvHold-                        deriving (Eq, Show)---- | Envelope curve pair.-type Envelope_Curve2 a = P.T2 (Envelope_Curve a)---- | Envelope curve triple.-type Envelope_Curve3 a = P.T3 (Envelope_Curve a)---- | Envelope curve quadruple.-type Envelope_Curve4 a = P.T4 (Envelope_Curve a)---- | Convert 'Envelope_Curve' to shape value.------ > map env_curve_shape [EnvSin,EnvSqr] == [3,6]-env_curve_shape :: Num a => Envelope_Curve a -> a-env_curve_shape e =-    case e of-      EnvStep -> 0-      EnvLin -> 1-      EnvExp -> 2-      EnvSin -> 3-      EnvWelch -> 4-      EnvNum _ -> 5-      EnvSqr -> 6-      EnvCub -> 7-      EnvHold -> 8---- | The /value/ of 'EnvCurve' is non-zero for 'EnvNum'.------ > map env_curve_value [EnvWelch,EnvNum 2] == [0,2]-env_curve_value :: Num a => Envelope_Curve a -> a-env_curve_value e =-    case e of-      EnvNum u -> u-      _ -> 0---- | 'Interpolation_F' of 'Envelope_Curve'.-env_curve_interpolation_f :: (Ord t, Floating t) => Envelope_Curve t -> I.Interpolation_F t-env_curve_interpolation_f c =-    case c of-      EnvStep -> I.step-      EnvLin -> I.linear-      EnvExp -> I.exponential-      EnvSin -> I.sine-      EnvWelch -> I.welch-      EnvNum n -> I.curve n-      EnvSqr -> I.squared-      EnvCub -> I.cubed-      EnvHold -> undefined---- | Apply /f/ to 'EnvNum' value.-env_curve_coerce :: (a -> b) -> Envelope_Curve a -> Envelope_Curve b-env_curve_coerce f e =-    case e of-      EnvStep -> EnvStep-      EnvLin -> EnvLin-      EnvExp -> EnvExp-      EnvSin -> EnvSin-      EnvWelch -> EnvWelch-      EnvNum x -> EnvNum (f x)-      EnvSqr -> EnvSqr-      EnvCub -> EnvCub-      EnvHold -> EnvHold---- * Envelope---- | SC3 envelope segment model-data Envelope a =-    Envelope {env_levels :: [a] -- ^ Set of /n/ levels, n is >= 1-             ,env_times :: [a] -- ^ Set of /n-1/ time intervals-             ,env_curves :: [Envelope_Curve a] -- ^ Possibly empty curve set-             ,env_release_node :: Maybe Int -- ^ Maybe index to release node-             ,env_loop_node :: Maybe Int -- ^ Maybe index to loop node-             }-    deriving (Eq,Show)---- | Apply /f/ to all /a/ at 'Envelope'.-envelope_coerce :: (a -> b) -> Envelope a -> Envelope b-envelope_coerce f e =-    let Envelope l t c rn ln = e-    in Envelope (map f l) (map f t) (map (env_curve_coerce f) c) rn ln---- | Variant without release and loop node inputs (defaulting to nil).-envelope :: [a] -> [a] -> [Envelope_Curve a] -> Envelope a-envelope l t c = Envelope l t c Nothing Nothing---- | Duration of 'Envelope', ie. 'sum' '.' 'env_times'.-envelope_duration :: Num n => Envelope n -> n-envelope_duration = sum . env_times---- | Number of segments at 'Envelope', ie. 'length' '.' 'env_times'.-envelope_n_segments :: Integral i => Envelope n -> i-envelope_n_segments = genericLength . env_times---- | Determine which envelope segment a given time /t/ falls in.-envelope_segment_ix :: (Ord a, Num a) => Envelope a -> a -> Maybe Int-envelope_segment_ix e t =-    let d = P.dx_d (env_times e)-    in findIndex (>= t) d---- | A set of start time, start level, end time, end level and curve.-type Envelope_Segment t = (t,t,t,t,Envelope_Curve t)---- | Extract envelope segment given at index /i/.-envelope_segment :: Num t => Envelope t -> Int -> Envelope_Segment t-envelope_segment e i =-    let l = env_levels e-        t = env_times e-        x0 = l !! i-        x1 = l !! (i + 1)-        t0 = (0 : P.dx_d t) !! i-        t1 = t0 + t !! i-        c = envelope_curves e !! i-    in (t0,x0,t1,x1,c)---- | Extract all segments.-envelope_segments :: Num t => Envelope t -> [Envelope_Segment t]-envelope_segments e =-    let n = envelope_n_segments e-    in map (envelope_segment e) [0 .. n - 1]---- | Transform list of 'Envelope_Segment's into lists ('env_levels','env_times','env_curves').-pack_envelope_segments :: Num t => [Envelope_Segment t] -> ([t],[t],[Envelope_Curve t])-pack_envelope_segments s =-    case s of-      [] -> error ""-      [(t0,l0,t1,l1,c)] -> ([l0,l1],[t1 - t0],[c])-      (_,l0,_,_,_) : _ ->-          let t (t0,_,t1,_,_) = t1 - t0-              c (_,_,_,_,x) = x-              l (_,_,_,x,_) = x-          in (l0 : map l s,map t s,map c s)---- | An envelope is /normal/ if it has no segments with zero duration.-envelope_is_normal :: (Eq n,Num n) => Envelope n -> Bool-envelope_is_normal = not . any (== 0) . env_times---- | Normalise envelope by deleting segments of zero duration.-envelope_normalise :: (Num a, Ord a) => Envelope a -> Envelope a-envelope_normalise e =-    let s = envelope_segments e-        f (t0,_,t1,_,_) = t1 <= t0-        s' = filter (not . f) s-        (l,t,c) = pack_envelope_segments s'-    in case e of-         Envelope _ _ _ Nothing Nothing -> Envelope l t c Nothing Nothing-         _ -> error "envelope_normalise: has release or loop node..."---- | Get value for 'Envelope' at time /t/, or zero if /t/ is out of--- range.  By convention if the envelope has a segment of zero--- duration we give the rightmost value.-envelope_at :: (Ord t, Floating t) => Envelope t -> t -> t-envelope_at e t =-    case envelope_segment_ix e t of-      Just n -> let (t0,x0,t1,x1,c) = envelope_segment e n-                    d = t1 - t0-                    t' = (t - t0) / d-                    f = env_curve_interpolation_f c-                in if d <= 0-                   then x1-                   else f x0 x1 t'-      Nothing -> 0---- | Render 'Envelope' to breakpoint set of /n/ equi-distant places.-envelope_render :: (Ord t, Floating t, Enum t) => t -> Envelope t -> [(t,t)]-envelope_render n e =-    let d = envelope_duration e-        k = d / (n - 1)-        t = [0,k .. d]-    in zip t (map (envelope_at e) t)---- | Contruct a lookup table of /n/ places from 'Envelope'.-envelope_table :: (Ord t, Floating t, Enum t) => t -> Envelope t -> [t]-envelope_table n = map snd . envelope_render n---- | Variant on 'env_curves' that expands the, possibly empty, user--- list by cycling (if not empty) or by filling with 'EnvLin'.-envelope_curves :: Envelope a -> [Envelope_Curve a]-envelope_curves e =-    let c = env_curves e-        n = envelope_n_segments e-    in if null c-       then replicate n EnvLin-       else take n (cycle c)---- | Linear SC3 form of 'Envelope' data.------ Form is: l0 #t reset loop l1 t0 c0 c0' ...------ > let {l = [0,0.6,0.3,1.0,0]--- >     ;t = [0.1,0.02,0.4,1.1]--- >     ;c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]--- >     ;e = Envelope l t c Nothing Nothing--- >     ;r = [0,4,-99,-99,0.6,0.1,1,0,0.3,0.02,2,0,1,0.4,5,-6,0,1.1,3,0]}--- > in envelope_sc3_array e == Just r-envelope_sc3_array :: Num a => Envelope a -> Maybe [a]-envelope_sc3_array e =-    let Envelope l t _ rn ln = e-        n = length t-        n' = fromIntegral n-        rn' = fromIntegral (fromMaybe (-99) rn)-        ln' = fromIntegral (fromMaybe (-99) ln)-        c = envelope_curves e-        f i j k = [i,j,env_curve_shape k,env_curve_value k]-    in case l of-         l0:l' -> Just (l0 : n' : rn' : ln' : concat (zipWith3 f l' t c))-         _ -> Nothing---- | @IEnvGen@ SC3 form of 'Envelope' data.  Offset not supported (zero).------ > let {l = [0,0.6,0.3,1.0,0]--- >     ;t = [0.1,0.02,0.4,1.1]--- >     ;c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]--- >     ;e = Envelope l t c Nothing Nothing--- >     ;r = [0,0,4,1.62,0.1,1,0,0.6,0.02,2,0,0.3,0.4,5,-6,1,1.1,3,0,0]}--- > in envelope_sc3_ienvgen_array e == Just r-envelope_sc3_ienvgen_array :: Num a => Envelope a -> Maybe [a]-envelope_sc3_ienvgen_array e =-    let Envelope l t _ _ _ = e-        n = length t-        n' = fromIntegral n-        c = envelope_curves e-        f i j k = [j,env_curve_shape k,env_curve_value k,i]-    in case l of-         l0:l' -> Just (0 : l0 : n' : sum t : concat (zipWith3 f l' t c))-         _ -> Nothing---- | 'True' if 'env_release_node' is not 'Nothing'.-env_is_sustained :: Envelope a -> Bool-env_is_sustained = isJust . env_release_node---- | Delay the onset of the envelope.-env_delay :: Envelope a -> a -> Envelope a-env_delay (Envelope l t c rn ln) d =-    let (l0:_) = l-        l' = l0 : l-        t' = d : t-        c' = EnvLin : c-        rn' = fmap (+ 1) rn-        ln' = fmap (+ 1) ln-    in Envelope l' t' c' rn' ln'---- | Connect releaseNode (or end) to first node of envelope.-env_circle :: Fractional a => Envelope a -> a -> Envelope_Curve a -> Envelope a-env_circle (Envelope l t c rn _) tc cc =-    let z = 1 {- 1 - impulse KR 0 0 -}-        n = length t-    in case rn of-         Nothing -> let l' = 0 : l ++ [0]-                        t' = z * tc : t ++ [9e8]-                        c' = cc : take n (cycle c) ++ [EnvLin]-                        rn' = Just (n + 1)-                    in Envelope l' t' c' rn' (Just 0)-         Just i -> let l' = 0 : l-                       t' = z * tc : t-                       c' = cc : take n (cycle c)-                       rn' = Just (i + 1)-                   in  Envelope l' t' c' rn' (Just 0)---- * Construct--{- | Trapezoidal envelope generator.--Requires (<=) and (>=) functions returning @1@ for true and @0@ for false.--The arguments are: 1. @shape@ determines the sustain time as a-proportion of @dur@, zero is a triangular envelope, one a rectangular-envelope; 2. @skew@ determines the attack\/decay ratio, zero is an-immediate attack and a slow decay, one a slow attack and an immediate-decay; 3. @duration@ in seconds; 4. @amplitude@ as linear gain.---}-envTrapezoid_f :: Num t => (t -> t -> t,t -> t -> t) -> t -> t -> t -> t -> Envelope t-envTrapezoid_f (lte_f,gte_f) shape skew dur amp =-    let x1 = skew * (1 - shape)-        bp = [(0,lte_f skew 0)-             ,(x1,1)-             ,(shape + x1,1)-             ,(1,gte_f skew 1)]-    in envCoord bp dur amp EnvLin--{- | Co-ordinate based static envelope generator.  Points are (time,value) pairs.--> let e = envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin-> in envelope_sc3_array e == Just [0,2,-99,-99,1,1/4,1,0,0,3/4,1,0]--> import Sound.SC3.Plot {- hsc3-plot -}--> plotEnvelope [envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin]---}-envCoord :: Num a => [(a,a)] -> a -> a -> Envelope_Curve a -> Envelope a-envCoord bp dur amp c =-    let l = map ((* amp) . snd) bp-        t = map (* dur) (tail (P.d_dx (map fst bp)))-    in Envelope l t [c] Nothing Nothing---- | Variant 'envPerc' with user specified 'Envelope_Curve a'.-envPerc' :: Num a => a -> a -> a -> Envelope_Curve2 a -> Envelope a-envPerc' atk rls lvl (c0,c1) =-    let c = [c0,c1]-    in Envelope [0,lvl,0] [atk,rls] c Nothing Nothing---- | Percussive envelope, with attack, release, level and curve---   inputs.-envPerc :: Num a => a -> a -> Envelope a-envPerc atk rls =-    let cn = EnvNum (-4)-    in envPerc' atk rls 1 (cn,cn)---- | Triangular envelope, with duration and level inputs.------ > let e = envTriangle 1 0.1--- > in envelope_sc3_array e = Just [0,2,-99,-99,0.1,0.5,1,0,0,0.5,1,0]-envTriangle :: Fractional a => a -> a -> Envelope a-envTriangle dur lvl =-    let c = replicate 2 EnvLin-        d = replicate 2 (dur / 2)-    in Envelope [0,lvl,0] d c Nothing Nothing---- | Sine envelope, with duration and level inputs.------ > let e = envSine 0 0.1--- > in envelope_sc3_array e == Just [0,2,-99,-99,0.1,0,3.0,0,0,0,3,0]-envSine :: Fractional a => a -> a -> Envelope a-envSine dur lvl =-    let c = replicate 2 EnvSin-        d = replicate 2 (dur / 2)-    in Envelope [0,lvl,0] d c Nothing Nothing---- | Parameters for LINEN envelopes.-data LINEN a = LINEN {linen_attackTime :: a-                     ,linen_sustainTime :: a-                     ,linen_releaseTime :: a-                     ,linen_level :: a-                     ,linen_curve :: Envelope_Curve3 a}---- | Record ('LINEN') variant of 'envLinen'.-envLinen_r :: Num a => LINEN a -> Envelope a-envLinen_r (LINEN aT sT rT lv (c0,c1,c2)) =-    let l = [0,lv,lv,0]-        t = [aT,sT,rT]-        c = [c0,c1,c2]-    in Envelope l t c Nothing Nothing---- | Variant of 'envLinen' with user specified 'Envelope_Curve a'.-envLinen' :: Num a => a -> a -> a -> a -> Envelope_Curve3 a -> Envelope a-envLinen' aT sT rT lv c = envLinen_r (LINEN aT sT rT lv c)---- | Linear envelope parameter constructor.------ > let {e = envLinen 0 1 0 1--- >     ;s = envelope_segments e--- >     ;p = pack_envelope_segments s}--- > in p == (env_levels e,env_times e,env_curves e)-envLinen :: Num a => a -> a -> a -> a -> Envelope a-envLinen aT sT rT l =-    let c = (EnvLin,EnvLin,EnvLin)-    in envLinen' aT sT rT l c---- | Parameters for ADSR envelopes.---   The sustain level is given as a proportion of the peak level.-data ADSR a = ADSR {adsr_attackTime :: a-                   ,adsr_decayTime :: a-                   ,adsr_sustainLevel :: a-                   ,adsr_releaseTime :: a-                   ,adsr_peakLevel :: a-                   ,adsr_curve :: Envelope_Curve3 a-                   ,adsr_bias :: a}--adsrDefault :: Fractional n => ADSR n-adsrDefault = let c = EnvNum (-4) in ADSR 0.01 0.3 0.5 1 1 (c,c,c) 0---- | Attack, decay, sustain, release envelope parameter constructor.-envADSR :: Num a => a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a-envADSR aT dT sL rT pL c b = envADSR_r (ADSR aT dT sL rT pL (c,c,c) b)---- | Vairant with defaults for pL, c and b.-envADSR' :: Num a => a -> a -> a -> a -> Envelope a-envADSR' aT dT sL rT = envADSR aT dT sL rT 1 (EnvNum (-4)) 0---- | Record ('ADSR') variant of 'envADSR'.-envADSR_r :: Num a => ADSR a -> Envelope a-envADSR_r (ADSR aT dT sL rT pL (c0,c1,c2) b) =-    let l = map (+ b) [0,pL,pL*sL,0]-        t = [aT,dT,rT]-        c = [c0,c1,c2]-    in Envelope l t c (Just 2) Nothing---- | Parameters for Roland type ADSSR envelopes.-data ADSSR a = ADSSR {adssr_attackTime :: a-                     ,adssr_attackLevel :: a-                     ,adssr_decayTime :: a-                     ,adssr_decayLevel :: a-                     ,adssr_slopeTime :: a-                     ,adssr_sustainLevel :: a-                     ,adssr_releaseTime :: a-                     ,adssr_curve :: Envelope_Curve4 a-                     ,adssr_bias :: a}---- | Attack, decay, slope, sustain, release envelope parameter constructor.-envADSSR :: Num a => a -> a -> a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a-envADSSR t1 l1 t2 l2 t3 l3 t4 c b = envADSSR_r (ADSSR t1 l1 t2 l2 t3 l3 t4 (c,c,c,c) b)---- | Record ('ADSSR') variant of 'envADSSR'.-envADSSR_r :: Num a => ADSSR a -> Envelope a-envADSSR_r (ADSSR t1 l1 t2 l2 t3 l3 t4 (c1,c2,c3,c4) b) =-    let l = map (+ b) [0,l1,l2,l3,0]-        t = [t1,t2,t3,t4]-        c = [c1,c2,c3,c4]-    in Envelope l t c (Just 3) Nothing---- | Parameters for ASR envelopes.-data ASR a = ASR {asr_attackTime :: a-                 ,asr_sustainLevel :: a-                 ,asr_releaseTime :: a-                 ,asr_curve :: Envelope_Curve2 a}---- | SC3 .asr has singular curve argument, hence _c suffix.-envASR_c :: Num a => a -> a -> a -> Envelope_Curve2 a -> Envelope a-envASR_c aT sL rT c = envASR_r (ASR aT sL rT c)---- | Attack, sustain, release envelope parameter constructor.------ > let {c = 3--- >     ;r = Just [0,2,1,-99,0.1,3,c,0,0,2,c,0]}--- > in envelope_sc3_array (envASR 3 0.1 2 EnvSin) == r-envASR :: Num a => a -> a -> a -> Envelope_Curve a -> Envelope a-envASR aT sL rT c = envASR_c aT sL rT (c,c)---- | Record ('ASR') variant of 'envASR'.-envASR_r :: Num a => ASR a -> Envelope a-envASR_r (ASR aT sL rT (c0,c1)) =-    let l = [0,sL,0]-        t = [aT,rT]-        c' = [c0,c1]-    in Envelope l t c' (Just 1) Nothing---- | All segments are horizontal lines.-envStep :: [a] -> [a] -> Maybe Int -> Maybe Int -> Envelope a-envStep levels times releaseNode loopNode =-    if length levels /= length times-    then error "envStep: levels and times must have same size"-    else let levels' = head levels : levels-         in Envelope levels' times [EnvStep] releaseNode loopNode
− Sound/SC3/Common/Math.hs
@@ -1,435 +0,0 @@-module Sound.SC3.Common.Math where--import qualified Data.Fixed as F {- base -}-import Data.Maybe {- base -}---- | Half pi.------ > half_pi == 1.5707963267948966-half_pi :: Floating a => a-half_pi = pi / 2---- | Two pi.------ > two_pi == 6.283185307179586-two_pi :: Floating n => n-two_pi = 2 * pi---- | Multiply and add, ordinary haskell argument order.--- 'mul_add' is a method of the 'MulAdd' class.------ > map (mul_add_hs 2 3) [1,2] == [5,7] && map (mul_add_hs 3 4) [1,2] == [7,10]-mul_add_hs :: Num a => a -> a -> a -> a-mul_add_hs m a = (+ a) . (* m)--sc_truncate :: RealFrac a => a -> a-sc_truncate = fromInteger . truncate--sc_round :: RealFrac a => a -> a-sc_round = fromInteger . round--sc_ceiling :: RealFrac a => a -> a-sc_ceiling = fromInteger . ceiling--sc_floor :: RealFrac a => a -> a-sc_floor = fromInteger . floor---- | Variant of @SC3@ @roundTo@ function.------ > let r = [0,0,0.25,0.25,0.5,0.5,0.5,0.75,0.75,1,1]--- > in map (`sc3_round_to` 0.25) [0,0.1 .. 1] == r-sc3_round_to :: RealFrac n => n -> n -> n-sc3_round_to a b = if b == 0 then a else sc_floor ((a / b) + 0.5) * b--sc3_idiv :: RealFrac n => n -> n -> n-sc3_idiv a b = fromInteger (floor a `div` floor b)--{- | The SC3 @%@ UGen operator is the 'F.mod'' function.--> > 1.5 % 1.2 // ~= 0.3-> > -1.5 % 1.2 // ~= 0.9-> > 1.5 % -1.2 // ~= -0.9-> > -1.5 % -1.2 // ~= -0.3--> let (%) = sc3_mod-> 1.5 % 1.2 ~= 0.3-> (-1.5) % 1.2 ~= 0.9-> 1.5 % (-1.2) ~= -0.9-> (-1.5) % (-1.2) ~= -0.3--> > 1.2 % 1.5 // ~= 1.2-> > -1.2 % 1.5 // ~= 0.3-> > 1.2 % -1.5 // ~= -0.3-> > -1.2 % -1.5 // ~= -1.2--> 1.2 % 1.5 ~= 1.2-> (-1.2) % 1.5 ~= 0.3-> 1.2 % (-1.5) ~= -0.3-> (-1.2) % (-1.5) ~= -1.2--> map (\n -> sc3_mod n 12.0) [-1.0,12.25,15.0] == [11.0,0.25,3.0]--}-sc3_mod :: RealFrac n => n -> n -> n-sc3_mod = F.mod'---- | Type specialised 'sc3_mod'.-fmod_f32 :: Float -> Float -> Float-fmod_f32 = sc3_mod---- | Type specialised 'sc3_mod'.-fmod_f64 :: Double -> Double -> Double-fmod_f64 = sc3_mod---- | @SC3@ clip function.  Clip /n/ to within range /(i,j)/.  'clip' is a 'UGen'.------ > map (\n -> sc_clip n 5 10) [3..12] == [5,5,5,6,7,8,9,10,10,10]-sc_clip :: Ord a => a -> a -> a -> a-sc_clip n i j = if n < i then i else if n > j then j else n---- | Variant of 'sc_clip' with haskell argument structure.------ > map (clip_hs (5,10)) [3..12] == [5,5,5,6,7,8,9,10,10,10]-clip_hs :: (Ord a) => (a,a) -> a -> a-clip_hs (i,j) n = sc_clip n i j---- | Fractional modulo.------ > map (\n -> sc_mod n 12.0) [-1.0,12.25,15.0] == [11.0,0.25,3.0]-sc_mod :: RealFrac a => a -> a -> a-sc_mod n hi =-    let lo = 0.0-    in if n >= lo && n < hi-       then n-       else if hi == lo-            then lo-            else n - hi * sc_floor (n / hi)--{- | Wrap function that is /non-inclusive/ at right edge, ie. the Wrap UGen rule.--> map (sc_wrap_ni 0 5) [4,5,6] == [4,0,1]-> map (sc_wrap_ni 5 10) [3..12] == [8,9,5,6,7,8,9,5,6,7]--}-sc_wrap_ni :: RealFrac a => a -> a -> a -> a-sc_wrap_ni lo hi n = sc_mod (n - lo) (hi - lo) + lo--{- | Wrap /n/ to within range /(i,j)/, ie. @AbstractFunction.wrap@,-ie. /inclusive/ at right edge.  'wrap' is a 'UGen', hence prime.--> > [5,6].wrap(0,5) == [5,0]-> map (wrap_hs (0,5)) [5,6] == [5,0]--> > [9,10,5,6,7,8,9,10,5,6].wrap(5,10) == [9,10,5,6,7,8,9,10,5,6]-> map (wrap_hs (5,10)) [3..12] == [9,10,5,6,7,8,9,10,5,6]---}-wrap_hs :: RealFrac n => (n,n) -> n -> n-wrap_hs (i,j) n =-    let r = j - i + 1-    in if n >= i && n <= j-       then n-       else n - r * sc_floor ((n - i) / r)---- | Variant of 'wrap'' with @SC3@ argument ordering.------ > map (\n -> sc_wrap n 5 10) [3..12] == map (wrap_hs (5,10)) [3..12]-sc_wrap :: RealFrac n => n -> n -> n -> n-sc_wrap a b c = wrap_hs (b,c) a--{- | Generic variant of 'wrap''.--> > [5,6].wrap(0,5) == [5,0]-> map (generic_wrap (0,5)) [5,6] == [5,0]--> > [9,10,5,6,7,8,9,10,5,6].wrap(5,10) == [9,10,5,6,7,8,9,10,5,6]-> map (generic_wrap (5::Integer,10)) [3..12] == [9,10,5,6,7,8,9,10,5,6]--}-generic_wrap :: (Ord a, Num a) => (a,a) -> a -> a-generic_wrap (l,r) n =-    let d = r - l + 1-        f = generic_wrap (l,r)-    in if n < l-       then f (n + d)-       else if n > r then f (n - d) else n---- > bin_to_freq 44100 2048 32 == 689.0625-bin_to_freq :: (Fractional n, Integral i) => n -> i -> i -> n-bin_to_freq sr n i = fromIntegral i * sr / fromIntegral n---- | Midi note number to cycles per second.------ > map (floor . midi_to_cps) [0,24,69,120,127] == [8,32,440,8372,12543]--- > map (floor . midi_to_cps) [-36,138] == [1,23679]-midi_to_cps :: Floating a => a -> a-midi_to_cps i = 440.0 * (2.0 ** ((i - 69.0) * (1.0 / 12.0)))---- | Cycles per second to midi note number.------ > map (round . cps_to_midi) [8,32,440,8372,12543] == [0,24,69,120,127]--- > map (round . cps_to_midi) [1,24000] == [-36,138]-cps_to_midi :: Floating a => a -> a-cps_to_midi a = (logBase 2 (a * (1.0 / 440.0)) * 12.0) + 69.0--cps_to_oct :: Floating a => a -> a-cps_to_oct a = logBase 2 (a * (1.0 / 440.0)) + 4.75--oct_to_cps :: Floating a => a -> a-oct_to_cps a = 440.0 * (2.0 ** (a - 4.75))---- | Linear amplitude to decibels.------ > map (round . amp_to_db) [0.01,0.05,0.0625,0.125,0.25,0.5] == [-40,-26,-24,-18,-12,-6]-amp_to_db :: Floating a => a -> a-amp_to_db a = logBase 10 a * 20---- | Decibels to linear amplitude.------ > map (floor . (* 100). db_to_amp) [-40,-26,-24,-18,-12,-6] == [01,05,06,12,25,50]-db_to_amp :: Floating a => a -> a-db_to_amp a = 10 ** (a * 0.05)---- | Fractional midi note interval to frequency multiplier.------ > map midi_to_ratio [0,7,12] == [1,1.4983070768766815,2]-midi_to_ratio :: Floating a => a -> a-midi_to_ratio a = 2.0 ** (a * (1.0 / 12.0))---- | Inverse of 'midi_to_ratio'.------ > map ratio_to_midi [3/2,2] == [7.019550008653875,12]-ratio_to_midi :: Floating a => a -> a-ratio_to_midi a = 12.0 * logBase 2 a---- | Scale uni-polar (0,1) input to linear (l,r) range------ > map (urange 3 4) [0,0.5,1] == [3,3.5,4]-urange :: Fractional a => a -> a -> a -> a-urange l r i = let m = r - l in i * m + l---- | Calculate multiplier and add values for 'range' transform.------ > range_muladd 3 4 == (0.5,3.5)-range_muladd :: Fractional t => t -> t -> (t,t)-range_muladd = linlin_muladd (-1) 1---- | Scale bi-polar (-1,1) input to linear (l,r) range.  Note that the--- argument order is not the same as 'linlin'.------ > map (range 3 4) [-1,0,1] == [3,3.5,4]--- > map (\x -> let (m,a) = linlin_muladd (-1) 1 3 4 in x * m + a) [-1,0,1] == [3,3.5,4]-range :: Fractional a => a -> a -> a -> a-range l r i = let (m,a) = range_muladd l r in i * m + a--range_hs :: Fractional a => (a,a) -> a -> a-range_hs (l,r) = range l r--data Clip_Rule = Clip_None | Clip_Left | Clip_Right | Clip_Both-                 deriving (Enum,Bounded)---- > let f r = map (\x -> apply_clip_rule r 0 1 (-1) 1 x) [-1,0,0.5,1,2]--- > in map f [minBound .. maxBound]-apply_clip_rule :: Ord n => Clip_Rule -> n -> n -> n -> n -> n -> Maybe n-apply_clip_rule clip_rule sl sr dl dr x =-    case clip_rule of-      Clip_None -> Nothing-      Clip_Left -> if x <= sl then Just dl else Nothing-      Clip_Right -> if x >= sr then Just dr else Nothing-      Clip_Both -> if x <= sl then Just dl else if x >= sr then Just dr else Nothing---- | Calculate multiplier and add values for 'linlin' transform.------ > range_muladd 3 4 == (0.5,3.5)--- > linlin_muladd (-1) 1 3 4 == (0.5,3.5)--- > linlin_muladd 0 1 3 4 == (1,3)--- > linlin_muladd (-1) 1 0 1 == (0.5,0.5)--- > linlin_muladd (-0.3) 1 (-1) 1-linlin_muladd :: Fractional t => t -> t -> t -> t -> (t,t)-linlin_muladd sl sr dl dr =-    let m = (dr - dl) / (sr - sl)-        a = dl - (m * sl)-    in (m,a)---- | Map from one linear range to another linear range.------ > map (\i -> linlin i (-1) 1 0 1) [-1,-0.9 .. 1.0]-linlin :: Fractional a => a -> a -> a -> a -> a -> a-linlin i sl sr dl dr = let (m,a) = linlin_muladd sl sr dl dr in i * m + a---- | Variant with a more typical argument structure, ranges as pairs and input last.------ > map (linlin_hs (0,127) (-0.5,0.5)) [0,63.5,127]-linlin_hs :: Fractional a => (a, a) -> (a, a) -> a -> a-linlin_hs (sl,sr) (dl,dr) i = linlin i sl sr dl dr---- | Given enumeration from /dst/ that is in the same relation as /n/ is from /src/.------ > linlin _enum' 'a' 'A' 'e' == 'E'--- > linlin_enum' 0 (-50) 16 == -34--- > linlin_enum' 0 (-50) (-1) == -51-linlin_enum' :: (Enum t,Enum u) => t -> u -> t -> u-linlin_enum' src dst n = toEnum (fromEnum dst + (fromEnum n - fromEnum src))---- | Variant of 'linlin_enum'' that requires /src/ and /dst/ ranges to be of equal size,--- and for /n/ to lie in /src/.------ > linlin_enum (0,100) (-50,50) 0x10 == Just (-34)--- > linlin_enum (-50,50) (0,100) (-34) == Just 0x10--- > linlin_enum (0,100) (-50,50) (-1) == Nothing-linlin_enum :: (Enum t,Enum u) => (t,t) -> (u,u) -> t -> Maybe u-linlin_enum (l,r) (l',r') n =-    if fromEnum n >= fromEnum l && fromEnum r - fromEnum l == fromEnum r' - fromEnum l'-    then Just (linlin_enum' l l' n)-    else Nothing---- | Erroring variant.-linlin_enum_err :: (Enum t,Enum u) => (t,t) -> (u,u) -> t -> u-linlin_enum_err src dst = fromMaybe (error "linlin_enum") . linlin_enum src dst---- | Variant of 'linlin' that requires /src/ and /dst/ ranges to be of--- equal size, thus with constraint of 'Num' and 'Eq' instead of--- 'Fractional'.------ > linlin_eq (0,100) (-50,50) 0x10 == Just (-34)--- > linlin_eq (-50,50) (0,100) (-34) == Just 0x10-linlin_eq :: (Eq a, Num a) => (a,a) -> (a,a) -> a -> Maybe a-linlin_eq (l,r) (l',r') n =-    let d = r - l-        d' = r' - l'-    in if d == d' then Just (l' + (n - l)) else Nothing---- | Erroring variant.-linlin_eq_err :: (Eq a,Num a) => (a,a) -> (a,a) -> a -> a-linlin_eq_err src dst = fromMaybe (error "linlin_eq") . linlin_eq src dst---- | @SimpleNumber.linexp@ shifts from linear to exponential ranges.------ > > [1,1.5,2].collect({|i| i.linexp(1,2,10,100).floor}) == [10,31,100]--- > map (floor . sc_linexp 1 2 10 100) [0,1,1.5,2,3] == [10,10,31,100,100]-sc_linexp :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a-sc_linexp src_l src_r dst_l dst_r x =-    case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of-      Just r -> r-      Nothing -> ((dst_r / dst_l) ** ((x - src_l) / (src_r - src_l))) * dst_l---- | @SimpleNumber.explin@ is the inverse of linexp.------ > map (sc_explin 10 100 1 2) [10,10,31,100,100]-sc_explin :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a-sc_explin src_l src_r dst_l dst_r x =-    case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of-      Just r -> r-      Nothing -> (log (x / src_l)) / (log (src_r / src_l)) * (dst_r - dst_l) + dst_l---- > map (sc_expexp 0.1 10 4.3 100) [1.. 10]-sc_expexp :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a-sc_expexp src_l src_r dst_l dst_r x =-    case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of-      Just r -> r-      Nothing -> ((dst_r / dst_l) ** (log (x / src_l) / log (src_r / src_l))) * dst_l--{- | Map /x/ from an assumed linear input range (src_l,src_r) to an-exponential curve output range (dst_l,dst_r). 'curve' is like the-parameter in Env.  Unlike with linexp, the output range may include-zero.--> > (0..10).lincurve(0,10,-4.3,100,-3).round == [-4,24,45,61,72,81,87,92,96,98,100]--> let f = round . sc_lincurve (-3) 0 10 (-4.3) 100-> in map f [0 .. 10] == [-4,24,45,61,72,81,87,92,96,98,100]--> import Sound.SC3.Plot {- hsc3-plot -}-> plotTable (map (\c-> map (sc_lincurve c 0 1 (-1) 1) [0,0.01 .. 1]) [-6,-4 .. 6])---}-sc_lincurve :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a -> a-sc_lincurve curve src_l src_r dst_l dst_r x =-    case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of-      Just r -> r-      Nothing ->-          if abs curve < 0.001-          then linlin_hs (src_l,src_r) (dst_l,dst_r) x-          else let grow = exp curve-                   a = (dst_r - dst_l) / (1.0 - grow)-                   b = dst_l + a-                   scaled = (x - src_l) / (src_r - src_l)-               in b - (a * (grow ** scaled))---- | Inverse of 'sc_lincurve'.------ > let f = round . sc_curvelin (-3) (-4.3) 100 0 10--- > in map f [-4,24,45,61,72,81,87,92,96,98,100] == [0..10]-sc_curvelin :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a -> a-sc_curvelin curve src_l src_r dst_l dst_r x =-    case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of-      Just r -> r-      Nothing ->-          if abs curve < 0.001-          then linlin_hs (src_l,src_r) (dst_l,dst_r) x-          else let grow = exp curve-                   a = (src_r - src_l) / (1.0 - grow)-                   b = src_l + a-               in log ((b - x) / a) * (dst_r - dst_l) / curve + dst_l---- > map (floor . linexp_hs (1,2) (10,100)) [0,1,1.5,2,3] == [1,10,31,100,1000]-linexp_hs :: Floating a => (a,a) -> (a,a) -> a -> a-linexp_hs (in_l,in_r) (out_l,out_r) x =-    let rt = out_r / out_l-        rn = 1.0 / (in_r - in_l)-        rr = rn * negate in_l-    in out_l * (rt ** (x * rn + rr))---- | Exponential range conversion.------ > map (\i -> lin_exp i 1 2 1 3) [1,1.1 .. 2]-lin_exp :: Floating a => a -> a -> a -> a -> a -> a-lin_exp x in_l in_r out_l out_r = linexp_hs (in_l,in_r) (out_l,out_r) x---- | /sr/ = sample rate, /r/ = cycle (two-pi), /cps/ = frequency------ > cps_to_incr 48000 128 375 == 1--- > cps_to_incr 48000 two_pi 458.3662361046586 == 6e-2-cps_to_incr :: Fractional a => a -> a -> a -> a-cps_to_incr sr r cps = (r / sr) * cps---- | Inverse of 'cps_to_incr'.------ > incr_to_cps 48000 128 1 == 375-incr_to_cps :: Fractional a => a -> a -> a -> a-incr_to_cps sr r ic = ic / (r / sr)---- | Linear pan.------ > map (lin_pan2 1) [-1,0,1] == [(1,0),(0.5,0.5),(0,1)]-lin_pan2 :: Fractional t => t -> t -> (t, t)-lin_pan2 p q =-    let q' = (q / 2) + 0.5-    in (p * (1 - q'),p * q')--sc3_properFraction :: RealFrac t => t -> (t,t)-sc3_properFraction a =-    let (p,q) = properFraction a-    in (fromInteger p,q)--sc_dif_sqr :: Num a => a -> a -> a-sc_dif_sqr a b = (a * a) - (b * b)--sc_hypot :: Floating a => a -> a -> a-sc_hypot x y = sqrt (x * x + y * y)--sc_hypotx :: (Ord a, Floating a) => a -> a -> a-sc_hypotx x y = abs x + abs y - ((sqrt 2 - 1) * min (abs x) (abs y))---- | Fold /k/ to within range /(i,j)/, ie. @AbstractFunction.fold@------ > map (foldToRange 5 10) [3..12] == [7,6,5,6,7,8,9,10,9,8]-foldToRange :: (Ord a,Num a) => a -> a -> a -> a-foldToRange i j =-    let f n = if n > j-              then f (j - (n - j))-              else if n < i-                   then f (i - (n - i))-                   else n-    in f---- | Variant of 'foldToRange' with @SC3@ argument ordering.-fold_ :: (Ord a,Num a) => a -> a -> a -> a-fold_ n i j = foldToRange i j n
− Sound/SC3/Common/Math/Interpolate.hs
@@ -1,108 +0,0 @@--- | Interpolation functions, ie. for envelope segments.-module Sound.SC3.Common.Math.Interpolate where--import Sound.SC3.Common.Math {- hsc3 -}---- | An interpolation function takes three arguments. /x0/ is the left--- or begin value, /x1/ is the right or end value, and /t/ is a (0,1)--- index.-type Interpolation_F t = t -> t -> t -> t---- | Clip /x/ to (0,1) and run /f/.------ > interpolate linear (-1,1) 0.5 == 0-interpolate :: (Num t,Ord t) => Interpolation_F t -> (t,t) -> t -> t-interpolate f (l,r) x = if x < 0 then l else if x > 1 then r else f l r x---- | Step function, ignores /t/ and returns /x1/.-step :: Interpolation_F t-step _ x1 _ = x1---- | Linear interpolation.------ > import Sound.SC3.Plot {- hsc3-plot -}--- > plotTable1 (map (linear (-1) 1) [0,0.01 .. 1])-linear :: Num t => Interpolation_F t-linear x0 x1 t = t * (x1 - x0) + x0---- | Exponential interpolation, /x0/ must not be @0@, (/x0/,/x1/) must--- not span @0@.------ > plotTable1 (map (exponential 0.001 1) [0,0.01 .. 1])-exponential :: Floating t => Interpolation_F t-exponential x0 x1 t = x0 * ((x1 / x0) ** t)---- | Variant that allows /x0/ to be @0@, though (/x0/,/x1/) must not--- span @0@.------ > plotTable1 (map (exponential' 0 1) [0,0.01 .. 1])--- > plotTable1 (map (exponential' 0 (-1)) [0,0.01 .. 1])-exponential' :: (Eq t,Floating t) => Interpolation_F t-exponential' x0 x1 =-    let epsilon = 1e-6-        x0' = if x0 == 0 then epsilon * signum x1 else x0-    in exponential x0' x1---- | 'linear' of 'exponential'', ie. allows (/x0/,/x1/) to span @0@.------ > plotTable1 (map (exponential'' (-1) 1) [0,0.01 .. 1])-exponential'' :: (Eq t,Floating t) => Interpolation_F t-exponential'' x0 x1 t = linear x0 x1 (exponential' 0 1 t)---- | 'linear' with /t/ transformed by sine function over (-pi/2,pi/2).------ > plotTable1 (map (sine (-1) 1) [0,0.01 .. 1])-sine :: Floating t => Interpolation_F t-sine x0 x1 t =-    let t' = - cos (pi * t) * 0.5 + 0.5-    in linear x0 x1 t'---- | If /x0/ '<' /x1/ rising sine segment (0,pi/2), else falling--- segment (pi/2,pi).------ > plotTable1 (map (welch (-1) 1) [0,0.01 .. 1])--- > plotTable1 (map (welch 1 (-1)) [0,0.01 .. 1])-welch :: (Ord t, Floating t) => Interpolation_F t-welch x0 x1 t =-    if x0 < x1-    then x0 + (x1 - x0) * sin (half_pi * t)-    else x1 - (x1 - x0) * sin (half_pi - (half_pi * t))---- | Curvature controlled by single parameter /c/.  @0@ is 'linear',--- increasing /c/ approaches 'exponential'.------ > plotTable (map (\c-> map (curve c (-1) 1) [0,0.01 .. 1]) [-6,-4 .. 6])-curve :: (Ord t, Floating t) => t -> Interpolation_F t-curve c x0 x1 t =-    if abs c < 0.0001-    then t * (x1 - x0) + x0-    else let d = 1 - exp c-             n = 1 - exp (t * c)-         in x0 + (x1 - x0) * (n/d)---- | Square of 'linear' of 'sqrt' of /x0/ and /x1/, therefore neither--- may be negative.------ > plotTable1 (map (squared 0 1) [0,0.01 .. 1])-squared :: Floating t => Interpolation_F t-squared x0 x1 t =-    let x0' = sqrt x0-        x1' = sqrt x1-        l = linear x0' x1' t-    in l * l---- | Cubic variant of 'squared'.------ > plotTable1 (map (cubed 0 1) [0,0.01 .. 1])-cubed :: Floating t => Interpolation_F t-cubed x0 x1 t =-    let x0' = x0 ** (1/3)-        x1' = x1 ** (1/3)-        l = linear x0' x1' t-    in l * l * l---- | x0 until end, then immediately x1.------ > plotTable1 (map (hold 0 1) [0,0.01 .. 1])-hold :: (Num t,Ord t) => Interpolation_F t-hold x0 x1 t = if t >= 1 then x1 else x0
− Sound/SC3/Common/Math/Window.hs
@@ -1,82 +0,0 @@--- | Windowing functions.-module Sound.SC3.Common.Math.Window where---- * Type and conversion---- | A function from a \(0,1)\ normalised input to an output.-type Window x = x -> x---- | A discrete /n/ element rendering of a 'Window'.-type Table x = [x]---- | Generate an /n/ element table from a \(0,1)\ normalised window--- function.-window_table :: (Integral n,Fractional a,Enum a) => n -> Window a -> Table a-window_table n f =-    let k = 1 / (fromIntegral n - 1)-    in map f [0,k..1]---- * Math---- | /n/ ^ 2.-square :: Num a => a -> a-square x = x * x---- * Window functions---- | Gaussian window, θ <= 0.5.-gaussian :: Floating a => a -> Window a-gaussian theta i = exp (- (0.5 * square ((i - 0.5) / (theta * 0.5))))---- | Hann raised cosine window.-hann :: Floating a => Window a-hann i = 0.5 * (1 - cos (2 * pi * i))---- | Hamming raised cosine window.-hamming :: Floating a => Window a-hamming i = 0.54 - 0.46 * cos (2 * pi * i)---- | Unit ('id') window, also known as a Dirichlet window.-rectangular :: Window a-rectangular = id---- | 'sin' window.-sine :: Floating a => Window a-sine i = sin (i * pi)---- | Triangular window, ie. Bartlett window with zero end-points.-triangular :: Fractional a => Window a-triangular i = 2 * (0.5 - abs (i - 0.5))---- * Tables---- | 'window_table' . 'gaussian'.------ > import Sound.SC3.Plot--- > plotTable [gaussian_table 1024 0.25,gaussian_table 1024 0.5]-gaussian_table :: (Integral n, Floating b, Enum b) => n -> b -> [b]-gaussian_table n = window_table n . gaussian---- | 'window_table' . 'hamming'.------ > plotTable [hann_table 128,hamming_table 128]-hamming_table :: Int -> [Double]-hamming_table n = window_table n hamming---- | 'window_table' . 'hann'.------ > plotTable [hann_table 128]-hann_table :: Int -> [Double]-hann_table n = window_table n hann---- | 'window_table' . 'sine'.------ plotTable [sine_table 128]-sine_table :: (Integral n, Floating b, Enum b) => n -> [b]-sine_table n = window_table n sine---- | 'window_table' . 'triangular'.------ plotTable [triangular_table (2^9)]-triangular_table :: (Integral n, Fractional b, Enum b) => n -> [b]-triangular_table n = window_table n triangular
− Sound/SC3/Common/Monad.hs
@@ -1,24 +0,0 @@-module Sound.SC3.Common.Monad where--import Control.Monad {- base -}---- | 'sequence' of 'repeat'-repeatM :: Monad m => m t -> m [t]-repeatM = sequence . repeat---- | 'void' of 'repeatM'.-repeatM_ :: Monad m => m t -> m ()-repeatM_ = void . repeatM---- | Right to left compositon of 'Monad' functions.------ > fmap (== 7) (composeM [return . (+ 1),return . (/ 2)] 3)--- > fmap (== 8) (composeM [return . (* 2),return . (+ 1)] 3)-composeM :: Monad m => [a -> m a] -> a -> m a-composeM = foldr (<=<) return---- | Feed forward composition of /n/ applications of /f/.------ > fmap (== 3) (chainM 3 (return . (+ 1)) 0)-chainM :: Monad m => Int -> (b -> m b) -> b -> m b-chainM n f = foldr (<=<) return (replicate n f)
− Sound/SC3/Common/Monad/Operators.hs
@@ -1,92 +0,0 @@--- | Functions to make writing 'Applicative' and 'Monad' UGen graphs--- less clumsy.-module Sound.SC3.Common.Monad.Operators where--import Control.Applicative {- base -}--infixl 7  .*,*.,.*.-infixl 6  .+,+.,.+.--infixl 7  ./,/.,./.-infixl 6  .-,-.,.-.---- | '+' variant with 'Functor' at left.------ > fmap (== 5) (return 3 .+ 2)--- > [3,4] .+ 2 == [5,6]-(.+) :: (Functor f, Num a) => f a -> a -> f a-m .+ n = fmap (+ n) m---- | '+' variant with 'Functor' at right.------ > fmap (== 5) (3 +. return 2)--- > 3 +. [2,3] == [5,6]-(+.) :: (Functor f, Num a) => a -> f a -> f a-m +. n = fmap (+ m) n---- | '+' variant with 'Applicative' at left and right.------ > fmap (== 5) (return 3 .+. return 2)--- > [3,4] .+. [2,3] == [5,6,6,7]--- > getZipList (ZipList [3,4] .+. ZipList [2,3]) == [5,7]-(.+.) :: (Applicative m, Num a) => m a -> m a -> m a-(.+.) = liftA2 (+)---- | '*' variant with 'Functor' at left.------ > fmap (== 6) (return 3 .* 2)-(.*) :: (Functor f, Num a) => f a -> a -> f a-m .* n = fmap (* n) m---- | '*' variant with 'Functor' at right.------ > fmap (== 6) (3 *. return 2)-(*.) :: (Functor f, Num a) => a -> f a -> f a-m *. n = fmap (* m) n---- | '*' variant with 'Applicative' at left and right.------ > fmap (== 6) (return 3 .*. return 2)-(.*.) :: (Applicative m, Num a) => m a -> m a -> m a-(.*.) = liftA2 (*)---- | '-' variant with 'Functor' at left.------ > fmap (== 1) (return 3 .- 2)--- > [3,4] .- 2 == [1,2]-(.-) :: (Functor f, Num a) => f a -> a -> f a-m .- n = fmap (subtract n) m---- | '-' variant with 'Functor' at right.------ > fmap (== 1) (3 -. return 2)--- > 3 -. [2,3] == [1,0]-(-.) :: (Functor f, Num a) => a -> f a -> f a-m -. n = fmap (m -) n---- | '-' variant with 'Applicative' at left and right.------ > fmap (== 1) (return 3 .-. return 2)--- > [3,4] .-. [2,3] == [1,0,2,1]--- > getZipList (ZipList [3,4] .-. ZipList [2,3]) == [1,1]-(.-.) :: (Applicative m, Num a) => m a -> m a -> m a-(.-.) = liftA2 (-)---- | '/' variant with 'Functor' at left.------ > fmap (== 3) (return 6 ./ 2)-(./) :: (Functor f,Fractional a) => f a -> a -> f a-m ./ n = fmap (/ n) m---- | '/' variant with 'Functor' at right.------ > fmap (== 3) (6 /. return 2)-(/.) :: (Functor f,Fractional a) => a -> f a -> f a-m /. n = fmap (m /) n---- | '/' variant with 'Applicative' at left and right.------ > fmap (== 3) (return 6 ./. return 2)--- > [5,6] ./. [2,3] == [5/2,5/3,3,2]-(./.) :: (Applicative m,Fractional a) => m a -> m a -> m a-(./.) = liftA2 (/)
− Sound/SC3/Common/Prelude.hs
@@ -1,139 +0,0 @@-module Sound.SC3.Common.Prelude where--import Data.Char {- base -}-import Data.List {- base -}---- | Variant of 'reads' requiring exact match.-reads_exact :: Read a => String -> Maybe a-reads_exact s =-    case reads s of-      [(r,"")] -> Just r-      _ -> Nothing---- * STRING / CASE---- | CI = Case insensitive, CS = case sensitive.-data Case_Rule = CI | CS deriving (Eq)---- | Predicates for 'Case_Rule'.-is_ci :: Case_Rule -> Bool-is_ci = (==) CI---- | Predicates for 'Case_Rule'.-is_cs :: Case_Rule -> Bool-is_cs = (==) CS---- | String equality with 'Case_Rule'.------ > string_eq CI "lower" "LOWER" == True-string_eq :: Case_Rule -> String -> String -> Bool-string_eq cr x y = if is_ci cr then map toLower x == map toLower y else x == y---- | 'rlookup_by' of 'string_eq'.-rlookup_str :: Case_Rule -> String -> [(a,String)] -> Maybe a-rlookup_str = rlookup_by . string_eq---- | 'Enum' parser with 'Case_Rule'.------ > parse_enum CI "FALSE" == Just False-parse_enum :: (Show t,Enum t,Bounded t) => Case_Rule -> String -> Maybe t-parse_enum cr nm =-    let u = [minBound .. maxBound]-        t = zip (map show u) u-    in lookup_by (string_eq cr) nm t---- * LIST---- > d_dx [0,1,3,6] == [0,1,2,3]-d_dx :: (Num a) => [a] -> [a]-d_dx l = zipWith (-) l (0:l)---- > dx_d (d_dx [0,1,3,6]) == [0,1,3,6]--- > dx_d [0.5,0.5] == [0.5,1]-dx_d :: Num n => [n] -> [n]-dx_d = scanl1 (+)---- > d_dx' [0,1,3,6] == [1,2,3]-d_dx' :: Num n => [n] -> [n]-d_dx' l = zipWith (-) (tail l) l---- > dx_d' (d_dx' [0,1,3,6]) == [0,1,3,6]--- > dx_d' [0.5,0.5] == [0,0.5,1]-dx_d' :: Num n => [n] -> [n]-dx_d' = (0 :) . scanl1 (+)---- | 'lookup' with equality function.-lookup_by :: (a -> a -> Bool) -> a -> [(a,b)] -> Maybe b-lookup_by f x = fmap snd . find (f x . fst)---- | Reverse 'lookup' with equality function.-rlookup_by :: (b -> b -> Bool) -> b -> [(a,b)] -> Maybe a-rlookup_by f x = fmap fst . find (f x . snd)---- | (prev,cur,next) triples.------ > pcn_triples [1..3] == [(Nothing,1,Just 2),(Just 1,2,Just 3),(Just 2,3,Nothing)]-pcn_triples :: [a] -> [(Maybe a,a,Maybe a)]-pcn_triples =-    let f e l = case l of-                  e1 : e2 : l' -> (e,e1,Just e2) : f (Just e1) (e2 : l')-                  [e'] -> [(e,e',Nothing)]-                  [] -> undefined-    in f Nothing---- | Separate first list element.------ > sep_first "astring" == Just ('a',"string")-sep_first :: [t] -> Maybe (t,[t])-sep_first l =-    case l of-      e:l' -> Just (e,l')-      _ -> Nothing---- | Separate last list element.------ > sep_last "stringb" == Just ("string",'b')-sep_last :: [t] -> Maybe ([t], t)-sep_last =-    let f (e,l) = (reverse l,e)-    in fmap f . sep_first . reverse---- | Are lists of equal length?------ > equal_length_p ["t1","t2"] == True--- > equal_length_p ["t","t1","t2"] == False-equal_length_p :: [[a]] -> Bool-equal_length_p = (== 1) . length . nub . map length---- | Histogram-histogram :: Ord a => [a] -> [(a,Int)]-histogram x =-    let g = group (sort x)-    in zip (map head g) (map length g)---- * TUPLES--type T2 a = (a,a)-type T3 a = (a,a,a)-type T4 a = (a,a,a,a)--dup2 :: t -> T2 t-dup2 t = (t,t)--dup3 :: t -> T3 t-dup3 t = (t,t,t)--dup4 :: t -> T4 t-dup4 t = (t,t,t,t)---- | 'concatMap' of /f/ at /x/ and /g/ at /y/.-mk_duples :: (a -> c) -> (b -> c) -> [(a, b)] -> [c]-mk_duples a b = concatMap (\(x,y) -> [a x, b y])---- | Length prefixed list variant of 'mk_duples'.-mk_duples_l :: (Int -> c) -> (a -> c) -> (b -> c) -> [(a,[b])] -> [c]-mk_duples_l i a b = concatMap (\(x,y) -> a x : i (length y) : map b y)---- | 'concatMap' of /f/ at /x/ and /g/ at /y/ and /h/ at /z/.-mk_triples :: (a -> d) -> (b -> d) -> (c -> d) -> [(a, b, c)] -> [d]-mk_triples a b c = concatMap (\(x,y,z) -> [a x, b y, c z])
− Sound/SC3/FD.hs
@@ -1,8 +0,0 @@--- | Composite of "Sound.SC3.Common", "Sound.SC3.Server.FD",---   "Sound.SC3.UGen" and "Sound.SC3.UGen.Bindings".-module Sound.SC3.FD (module M) where--import Sound.SC3.Common as M-import Sound.SC3.Server.FD as M-import Sound.SC3.UGen as M-import Sound.SC3.UGen.Bindings as M
− Sound/SC3/Server.hs
@@ -1,12 +0,0 @@--- | Collection of modules for communicating with the SuperCollider--- synthesis server, see also "Sound.SC3.Server.FD" and--- "Sound.SC3.Server.Monad".-module Sound.SC3.Server (module S) where--import Sound.SC3.Server.Command as S-import Sound.SC3.Server.Enum as S-import Sound.SC3.Server.Synthdef as S-import Sound.SC3.Server.Status as S-import Sound.SC3.Server.NRT as S-import Sound.SC3.Server.NRT.Edit as S-import Sound.SC3.Server.Recorder as S
− Sound/SC3/Server/Command.hs
@@ -1,5 +0,0 @@--- | Collection of standard /command/ modules.-module Sound.SC3.Server.Command (module S) where--import Sound.SC3.Server.Command.Enum as S-import Sound.SC3.Server.Command.Plain as S
− Sound/SC3/Server/Command/Completion.hs
@@ -1,68 +0,0 @@--- | This module provides variations of the asynchronous server commands that--- expect a /completion packet/ as the first argument. The completion packet--- is executed by the server when the asynchronous command has finished. Note--- that this mechanism is for synchronizing server side processes only, for--- client side synchronization use @\/done@ message notification or the--- @\/sync@ barrier.-module Sound.SC3.Server.Command.Completion where--import Sound.OSC {- hosc -}--import Sound.SC3.Server.Enum-import Sound.SC3.Server.Synthdef---- | Encode an OSC packet as an OSC blob.-encode_blob :: Packet -> Datum-encode_blob = Blob . encodePacket---- | Install a bytecode instrument definition. (Asynchronous)-d_recv :: Packet -> Synthdef -> Message-d_recv osc d = Message "/d_recv" [Blob (synthdefData d),encode_blob osc]---- | Load an instrument definition from a named file. (Asynchronous)-d_load :: Packet -> String -> Message-d_load osc p = Message "/d_load" [string p,encode_blob osc]---- | Load a directory of instrument definitions files. (Asynchronous)-d_loadDir :: Packet -> String -> Message-d_loadDir osc p = Message "/d_loadDir" [string p,encode_blob osc]---- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)-b_alloc :: Packet -> Int -> Int -> Int -> Message-b_alloc osc nid frames channels = Message "/b_alloc" [int32 nid,int32 frames,int32 channels,encode_blob osc]---- | Allocate buffer space and read a sound file. (Asynchronous)-b_allocRead :: Packet -> Int -> String -> Int -> Int -> Message-b_allocRead osc nid p f n = Message "/b_allocRead" [int32 nid,string p,int32 f,int32 n,encode_blob osc]---- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)-b_allocReadChannel :: Packet -> Int -> String -> Int -> Int -> [Int] -> Message-b_allocReadChannel osc nid p f n cs = Message "/b_allocReadChannel" ([int32 nid,string p,int32 f,int32 n] ++ map int32 cs ++ [encode_blob osc])---- | Free buffer data. (Asynchronous)-b_free :: Packet -> Int -> Message-b_free osc nid = Message "/b_free" [int32 nid,encode_blob osc]---- | Close attached soundfile and write header information. (Asynchronous)-b_close :: Packet -> Int -> Message-b_close osc nid = Message "/b_close" [int32 nid,encode_blob osc]---- | Read sound file data into an existing buffer. (Asynchronous)-b_read :: Packet -> Int -> String -> Int -> Int -> Int -> Bool -> Message-b_read osc nid p f n f' z = Message "/b_read" [int32 nid,string p,int32 f,int32 n,int32 f',int32 (fromEnum z),encode_blob osc]---- | Read sound file data into an existing buffer. (Asynchronous)-b_readChannel :: Packet -> Int -> String -> Int -> Int -> Int -> Bool -> [Int] -> Message-b_readChannel osc nid p f n f' z cs = Message "/b_readChannel" ([int32 nid,string p,int32 f,int32 n,int32 f',int32 (fromEnum z)] ++ map int32 cs ++ [encode_blob osc])---- | Write sound file data. (Asynchronous)-b_write :: Packet -> Int -> String -> SoundFileFormat -> SampleFormat -> Int -> Int -> Bool -> Message-b_write osc nid p h t f s z = Message "/b_write" [int32 nid,string p,string (soundFileFormatString h),string (sampleFormatString t),int32 f,int32 s,int32 (fromEnum z),encode_blob osc]---- | Zero sample data. (Asynchronous)-b_zero :: Packet -> Int -> Message-b_zero osc nid = Message "/b_zero" [int32 nid,encode_blob osc]---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/Server/Command/Enum.hs
@@ -1,159 +0,0 @@--- | Enumeration of SC3 server commands.-module Sound.SC3.Server.Command.Enum where--import Data.List {- base -}-import Data.Maybe {- base -}--import Sound.OSC.Packet {- hosc -}---- | SC3 server commands are strings.-type SC3_Command = String---- | Enumerate server command numbers.-sc3_cmd_enumeration :: [(SC3_Command,Int)]-sc3_cmd_enumeration =-    [("/notify",1)-    ,("/status",2)-    ,("/quit",3)-    ,("/cmd",4)-    -- /d = synthdef-    ,("/d_recv",5)-    ,("/d_load",6)-    ,("/d_loadDir",7)-    ,("/d_freeAll",8)-    -- /s = synth-    ,("/s_new",9)-    -- /n = node-    ,("/n_trace",10)-    ,("/n_free",11)-    ,("/n_run",12)-    ,("/n_cmd",13)-    ,("/n_map",14)-    ,("/n_set",15)-    ,("/n_setn",16)-    ,("/n_fill",17)-    ,("/n_before",18)-    ,("/n_after",19)-    -- /u = ugen-    ,("/u_cmd",20)-    -- /g = group-    ,("/g_new",21)-    ,("/g_head",22)-    ,("/g_tail",23)-    ,("/g_freeAll",24)-    -- /c = control-    ,("/c_set",25)-    ,("/c_setn",26)-    ,("/c_fill",27)-    -- /b = buffer-    ,("/b_alloc",28)-    ,("/b_allocRead",29)-    ,("/b_read",30)-    ,("/b_write",31)-    ,("/b_free",32)-    ,("/b_close",33)-    ,("/b_zero",34)-    ,("/b_set",35)-    ,("/b_setn",36)-    ,("/b_fill",37)-    ,("/b_gen",38)-    ---    ,("/dumpOSC",39)-    -- _get-    ,("/c_get",40)-    ,("/c_getn",41)-    ,("/b_get",42)-    ,("/b_getn",43)-    ,("/s_get",44)-    ,("/s_getn",45)-    -- _query-    ,("/n_query",46)-    ,("/b_query",47)-    ---    ,("/n_mapn",48)-    ,("/s_noid",49)-    ---    ,("/g_deepFree",50)-    ,("/clearSched",51)-    ---    ,("/sync",52)-    ---    ,("/d_free",53)-    -- _channel-    ,("/b_allocReadChannel",54)-    ,("/b_readChannel",55)-    -- _tree-    ,("/g_dumpTree",56)-    ,("/g_queryTree",57)-    -- error-    ,("/error",58)-    -- _args-    ,("/s_newargs",59)-    ---    ,("/n_mapa",60)-    ,("/n_mapan",61)-    ,("/n_order",62)-    ]---- | Lookup command number in 'sc3_cmd_enumeration'.------ > map sc3_cmd_number ["/b_alloc","/s_new"] == [Just 28,Just 9]-sc3_cmd_number :: SC3_Command -> Maybe Int-sc3_cmd_number = flip lookup sc3_cmd_enumeration---- | 'isJust' of 'sc3_cmd_number'.-known_sc3_cmd :: SC3_Command -> Bool-known_sc3_cmd = isJust . sc3_cmd_number---- | List of asynchronous server commands, ie. commands that reply with @/done@.-async_cmds :: [SC3_Command]-async_cmds =-    ["/b_alloc"-    ,"/b_allocRead"-    ,"/b_allocReadChannel"-    ,"/b_close"-    ,"/b_free"-    ,"/b_read"-    ,"/b_readChannel"-    ,"/b_write"-    ,"/b_zero"-    ,"/d_load"-    ,"/d_loadDir"-    ,"/d_recv"-    ,"/notify"-    ,"/quit"-    ,"/sync"]---- | 'True' if 'Message' is an asynchronous 'Message'.------ > import Sound.SC3--- > map isAsync [b_close 0,n_set1 0 "0" 0,status] == [True,False,False]-isAsync :: Message -> Bool-isAsync (Message a _) = a `elem` async_cmds---- | Asynchronous commands are at the left.  This function should--- preserve the ordering of both branches.------ > partition_async [b_close 0,n_set1 0 "0" 0]-partition_async :: [Message] -> ([Message],[Message])-partition_async = partition isAsync---- | Types & names for @b_info@ message fields.-b_info_fields :: [(String,String)]-b_info_fields =-    [("int","buffer-id")-    ,("int","frame-count")-    ,("int","channels-count")-    ,("float","sample-rate")]---- | Type, name and value descriptors for fields of @n_info@ message.-n_info_fields :: [(String,String,String)]-n_info_fields =-    [("int","node-id","")-    ,("int","parent group-id","-1 = nil")-    ,("int","previous node-id","-1 = nil")-    ,("int","next node-id","-1 = nil")-    ,("int","node-type","0 = synth,1 = group")-    ,("int","head node-id","-1 = nil")-    ,("int","tail node-id","-1 = nil")]-
− Sound/SC3/Server/Command/Generic.hs
@@ -1,511 +0,0 @@--- | Generic constructors for the command set implemented by the SuperCollider synthesis server.-module Sound.SC3.Server.Command.Generic where--import Data.List {- base -}-import Data.Maybe {- base -}--import Sound.OSC.Core {- hosc -}--import qualified Sound.SC3.Common.Prelude as P-import qualified Sound.SC3.Server.Command.Enum as C-import qualified Sound.SC3.Server.Enum as E-import qualified Sound.SC3.Server.Graphdef as G-import qualified Sound.SC3.Server.Synthdef as S---- * Buffer commands (b_)---- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)-b_alloc :: Integral i => i -> i -> i -> Message-b_alloc nid frames channels = message "/b_alloc" [int32 nid,int32 frames,int32 channels]---- | Allocate buffer space and read a sound file. (Asynchronous)-b_allocRead :: Integral i => i -> String -> i -> i -> Message-b_allocRead nid p f n = message "/b_allocRead" [int32 nid,string p,int32 f,int32 n]---- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)-b_allocReadChannel :: Integral i => i -> String -> i -> i -> [i] -> Message-b_allocReadChannel nid p f n cs = message "/b_allocReadChannel" ([int32 nid,string p,int32 f,int32 n] ++ map int32 cs)---- | Close attached soundfile and write header information. (Asynchronous)-b_close :: Integral i => i -> Message-b_close nid = message "/b_close" [int32 nid]---- | Fill ranges of sample values.-b_fill :: (Integral i,Real n) => i -> [(i,i,n)] -> Message-b_fill nid l = message "/b_fill" (int32 nid : P.mk_triples int32 int32 float l)---- | Free buffer data. (Asynchronous)-b_free :: Integral i => i -> Message-b_free nid = message "/b_free" [int32 nid]---- | Call a command to fill a buffer.  (Asynchronous)-b_gen :: Integral i => i -> String -> [Datum] -> Message-b_gen bid name arg = message "/b_gen" (int32 bid : string name : arg)---- | Call @sine1@ 'b_gen' command.-b_gen_sine1 :: (Integral i,Real n) => i -> [E.B_Gen] -> [n] -> Message-b_gen_sine1 z f n = b_gen z "sine1" (int32 (E.b_gen_flag f) : map float n)---- | Call @sine2@ 'b_gen' command.-b_gen_sine2 :: (Integral i,Real n) => i -> [E.B_Gen] -> [(n,n)] -> Message-b_gen_sine2 z f n = b_gen z "sine2" (int32 (E.b_gen_flag f) : P.mk_duples float float n)---- | Call @sine3@ 'b_gen' command.-b_gen_sine3 :: (Integral i,Real n) => i -> [E.B_Gen] -> [(n,n,n)] -> Message-b_gen_sine3 z f n = b_gen z "sine3" (int32 (E.b_gen_flag f) : P.mk_triples float float float n)---- | Call @cheby@ 'b_gen' command.-b_gen_cheby :: (Integral i,Real n) => i -> [E.B_Gen] -> [n] -> Message-b_gen_cheby z f n = b_gen z "cheby" (int32 (E.b_gen_flag f) : map float n)---- | Call @copy@ 'b_gen' command.-b_gen_copy :: Integral i => i -> i -> i -> i -> Maybe i -> Message-b_gen_copy dst_b dst_ix src_b src_ix nf =-    let nf' = fromMaybe (-1) nf-    in b_gen dst_b "copy" (map int32 [dst_ix,src_b,src_ix,nf'])---- | Get sample values.-b_get :: Integral i => i -> [i] -> Message-b_get nid i = message "/b_get" (int32 nid : map int32 i)---- | Get ranges of sample values.-b_getn :: Integral i => i -> [(i,i)] -> Message-b_getn nid l = message "/b_getn" (int32 nid : P.mk_duples int32 int32 l)---- | Request \/b_info messages.-b_query :: Integral i => [i] -> Message-b_query = message "/b_query" . map int32---- | Read sound file data into an existing buffer. (Asynchronous)-b_read :: Integral i => i -> String -> i -> i -> i -> Bool -> Message-b_read nid p f n f' z = message "/b_read" [int32 nid,string p,int32 f,int32 n,int32 f',int32 (fromEnum z)]---- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)-b_readChannel :: Integral i => i -> String -> i -> i -> i -> Bool -> [i] -> Message-b_readChannel nid p f n f' z cs = message "/b_readChannel" ([int32 nid,string p,int32 f,int32 n,int32 f',int32 (fromEnum z)] ++ map int32 cs)---- | Set sample values.-b_set :: (Integral i,Real n) => i -> [(i,n)] -> Message-b_set nid l = message "/b_set" (int32 nid : P.mk_duples int32 float l)---- | Set ranges of sample values.-b_setn :: (Integral i,Real n) => i -> [(i,[n])] -> Message-b_setn nid l =-    let f (i,d) = int32 i : int32 (length d) : map float d-    in message "/b_setn" (int32 nid : concatMap f l)---- | Write sound file data. (Asynchronous)-b_write :: Integral i => i -> String -> E.SoundFileFormat -> E.SampleFormat -> i -> i -> Bool -> Message-b_write nid p h t f s z =-    let h' = string (E.soundFileFormatString h)-        t' = string (E.sampleFormatString t)-    in message "/b_write" [int32 nid,string p,h',t',int32 f,int32 s,int32 (fromEnum z)]---- | Zero sample data. (Asynchronous)-b_zero :: Integral i => i -> Message-b_zero nid = message "/b_zero" [int32 nid]---- * Control bus commands (c_)---- |  Fill ranges of bus values.-c_fill :: (Integral i,Real n) => [(i,i,n)] -> Message-c_fill = message "/c_fill" . P.mk_triples int32 int32 float---- | Get bus values.-c_get :: Integral i => [i] -> Message-c_get = message "/c_get" . map int32---- | Get ranges of bus values.-c_getn :: Integral i => [(i,i)] -> Message-c_getn = message "/c_getn" . P.mk_duples int32 int32---- | Set bus values.-c_set :: (Integral i,Real n) => [(i,n)] -> Message-c_set = message "/c_set" . P.mk_duples int32 float---- | Set ranges of bus values.-c_setn :: (Integral i,Real n) => [(i,[n])] -> Message-c_setn l =-    let f (i,d) = int32 i : int32 (length d) : map float d-    in message "/c_setn" (concatMap f l)---- * Instrument definition commands (d_)---- | Install a bytecode instrument definition. (Asynchronous)-d_recv' :: G.Graphdef -> Message-d_recv' g = message "/d_recv" [Blob (G.encode_graphdef g)]---- | Install a bytecode instrument definition. (Asynchronous)-d_recv :: S.Synthdef -> Message-d_recv d = message "/d_recv" [Blob (S.synthdefData d)]---- | Load an instrument definition from a named file. (Asynchronous)-d_load :: String -> Message-d_load p = message "/d_load" [string p]---- | Load a directory of instrument definitions files. (Asynchronous)-d_loadDir :: String -> Message-d_loadDir p = message "/d_loadDir" [string p]---- | Remove definition once all nodes using it have ended.-d_free :: [String] -> Message-d_free = message "/d_free" . map string---- * Group node commands (g_)---- | Free all synths in this group and all its sub-groups.-g_deepFree :: Integral i => [i] -> Message-g_deepFree = message "/g_deepFree" . map int32---- | Delete all nodes in a group.-g_freeAll :: Integral i => [i] -> Message-g_freeAll = message "/g_freeAll" . map int32---- | Add node to head of group.-g_head :: Integral i => [(i,i)] -> Message-g_head = message "/g_head" . P.mk_duples int32 int32---- | Create a new group.-g_new :: Integral i => [(i,E.AddAction,i)] -> Message-g_new = message "/g_new" . P.mk_triples int32 (int32 . fromEnum) int32---- | Add node to tail of group.-g_tail :: Integral i => [(i,i)] -> Message-g_tail = message "/g_tail" . P.mk_duples int32 int32---- | Post a representation of a group's node subtree, optionally including the current control values for synths.-g_dumpTree :: Integral i => [(i,Bool)] -> Message-g_dumpTree = message "/g_dumpTree" . P.mk_duples int32 (int32 . fromEnum)---- | Request a representation of a group's node subtree, optionally including the current control values for synths.------ Replies to the sender with a @/g_queryTree.reply@ message listing all of the nodes contained within the group in the following format:------ > int32 - if synth control values are included 1, else 0--- > int32 - node ID of the requested group--- > int32 - number of child nodes contained within the requested group--- >--- > For each node in the subtree:--- > [--- >   int32 - node ID--- >   int32 - number of child nodes contained within this node. If -1 this is a synth, if >= 0 it's a group.--- >--- >   If this node is a synth:--- >     symbol - the SynthDef name for this node.--- >--- >   If flag (see above) is true:--- >     int32 - numControls for this synth (M)--- >     [--- >       symbol or int: control name or index--- >       float or symbol: value or control bus mapping symbol (e.g. 'c1')--- >     ] * M--- > ] * the number of nodes in the subtree------ N.B. The order of nodes corresponds to their execution order on the server. Thus child nodes (those contained within a group) are listed immediately following their parent.-g_queryTree :: Integral i => [(i,Bool)] -> Message-g_queryTree = message "/g_queryTree" . P.mk_duples int32 (int32 . fromEnum)---- * Node commands (n_)---- | Place a node after another.-n_after :: Integral i => [(i,i)] -> Message-n_after = message "/n_after" . P.mk_duples int32 int32---- | Place a node before another.-n_before :: Integral i => [(i,i)] -> Message-n_before = message "/n_before" . P.mk_duples int32 int32---- | Fill ranges of a node's control values.-n_fill :: (Integral i,Real f) => i -> [(String,i,f)] -> Message-n_fill nid l = message "/n_fill" (int32 nid : P.mk_triples string int32 float l)---- | Delete a node.-n_free :: Integral i => [i] -> Message-n_free = message "/n_free" . map int32--n_map :: Integral i => i -> [(String,i)] -> Message-n_map nid l = message "/n_map" (int32 nid : P.mk_duples string int32 l)---- | Map a node's controls to read from buses.-n_mapn :: Integral i => i -> [(String,i,i)] -> Message-n_mapn nid l = message "/n_mapn" (int32 nid : P.mk_triples string int32 int32 l)---- | Map a node's controls to read from an audio bus.-n_mapa :: Integral i => i -> [(String,i)] -> Message-n_mapa nid l = message "/n_mapa" (int32 nid : P.mk_duples string int32 l)---- | Map a node's controls to read from audio buses.-n_mapan :: Integral i => i -> [(String,i,i)] -> Message-n_mapan nid l = message "/n_mapan" (int32 nid : P.mk_triples string int32 int32 l)---- | Get info about a node.-n_query :: Integral i => [i] -> Message-n_query = message "/n_query" . map int32---- | Turn node on or off.-n_run :: Integral i => [(i,Bool)] -> Message-n_run = message "/n_run" . P.mk_duples int32 (int32 . fromEnum)---- | Set a node's control values.-n_set :: (Integral i,Real n) => i -> [(String,n)] -> Message-n_set nid c = message "/n_set" (int32 nid : P.mk_duples string float c)---- | Set ranges of a node's control values.-n_setn :: (Integral i,Real n) => i -> [(String,[n])] -> Message-n_setn nid l =-    let f (s,d) = string s : int32 (length d) : map float d-    in message "/n_setn" (int32 nid : concatMap f l)---- | Trace a node.-n_trace :: Integral i => [i] -> Message-n_trace = message "/n_trace" . map int32---- | Move an ordered sequence of nodes.-n_order :: Integral i => E.AddAction -> i -> [i] -> Message-n_order a n ns = message "/n_order" (int32 (fromEnum a) : int32 n : map int32 ns)---- * Par commands (p_)---- | Create a new parallel group (supernova specific).-p_new :: Integral i => [(i,E.AddAction,i)] -> Message-p_new = message "/p_new" . P.mk_triples int32 (int32 . fromEnum) int32---- * Synthesis node commands (s_)---- | Get control values.-s_get :: Integral i => i -> [String] -> Message-s_get nid i = message "/s_get" (int32 nid : map string i)---- | Get ranges of control values.-s_getn :: Integral i => i -> [(String,i)] -> Message-s_getn nid l = message "/s_getn" (int32 nid : P.mk_duples string int32 l)---- | Create a new synth.-s_new :: (Integral i,Real n) => String -> i -> E.AddAction -> i -> [(String,n)] -> Message-s_new n i a t c = message "/s_new" (string n : int32 i : int32 (fromEnum a) : int32 t : P.mk_duples string float c)---- | Auto-reassign synth's ID to a reserved value.-s_noid :: Integral i => [i] -> Message-s_noid = message "/s_noid" . map int32---- * UGen commands (u_)---- | Send a command to a unit generator.-u_cmd :: Integral i => i -> i -> String -> [Datum] -> Message-u_cmd nid uid name arg = message "/u_cmd" ([int32 nid,int32 uid,string name] ++ arg)---- * Server operation commands---- | Send a plugin command.-cmd :: String -> [Datum] -> Message-cmd name = message "/cmd" . (string name :)---- | Remove all bundles from the scheduling queue.-clearSched :: Message-clearSched = message "/clearSched" []---- | Select printing of incoming Open Sound Control messages.-dumpOSC :: E.PrintLevel -> Message-dumpOSC c = message "/dumpOSC" [int32 (fromEnum c)]---- | Set error posting scope and mode.-errorMode :: E.ErrorScope -> E.ErrorMode -> Message-errorMode scope mode =-    let e = case scope of-              E.Globally -> fromEnum mode-              E.Locally  -> -1 - fromEnum mode-    in message "/error" [int32 e]---- | Select reception of notification messages. (Asynchronous)-notify :: Bool -> Message-notify c = message "/notify" [int32 (fromEnum c)]---- | End real time mode, close file (un-implemented).-nrt_end :: Message-nrt_end = message "/nrt_end" []---- | Stop synthesis server.-quit :: Message-quit = message "/quit" []---- | Request \/status.reply message.-status :: Message-status = message "/status" []---- | Request \/synced message when all current asynchronous commands complete.-sync :: Integral i => i -> Message-sync sid = message "/sync" [int32 sid]---- * Modify existing message to include completion message---- | Add a completion packet to an existing asynchronous command.-with_completion_packet :: Message -> Packet -> Message-with_completion_packet (Message c xs) cm =-    if c `elem` C.async_cmds-    then let xs' = xs ++ [Blob (encodePacket cm)]-         in Message c xs'-    else error ("with_completion_packet: not async: " ++ c)---- | Add a completion message to an existing asynchronous command.------ > let m = n_set1 0 "0" 0--- > let e = encodeMessage m--- > withCM (b_close 0) m == Message "/b_close" [Int32 0,Blob e]-withCM :: Message -> Message -> Message-withCM m cm = with_completion_packet m (Packet_Message cm)---- * Variants to simplify common cases---- | Pre-allocate for b_setn1, values preceding offset are zeroed.-b_alloc_setn1 :: (Integral i,Real n) => i -> i -> [n] -> Message-b_alloc_setn1 nid i xs =-    let k = i + genericLength xs-        xs' = genericReplicate i 0 ++ xs-    in withCM (b_alloc nid k 1) (b_setn1 nid 0 xs')---- | Get ranges of sample values.-b_getn1 :: Integral i => i -> (i,i) -> Message-b_getn1 nid = b_getn nid . return---- | Variant on 'b_query'.-b_query1 :: Integral i => i -> Message-b_query1 = b_query . return---- | Set single sample value.-b_set1 :: (Integral i,Real n) => i -> i -> n -> Message-b_set1 nid i x = b_set nid [(i,x)]---- | Set a range of sample values.-b_setn1 :: (Integral i,Real n) => i -> i -> [n] -> Message-b_setn1 nid i xs = b_setn nid [(i,xs)]---- | Segmented variant of 'b_setn1'.-b_setn1_segmented :: (Integral i,Real n) => i -> i -> i -> [n] -> [Message]-b_setn1_segmented k b i d =-    if genericLength d < k-    then [b_setn1 b i d]-    else b_setn1 b i (genericTake k d) : b_setn1_segmented k b (i + k) (genericDrop k d)---- | Get ranges of sample values.-c_getn1 :: Integral i => (i,i) -> Message-c_getn1 = c_getn . return---- | Set single bus values.-c_set1 :: (Integral i,Real n) => i -> n -> Message-c_set1 i x = c_set [(i,x)]---- | Set single range of bus values.-c_setn1 :: (Integral i,Real n) => (i,[n]) -> Message-c_setn1 = c_setn . return---- | Turn a single node on or off.-n_run1 :: Integral i => i -> Bool -> Message-n_run1 nid k = n_run [(nid,k)]---- | Set a single node control value.-n_set1 :: (Integral i,Real n) => i -> String -> n -> Message-n_set1 nid k n = n_set nid [(k,n)]---- | @s_new@ with no parameters.-s_new0 :: Integral i => String -> i -> E.AddAction -> i -> Message-s_new0 n i a t = s_new n i a t ([]::[(String,Double)])---- * Buffer segmentation and indices---- | Segment a request for /m/ places into sets of at most /n/.------ > b_segment 1024 2056 == [8,1024,1024]--- > b_segment 1 5 == replicate 5 1-b_segment :: Integral i => i -> i -> [i]-b_segment n m =-    let (q,r) = m `quotRem` n-        s = genericReplicate q n-    in if r == 0 then s else r : s---- | Variant of 'b_segment' that takes a starting index and returns--- /(index,size)/ duples.------ > b_indices 1 5 0 == zip [0..4] (replicate 5 1)--- > b_indices 1024 2056 16 == [(16,8),(24,1024),(1048,1024)]-b_indices :: Integral i => i -> i -> i -> [(i,i)]-b_indices n m k =-    let s = b_segment n m-        i = 0 : P.dx_d s-    in zip (map (+ k) i) s---- * UGen commands.---- | Generate accumulation buffer given time-domain IR buffer and FFT size.-pc_preparePartConv :: Integral i => i -> i -> i -> Message-pc_preparePartConv b irb fft_size =-    b_gen b "PreparePartConv" (map int32 [irb, fft_size])---- * Unpack---- | Result is null for non-conforming data, or has five or sevel elements.-unpack_n_info_datum_plain :: Num i => [Datum] -> [i]-unpack_n_info_datum_plain m =-    let to_i = fromIntegral-    in case m of-         [Int32 i1,Int32 i2,Int32 i3,Int32 i4,Int32 i5] -> [to_i i1,to_i i2,to_i i3,to_i i4,to_i i5]-         [Int32 i1,Int32 i2,Int32 i3,Int32 i4,Int32 i5,Int32 i6,Int32 i7] -> [to_i i1,to_i i2,to_i i3,to_i i4,to_i i5,to_i i6,to_i i7]-         _ -> []--unpack_n_info_plain :: Num i => Message -> [i]-unpack_n_info_plain m =-    case m of-      Message "/n_info" dat -> unpack_n_info_datum_plain dat-      _ -> []---- | Unpack @n_info@ message.-unpack_n_info :: Num i => Message -> Maybe (i,i,i,i,i,Maybe (i,i))-unpack_n_info m =-    case unpack_n_info_plain m of-      [i1,i2,i3,i4,i5] -> Just (i1,i2,i3,i4,i5,Nothing)-      [i1,i2,i3,i4,i5,i6,i7] -> Just (i1,i2,i3,i4,i5,Just (i6,i7))-      _ -> Nothing--unpack_n_info_err :: Num i => Message -> (i,i,i,i,i,Maybe (i,i))-unpack_n_info_err = fromMaybe (error "unpack_n_info") . unpack_n_info---- | Unpack the '/tr' messages sent by 'sendTrig'.-unpack_tr :: (Num i,Fractional f) => Message -> Maybe (i,i,f)-unpack_tr m =-    let to_i = fromIntegral-        to_f = realToFrac-    in case m of-         Message "/tr" [Int32 p,Int32 q,Float r] -> Just (to_i p,to_i q,to_f r)-         _ -> Nothing--unpack_tr_err :: (Num i,Fractional f) => Message -> (i,i,f)-unpack_tr_err = fromMaybe (error "unpack_tr") . unpack_tr--unpack_b_setn :: (Num i,Fractional f) => Message -> Maybe (i,i,i,[f])-unpack_b_setn m =-    let to_i = fromIntegral-        to_f d = case d of-                    Float n -> realToFrac n-                    _ -> error "unpack_b_setn: non-float data"-    in case m of-         Message "/b_setn" (Int32 p:Int32 q:Int32 r:z) -> Just (to_i p,to_i q,to_i r,map to_f z)-         _ -> Nothing--unpack_b_setn_err :: (Num i,Fractional f) => Message -> (i,i,i,[f])-unpack_b_setn_err = fromMaybe (error "unpack_b_setn") . unpack_b_setn---- | Unpack @b_info@ message, fields are (id,frames,channels,sample-rate).-unpack_b_info :: (Num i,Fractional f) => Message -> Maybe (i,i,i,f)-unpack_b_info m =-    let to_i = fromIntegral-        to_f = realToFrac-    in case m of-         Message "/b_info" [Int32 p,Int32 q,Int32 r,Float s] -> Just (to_i p,to_i q,to_i r,to_f s)-         _ -> Nothing---- | Variant generating 'error'.-unpack_b_info_err :: (Num i,Fractional f) => Message -> (i,i,i,f)-unpack_b_info_err = fromMaybe (error "unpack_b_info") . unpack_b_info---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/Server/Command/Plain.hs
@@ -1,422 +0,0 @@--- | Functions from "Sound.SC3.Server.Command.Generic" specialised to 'Int' and 'Double'.-module Sound.SC3.Server.Command.Plain where--import Sound.OSC.Core (Datum,Message) {- hosc -}--import qualified Sound.SC3.Server.Command.Generic as G-import qualified Sound.SC3.Server.Enum as E-import Sound.SC3.Server.Graphdef (Graphdef)-import Sound.SC3.Server.Synthdef (Synthdef)---- * Types---- | Buffer identifier (buffer number).-type Buffer_Id = Int---- | Buffer index (frame index).-type Buffer_Ix = Int---- | File connection flag.-type Buffer_Leave_File_Open = Bool---- | Control bus identifier (number).-type Bus_Id = Int---- | Node identifier (number).-type Node_Id = Int---- | Group-node identifier (number).-type Group_Id = Int---- | Synth-node identifier (number).-type Synth_Id = Int---- * Buffer commands (b_)---- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)-b_alloc :: Buffer_Id -> Int -> Int -> Message-b_alloc = G.b_alloc---- | Allocate buffer space and read a sound file. (Asynchronous)-b_allocRead :: Buffer_Id -> String -> Int -> Int -> Message-b_allocRead = G.b_allocRead---- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)-b_allocReadChannel :: Buffer_Id -> String -> Int -> Int -> [Int] -> Message-b_allocReadChannel = G.b_allocReadChannel---- | Close attached soundfile and write header information. (Asynchronous)-b_close :: Buffer_Id -> Message-b_close = G.b_close---- | Fill ranges of sample values.-b_fill :: Buffer_Id -> [(Buffer_Ix,Int,Double)] -> Message-b_fill = G.b_fill---- | Free buffer data. (Asynchronous)-b_free :: Buffer_Id -> Message-b_free = G.b_free---- | Call a command to fill a buffer.  (Asynchronous)-b_gen :: Buffer_Id -> String -> [Datum] -> Message-b_gen = G.b_gen---- | Get sample values.-b_get :: Buffer_Id -> [Buffer_Ix] -> Message-b_get = G.b_get---- | Get ranges of sample values.-b_getn :: Buffer_Id -> [(Buffer_Ix,Int)] -> Message-b_getn = G.b_getn---- | Request \/b_info messages.-b_query :: [Buffer_Id] -> Message-b_query = G.b_query---- | Read sound file data into an existing buffer. (Asynchronous)-b_read :: Buffer_Id -> String -> Int -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> Message-b_read = G.b_read---- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)-b_readChannel :: Buffer_Id -> String -> Int -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> [Int] -> Message-b_readChannel = G.b_readChannel---- | Set sample values.-b_set :: Buffer_Id -> [(Buffer_Ix,Double)] -> Message-b_set = G.b_set---- | Set ranges of sample values.-b_setn :: Buffer_Id -> [(Buffer_Ix,[Double])] -> Message-b_setn = G.b_setn---- | Write sound file data. (Asynchronous)-b_write :: Buffer_Id -> String -> E.SoundFileFormat -> E.SampleFormat -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> Message-b_write = G.b_write---- | Zero sample data. (Asynchronous)-b_zero :: Buffer_Id -> Message-b_zero = G.b_zero---- * Control bus commands---- |  Fill ranges of bus values.-c_fill :: [(Bus_Id,Int,Double)] -> Message-c_fill = G.c_fill---- | Get bus values.-c_get :: [Bus_Id] -> Message-c_get = G.c_get---- | Get ranges of bus values.-c_getn :: [(Bus_Id,Int)] -> Message-c_getn = G.c_getn---- | Set bus values.-c_set :: [(Bus_Id,Double)] -> Message-c_set = G.c_set---- | Set ranges of bus values.-c_setn :: [(Bus_Id,[Double])] -> Message-c_setn = G.c_setn---- * Instrument definition commands (d_)---- | Install a bytecode instrument definition. (Asynchronous)-d_recv' :: Graphdef -> Message-d_recv' = G.d_recv'---- | Install a bytecode instrument definition. (Asynchronous)-d_recv :: Synthdef -> Message-d_recv = G.d_recv---- | Load an instrument definition from a named file. (Asynchronous)-d_load :: String -> Message-d_load = G.d_load---- | Load a directory of instrument definitions files. (Asynchronous)-d_loadDir :: String -> Message-d_loadDir = G.d_loadDir---- | Remove definition once all nodes using it have ended.-d_free :: [String] -> Message-d_free = G.d_free---- * Group node commands (g_)---- | Free all synths in this group and all its sub-groups.-g_deepFree :: [Group_Id] -> Message-g_deepFree = G.g_deepFree---- | Delete all nodes in a set of groups.-g_freeAll :: [Group_Id] -> Message-g_freeAll = G.g_freeAll---- | Add node to head of group.-g_head :: [(Group_Id,Node_Id)] -> Message-g_head = G.g_head---- | Create a new group.-g_new :: [(Group_Id,E.AddAction,Node_Id)] -> Message-g_new = G.g_new---- | Add node to tail of group.-g_tail :: [(Group_Id,Node_Id)] -> Message-g_tail = G.g_tail---- | Post a representation of a group's node subtree, optionally including the current control values for synths.-g_dumpTree :: [(Group_Id,Bool)] -> Message-g_dumpTree = G.g_dumpTree---- | Request a representation of a group's node subtree, optionally including the current control values for synths.-g_queryTree :: [(Group_Id,Bool)] -> Message-g_queryTree = G.g_queryTree---- * Node commands (n_)---- | Place a node after another.-n_after :: [(Node_Id,Node_Id)] -> Message-n_after = G.n_after---- | Place a node before another.-n_before :: [(Node_Id,Node_Id)] -> Message-n_before = G.n_before---- | Fill ranges of a node's control values.-n_fill :: Node_Id -> [(String,Int,Double)] -> Message-n_fill = G.n_fill---- | Delete a node.-n_free :: [Node_Id] -> Message-n_free = G.n_free--n_map :: Node_Id -> [(String,Bus_Id)] -> Message-n_map = G.n_map---- | Map a node's controls to read from buses.-n_mapn :: Node_Id -> [(String,Bus_Id,Int)] -> Message-n_mapn = G.n_mapn---- | Map a node's controls to read from an audio bus.-n_mapa :: Node_Id -> [(String,Bus_Id)] -> Message-n_mapa = G.n_mapa---- | Map a node's controls to read from audio buses.-n_mapan :: Node_Id -> [(String,Bus_Id,Int)] -> Message-n_mapan = G.n_mapan---- | Get info about a node.-n_query :: [Node_Id] -> Message-n_query = G.n_query---- | Turn node on or off.-n_run :: [(Node_Id,Bool)] -> Message-n_run = G.n_run---- | Set a node's control values.-n_set :: Node_Id -> [(String,Double)] -> Message-n_set = G.n_set---- | Set ranges of a node's control values.-n_setn :: Node_Id -> [(String,[Double])] -> Message-n_setn = G.n_setn---- | Trace a node.-n_trace :: [Node_Id] -> Message-n_trace = G.n_trace---- | Move and order a sequence of nodes.-n_order :: E.AddAction -> Node_Id -> [Node_Id] -> Message-n_order = G.n_order---- * Par commands (p_)---- | Create a new parallel group (supernova specific).-p_new :: [(Group_Id,E.AddAction,Node_Id)] -> Message-p_new = G.p_new---- * Synthesis node commands (s_)---- | Get control values.-s_get :: Synth_Id -> [String] -> Message-s_get = G.s_get---- | Get ranges of control values.-s_getn :: Synth_Id -> [(String,Int)] -> Message-s_getn = G.s_getn---- | Create a new synth.-s_new :: String -> Synth_Id -> E.AddAction -> Node_Id -> [(String,Double)] -> Message-s_new = G.s_new---- | Auto-reassign synth's ID to a reserved value.-s_noid :: [Synth_Id] -> Message-s_noid = G.s_noid---- * Unit Generator commands (u_)---- | Send a command to a unit generator.-u_cmd :: Int -> Int -> String -> [Datum] -> Message-u_cmd = G.u_cmd---- * Server operation commands---- | Send a plugin command.-cmd :: String -> [Datum] -> Message-cmd = G.cmd---- | Remove all bundles from the scheduling queue.-clearSched :: Message-clearSched = G.clearSched---- | Select printing of incoming Open Sound Control messages.-dumpOSC :: E.PrintLevel -> Message-dumpOSC = G.dumpOSC---- | Set error posting scope and mode.-errorMode :: E.ErrorScope -> E.ErrorMode -> Message-errorMode = G.errorMode---- | Select reception of notification messages. (Asynchronous)-notify :: Bool -> Message-notify = G.notify---- | End real time mode, close file (un-implemented).-nrt_end :: Message-nrt_end = G.nrt_end---- | Stop synthesis server.-quit :: Message-quit = G.quit---- | Request \/status.reply message.-status :: Message-status = G.status---- | Request \/synced message when all current asynchronous commands complete.-sync :: Int -> Message-sync = G.sync---- * Variants to simplify common cases---- | Get ranges of sample values.-b_getn1 :: Buffer_Id -> (Buffer_Ix,Int) -> Message-b_getn1 = G.b_getn1---- | Variant on 'b_query'.-b_query1 :: Buffer_Id -> Message-b_query1 = b_query . return---- | Get ranges of sample values.-c_getn1 :: (Bus_Id,Int) -> Message-c_getn1 = G.c_getn1---- | Set single bus values.-c_set1 :: Bus_Id -> Double -> Message-c_set1 = G.c_set1---- | Set single range of bus values.-c_setn1 :: (Bus_Id,[Double]) -> Message-c_setn1 = G.c_setn1---- | Turn a single node on or off.-n_run1 :: Node_Id -> Bool -> Message-n_run1 = G.n_run1---- | Set a single node control value.-n_set1 :: Node_Id -> String -> Double -> Message-n_set1 = G.n_set1---- | @s_new@ with no parameters.-s_new0 :: String -> Synth_Id -> E.AddAction -> Node_Id -> Message-s_new0 = G.s_new0---- * Buffer segmentation and indices---- | Segment a request for /m/ places into sets of at most /n/.------ > b_segment 1024 2056 == [8,1024,1024]--- > b_segment 1 5 == replicate 5 1-b_segment :: Int -> Int -> [Int]-b_segment = G.b_segment---- | Variant of 'b_segment' that takes a starting index and returns /(index,size)/ duples.------ > b_indices 1 5 0 == zip [0..4] (replicate 5 1)--- > b_indices 1024 2056 16 == [(16,8),(24,1024),(1048,1024)]-b_indices :: Int -> Int -> Int -> [(Int,Int)]-b_indices = G.b_indices---- | Call @copy@ 'b_gen' command.-b_gen_copy :: Buffer_Id -> Int -> Buffer_Id -> Int -> Maybe Int -> Message-b_gen_copy = G.b_gen_copy---- | Call @sine1@ 'b_gen' command.-b_gen_sine1 :: Buffer_Id -> [E.B_Gen] -> [Double] -> Message-b_gen_sine1 = G.b_gen_sine1---- | Call @sine2@ 'b_gen' command.-b_gen_sine2 :: Buffer_Id -> [E.B_Gen] -> [(Double,Double)] -> Message-b_gen_sine2 = G.b_gen_sine2---- | Call @sine3@ 'b_gen' command.-b_gen_sine3 :: Buffer_Id -> [E.B_Gen] -> [(Double,Double,Double)] -> Message-b_gen_sine3 = G.b_gen_sine3---- | Call @cheby@ 'b_gen' command.-b_gen_cheby :: Buffer_Id -> [E.B_Gen] -> [Double] -> Message-b_gen_cheby = G.b_gen_cheby---- | Pre-allocate for b_setn1, values preceding offset are zeroed.-b_alloc_setn1 :: Buffer_Id -> Buffer_Ix -> [Double] -> Message-b_alloc_setn1 = G.b_alloc_setn1---- | Set single sample value.-b_set1 :: Buffer_Id -> Buffer_Ix -> Double -> Message-b_set1 = G.b_set1---- | Set a range of sample values.-b_setn1 :: Buffer_Id -> Buffer_Ix -> [Double] -> Message-b_setn1 = G.b_setn1---- | Segmented variant of 'b_setn1'.-b_setn1_segmented :: Int -> Buffer_Id -> Buffer_Ix -> [Double] -> [Message]-b_setn1_segmented = G.b_setn1_segmented---- * UGen commands.---- | Generate accumulation buffer given time-domain IR buffer and FFT size.-pc_preparePartConv :: Int -> Int -> Int -> Message-pc_preparePartConv = G.pc_preparePartConv---- * Unpack--unpack_n_info_plain :: Message -> [Int]-unpack_n_info_plain = G.unpack_n_info_plain--unpack_n_info :: Message -> Maybe (Int,Int,Int,Int,Int,Maybe (Int,Int))-unpack_n_info = G.unpack_n_info--unpack_n_info_err :: Message -> (Int,Int,Int,Int,Int,Maybe (Int,Int))-unpack_n_info_err = G.unpack_n_info_err--unpack_tr :: Message -> Maybe (Int,Int,Double)-unpack_tr = G.unpack_tr--unpack_tr_err :: Message -> (Int,Int,Double)-unpack_tr_err = G.unpack_tr_err--unpack_b_setn :: Message -> Maybe (Int,Int,Int,[Double])-unpack_b_setn = G.unpack_b_setn--unpack_b_setn_err :: Message -> (Int,Int,Int,[Double])-unpack_b_setn_err = G.unpack_b_setn_err--unpack_b_info :: Message -> Maybe (Int,Int,Int,Double)-unpack_b_info = G.unpack_b_info--unpack_b_info_err :: Message -> (Int,Int,Int,Double)-unpack_b_info_err = G.unpack_b_info_err---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/Server/Enum.hs
@@ -1,89 +0,0 @@--- | Server input enumerations.-module Sound.SC3.Server.Enum where---- | Enumeration of possible locations to add new nodes (s_new and g_new).-data AddAction = AddToHead-               | AddToTail-               | AddBefore-               | AddAfter-               | AddReplace-                 deriving (Eq,Show,Enum)---- | Enumeration of flags for '/b_gen' command.-data B_Gen = Normalise | Wavetable | Clear-             deriving (Eq,Enum,Bounded,Show)---- | 'B_Gen' to bit number.------ > map b_gen_bit [minBound .. maxBound]-b_gen_bit :: B_Gen -> Int-b_gen_bit = fromEnum---- | Set of 'B_Gen' to flag.------ > b_gen_flag [minBound .. maxBound] == 7-b_gen_flag :: [B_Gen] -> Int-b_gen_flag = sum . map ((2 ^) . b_gen_bit)---- | Error posting scope.-data ErrorScope = Globally  -- ^ Global scope-                | Locally   -- ^ Bundle scope-                  deriving (Eq,Show,Enum)---- | Error posting mode.-data ErrorMode = ErrorsOff  -- ^ Turn error posting off-               | ErrorsOn   -- ^ Turn error posting on-                 deriving (Eq,Show,Enum)---- | Enumeration of Message printer types.-data PrintLevel = NoPrinter-                | TextPrinter-                | HexPrinter-                | AllPrinter-                  deriving (Eq,Show,Enum)---- | Sound file format.-data SoundFileFormat = Aiff | Flac | Ircam | Next | Raw | Wave-  deriving (Enum, Eq, Read, Show)---- | Sample format.-data SampleFormat =-    PcmInt8 | PcmInt16 | PcmInt24 | PcmInt32-  | PcmFloat | PcmDouble-  | PcmMulaw | PcmAlaw-  deriving (Enum, Eq, Read, Show)---- | Sample format to standard file extension name.-soundFileFormatString :: SoundFileFormat -> String-soundFileFormatString f =-    case f of-      Aiff -> "aiff"-      Flac -> "flac"-      Ircam -> "ircam"-      Next -> "next"-      Raw -> "raw"-      Wave -> "wav"---- | Infer sample format from file extension name.-soundFileFormat_from_extension :: String -> Maybe SoundFileFormat-soundFileFormat_from_extension =-    let tbl = [("aif",Aiff)-              ,("aiff",Aiff)-              ,("flac",Flac)-              ,("ircam",Ircam)-              ,("next",Next)-              ,("raw",Raw)-              ,("wav",Wave)]-    in flip lookup tbl--sampleFormatString :: SampleFormat -> String-sampleFormatString f =-    case f of-      PcmInt8 -> "int8"-      PcmInt16 -> "int16"-      PcmInt24 -> "int24"-      PcmInt32 -> "int32"-      PcmFloat -> "float"-      PcmDouble -> "double"-      PcmMulaw -> "mulaw"-      PcmAlaw -> "alaw"
− Sound/SC3/Server/FD.hs
@@ -1,5 +0,0 @@--- | Composite of "Sound.SC3.Server" and /FD/ transport.-module Sound.SC3.Server.FD (module M) where--import Sound.SC3.Server as M-import Sound.SC3.Server.Transport.FD as M
− Sound/SC3/Server/Graphdef.hs
@@ -1,221 +0,0 @@--- | Binary 'Graph Definition' as understood by @scsynth@.-module Sound.SC3.Server.Graphdef where--import Control.Monad {- base -}-import qualified Data.ByteString.Lazy as L {- bytestring -}-import Data.List-import System.IO {- base -}--import qualified Sound.OSC.Coding.Byte as B {- hosc -}-import qualified Sound.OSC.Coding.Cast as C {- hosc -}-import Sound.OSC.Datum {- hosc -}---- * Type--type Name = ASCII--type Control = (Name,Int)--type Sample = Double--data Input = Input Int Int deriving (Eq,Show)--input_ugen_ix :: Input -> Maybe Int-input_ugen_ix (Input u p) = if p == -1 then Nothing else Just u--type Output = Int--type Rate = Int--type Special = Int--type UGen = (Name,Rate,[Input],[Output],Special)--ugen_inputs :: UGen -> [Input]-ugen_inputs (_,_,i,_,_) = i--ugen_outputs :: UGen -> [Output]-ugen_outputs (_,_,_,o,_) = o--ugen_is_control :: UGen -> Bool-ugen_is_control (nm,_,_,_,_) = ascii_to_string nm `elem` ["Control","LagControl","TrigControl"]--ugen_rate :: UGen -> Rate-ugen_rate (_,r,_,_,_) = r--input_is_control :: Graphdef -> Input -> Bool-input_is_control g (Input u _) =-    if u == -1-    then False-    else ugen_is_control (graphdef_ugen g u)--data Graphdef = Graphdef {graphdef_name :: Name-                         ,graphdef_constants :: [Sample]-                         ,graphdef_controls :: [(Control,Sample)]-                         ,graphdef_ugens :: [UGen]}-                deriving (Eq,Show)--graphdef_ugen :: Graphdef -> Int -> UGen-graphdef_ugen g = (graphdef_ugens g !!)--graphdef_control :: Graphdef -> Int -> (Control,Sample)-graphdef_control g = (graphdef_controls g !!)--graphdef_constant_nid :: Graphdef -> Int -> Int-graphdef_constant_nid _ = id--graphdef_control_nid :: Graphdef -> Int -> Int-graphdef_control_nid g = (+) (length (graphdef_constants g))--graphdef_ugen_nid :: Graphdef -> Int -> Int-graphdef_ugen_nid g n = graphdef_control_nid g 0 + length (graphdef_controls g) + n---- * Read--read_i8 :: Handle -> IO Int-read_i8 h = fmap B.decode_i8 (L.hGet h 1)--read_i16 :: Handle -> IO Int-read_i16 h = fmap B.decode_i16 (L.hGet h 2)--read_i32 :: Handle -> IO Int-read_i32 h = fmap B.decode_i32 (L.hGet h 4)--read_sample :: Handle -> IO Sample-read_sample h = fmap (realToFrac . B.decode_f32) (L.hGet h 4)--read_pstr :: Handle -> IO ASCII-read_pstr h = do-  n <- fmap B.decode_u8 (L.hGet h 1)-  fmap B.decode_str (L.hGet h n)--read_control :: (Handle -> IO Int) -> Handle -> IO Control-read_control read_i h = do-  nm <- read_pstr h-  ix <- read_i h-  return (nm,ix)--read_input :: (Handle -> IO Int) -> Handle -> IO Input-read_input read_i h = do-  u <- read_i h-  p <- read_i h-  return (Input u p)--read_output :: Handle -> IO Int-read_output = read_i8--read_ugen :: (Handle -> IO Int) -> Handle -> IO UGen-read_ugen read_i h = do-  name <- read_pstr h-  rate <- read_i8 h-  number_of_inputs <- read_i h-  number_of_outputs <- read_i h-  special <- read_i16 h-  inputs <- replicateM number_of_inputs (read_input read_i h)-  outputs <- replicateM number_of_outputs (read_output h)-  return (name-         ,rate-         ,inputs-         ,outputs-         ,special)--read_graphdef :: Handle -> IO Graphdef-read_graphdef h = do-  magic <- fmap B.decode_str (L.hGet h 4)-  version <- read_i32 h-  let read_i =-          case version of-            0 -> read_i16-            2 -> read_i32-            _ -> error ("read_graphdef: version not at {zero | two}: " ++ show version)-  number_of_definitions <- read_i16 h-  when (magic /= ascii "SCgf")-       (error "read_graphdef: illegal magic string")-  when (number_of_definitions /= 1)-       (error "read_graphdef: non unary graphdef file")-  name <- read_pstr h-  number_of_constants <- read_i h-  constants <- replicateM number_of_constants (read_sample h)-  number_of_control_defaults <- read_i h-  control_defaults <- replicateM number_of_control_defaults (read_sample h)-  number_of_controls <- read_i h-  controls <- replicateM number_of_controls (read_control read_i h)-  number_of_ugens <- read_i h-  ugens <- replicateM number_of_ugens (read_ugen read_i h)-  -- ignore variants...-  return (Graphdef name-                   constants-                   (zip controls control_defaults)-                   ugens)---- > g <- read_graphdef_file "/home/rohan/sw/rsc3-disassembler/scsyndef/simple.scsyndef"--- > g <- read_graphdef_file "/home/rohan/sw/rsc3-disassembler/scsyndef/with-ctl.scsyndef"--- > g <- read_graphdef_file "/home/rohan/sw/rsc3-disassembler/scsyndef/mce.scsyndef"--- > g <- read_graphdef_file "/home/rohan/sw/rsc3-disassembler/scsyndef/mrg.scsyndef"--- > putStrLn$ graphdef_stat g-read_graphdef_file :: FilePath -> IO Graphdef-read_graphdef_file nm = do-  h <- openFile nm ReadMode-  g <- read_graphdef h-  hClose h-  return g---- * Encode, we write version zero files---- | Pascal (length prefixed) encoding of string.-encode_pstr :: ASCII -> L.ByteString-encode_pstr = L.pack . C.str_pstr . ascii_to_string---- | Byte-encode 'Input' value.-encode_input :: Input -> L.ByteString-encode_input (Input u p) = L.append (B.encode_i16 u) (B.encode_i16 p)--encode_control :: Control -> L.ByteString-encode_control (nm,k) = L.concat [encode_pstr nm,B.encode_i16 k]---- | Byte-encode 'UGen'.-encode_ugen :: UGen -> L.ByteString-encode_ugen (nm,r,i,o,s) =-    L.concat [encode_pstr nm-             ,B.encode_i8 r-             ,B.encode_i16 (length i)-             ,B.encode_i16 (length o)-             ,B.encode_i16 s-             ,L.concat (map encode_input i)-             ,L.concat (map B.encode_i8 o)]--encode_sample :: Sample -> L.ByteString-encode_sample = B.encode_f32 . realToFrac--encode_graphdef :: Graphdef -> L.ByteString-encode_graphdef (Graphdef nm cs ks us) =-    let (ks_ctl,ks_def) = unzip ks-    in L.concat [B.encode_str (ascii "SCgf")-                ,B.encode_i32 0 -- version-                ,B.encode_i16 1 -- number of graphs-                ,encode_pstr nm-                ,B.encode_i16 (length cs)-                ,L.concat (map encode_sample cs)-                ,B.encode_i16 (length ks_def)-                ,L.concat (map encode_sample ks_def)-                ,B.encode_i16 (length ks_ctl)-                ,L.concat (map encode_control ks_ctl)-                ,B.encode_i16 (length us)-                ,L.concat (map encode_ugen us)]---- * Stat--graphdef_stat :: Graphdef -> String-graphdef_stat (Graphdef nm cs ks us) =-    let u_nm (sc3_nm,_,_,_,_) = ascii_to_string sc3_nm-        f g = let h (x:xs) = (x,length (x:xs))-                  h [] = error "graphdef_stat"-              in show . map h . group . sort . map g-        sq pp_f = intercalate "," (pp_f (map u_nm us))-    in unlines ["name                      : " ++ show nm-               ,"number of constants       : " ++ show (length cs)-               ,"number of controls        : " ++ show (length ks)-               ,"number of unit generators : " ++ show (length us)-               ,"unit generator rates      : " ++ f ugen_rate us-               ,"unit generator set        : " ++ sq (nub . sort)-               ,"unit generator sequence   : " ++ sq id]
− Sound/SC3/Server/Graphdef/Graph.hs
@@ -1,48 +0,0 @@--- | Transform 'Graph' to 'Graphdef'.-module Sound.SC3.Server.Graphdef.Graph where--import Data.Maybe{- base -}--import Sound.OSC.Datum {- hosc -}--import qualified Sound.SC3.Server.Graphdef as G-import Sound.SC3.UGen.Graph-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type---- * Encode to 'G.Graphdef'---- | Construct 'Input' form required by byte-code generator.-make_input :: Maps -> FromPort -> G.Input-make_input (cs,ks,_,us,kt) fp =-    case fp of-      FromPort_C n -> G.Input (-1) (fetch n cs)-      FromPort_K n t -> let i = ktype_map_lookup t kt-                        in G.Input i (fetch_k n t ks)-      FromPort_U n p -> G.Input (fetch n us) (fromMaybe 0 p)--node_k_to_control :: Maps -> Node -> G.Control-node_k_to_control (_,_,ks,_,_) nd =-    case nd of-      NodeK n _ _ nm _ _ _ -> (ascii nm,fetch n ks)-      _ -> error "node_k_to_control"---- | Byte-encode 'NodeU' primitive node.-node_u_to_ugen :: Maps -> Node -> G.UGen-node_u_to_ugen m n =-    case n of-      NodeU _ r nm i o (Special s) _ ->-          let i' = map (make_input m) i-          in (ascii nm,rateId r,i',map rateId o,s)-      _ -> error "encode_node_u: illegal input"---- | Construct instrument definition bytecode.-graph_to_graphdef :: String -> Graph -> G.Graphdef-graph_to_graphdef nm g =-    let Graph _ cs ks us = g-        cs' = map node_c_value cs-        mm = mk_maps g-        ks_def = map node_k_default ks-        ks_ctl = map (node_k_to_control mm) ks-        us' = map (node_u_to_ugen mm) us-    in G.Graphdef (ascii nm) cs' (zip ks_ctl ks_def) us'
− Sound/SC3/Server/Graphdef/Read.hs
@@ -1,49 +0,0 @@--- | Transform (read) a 'Graphdef' into a 'Graph'.-module Sound.SC3.Server.Graphdef.Read where--import Sound.OSC.Datum {- hosc -}--import Sound.SC3.Server.Graphdef-import qualified Sound.SC3.UGen.Graph as G-import qualified Sound.SC3.UGen.Rate as R-import qualified Sound.SC3.UGen.Type as U--mk_node_k :: Graphdef -> G.NodeId -> (Control,U.Sample) -> G.Node-mk_node_k g z ((nm,ix),v) =-    let z' = graphdef_control_nid g z-        nm' = ascii_to_string nm-    in G.NodeK z' R.KR (Just ix) nm' v G.K_KR Nothing--input_to_from_port :: Graphdef -> Input -> G.FromPort-input_to_from_port g (Input u p) =-    if u == -1-    then G.FromPort_C (graphdef_constant_nid g p)-    else if input_is_control g (Input u p)-         then if u /= 0-              then error "multiple control UGens..."-              else G.FromPort_K (graphdef_control_nid g p) G.K_KR-         else let ugen = graphdef_ugens g !! u-                  port = if length (ugen_outputs ugen) > 1-                         then Just p-                         else Nothing-              in G.FromPort_U (graphdef_ugen_nid g u) port--mk_node_u :: Graphdef -> G.NodeId -> UGen -> G.Node-mk_node_u g z u =-    let (name,rate,inputs,outputs,special) = u-        z' = graphdef_ugen_nid g z-        rate' = toEnum rate-        name' = ascii_to_string name-        inputs' = map (input_to_from_port g) inputs-        outputs' = map toEnum outputs-        special' = U.Special special-    in G.NodeU z' rate' name' inputs' outputs' special' (U.UId z')--graphdef_to_graph :: Graphdef -> (String,G.Graph)-graphdef_to_graph g =-    let constants_nd = zipWith G.NodeC [0..] (graphdef_constants g)-        controls_nd = zipWith (mk_node_k g) [0 ..] (graphdef_controls g)-        ugens_nd = zipWith (mk_node_u g) [0 ..] (graphdef_ugens g)-        nm = ascii_to_string (graphdef_name g)-        gr = G.Graph (-1) constants_nd controls_nd ugens_nd-    in (nm,gr) -- S.Synthdef nm gr
− Sound/SC3/Server/Help.hs
@@ -1,35 +0,0 @@--- | Functions to provide mediated access to the SC3 help system.-module Sound.SC3.Server.Help where--import Control.Monad {- base -}-import System.FilePath {- filepath -}-import System.Process {- process -}--import Sound.SC3.UGen.Help--{- | Generate path to indicated SC3 instance method help.  Adds initial-forward slash if not present.--> let r = "./Reference/Server-Command-Reference.html#/b_alloc"-> in sc3_server_command_ref "." "b_alloc" == r---}-sc3_server_command_ref :: FilePath -> String -> FilePath-sc3_server_command_ref d c =-    let f = d </> "Reference/Server-Command-Reference.html"-        c' = case c of-               '/':_ -> c-               _ -> '/':c-    in f ++ '#':c'--{- | Lookup @SC3@ help file for server command `c'.--> Sound.SC3.Server.Help.viewServerHelp "/b_allocRead"-> viewServerHelp "done"--}-viewServerHelp :: String -> IO ()-viewServerHelp c = do-  d <- sc3HelpDirectory-  let nm = sc3_server_command_ref d c-  br <- get_env_default "BROWSER" "x-www-browser"-  void (rawSystem br ["file://" ++ nm])
− Sound/SC3/Server/Monad.hs
@@ -1,5 +0,0 @@--- | Composite of "Sound.SC3.Server" and 'Monad' transport.-module Sound.SC3.Server.Monad (module S) where--import Sound.SC3.Server as S-import Sound.SC3.Server.Transport.Monad as S
− Sound/SC3/Server/NRT.hs
@@ -1,104 +0,0 @@--- | Non-realtime score generation.-module Sound.SC3.Server.NRT where--import Data.Maybe {- base -}-import qualified Data.ByteString.Lazy as B {- bytestring -}-import System.FilePath {- filepath -}-import System.IO {- base -}-import System.Process {- process -}--import Sound.OSC.Core {- hosc -}-import qualified Sound.OSC.Coding.Byte as Byte {- hosc -}--import Sound.SC3.Common.Prelude-import Sound.SC3.Server.Enum---- | Encode and prefix with encoded length.-oscWithSize :: Bundle -> B.ByteString-oscWithSize o =-    let b = encodeBundle o-        l = Byte.encode_i32 (fromIntegral (B.length b))-    in B.append l b---- | An 'NRT' score is a sequence of 'Bundle's.-data NRT = NRT {nrt_bundles :: [Bundle]} deriving (Show)--type NRT_STAT =-    ((String, Time)-    ,(String, Int)-    ,(String, Int)-    ,(String, [(String,Int)]))---- | Trivial NRT statistics.-nrt_stat :: NRT -> NRT_STAT-nrt_stat (NRT b_seq) =-    let b_msg = map bundleMessages b_seq-    in (("duration",bundleTime (last b_seq))-       ,("# bundles",length b_seq)-       ,("# messages",sum (map length b_msg))-       ,("command set",histogram (concatMap (map messageAddress) b_msg)))---- | 'span' of 'f' of 'bundleTime'.  Can be used to separate the--- /initialisation/ and /remainder/ parts of a score.-nrt_span :: (Time -> Bool) -> NRT -> ([Bundle],[Bundle])-nrt_span f = span (f . bundleTime) . nrt_bundles---- | Encode an 'NRT' score.-encodeNRT :: NRT -> B.ByteString-encodeNRT = B.concat . map oscWithSize . nrt_bundles---- | Write an 'NRT' score.-writeNRT :: FilePath -> NRT -> IO ()-writeNRT fn = B.writeFile fn . encodeNRT---- | Write an 'NRT' score to a file handle.-putNRT :: Handle -> NRT -> IO ()-putNRT h = B.hPut h . encodeNRT---- | Decode an 'NRT' 'B.ByteString' to a list of 'Bundle's.-decode_nrt_bundles :: B.ByteString -> [Bundle]-decode_nrt_bundles s =-    let (p,q) = B.splitAt 4 s-        n = fromIntegral (Byte.decode_i32 p)-        (r,s') = B.splitAt n q-        r' = decodeBundle r-    in if B.null s'-       then [r']-       else r' : decode_nrt_bundles s'---- | Decode an 'NRT' 'B.ByteString'.-decodeNRT :: B.ByteString -> NRT-decodeNRT = NRT . decode_nrt_bundles---- | 'decodeNRT' of 'B.readFile'.-readNRT :: FilePath -> IO NRT-readNRT = fmap decodeNRT . B.readFile---- * Render---- | Minimal NRT rendering options.  The sound file type is inferred--- from the file name extension.  Structure is: OSC file name, output--- audio file name, output number of channels, sample rate, sample--- format, further parameters (ie. ["-m","32768"]) to be inserted before--- the NRT -N option.-type NRT_Render_Plain = (FilePath,FilePath,Int,Int,SampleFormat,[String])---- | Minimal NRT rendering, for more control see Stefan Kersten's--- /hsc3-process/ package at:--- <https://github.com/kaoskorobase/hsc3-process>.-nrt_render_plain :: NRT_Render_Plain -> NRT -> IO ()-nrt_render_plain (osc_nm,sf_nm,nc,sr,sf,param) sc = do-  let sf_ty = case takeExtension sf_nm of-                '.':ext -> let fmt = soundFileFormat_from_extension ext-                           in fromMaybe (error "nrt_render_plain: unknown sf extension") fmt-                _ -> error "nrt_render_plain: invalid sf extension"-      sys = unwords ["scsynth"-                    ,"-i","0"-                    ,"-o",show nc-                    ,unwords param-                    ,"-N"-                    ,osc_nm,"_"-                    ,sf_nm,show sr,soundFileFormatString sf_ty,sampleFormatString sf]-  writeNRT osc_nm sc-  _ <- system sys-  return ()
− Sound/SC3/Server/NRT/Edit.hs
@@ -1,85 +0,0 @@--- | 'NRT' operations.-module Sound.SC3.Server.NRT.Edit where--import Data.List {- base -}-import qualified Data.List.Ordered as L {- data-ordlist -}-import Sound.OSC {- hosc -}--import Sound.SC3.Server.Command-import Sound.SC3.Server.NRT---- * List---- | Inserts at the first position where it compares less but not--- equal to the next element.------ > import Data.Function--- > insertBy (compare `on` fst) (3,'x') (zip [1..5] ['a'..])--- > insertBy_post (compare `on` fst) (3,'x') (zip [1..5] ['a'..])-insertBy_post :: (a -> a -> Ordering) -> a -> [a] -> [a]-insertBy_post cmp e l =-    case l of-      [] -> [e]-      h:l' -> case cmp e h of-                LT -> e : l-                _ -> h : insertBy_post cmp e l'---- | 'insertBy_post' using 'compare'.-insert_post :: Bundle -> [Bundle] -> [Bundle]-insert_post = insertBy_post compare---- | Apply /f/ at all but last element, and /g/ at last element.------ > at_last (* 2) negate [1..4] == [2,4,6,-4]-at_last :: (a -> b) -> (a -> b) -> [a] -> [b]-at_last f g x =-    case x of-      [] -> []-      [i] -> [g i]-      i:x' -> f i : at_last f g x'---- * NRT---- | Merge two NRT scores.  Retains internal 'nrt_end' messages.-nrt_merge :: NRT -> NRT -> NRT-nrt_merge (NRT p) (NRT q) = NRT (L.merge p q)---- | Merge a set of NRT.  Retains internal 'nrt_end' messages.-nrt_merge_set :: [NRT] -> NRT-nrt_merge_set = foldr nrt_merge nrt_empty---- | The empty NRT.-nrt_empty :: NRT-nrt_empty = NRT []---- | Add bundle at first permissable location of NRT.-nrt_insert_pre :: Bundle -> NRT -> NRT-nrt_insert_pre p (NRT q) = NRT (insert p q)---- | Add bundle at last permissable location of NRT.-nrt_insert_post :: Bundle -> NRT -> NRT-nrt_insert_post p (NRT q) = NRT (insert_post p q)---- | 'bundleTime' of 'last' of 'nrt_bundles'.-nrt_end_time :: NRT -> Time-nrt_end_time = bundleTime . last . nrt_bundles---- | Apply temporal and message functions to bundle.-bundle_map :: (Time -> Time) -> ([Message] -> [Message]) -> Bundle -> Bundle-bundle_map t_f m_f (Bundle t m) = Bundle (t_f t) (m_f m)---- | Delete any internal 'nrt_end' messages, and require one at the--- final bundle.-nrt_close :: NRT -> NRT-nrt_close (NRT l) =-    let is_nrt_end_msg = (== "/nrt_end") . messageAddress-        rem_end_msg = bundle_map id (filter (not . is_nrt_end_msg))-        req_end_msg = let f m = if any is_nrt_end_msg m-                                then m-                                else m ++ [nrt_end]-                      in bundle_map id f-    in NRT (at_last rem_end_msg req_end_msg l)---- | Append /q/ to /p/, assumes last timestamp at /p/ precedes first at /q/.-nrt_append :: NRT -> NRT -> NRT-nrt_append (NRT p) (NRT q) = NRT (p ++ q)
− Sound/SC3/Server/Recorder.hs
@@ -1,103 +0,0 @@--- | Recording @scsynth@.-module Sound.SC3.Server.Recorder where--import Data.Default {- data-default -}-import Sound.OSC {- hosc -}--import Sound.SC3.Server.Command-import Sound.SC3.Server.Enum-import Sound.SC3.Server.NRT-import Sound.SC3.Server.Synthdef-import Sound.SC3.UGen-import Sound.SC3.UGen.Bindings---- | Parameters for recording @scsynth@.-data SC3_Recorder =-    SC3_Recorder {rec_sftype :: SoundFileFormat -- ^ Sound file format.-                 ,rec_coding :: SampleFormat -- ^ Sample format.-                 ,rec_fname :: FilePath -- ^ File name.-                 ,rec_nc :: Int -- ^ Number of channels.-                 ,rec_bus :: Int -- ^ Bus number.-                 ,rec_buf_id :: Int -- ^ ID of buffer to allocate.-                 ,rec_buf_frames :: Int -- ^ Number of frames at buffer.-                 ,rec_node_id :: Int -- ^ ID to allocate for node.-                 ,rec_group_id :: Int -- ^ Group to allocate node within.-                 ,rec_dur :: Maybe Time -- ^ Recoring duration if fixed.-                 }---- | Default recording structure.-default_SC3_Recorder :: SC3_Recorder-default_SC3_Recorder =-    SC3_Recorder {rec_sftype = Wave-                 ,rec_coding = PcmFloat-                 ,rec_fname = "/tmp/sc3-recorder.wav"-                 ,rec_nc = 2-                 ,rec_bus = 0-                 ,rec_buf_id = 10-                 ,rec_buf_frames = 65536-                 ,rec_node_id = 2001-                 ,rec_group_id = 0-                 ,rec_dur = Just 60}--instance Default SC3_Recorder where def = default_SC3_Recorder---- | The name indicates the number of channels.-rec_synthdef_nm :: Int -> String-rec_synthdef_nm nc = "sc3-recorder-" ++ show nc---- | Generate 'Synthdef' with required number of channels.------ > Sound.SC3.UGen.Dot.draw (rec_synthdef 2)-rec_synthdef :: Int -> Synthdef-rec_synthdef nc =-    let bufnum = control KR "bufnum" 0-        bus = control KR "bus" 0-    in synthdef (rec_synthdef_nm nc) (diskOut bufnum (in' nc AR bus))---- | Asyncronous initialisation 'Message's ('d_recv', 'b_alloc' and--- 'b_write').------ > withSC3 (sendBundle (bundle immediately (rec_init_m def)))-rec_init_m :: SC3_Recorder -> [Message]-rec_init_m r =-    let buf = rec_buf_id r-    in [d_recv (rec_synthdef (rec_nc r))-       ,b_alloc buf (rec_buf_frames r) (rec_nc r)-       ,b_write buf (rec_fname r) (rec_sftype r) (rec_coding r) (-1) 0 True]---- | Begin recording 'Message' ('s_new').------ > withSC3 (sendMessage (rec_begin_m def))-rec_begin_m :: SC3_Recorder -> Message-rec_begin_m r =-    s_new (rec_synthdef_nm (rec_nc r))-          (rec_node_id r)-          AddToTail-          (rec_group_id r)-          [("bus",fromIntegral (rec_bus r))-          ,("bufnum",fromIntegral (rec_buf_id r))]---- | End recording 'Message's ('n_free', 'b_close' and 'b_free').------ > withSC3 (sendBundle (bundle immediately (rec_end_m def)))-rec_end_m :: SC3_Recorder -> [Message]-rec_end_m r =-    [n_free [rec_node_id r]-    ,b_close (rec_buf_id r)-    ,b_free (rec_buf_id r)]--{- | 'NRT' score for recorder, if 'rec_dur' is given schedule 'rec_end_m'.--> import Sound.SC3-> withSC3 (Sound.OSC.sendMessage (dumpOSC TextPrinter))-> audition (out 0 (sinOsc AR (mce2 440 441) 0 * 0.1))-> let rc = default_SC3_Recorder {rec_dur = Just 5.0}-> nrt_audition (sc3_recorder rc)---}-sc3_recorder :: SC3_Recorder -> NRT-sc3_recorder r =-    let b0 = bundle 0 (rec_init_m r ++ [rec_begin_m r])-    in case rec_dur r of-         Nothing -> NRT [b0]-         Just d -> NRT [b0,bundle d (rec_end_m r)]
− Sound/SC3/Server/Status.hs
@@ -1,160 +0,0 @@--- | Request and display status information from the synthesis server.-module Sound.SC3.Server.Status where--import qualified Data.ByteString.Char8 as C {- bytestring -}-import Data.List {- base -}-import Data.Maybe {- base -}-import qualified Data.Tree as T {- containers -}--import Sound.OSC.Datum {- hosc -}---- | Get /n/th field of status as 'Floating'.-extractStatusField :: Floating n => Int -> [Datum] -> n-extractStatusField n =-    fromMaybe (error "extractStatusField")-    . datum_floating-    . (!! n)---- | Names of status fields.-statusFields :: [String]-statusFields =-    ["Unused                      "-    ,"# UGens                     "-    ,"# Synths                    "-    ,"# Groups                    "-    ,"# Instruments               "-    ,"% CPU (Average)             "-    ,"% CPU (Peak)                "-    ,"Sample Rate (Nominal)       "-    ,"Sample Rate (Actual)        "]---- | Status pretty printer.-statusFormat :: [Datum] -> [String]-statusFormat d =-    let s = "***** SuperCollider Server Status *****"-    in s : zipWith (++) (tail statusFields) (map (datum_pp_typed (Just 5)) (tail d))---- * Query Group---- | Name or index and value or bus mapping.-type Query_Ctl = (Either String Int,Either Double Int)---- | Nodes are either groups of synths.-data Query_Node = Query_Group Int [Query_Node]-                | Query_Synth Int String (Maybe [Query_Ctl])-                deriving (Eq,Show)--query_ctl_pp :: Query_Ctl -> String-query_ctl_pp (p,q) = either id show p ++ ":" ++ either show show q--query_node_pp :: Query_Node -> String-query_node_pp n =-    case n of-      Query_Group k _ -> show k-      Query_Synth k nm c ->-          let c' = unwords (map query_ctl_pp (fromMaybe [] c))-          in show (k,nm,c')---- | Control (parameter) data may be given as names or indices and as--- values or bus mappings.------ > queryTree_ctl (string "freq",float 440) == (Left "freq",Left 440.0)--- > queryTree_ctl (int32 1,string "c0") == (Right 1,Right 0)-queryTree_ctl :: (Datum,Datum) -> Query_Ctl-queryTree_ctl (p,q) =-    let err msg val = error (show ("queryTree_ctl",msg,val))-        f d = case d of-                ASCII_String nm -> Left (C.unpack nm)-                Int32 ix -> Right (fromIntegral ix)-                _ -> err "string/int32" d-        g d = case d of-                Float k -> Left (realToFrac k)-                ASCII_String b -> case C.unpack b of-                                    'c' : n -> Right (read n)-                                    _ -> err "c:_" d-                _ -> err "float/string" d-    in (f p,g q)--{- | If /rc/ is 'True' then 'Query_Ctl' data is expected (ie. flag was set at @/g_queryTree@).-/k/ is the synth-id, and /nm/ the name.--> let d = [int32 1,string "freq",float 440]-> in queryTree_synth True 1000 "saw" d---}-queryTree_synth :: Bool -> Int -> String -> [Datum] -> (Query_Node,[Datum])-queryTree_synth rc k nm d =-    let pairs l = case l of-                    e0:e1:l' -> (e0,e1) : pairs l'-                    _ -> []-        f r = case r of-                Int32 n : r' -> let (p,r'') = genericSplitAt (n * 2) r'-                                in (map queryTree_ctl (pairs p),r'')-                _ -> error "queryTree_synth"-    in if rc-       then let (p,d') = f d-            in (Query_Synth k nm (Just p),d')-       else (Query_Synth k nm Nothing,d)--queryTree_group :: Bool -> Int -> Int -> [Datum] -> (Query_Node,[Datum])-queryTree_group rc gid nc =-    let recur n r d =-            if n == 0-            then (Query_Group gid (reverse r),d)-            else let (c,d') = queryTree_child rc d-                 in recur (n - 1) (c : r) d'-    in recur nc []--queryTree_child :: Bool -> [Datum] -> (Query_Node,[Datum])-queryTree_child rc d =-    case d of-      Int32 nid : Int32 (-1) : ASCII_String nm : d' ->-          queryTree_synth rc (fromIntegral nid) (C.unpack nm) d'-      Int32 gid : Int32 nc : d' ->-          queryTree_group rc (fromIntegral gid) (fromIntegral nc) d'-      _ -> error "queryTree_child"---- | Parse result of 'g_queryTree'.------ > let r = [int32 1,int32 0,int32 2,int32 1,int32 1--- >         ,int32 100,int32 1--- >         ,int32 1000,int32 (-1),string "saw"--- >         ,int32 1,string "freq",float 440.0--- >         ,int32 2,int32 0]--- > in queryTree r-queryTree :: [Datum] -> Query_Node-queryTree d =-    case d of-      Int32 rc : Int32 gid : Int32 nc : d' ->-          let rc' = rc /= 0-              gid' = fromIntegral gid-              nc' = fromIntegral nc-          in case queryTree_group rc' gid' nc' d' of-               (r,[]) -> r-               _ -> error "queryTree"-      _ -> error "queryTree"---- | Extact sequence of group-ids from 'Query_Node'.-queryNode_to_group_seq :: Query_Node -> [Int]-queryNode_to_group_seq nd =-    case nd of-      Query_Group k ch -> k : concatMap queryNode_to_group_seq ch-      Query_Synth _ _ _ -> []---- | Transform 'Query_Node' to 'T.Tree'.------ > putStrLn (T.drawTree (fmap query_node_pp (queryTree_rt (queryTree r))))--- > > 0--- > > |--- > > +- 1--- > > |  |--- > > |  `- 100--- > > |     |--- > > |     `- (1000,"saw","freq:440.0")--- > > |--- > > `- 2-queryTree_rt :: Query_Node -> T.Tree Query_Node-queryTree_rt n =-    case n of-      Query_Synth _ _ _ -> T.Node n []-      Query_Group _ c -> T.Node n (map queryTree_rt c)
− Sound/SC3/Server/Synthdef.hs
@@ -1,110 +0,0 @@--- | The unit-generator graph structure implemented by the---   SuperCollider synthesis server.-module Sound.SC3.Server.Synthdef where--import qualified Data.ByteString.Lazy as L {- bytestring -}-import Data.Default {- data-default -}-import Data.List {- base -}-import Data.Maybe {- base -}-import System.FilePath {- filepath -}--import qualified Sound.SC3.Server.Graphdef as G-import qualified Sound.SC3.Server.Graphdef.Graph as G-import Sound.SC3.UGen.Graph-import Sound.SC3.UGen.Help.Graph-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- | A named unit generator graph.-data Synthdef = Synthdef {synthdefName :: String-                         ,synthdefUGen :: UGen}-                deriving (Eq,Show)--instance Default Synthdef where def = defaultSynthdef---- | Lift a 'UGen' graph into a 'Synthdef'.-synthdef :: String -> UGen -> Synthdef-synthdef = Synthdef---- | The SC3 /default/ instrument 'Synthdef', see--- 'default_ugen_graph'.------ > import Sound.OSC {- hosc -}--- > import Sound.SC3 {- hsc3 -}--- > withSC3 (sendMessage (d_recv defaultSynthdef))--- > audition defaultSynthdef-defaultSynthdef :: Synthdef-defaultSynthdef = synthdef "default" default_ugen_graph---- | The SC3 /default/ sample (buffer) playback instrument 'Synthdef',--- see 'default_sampler_ugen_graph'.------ > withSC3 (sendMessage (d_recv (defaultSampler False)))--- > audition (defaultSampler False)-defaultSampler :: Bool -> Synthdef-defaultSampler use_gate =-    let nm = "default-sampler-" ++ if use_gate then "gate" else "fixed"-    in synthdef nm (default_sampler_ugen_graph use_gate)---- | 'ugen_to_graph' of 'synthdefUGen'.-synthdefGraph :: Synthdef -> Graph-synthdefGraph = ugen_to_graph . synthdefUGen---- | Parameter names at 'Synthdef'.------ > synthdefParam defaultSynthdef == ["amp","pan","gate","freq","out"]-synthdefParam :: Synthdef -> [String]-synthdefParam = map node_k_name . controls . synthdefGraph---- | Find the indices of the named UGen at 'Graph'.  The index is--- required when using 'Sound.SC3.Server.Command.u_cmd'.-ugenIndices :: String -> Graph -> [Integer]-ugenIndices nm =-    let f (k,nd) =-            case nd of-              NodeU _ _ nm' _ _ _ _ -> if nm == nm' then Just k else Nothing-              _ -> Nothing-    in mapMaybe f . zip [0..] . ugens---- | 'graph_to_graphdef' at 'Synthdef'.-synthdef_to_graphdef :: Synthdef -> G.Graphdef-synthdef_to_graphdef (Synthdef nm u) = G.graph_to_graphdef nm (ugen_to_graph u)---- | Encode 'Synthdef' as a binary data stream.-synthdefData :: Synthdef -> L.ByteString-synthdefData = G.encode_graphdef . synthdef_to_graphdef---- | Write 'Synthdef' to indicated directory.  The filename is the--- 'synthdefName' with the appropriate extension (@scsyndef@).-synthdefWrite :: Synthdef -> FilePath -> IO ()-synthdefWrite s dir =-    let nm = dir </> synthdefName s <.> "scsyndef"-    in L.writeFile nm (synthdefData s)---- | Simple statistical analysis of a unit generator graph.-graph_stat :: Graph -> [String]-graph_stat s =-    let cs = constants s-        ks = controls s-        us = ugens s-        u_nm z = ugen_user_name (node_u_name z) (node_u_special z)-        f g = let h (x:xs) = (x,length (x:xs))-                  h [] = error "graph_stat"-              in show . map h . group . sort . map g-        sq pp_f = intercalate "," (pp_f (map u_nm us))-    in ["number of constants       : " ++ show (length cs)-       ,"number of controls        : " ++ show (length ks)-       ,"control rates             : " ++ f node_k_rate ks-       ,"number of unit generators : " ++ show (length us)-       ,"unit generator rates      : " ++ f node_u_rate us-       ,"unit generator set        : " ++ sq (sort . nub)-       ,"unit generator sequence   : " ++ sq id]--synthstat' :: UGen -> [String]-synthstat' = graph_stat . ugen_to_graph---- | 'graph_stat' of 'synth'.-synthstat :: UGen -> String-synthstat = unlines . synthstat'--
− Sound/SC3/Server/Transport/FD.hs
@@ -1,178 +0,0 @@--- | /FD/ variant of interaction with the scsynth server.------ This duplicates functions at 'Sound.SC3.Server.Transport.Monad' and--- at some point at least part of the duplication will be removed.-module Sound.SC3.Server.Transport.FD where--import Data.List {- base -}-import Data.List.Split {- split -}-import Data.Maybe {- base -}-import Control.Monad {- base -}-import Sound.OSC.FD {- hosc -}--import Sound.SC3.Server.Command-import Sound.SC3.Server.Enum-import qualified Sound.SC3.Server.Graphdef as G-import Sound.SC3.Server.NRT-import Sound.SC3.Server.Status-import Sound.SC3.Server.Synthdef-import Sound.SC3.UGen.Type---- * hosc variants---- | Send a 'Message' and 'waitReply' for a @\/done@ reply.-async :: Transport t => t -> Message -> IO Message-async fd m = sendMessage fd m >> waitReply fd "/done"---- | If 'isAsync' then 'void' 'async' else 'sendMessage'.-maybe_async :: (Transport t) => t -> Message -> IO ()-maybe_async fd m = if isAsync m then void (async fd m) else sendMessage fd m---- | Variant that timestamps synchronous messages.-maybe_async_at :: (Transport t) => t -> Time -> Message -> IO ()-maybe_async_at fd t m =-    if isAsync m-    then void (async fd m)-    else sendBundle fd (bundle t [m])---- | Bracket @SC3@ communication.-withSC3 :: (UDP -> IO a) -> IO a-withSC3 = withTransport (openUDP "127.0.0.1" 57110)---- * Server control---- | Free all nodes ('g_freeAll') at group @1@.-stop :: Transport t => t -> IO ()-stop fd = sendMessage fd (g_freeAll [1])---- | Free all nodes ('g_freeAll') at and re-create groups @1@ and @2@.-reset :: Transport t => t -> IO ()-reset fd = do-  sendMessage fd (g_freeAll [1,2])-  sendMessage fd (g_new [(1,AddToTail,0),(2,AddToTail,0)])---- | Send 'd_recv' and 's_new' messages to scsynth.-playGraphdef :: Transport t => Int -> t -> G.Graphdef -> IO ()-playGraphdef k fd g = do-  _ <- async fd (d_recv' g)-  sendMessage fd (s_new0 (ascii_to_string (G.graphdef_name g)) k AddToTail 1)---- | 'playGraphdef' of 'synthdef_to_graphdef'.-playSynthdef :: Transport t => Int -> t -> Synthdef -> IO ()-playSynthdef k fd = playGraphdef k fd . synthdef_to_graphdef---- | Send an /anonymous/ instrument definition using 'playSynthdef'.-playUGen :: Transport t => Int -> t -> UGen -> IO ()-playUGen k fd = playSynthdef k fd . synthdef "Anonymous"---- * Non-real time---- | Wait ('pauseThreadUntil') until bundle is due to be sent relative--- to initial 'Time', then send each message, asynchronously if--- required.-run_bundle :: Transport t => t -> Time -> Bundle -> IO ()-run_bundle fd t0 b = do-  let t = t0 + bundleTime b-      latency = 0.1-  pauseThreadUntil (t - latency)-  mapM_ (maybe_async_at fd t) (bundleMessages b)---- | Perform an 'NRT' score (as would be rendered by 'writeNRT').  In--- particular note that all timestamps /must/ be in 'NTPr' form.-nrt_play :: Transport t => t -> NRT -> IO ()-nrt_play fd sc = time >>= \t0 -> mapM_ (run_bundle fd t0) (nrt_bundles sc)--nrt_audition :: NRT -> IO ()-nrt_audition sc = withSC3 (\fd -> nrt_play fd sc)---- * Audible---- | Class for values that can be encoded and sent to @scsynth@ for audition.-class Audible e where-    play_id :: Transport t => Int -> t -> e -> IO ()-    play :: Transport t => t -> e -> IO ()-    play = play_id (-1)--instance Audible G.Graphdef where-    play_id = playGraphdef--instance Audible Synthdef where-    play_id = playSynthdef--instance Audible UGen where-    play_id = playUGen--audition_id :: Audible e => Int -> e -> IO ()-audition_id k e = withSC3 (\fd -> play_id k fd e)--audition :: Audible e => e -> IO ()-audition = audition_id (-1)---- * Notifications---- | Turn on notifications, run /f/, turn off notifications, return--- result.-withNotifications :: Transport t => t -> (t -> IO a) -> IO a-withNotifications fd f = do-  _ <- async fd (notify True)-  r <- f fd-  _ <- async fd (notify False)-  return r---- * Buffer---- | Variant of 'b_getn1' that waits for return message and unpacks it.------ > withSC3 (\fd -> b_getn1_data fd 0 (0,5))-b_getn1_data :: Transport t => t -> Int -> (Int,Int) -> IO [Double]-b_getn1_data fd b s = do-  let f d = case d of-              Int32 _:Int32 _:Int32 _:x -> mapMaybe datum_floating x-              _ -> error "b_getn1_data"-  sendMessage fd (b_getn1 b s)-  fmap f (waitDatum fd "/b_setn")---- | Variant of 'b_getn1_data' that segments individual 'b_getn'--- messages to /n/ elements.------ > withSC3 (\fd -> b_getn1_data_segment fd 1 0 (0,5))-b_getn1_data_segment :: Transport t => t -> Int -> Int -> (Int,Int) -> IO [Double]-b_getn1_data_segment fd n b (i,j) = do-  let ix = b_indices n j i-  d <- mapM (b_getn1_data fd b) ix-  return (concat d)---- | Variant of 'b_getn1_data_segment' that gets the entire buffer.-b_fetch :: Transport t => t -> Int -> Int -> IO [[Double]]-b_fetch fd n b = do-  let f d = case d of-              [Int32 _,Int32 nf,Int32 nc,Float _] ->-                  let ix = (0,fromIntegral (nf * nc))-                      deinterleave = transpose . chunksOf (fromIntegral nc)-                  in liftM deinterleave (b_getn1_data_segment fd n b ix)-              _ -> error "b_fetch"-  sendMessage fd (b_query1 b)-  waitDatum fd "/b_info" >>= f--b_fetch1 :: Transport t => t -> Int -> Int -> IO [Double]-b_fetch1 fd n b = liftM head (b_fetch fd n b)---- * Status---- | Collect server status information.-serverStatus :: Transport t => t -> IO [String]-serverStatus = liftM statusFormat . serverStatusData---- | Read nominal sample rate of server.-serverSampleRateNominal :: Transport t => t -> IO Double-serverSampleRateNominal = liftM (extractStatusField 7) . serverStatusData---- | Read actual sample rate of server.-serverSampleRateActual :: Transport t => t -> IO Double-serverSampleRateActual = liftM (extractStatusField 8) . serverStatusData---- | Retrieve status data from server.-serverStatusData :: Transport t => t -> IO [Datum]-serverStatusData fd = do-  sendMessage fd status-  waitDatum fd "/status.reply"
− Sound/SC3/Server/Transport/Monad.hs
@@ -1,287 +0,0 @@--- | /Monad/ variant of interaction with the scsynth server.-module Sound.SC3.Server.Transport.Monad where--import Control.Monad {- base -}-import Data.List {- base -}-import Data.List.Split {- split -}-import Data.Maybe {- base -}-import Safe {- safe -}--import Sound.OSC {- hosc -}--import Sound.SC3.Server.Command-import qualified Sound.SC3.Server.Command.Generic as Generic-import Sound.SC3.Server.Enum-import qualified Sound.SC3.Server.Graphdef as G-import Sound.SC3.Server.NRT-import Sound.SC3.Server.Status-import Sound.SC3.Server.Synthdef--import Sound.SC3.UGen.Bindings.Composite (wrapOut)-import Sound.SC3.UGen.Type---- * hosc variants---- | 'sendMessage' and 'waitReply' for a @\/done@ reply.-async :: DuplexOSC m => Message -> m Message-async m = sendMessage m >> waitReply "/done"---- | 'void' of 'async'.-async_ :: DuplexOSC m => Message -> m ()-async_ = void . async---- | If 'isAsync' then 'async_' else 'sendMessage'.-maybe_async :: DuplexOSC m => Message -> m ()-maybe_async m = if isAsync m then async_ m else sendMessage m---- | Variant that timestamps synchronous messages.-maybe_async_at :: DuplexOSC m => Time -> Message -> m ()-maybe_async_at t m =-    if isAsync m-    then async_ m-    else sendBundle (bundle t [m])---- | Local host (ie. @127.0.0.1@) at port @57110@.-sc3_default_udp :: IO UDP-sc3_default_udp = openUDP "127.0.0.1" 57110---- | Bracket @SC3@ communication, ie. 'withTransport' 'sc3_default_udp'.------ > import Sound.SC3.Server.Command------ > withSC3 (sendMessage status >> waitReply "/status.reply")-withSC3 :: Connection UDP a -> IO a-withSC3 = withTransport sc3_default_udp---- | 'void' of 'withSC3'.-withSC3_ :: Connection UDP a -> IO ()-withSC3_ = void . withSC3---- * Server control---- | Free all nodes ('g_freeAll') at group @1@.-stop :: SendOSC m => m ()-stop = sendMessage (g_freeAll [1])---- * Composite---- | Runs 'clearSched' and then frees and re-creates groups @1@ and @2@.-reset :: SendOSC m => m ()-reset =-    let m = [clearSched-            ,n_free [1,2]-            ,g_new [(1,AddToHead,0),(2,AddToTail,0)]]-    in sendBundle (bundle immediately m)---- | (node-id,add-action,group-id,parameters)-type Play_Opt = (Node_Id,AddAction,Group_Id,[(String,Double)])--play_graphdef_msg :: Play_Opt -> G.Graphdef -> Message-play_graphdef_msg (nid,act,gid,param) g =-    let nm = ascii_to_string (G.graphdef_name g)-    in s_new nm nid act gid param---- | Send 'd_recv' and 's_new' messages to scsynth.-playGraphdef :: DuplexOSC m => Play_Opt -> G.Graphdef -> m ()-playGraphdef opt g = async_ (d_recv' g) >> sendMessage (play_graphdef_msg opt g)--play_synthdef_msg :: Play_Opt -> Synthdef -> Message-play_synthdef_msg (nid,act,gid,param) syn = s_new (synthdefName syn) nid act gid param---- | Send 'd_recv' and 's_new' messages to scsynth.-playSynthdef :: DuplexOSC m => Play_Opt -> Synthdef -> m ()-playSynthdef opt syn = async_ (d_recv syn) >> sendMessage (play_synthdef_msg opt syn)---- | Send an /anonymous/ instrument definition using 'playSynthdef'.-playUGen :: DuplexOSC m => Play_Opt -> UGen -> m ()-playUGen loc =-    playSynthdef loc .-    synthdef "Anonymous" .-    wrapOut Nothing---- * NRT---- | Wait ('pauseThreadUntil') until bundle is due to be sent relative--- to the initial 'Time', then send each message, asynchronously if--- required.-run_bundle :: Transport m => Time -> Bundle -> m ()-run_bundle t0 b = do-  let t = t0 + bundleTime b-      latency = 0.1-  liftIO (pauseThreadUntil (t - latency))-  mapM_ (maybe_async_at t) (bundleMessages b)--{- | Play an 'NRT' score (as would be rendered by 'writeNRT').--> let sc = NRT [bundle 1 [s_new0 "default" (-1) AddToHead 1]->              ,bundle 2 [n_set1 (-1) "gate" 0]]-> in withSC3 (nrt_play sc)---}-nrt_play :: Transport m => NRT -> m ()-nrt_play sc = do-  t0 <- liftIO time-  mapM_ (run_bundle t0) (nrt_bundles sc)---- | Variant where asynchronous commands at time @0@ are separated out and run before--- the initial time-stamp is taken.  This re-orders synchronous--- commands in relation to asynchronous at time @0@.-nrt_play_reorder :: Transport m => NRT -> m ()-nrt_play_reorder s = do-  let (i,r) = nrt_span (<= 0) s-      i' = concatMap bundleMessages i-      (a,b) = partition_async i'-  mapM_ async a-  t <- liftIO time-  mapM_ (run_bundle t) (Bundle 0 b : r)--nrt_audition :: NRT -> IO ()-nrt_audition = withSC3 . nrt_play---- * Audible---- | Class for values that can be encoded and send to @scsynth@ for audition.-class Audible e where-    play_at :: Transport m => Play_Opt -> e -> m ()-    -- | Variant where /id/ is @-1@.-    play :: Transport m => e -> m ()-    play = play_at (-1,AddToHead,1,[])--instance Audible G.Graphdef where-    play_at = playGraphdef--instance Audible Synthdef where-    play_at = playSynthdef--instance Audible UGen where-    play_at = playUGen---- | 'withSC3' of 'play_at'.-audition_at :: Audible e => Play_Opt -> e -> IO ()-audition_at k = withSC3 . play_at k---- | Variant where /id/ is @-1@.-audition :: Audible e => e -> IO ()-audition = audition_at (-1,AddToHead,1,[])---- * Notifications---- | Turn on notifications, run /f/, turn off notifications, return result.-withNotifications :: DuplexOSC m => m a -> m a-withNotifications f = do-  async_ (notify True)-  r <- f-  async_ (notify False)-  return r---- * Buffer & control & node variants.---- | Variant of 'b_getn1' that waits for return message and unpacks it.------ > withSC3 (b_getn1_data 0 (0,5))-b_getn1_data :: DuplexOSC m => Int -> (Int,Int) -> m [Double]-b_getn1_data b s = do-  let f m = let (_,_,_,r) = unpack_b_setn_err m in r-  sendMessage (b_getn1 b s)-  liftM f (waitReply "/b_setn")---- | Variant of 'b_getn1_data' that segments individual 'b_getn'--- messages to /n/ elements.------ > withSC3 (b_getn1_data_segment 1 0 (0,5))-b_getn1_data_segment :: DuplexOSC m =>-                        Int -> Int -> (Int,Int) -> m [Double]-b_getn1_data_segment n b (i,j) = do-  let ix = b_indices n j i-  d <- mapM (b_getn1_data b) ix-  return (concat d)---- | Variant of 'b_getn1_data_segment' that gets the entire buffer.----b_fetch :: DuplexOSC m => Int -> Int -> m [[Double]]-b_fetch n b = do-  let f m = let (_,nf,nc,_) = unpack_b_info_err m-                ix = (0,nf * nc)-                deinterleave = transpose . chunksOf nc-            in liftM deinterleave (b_getn1_data_segment n b ix)-  sendMessage (b_query1 b)-  waitReply "/b_info" >>= f---- | First channel of 'b_fetch', errors if there is no data.------ > withSC3 (b_fetch1 512 123456789)-b_fetch1 :: DuplexOSC m => Int -> Int -> m [Double]-b_fetch1 n b = liftM (headNote "b_fetch1: no data") (b_fetch n b)---- | Combination of 'b_query1_unpack' and 'b_fetch'.-b_fetch_hdr :: Transport m => Int -> Int -> m ((Int,Int,Int,Double),[[Double]])-b_fetch_hdr k b = do-  q <- b_query1_unpack b-  d <- b_fetch k b-  return (q,d)---- | 'b_info_unpack_err' of 'b_query1'.-b_query1_unpack_generic :: (DuplexOSC m,Num n,Fractional r) => Int -> m (n,n,n,r)-b_query1_unpack_generic n = do-  sendMessage (b_query1 n)-  q <- waitReply "/b_info"-  return (Generic.unpack_b_info_err q)---- | Type specialised 'b_query1_unpack_generic'.------ > withSC3 (b_query1_unpack 0)-b_query1_unpack :: DuplexOSC m => Buffer_Id -> m (Int,Int,Int,Double)-b_query1_unpack = b_query1_unpack_generic---- | Variant of 'c_getn1' that waits for the reply and unpacks the data.-c_getn1_data :: DuplexOSC m => (Int,Int) -> m [Double]-c_getn1_data s = do-  let f d = case d of-              Int32 _:Int32 _:x -> mapMaybe datum_floating x-              _ -> error "c_getn1_data"-  sendMessage (c_getn1 s)-  liftM f (waitDatum "/c_setn")--n_query1_unpack_f :: Transport m => (Message -> t) -> Node_Id -> m t-n_query1_unpack_f f n = do-  sendMessage (n_query [n])-  r <- waitReply "/n_info"-  return (f r)---- | Variant of 'n_query' that waits for and unpacks the reply.-n_query1_unpack :: Transport m => Node_Id -> m (Maybe (Int,Int,Int,Int,Int,Maybe (Int,Int)))-n_query1_unpack = n_query1_unpack_f unpack_n_info--n_query1_unpack_plain :: Transport m => Node_Id -> m [Int]-n_query1_unpack_plain = n_query1_unpack_f unpack_n_info_plain---- | Variant of 'g_queryTree' that waits for and unpacks the reply.-g_queryTree1_unpack :: Transport m => Group_Id -> m Query_Node-g_queryTree1_unpack n = do-  sendMessage (g_queryTree [(n,True)])-  r <- waitReply "/g_queryTree.reply"-  return (queryTree (messageDatum r))---- * Status---- | Collect server status information.-serverStatus :: DuplexOSC m => m [String]-serverStatus = liftM statusFormat serverStatusData---- | Read nominal sample rate of server.------ > withSC3 serverSampleRateNominal-serverSampleRateNominal :: DuplexOSC m => m Double-serverSampleRateNominal = liftM (extractStatusField 7) serverStatusData---- | Read actual sample rate of server.------ > withSC3 serverSampleRateActual-serverSampleRateActual :: DuplexOSC m => m Double-serverSampleRateActual = liftM (extractStatusField 8) serverStatusData---- | Retrieve status data from server.-serverStatusData :: DuplexOSC m => m [Datum]-serverStatusData = do-  sendMessage status-  waitDatum "/status.reply"
− Sound/SC3/UGen.hs
@@ -1,18 +0,0 @@--- | Collection of modules for writing unit-generator graphs.-module Sound.SC3.UGen (module U) where--import Sound.SC3.UGen.Analysis as U-import Sound.SC3.UGen.Envelope as U-import Sound.SC3.UGen.Enum as U-import Sound.SC3.UGen.Help as U-import Sound.SC3.UGen.Help.Graph as U-import Sound.SC3.UGen.Identifier as U-import Sound.SC3.UGen.Math as U-import Sound.SC3.UGen.Name as U-import Sound.SC3.UGen.Operator as U-import Sound.SC3.UGen.Optimise as U-import Sound.SC3.UGen.Protect as U-import Sound.SC3.UGen.Rate as U-import Sound.SC3.UGen.Type as U-import Sound.SC3.UGen.UGen as U-import Sound.SC3.UGen.UId as U
− Sound/SC3/UGen/Analysis.hs
@@ -1,67 +0,0 @@--- | UGen analysis-module Sound.SC3.UGen.Analysis where--import Data.List {- base -}--import qualified Sound.SC3.UGen.Bindings.DB as DB-import qualified Sound.SC3.UGen.MCE as MCE-import Sound.SC3.UGen.Type---- | UGen primitive.  Sees through Proxy and MRG, possible multiple--- primitives for MCE.-ugen_primitive :: UGen -> [Primitive]-ugen_primitive u =-    case u of-      Constant_U _ -> []-      Control_U _ -> []-      Label_U _ -> []-      Primitive_U p -> [p]-      Proxy_U p -> [proxySource p]-      MCE_U m -> concatMap ugen_primitive (MCE.mce_elem m)-      MRG_U m -> ugen_primitive (mrgLeft m)---- | Heuristic based on primitive name (@FFT@, @PV_@).  Note that--- @IFFT@ is at /control/ rate, not @PV@ rate.-primitive_is_pv_rate :: String -> Bool-primitive_is_pv_rate nm = nm == "FFT" || "PV_" `isPrefixOf` nm---- | Variant on primitive_is_pv_rate.-ugen_is_pv_rate :: UGen -> Bool-ugen_is_pv_rate = any (primitive_is_pv_rate . ugenName) . ugen_primitive---- | 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)-pv_track_buffer :: UGen -> Either String UGen-pv_track_buffer u =-    case ugen_primitive u of-      [] -> Left "pv_track_buffer: not located"-      p:_ -> case ugenName p of-               "FFT" -> Right (ugenInputs p !! 0)-               "PV_Split" -> Right (ugenInputs p !! 1)-               _ -> pv_track_buffer (ugenInputs p !! 0)---- | 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-buffer_nframes :: UGen -> UGen-buffer_nframes u =-    case ugen_primitive u of-      [] -> DB.bufFrames (rateOf u) u-      p:_ -> case ugenName p of-               "LocalBuf" -> ugenInputs p !! 1-               _ -> DB.bufFrames (rateOf u) u---- | 'pv_track_buffer' then 'buffer_nframes'.-pv_track_nframes :: UGen -> Either String UGen-pv_track_nframes u = pv_track_buffer u >>= Right . buffer_nframes
− Sound/SC3/UGen/Bindings.hs
@@ -1,7 +0,0 @@-module Sound.SC3.UGen.Bindings (module B) where--import Sound.SC3.UGen.Bindings.Composite as B-import Sound.SC3.UGen.Bindings.DB as B-import Sound.SC3.UGen.Bindings.HW as B---import Sound.SC3.UGen.Bindings.HW.External as B-import Sound.SC3.UGen.Bindings.Monad as B
− Sound/SC3/UGen/Bindings/Composite.hs
@@ -1,466 +0,0 @@--- | Common unit generator graphs.-module Sound.SC3.UGen.Bindings.Composite where--import Control.Monad {- base -}-import Data.List {- base -}-import Data.List.Split {- split -}-import Data.Maybe {- base -}--import Sound.SC3.Common.Envelope--import Sound.SC3.UGen.Bindings.DB-import Sound.SC3.UGen.Bindings.HW-import Sound.SC3.UGen.Bindings.Monad-import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Identifier-import Sound.SC3.UGen.Math-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UId---- | Generate a localBuf and use setBuf to initialise it.-asLocalBuf :: ID i => i -> [UGen] -> UGen-asLocalBuf i xs =-    let b = localBuf i 1 (fromIntegral (length xs))-        s = setBuf' b xs 0-    in mrg2 b s---- | Calculate coefficients for bi-quad low pass filter.-bLowPassCoef :: Floating a => a -> a -> a -> (a,a,a,a,a)-bLowPassCoef sr freq rq =-    let w0 = pi * 2 * freq * (1 / sr)-        cos_w0 = cos w0-        i = 1 - cos_w0-        alpha = sin w0 * 0.5 * rq-        b0rz = recip (1 + alpha)-        a0 = i * 0.5 * b0rz-        a1 = i * b0rz-        b1 = cos_w0 * 2 * b0rz-        b2 = (1 - alpha) * negate b0rz-    in (a0,a1,a0,b1,b2)---- | Buffer reader (no interpolation).-bufRdN :: Int -> Rate -> UGen -> UGen -> Loop -> UGen-bufRdN n r b p l = bufRd n r b p l NoInterpolation---- | Buffer reader (linear interpolation).-bufRdL :: Int -> Rate -> UGen -> UGen -> Loop -> UGen-bufRdL n r b p l = bufRd n r b p l LinearInterpolation---- | Buffer reader (cubic interpolation).-bufRdC :: Int -> Rate -> UGen -> UGen -> Loop -> UGen-bufRdC n r b p l = bufRd n r b p l CubicInterpolation---- | Triggers when a value changes-changed :: UGen -> UGen -> UGen-changed input threshold = abs (hpz1 input) >* threshold---- | 'mce' variant of 'lchoose'.-choose :: ID m => m -> UGen -> UGen-choose e = lchoose e . mceChannels---- | 'liftUId' of 'choose'.-chooseM :: UId m => UGen -> m UGen-chooseM = liftUId choose---- | 'clearBuf' of 'localBuf'.-clearLocalBuf :: ID a => a -> UGen -> UGen -> UGen-clearLocalBuf z nc nf = clearBuf (localBuf z nc nf)---- | Demand rate (:) function.-dcons :: ID m => (m,m,m) -> UGen -> UGen -> UGen-dcons (z0,z1,z2) x xs =-    let i = dseq z0 1 (mce2 0 1)-        a = dseq z1 1 (mce2 x xs)-    in dswitch z2 i a---- | Demand rate (:) function.-dconsM :: (UId m) => UGen -> UGen -> m UGen-dconsM x xs = do-  i <- dseqM 1 (mce2 0 1)-  a <- dseqM 1 (mce2 x xs)-  dswitchM i a---- | Dynamic klang, dynamic sine oscillator bank-dynKlang :: Rate -> UGen -> UGen -> UGen -> UGen-dynKlang r fs fo s =-    let gen (f:a:ph:xs) = sinOsc r (f * fs + fo) ph * a + gen xs-        gen _ = 0-    in gen (mceChannels s)---- | Dynamic klank, set of non-fixed resonating filters.-dynKlank :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-dynKlank i fs fo ds s =-    let gen (f:a:d:xs) = ringz i (f * fs + fo) (d * ds) * a + gen xs-        gen _ = 0-    in gen (mceChannels s)---- | Variant FFT constructor with default values for hop size (0.5),--- window type (0), active status (1) and window size (0).-fft' :: UGen -> UGen -> UGen-fft' buf i = fft buf i 0.5 0 1 0---- | 'fft' variant that allocates 'localBuf'.------ > let c = ffta 'α' 2048 (soundIn 0) 0.5 0 1 0--- > in audition (out 0 (ifft c 0 0))-ffta :: ID i => i -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-ffta z nf i h wt a ws =-    let b = localBuf z 1 nf-    in fft b i h wt a ws---- | Sum of 'numInputBuses' and 'numOutputBuses'.-firstPrivateBus :: UGen-firstPrivateBus = numInputBuses + numOutputBuses---- | Frequency shifter, in terms of 'hilbert' (see also 'freqShift').-freqShift_hilbert :: UGen -> UGen -> UGen -> UGen-freqShift_hilbert i f p =-    let o = sinOsc AR f (mce [p + 0.5 * pi, p])-        h = hilbert i-    in mix (h * o)---- | Variant ifft with default value for window type.-ifft' :: UGen -> UGen-ifft' buf = ifft buf 0 0--{---- | Linear interpolating variant on index.-indexL :: UGen -> UGen -> UGen-indexL b i =-    let x = index b i-        y = index b (i + 1)-    in linLin (frac i) 0 1 x y--}---- | Generalised Klan(k/g) specification rule.  /f/ unwraps inputs, /g/ wraps output.------ > let r = [220,0.2,0,219,0.1,1,221,0.1,2]--- > in klanx_spec_f id id [220,219,221] [0.2,0.1,0.1] [0,1,2] == r-klanx_spec_f :: (a -> [b]) -> ([b] -> c) -> a -> a -> a -> c-klanx_spec_f f g fr am z = g ((concat . transpose) [f fr,f am,f z])---- | Format frequency, amplitude and decay time data as required for klank.-klangSpec :: [UGen] -> [UGen] -> [UGen] -> UGen-klangSpec = klanx_spec_f id mce---- | Variant of 'klangSpec' for non-UGen inputs.-klangSpec' :: Real n => [n] -> [n] -> [n] -> UGen-klangSpec' = klanx_spec_f (map constant) mce---- | Variant of 'klangSpec' for 'MCE' inputs.-klangSpec_mce :: UGen -> UGen -> UGen -> UGen-klangSpec_mce = klanx_spec_f mceChannels mce---- | Format frequency, amplitude and decay time data as required for klank.-klankSpec :: [UGen] -> [UGen] -> [UGen] -> UGen-klankSpec = klanx_spec_f id mce---- | Variant for non-UGen inputs.-klankSpec' :: Real n => [n] -> [n] -> [n] -> UGen-klankSpec' = klanx_spec_f (map constant) mce---- | Variant of 'klankSpec' for 'MCE' inputs.-klankSpec_mce :: UGen -> UGen -> UGen -> UGen-klankSpec_mce = klanx_spec_f mceChannels mce---- | Randomly select one of a list of UGens (initialisation rate).-lchoose :: ID m => m -> [UGen] -> UGen-lchoose e a = select (iRand e 0 (fromIntegral (length a))) (mce a)---- | 'liftUId' of 'lchoose'.-lchooseM :: UId m => [UGen] -> m UGen-lchooseM = liftUId lchoose---- | 'linExp' of (-1,1).-linExp_b :: UGen -> UGen -> UGen -> UGen-linExp_b i = linExp i (-1) 1---- | 'linExp' of (0,1).-linExp_u :: UGen -> UGen -> UGen -> UGen-linExp_u i = linExp i 0 1---- | Map from one linear range to another linear range.-linLin :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linLin = linlin_ma---- | 'linLin' where source is (0,1).-linLin_u :: UGen -> UGen -> UGen -> UGen-linLin_u i = linLin i 0 1---- | 'linLin' where source is (-1,1).-linLin_b :: UGen -> UGen -> UGen -> UGen-linLin_b i = linLin i (-1) 1---- | Variant with defaults of zero.-localIn' :: Int -> Rate -> UGen-localIn' nc r = localIn nc r (mce (replicate nc 0))---- | Generate an 'envGen' UGen with @fadeTime@ and @gate@ controls.------ > import Sound.SC3--- > audition (out 0 (makeFadeEnv 1 * sinOsc AR 440 0 * 0.1))--- > withSC3 (send (n_set1 (-1) "gate" 0))-makeFadeEnv :: Double -> UGen-makeFadeEnv fadeTime =-    let dt = control KR "fadeTime" (realToFrac fadeTime)-        gate_ = control KR "gate" 1-        startVal = dt <=* 0-        env = Envelope [startVal,1,0] [1,1] [EnvLin,EnvLin] (Just 1) Nothing-    in envGen KR gate_ 1 0 dt RemoveSynth env---- | Count 'mce' channels.-mceN :: UGen -> UGen-mceN = constant . length . mceChannels---- | Collapse possible mce by summing.-mix :: UGen -> UGen-mix = sum_opt . mceChannels---- | Mix variant, sum to n channels.-mixN :: Int -> UGen -> UGen-mixN n u =-    let xs = transpose (chunksOf n (mceChannels u))-    in mce (map sum xs)---- | Construct and sum a set of UGens.-mixFill :: Integral n => Int -> (n -> UGen) -> UGen-mixFill n f = mix (mce (map f [0 .. fromIntegral n - 1]))---- | Monad variant on mixFill.-mixFillM :: (Integral n,Monad m) => Int -> (n -> m UGen) -> m UGen-mixFillM n f = liftM sum (mapM f [0 .. fromIntegral n - 1])---- | Variant that is randomly pressed.-mouseButton' :: Rate -> UGen -> UGen -> UGen -> UGen-mouseButton' rt l r tm =-    let o = lfClipNoise 'z' rt 1-    in lag (linLin o (-1) 1 l r) tm---- | Randomised mouse UGen (see also 'mouseX'' and 'mouseY'').-mouseR :: ID a => a -> Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseR z rt l r ty tm =-  let f = case ty of-            Linear -> linLin-            Exponential -> linExp-            _ -> undefined-  in lag (f (lfNoise1 z rt 1) (-1) 1 l r) tm---- | Variant that randomly traverses the mouseX space.-mouseX' :: Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseX' = mouseR 'x'---- | Variant that randomly traverses the mouseY space.-mouseY' :: Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseY' = mouseR 'y'---- | Translate onset type string to constant UGen value.-onsetType :: Num a => String -> a-onsetType s =-    let t = ["power", "magsum", "complex", "rcomplex", "phase", "wphase", "mkl"]-    in fromIntegral (fromMaybe 3 (elemIndex s t))---- | Onset detector with default values for minor parameters.-onsets' :: UGen -> UGen -> UGen -> UGen-onsets' c t o = onsets c t o 1 0.1 10 11 1 0---- | Format magnitude and phase data data as required for packFFT.-packFFTSpec :: [UGen] -> [UGen] -> UGen-packFFTSpec m p =-    let interleave x = concat . zipWith (\a b -> [a,b]) x-    in mce (interleave m p)---- | Calculate size of accumulation buffer given FFT and IR sizes.-pc_calcAccumSize :: Int -> Int -> Int-pc_calcAccumSize fft_size ir_length =-    let partition_size = fft_size `div` 2-        num_partitions = (ir_length `div` partition_size) + 1-    in fft_size * num_partitions---- | PM oscillator.-pmOsc :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-pmOsc r cf mf pm mp = sinOsc r cf (sinOsc r mf mp * pm)---- | Variant of 'poll' that generates an 'mrg' value with the input--- signal at left, and that allows a constant /frequency/ input in--- place of a trigger.-poll' :: UGen -> UGen -> UGen -> UGen -> UGen-poll' t i l tr =-    let t' = if isConstant t then impulse KR t 0 else t-    in mrg [i,poll t' i l tr]---- | Variant of 'in'' offset so zero if the first private bus.-privateIn :: Int -> Rate -> UGen -> UGen-privateIn nc rt k = in' nc rt (k + firstPrivateBus)---- | Variant of 'out' offset so zero if the first private bus.-privateOut :: UGen -> UGen -> UGen-privateOut k = out (k + firstPrivateBus)---- | Apply function /f/ to each bin of an @FFT@ chain, /f/ receives--- magnitude, phase and index and returns a (magnitude,phase).-pvcollect :: UGen -> UGen -> (UGen -> UGen -> UGen -> (UGen, UGen)) -> UGen -> UGen -> UGen -> UGen-pvcollect c nf f from to z =-    let m = unpackFFT c nf from to 0-        p = unpackFFT c nf from to 1-        i = [from .. to]-        e = zipWith3 f m p i-        mp = uncurry packFFTSpec (unzip e)-    in packFFT c nf from to z mp---- | 'rand' with left edge set to zero.-rand0 :: ID a => a -> UGen -> UGen-rand0 z = rand z 0---- | 'UId' form of 'rand0'.-rand0M :: UId m => UGen -> m UGen-rand0M = randM 0---- | 'rand' with left edge set to negative /n/.-rand2 :: ID a => a -> UGen -> UGen-rand2 z n = rand z (negate n) n---- | 'UId' form of 'rand2'.-rand2M :: UId m => UGen -> m UGen-rand2M n = randM (negate n) n---- | RMS variant of 'runningSum'.-runningSumRMS :: UGen -> UGen -> UGen-runningSumRMS z n = sqrt (runningSum (z * z) n * recip n)---- | Mix one output from many sources-selectX :: UGen -> UGen -> UGen-selectX ix xs =-    let s0 = select (roundTo ix 2) xs-        s1 = select (trunc ix 2 + 1) xs-    in xFade2 s0 s1 (fold2 (ix * 2 - 1) 1) 1---- | Set local buffer values.-setBuf' :: UGen -> [UGen] -> UGen -> UGen-setBuf' b xs o = setBuf b o (fromIntegral (length xs)) (mce xs)---- | Silence.-silent :: Int -> UGen-silent n = let s = dc AR 0 in mce (replicate n s)---- | Zero indexed audio input buses.-soundIn :: UGen -> UGen-soundIn u =-    let r = in' 1 AR (numOutputBuses + u)-    in case u of-         MCE_U m ->-             let n = mceProxies m-             in if all (==1) (zipWith (-) (tail n) n)-                then in' (length n) AR (numOutputBuses + head n)-                else r-         _ -> r---- | Pan a set of channels across the stereo field.------ > input, spread:1, level:1, center:0, levelComp:true-splay :: UGen -> UGen -> UGen -> UGen -> Bool -> UGen-splay i s l c lc =-    let n = max 2 (fromIntegral (fromMaybe 1 (mceDegree i)))-        m = n - 1-        p = map ( (+ (-1.0)) . (* (2 / m)) ) [0 .. m]-        a = if lc then sqrt (1 / n) else 1-    in mix (pan2 i (mce p * s + c) 1) * l * a---- | Optimised sum function.-sum_opt :: [UGen] -> UGen-sum_opt l =-    case l of-      p:q:r:s:l' -> sum_opt (sum4 p q r s : l')-      p:q:r:l' -> sum_opt (sum3 p q r : l')-      _ -> sum l---- | Single tap into a delayline-tap :: Int -> UGen -> UGen -> UGen-tap numChannels bufnum delaytime =-    let n = delaytime * negate sampleRate-    in playBuf numChannels AR bufnum 1 0 n Loop DoNothing---- | Randomly select one of several inputs on trigger.-tChoose :: ID m => m -> UGen -> UGen -> UGen-tChoose z t a = select (tIRand z 0 (mceN a) t) a---- | Randomly select one of several inputs.-tChooseM :: (UId m) => UGen -> UGen -> m UGen-tChooseM t a = do-  r <- tIRandM 0 (constant (length (mceChannels a))) t-  return (select r a)---- | Triangle wave as sum of /n/ sines.--- For partial n, amplitude is (1 / square n) and phase is pi at every other odd partial.-triAS :: Int -> UGen -> UGen-triAS n f0 =-    let mk_freq i = f0 * fromIntegral i-        mk_amp i = if even i then 0 else 1 / fromIntegral (i * i)-        mk_ph i = if i + 1 `mod` 4 == 0 then pi else 0-        m = [1,3 .. n]-        param = zip3 (map mk_freq m) (map mk_ph m) (map mk_amp m)-    in sum (map (\(fr,ph,am) -> sinOsc AR fr ph * am) param)---- | Randomly select one of several inputs on trigger (weighted).-tWChoose :: ID m => m -> UGen -> UGen -> UGen -> UGen -> UGen-tWChoose z t a w n =-    let i = tWindex z t n w-    in select i a---- | Randomly select one of several inputs (weighted).-tWChooseM :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-tWChooseM t a w n = do-  i <- tWindexM t n w-  return (select i a)---- | Unpack an FFT chain into separate demand-rate FFT bin streams.-unpackFFT :: UGen -> UGen -> UGen -> UGen -> UGen -> [UGen]-unpackFFT c nf from to w = map (\i -> unpack1FFT c nf i w) [from .. to]---- | If @z@ isn't a sink node route to an @out@ node writing to @bus@.--- If @fadeTime@ is given multiply by 'makeFadeEnv'.------ > import Sound.SC3--- > audition (wrapOut (sinOsc AR 440 0 * 0.1) 1)--- > withSC3 (send (n_set1 (-1) "gate" 0))-wrapOut :: Maybe Double -> UGen -> UGen-wrapOut fadeTime z =-    let bus = control KR "out" 0-    in if isSink z-       then z-       else out bus (z * maybe 1 makeFadeEnv fadeTime)---- * wslib--playBufCF :: Int -> UGen -> UGen -> UGen -> UGen -> Loop -> UGen -> Int -> UGen-playBufCF nc bufnum rate trigger startPos loop lag' n =-    let trigger' = if rateOf trigger == DR-                   then tDuty AR trigger 0 DoNothing 1 0-                   else trigger-        index' = stepper trigger' 0 0 (constant n - 1) 1 0-        on = map-             (\i -> inRange index' (i - 0.5) (i + 0.5))-             [0 .. constant n - 1]-        rate' = case rateOf rate of-                  DR -> map (\on' -> demand on' 0 rate) on-                  KR -> map (gate rate) on-                  AR -> map (gate rate) on-                  IR -> map (const rate) on-        startPos' = if rateOf startPos == DR-                    then demand trigger' 0 startPos-                    else startPos-        lag'' = 1 / lag'-        s = map-            (\(on',r) -> let p = playBuf nc AR bufnum r on' startPos' loop DoNothing-                         in p * sqrt (slew on' lag'' lag''))-            (zip on rate')-    in sum s---- * adc---- | An oscillator that reads through a table once.-osc1 :: Rate -> UGen -> UGen -> DoneAction -> UGen-osc1 rt buf dur doneAction =-    let ph = line rt 0 (bufFrames IR buf - 1) dur doneAction-    in bufRd 1 rt buf ph NoLoop LinearInterpolation
− Sound/SC3/UGen/Bindings/DB.hs
@@ -1,2269 +0,0 @@-module Sound.SC3.UGen.Bindings.DB where--import Sound.SC3.Common.Envelope--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Identifier-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- | Audio to control rate converter.------  A2K [KR] in=0.0-a2K :: UGen -> UGen-a2K in_ = mkUGen Nothing [KR] (Left KR) "A2K" [in_] Nothing 1 (Special 0) NoId---- | FIXME: APF purpose.------  APF [KR,AR] in=0.0 freq=440.0 radius=0.8;    FILTER: TRUE-apf :: UGen -> UGen -> UGen -> UGen-apf in_ freq radius = mkUGen Nothing [KR,AR] (Right [0]) "APF" [in_,freq,radius] Nothing 1 (Special 0) NoId---- | All pass delay line with cubic interpolation.------  AllpassC [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-allpassC :: UGen -> UGen -> UGen -> UGen -> UGen-allpassC in_ maxdelaytime delaytime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "AllpassC" [in_,maxdelaytime,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | All pass delay line with linear interpolation.------  AllpassL [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-allpassL :: UGen -> UGen -> UGen -> UGen -> UGen-allpassL in_ maxdelaytime delaytime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "AllpassL" [in_,maxdelaytime,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | All pass delay line with no interpolation.------  AllpassN [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-allpassN :: UGen -> UGen -> UGen -> UGen -> UGen-allpassN in_ maxdelaytime delaytime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "AllpassN" [in_,maxdelaytime,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Basic psychoacoustic amplitude compensation.------  AmpComp [IR,KR,AR] freq=0.0 root=0.0 exp=0.3333-ampComp :: Rate -> UGen -> UGen -> UGen -> UGen-ampComp rate freq root exp_ = mkUGen Nothing [IR,KR,AR] (Left rate) "AmpComp" [freq,root,exp_] Nothing 1 (Special 0) NoId---- | Basic psychoacoustic amplitude compensation (ANSI A-weighting curve).------  AmpCompA [IR,KR,AR] freq=1000.0 root=0.0 minAmp=0.32 rootAmp=1.0-ampCompA :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-ampCompA rate freq root minAmp rootAmp = mkUGen Nothing [IR,KR,AR] (Left rate) "AmpCompA" [freq,root,minAmp,rootAmp] Nothing 1 (Special 0) NoId---- | Amplitude follower------  Amplitude [KR,AR] in=0.0 attackTime=1.0e-2 releaseTime=1.0e-2-amplitude :: Rate -> UGen -> UGen -> UGen -> UGen-amplitude rate in_ attackTime releaseTime = mkUGen Nothing [KR,AR] (Left rate) "Amplitude" [in_,attackTime,releaseTime] Nothing 1 (Special 0) NoId---- | (Undocumented class)------  AudioControl [AR] values=0.0-audioControl :: Rate -> UGen -> UGen-audioControl rate values = mkUGen Nothing [AR] (Left rate) "AudioControl" [values] Nothing 0 (Special 0) NoId---- | All Pass Filter------  BAllPass [AR] in=0.0 freq=1200.0 rq=1.0;    FILTER: TRUE-bAllPass :: UGen -> UGen -> UGen -> UGen-bAllPass in_ freq rq = mkUGen Nothing [AR] (Right [0]) "BAllPass" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | Band Pass Filter------  BBandPass [AR] in=0.0 freq=1200.0 bw=1.0;    FILTER: TRUE-bBandPass :: UGen -> UGen -> UGen -> UGen-bBandPass in_ freq bw = mkUGen Nothing [AR] (Right [0]) "BBandPass" [in_,freq,bw] Nothing 1 (Special 0) NoId---- | Band reject filter------  BBandStop [AR] in=0.0 freq=1200.0 bw=1.0;    FILTER: TRUE-bBandStop :: UGen -> UGen -> UGen -> UGen-bBandStop in_ freq bw = mkUGen Nothing [AR] (Right [0]) "BBandStop" [in_,freq,bw] Nothing 1 (Special 0) NoId---- | 12db/oct rolloff - 2nd order resonant  Hi Pass Filter------  BHiPass [AR] in=0.0 freq=1200.0 rq=1.0;    FILTER: TRUE-bHiPass :: UGen -> UGen -> UGen -> UGen-bHiPass in_ freq rq = mkUGen Nothing [AR] (Right [0]) "BHiPass" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | Hi Shelf------  BHiShelf [AR] in=0.0 freq=1200.0 rs=1.0 db=0.0;    FILTER: TRUE-bHiShelf :: UGen -> UGen -> UGen -> UGen -> UGen-bHiShelf in_ freq rs db = mkUGen Nothing [AR] (Right [0]) "BHiShelf" [in_,freq,rs,db] Nothing 1 (Special 0) NoId---- | 12db/oct rolloff - 2nd order resonant Low Pass Filter------  BLowPass [AR] in=0.0 freq=1200.0 rq=1.0;    FILTER: TRUE-bLowPass :: UGen -> UGen -> UGen -> UGen-bLowPass in_ freq rq = mkUGen Nothing [AR] (Right [0]) "BLowPass" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | Low Shelf------  BLowShelf [AR] in=0.0 freq=1200.0 rs=1.0 db=0.0;    FILTER: TRUE-bLowShelf :: UGen -> UGen -> UGen -> UGen -> UGen-bLowShelf in_ freq rs db = mkUGen Nothing [AR] (Right [0]) "BLowShelf" [in_,freq,rs,db] Nothing 1 (Special 0) NoId---- | 2nd order Butterworth bandpass filter.------  BPF [KR,AR] in=0.0 freq=440.0 rq=1.0;    FILTER: TRUE-bpf :: UGen -> UGen -> UGen -> UGen-bpf in_ freq rq = mkUGen Nothing [KR,AR] (Right [0]) "BPF" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | Two zero fixed midpass.------  BPZ2 [KR,AR] in=0.0;    FILTER: TRUE-bpz2 :: UGen -> UGen-bpz2 in_ = mkUGen Nothing [KR,AR] (Right [0]) "BPZ2" [in_] Nothing 1 (Special 0) NoId---- | Parametric equalizer------  BPeakEQ [AR] in=0.0 freq=1200.0 rq=1.0 db=0.0;    FILTER: TRUE-bPeakEQ :: UGen -> UGen -> UGen -> UGen -> UGen-bPeakEQ in_ freq rq db = mkUGen Nothing [AR] (Right [0]) "BPeakEQ" [in_,freq,rq,db] Nothing 1 (Special 0) NoId---- | 2nd order Butterworth band reject filter.------  BRF [KR,AR] in=0.0 freq=440.0 rq=1.0;    FILTER: TRUE-brf :: UGen -> UGen -> UGen -> UGen-brf in_ freq rq = mkUGen Nothing [KR,AR] (Right [0]) "BRF" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | Two zero fixed midcut.------  BRZ2 [KR,AR] in=0.0;    FILTER: TRUE-brz2 :: UGen -> UGen-brz2 in_ = mkUGen Nothing [KR,AR] (Right [0]) "BRZ2" [in_] Nothing 1 (Special 0) NoId---- | Stereo signal balancer------  Balance2 [KR,AR] left=0.0 right=0.0 pos=0.0 level=1.0;    FILTER: TRUE-balance2 :: UGen -> UGen -> UGen -> UGen -> UGen-balance2 left right pos level = mkUGen Nothing [KR,AR] (Right [0,1]) "Balance2" [left,right,pos,level] Nothing 2 (Special 0) NoId---- | physical model of bouncing object------  Ball [KR,AR] in=0.0 g=1.0 damp=0.0 friction=1.0e-2-ball :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-ball rate in_ g damp friction = mkUGen Nothing [KR,AR] (Left rate) "Ball" [in_,g,damp,friction] Nothing 1 (Special 0) NoId---- | Autocorrelation beat tracker------  BeatTrack [KR] chain=0.0 lock=0.0-beatTrack :: Rate -> UGen -> UGen -> UGen-beatTrack rate chain lock = mkUGen Nothing [KR] (Left rate) "BeatTrack" [chain,lock] Nothing 4 (Special 0) NoId---- | Template matching beat tracker------  BeatTrack2 [KR] busindex=0.0 numfeatures=0.0 windowsize=2.0 phaseaccuracy=2.0e-2 lock=0.0 weightingscheme=0.0-beatTrack2 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-beatTrack2 rate busindex numfeatures windowsize phaseaccuracy lock weightingscheme = mkUGen Nothing [KR] (Left rate) "BeatTrack2" [busindex,numfeatures,windowsize,phaseaccuracy,lock,weightingscheme] Nothing 6 (Special 0) NoId---- | 2D Ambisonic B-format panner.------  BiPanB2 [KR,AR] inA=0.0 inB=0.0 azimuth=0.0 gain=1.0-biPanB2 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-biPanB2 rate inA inB azimuth gain = mkUGen Nothing [KR,AR] (Left rate) "BiPanB2" [inA,inB,azimuth,gain] Nothing 3 (Special 0) NoId---- | Apply a binary operation to the values of an input UGen------  BinaryOpUGen [] a=0.0 b=0.0;    FILTER: TRUE-binaryOpUGen :: UGen -> UGen -> UGen-binaryOpUGen a b = mkUGen Nothing [IR,KR,AR,DR] (Right [0,1]) "BinaryOpUGen" [a,b] Nothing 1 (Special 0) NoId---- | Band limited impulse oscillator.------  Blip [KR,AR] freq=440.0 numharm=200.0-blip :: Rate -> UGen -> UGen -> UGen-blip rate freq numharm = mkUGen Nothing [KR,AR] (Left rate) "Blip" [freq,numharm] Nothing 1 (Special 0) NoId---- | (Undocumented class)------  BlockSize [IR]-blockSize :: UGen-blockSize = mkUGen Nothing [IR] (Left IR) "BlockSize" [] Nothing 1 (Special 0) NoId---- | Brown Noise.------  BrownNoise [KR,AR] ;    NONDET-brownNoise :: ID a => a -> Rate -> UGen-brownNoise z rate = mkUGen Nothing [KR,AR] (Left rate) "BrownNoise" [] Nothing 1 (Special 0) (toUId z)---- | Buffer based all pass delay line with cubic interpolation.------  BufAllpassC [AR] buf=0.0 in=0.0 delaytime=0.2 decaytime=1.0-bufAllpassC :: UGen -> UGen -> UGen -> UGen -> UGen-bufAllpassC buf in_ delaytime decaytime = mkUGen Nothing [AR] (Right [1]) "BufAllpassC" [buf,in_,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Buffer based all pass delay line with linear interpolation.------  BufAllpassL [AR] buf=0.0 in=0.0 delaytime=0.2 decaytime=1.0-bufAllpassL :: UGen -> UGen -> UGen -> UGen -> UGen-bufAllpassL buf in_ delaytime decaytime = mkUGen Nothing [AR] (Right [1]) "BufAllpassL" [buf,in_,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Buffer based all pass delay line with no interpolation.------  BufAllpassN [AR] buf=0.0 in=0.0 delaytime=0.2 decaytime=1.0-bufAllpassN :: UGen -> UGen -> UGen -> UGen -> UGen-bufAllpassN buf in_ delaytime decaytime = mkUGen Nothing [AR] (Right [1]) "BufAllpassN" [buf,in_,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Current number of channels of soundfile in buffer.------  BufChannels [IR,KR] bufnum=0.0-bufChannels :: Rate -> UGen -> UGen-bufChannels rate bufnum = mkUGen Nothing [IR,KR] (Left rate) "BufChannels" [bufnum] Nothing 1 (Special 0) NoId---- | Buffer based comb delay line with cubic interpolation.------  BufCombC [AR] buf=0.0 in=0.0 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-bufCombC :: UGen -> UGen -> UGen -> UGen -> UGen-bufCombC buf in_ delaytime decaytime = mkUGen Nothing [AR] (Right [1]) "BufCombC" [buf,in_,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Buffer based comb delay line with linear interpolation.------  BufCombL [AR] buf=0.0 in=0.0 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-bufCombL :: UGen -> UGen -> UGen -> UGen -> UGen-bufCombL buf in_ delaytime decaytime = mkUGen Nothing [AR] (Right [1]) "BufCombL" [buf,in_,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Buffer based comb delay line with no interpolation.------  BufCombN [AR] buf=0.0 in=0.0 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-bufCombN :: UGen -> UGen -> UGen -> UGen -> UGen-bufCombN buf in_ delaytime decaytime = mkUGen Nothing [AR] (Right [1]) "BufCombN" [buf,in_,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Buffer based simple delay line with cubic interpolation.------  BufDelayC [KR,AR] buf=0.0 in=0.0 delaytime=0.2-bufDelayC :: UGen -> UGen -> UGen -> UGen-bufDelayC buf in_ delaytime = mkUGen Nothing [KR,AR] (Right [1]) "BufDelayC" [buf,in_,delaytime] Nothing 1 (Special 0) NoId---- | Buffer based simple delay line with linear interpolation.------  BufDelayL [KR,AR] buf=0.0 in=0.0 delaytime=0.2-bufDelayL :: UGen -> UGen -> UGen -> UGen-bufDelayL buf in_ delaytime = mkUGen Nothing [KR,AR] (Right [1]) "BufDelayL" [buf,in_,delaytime] Nothing 1 (Special 0) NoId---- | Buffer based simple delay line with no interpolation.------  BufDelayN [KR,AR] buf=0.0 in=0.0 delaytime=0.2-bufDelayN :: UGen -> UGen -> UGen -> UGen-bufDelayN buf in_ delaytime = mkUGen Nothing [KR,AR] (Right [1]) "BufDelayN" [buf,in_,delaytime] Nothing 1 (Special 0) NoId---- | Current duration of soundfile in buffer.------  BufDur [IR,KR] bufnum=0.0-bufDur :: Rate -> UGen -> UGen-bufDur rate bufnum = mkUGen Nothing [IR,KR] (Left rate) "BufDur" [bufnum] Nothing 1 (Special 0) NoId---- | Current number of frames allocated in the buffer.------  BufFrames [IR,KR] bufnum=0.0-bufFrames :: Rate -> UGen -> UGen-bufFrames rate bufnum = mkUGen Nothing [IR,KR] (Left rate) "BufFrames" [bufnum] Nothing 1 (Special 0) NoId---- | Buffer rate scaling in respect to server samplerate.------  BufRateScale [IR,KR] bufnum=0.0-bufRateScale :: Rate -> UGen -> UGen-bufRateScale rate bufnum = mkUGen Nothing [IR,KR] (Left rate) "BufRateScale" [bufnum] Nothing 1 (Special 0) NoId---- | Buffer reading oscillator.------  BufRd [KR,AR] bufnum=0.0 phase=0.0 loop=1.0 interpolation=2.0;    NC INPUT: True, ENUMERATION INPUTS: 2=Loop, 3=Interpolation-bufRd :: Int -> Rate -> UGen -> UGen -> Loop -> Interpolation -> UGen-bufRd numChannels rate bufnum phase loop interpolation = mkUGen Nothing [KR,AR] (Left rate) "BufRd" [bufnum,phase,(from_loop loop),(from_interpolation interpolation)] Nothing numChannels (Special 0) NoId---- | Buffer sample rate.------  BufSampleRate [IR,KR] bufnum=0.0-bufSampleRate :: Rate -> UGen -> UGen-bufSampleRate rate bufnum = mkUGen Nothing [IR,KR] (Left rate) "BufSampleRate" [bufnum] Nothing 1 (Special 0) NoId---- | Current number of samples in buffer.------  BufSamples [IR,KR] bufnum=0.0-bufSamples :: Rate -> UGen -> UGen-bufSamples rate bufnum = mkUGen Nothing [IR,KR] (Left rate) "BufSamples" [bufnum] Nothing 1 (Special 0) NoId---- | Buffer writing oscillator.------  BufWr [KR,AR] bufnum=0.0 phase=0.0 loop=1.0 *inputArray=0.0;    MCE, FILTER: TRUE, REORDERS INPUTS: [3,0,1,2], ENUMERATION INPUTS: 2=Loop-bufWr :: UGen -> UGen -> Loop -> UGen -> UGen-bufWr bufnum phase loop inputArray = mkUGen Nothing [KR,AR] (Right [3]) "BufWr" [bufnum,phase,(from_loop loop)] (Just inputArray) 1 (Special 0) NoId---- | Chorusing wavetable oscillator.------  COsc [KR,AR] bufnum=0.0 freq=440.0 beats=0.5-cOsc :: Rate -> UGen -> UGen -> UGen -> UGen-cOsc rate bufnum freq beats = mkUGen Nothing [KR,AR] (Left rate) "COsc" [bufnum,freq,beats] Nothing 1 (Special 0) NoId---- | Test for infinity, not-a-number, and denormals------  CheckBadValues [KR,AR] in=0.0 id=0.0 post=2.0;    FILTER: TRUE-checkBadValues :: UGen -> UGen -> UGen -> UGen-checkBadValues in_ id_ post = mkUGen Nothing [KR,AR] (Right [0]) "CheckBadValues" [in_,id_,post] Nothing 1 (Special 0) NoId---- | Clip a signal outside given thresholds.------  Clip [IR,KR,AR] in=0.0 lo=0.0 hi=1.0;    FILTER: TRUE-clip :: UGen -> UGen -> UGen -> UGen-clip in_ lo hi = mkUGen Nothing [IR,KR,AR] (Right [0]) "Clip" [in_,lo,hi] Nothing 1 (Special 0) NoId---- | Clip Noise.------  ClipNoise [KR,AR] ;    NONDET-clipNoise :: ID a => a -> Rate -> UGen-clipNoise z rate = mkUGen Nothing [KR,AR] (Left rate) "ClipNoise" [] Nothing 1 (Special 0) (toUId z)---- | Statistical gate.------  CoinGate [KR,AR] prob=0.0 in=0.0;    FILTER: TRUE, NONDET-coinGate :: ID a => a -> UGen -> UGen -> UGen-coinGate z prob in_ = mkUGen Nothing [KR,AR] (Right [1]) "CoinGate" [prob,in_] Nothing 1 (Special 0) (toUId z)---- | Comb delay line with cubic interpolation.------  CombC [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-combC :: UGen -> UGen -> UGen -> UGen -> UGen-combC in_ maxdelaytime delaytime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "CombC" [in_,maxdelaytime,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Comb delay line with linear interpolation.------  CombL [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-combL :: UGen -> UGen -> UGen -> UGen -> UGen-combL in_ maxdelaytime delaytime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "CombL" [in_,maxdelaytime,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Comb delay line with no interpolation.------  CombN [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0;    FILTER: TRUE-combN :: UGen -> UGen -> UGen -> UGen -> UGen-combN in_ maxdelaytime delaytime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "CombN" [in_,maxdelaytime,delaytime,decaytime] Nothing 1 (Special 0) NoId---- | Compressor, expander, limiter, gate, ducker------  Compander [AR] in=0.0 control=0.0 thresh=0.5 slopeBelow=1.0 slopeAbove=1.0 clampTime=1.0e-2 relaxTime=0.1;    FILTER: TRUE-compander :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-compander in_ control_ thresh slopeBelow slopeAbove clampTime relaxTime = mkUGen Nothing [AR] (Right [0]) "Compander" [in_,control_,thresh,slopeBelow,slopeAbove,clampTime,relaxTime] Nothing 1 (Special 0) NoId---- | Compressor, expander, limiter, gate, ducker.------  CompanderD [AR] in=0.0 thresh=0.5 slopeBelow=1.0 slopeAbove=1.0 clampTime=1.0e-2 relaxTime=1.0e-2-companderD :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-companderD rate in_ thresh slopeBelow slopeAbove clampTime relaxTime = mkUGen Nothing [AR] (Left rate) "CompanderD" [in_,thresh,slopeBelow,slopeAbove,clampTime,relaxTime] Nothing 1 (Special 0) NoId---- | Duration of one block------  ControlDur [IR]-controlDur :: UGen-controlDur = mkUGen Nothing [IR] (Left IR) "ControlDur" [] Nothing 1 (Special 0) NoId---- | Server control rate.------  ControlRate [IR]-controlRate :: UGen-controlRate = mkUGen Nothing [IR] (Left IR) "ControlRate" [] Nothing 1 (Special 0) NoId---- | Real-time convolver.------  Convolution [AR] in=0.0 kernel=0.0 framesize=512.0-convolution :: Rate -> UGen -> UGen -> UGen -> UGen-convolution rate in_ kernel framesize = mkUGen Nothing [AR] (Left rate) "Convolution" [in_,kernel,framesize] Nothing 1 (Special 0) NoId---- | Real-time fixed kernel convolver.------  Convolution2 [AR] in=0.0 kernel=0.0 trigger=0.0 framesize=2048.0-convolution2 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-convolution2 rate in_ kernel trigger framesize = mkUGen Nothing [AR] (Left rate) "Convolution2" [in_,kernel,trigger,framesize] Nothing 1 (Special 0) NoId---- | Real-time convolver with linear interpolation------  Convolution2L [AR] in=0.0 kernel=0.0 trigger=0.0 framesize=2048.0 crossfade=1.0-convolution2L :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-convolution2L rate in_ kernel trigger framesize crossfade = mkUGen Nothing [AR] (Left rate) "Convolution2L" [in_,kernel,trigger,framesize,crossfade] Nothing 1 (Special 0) NoId---- | Time based convolver.------  Convolution3 [KR,AR] in=0.0 kernel=0.0 trigger=0.0 framesize=2048.0-convolution3 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-convolution3 rate in_ kernel trigger framesize = mkUGen Nothing [KR,AR] (Left rate) "Convolution3" [in_,kernel,trigger,framesize] Nothing 1 (Special 0) NoId---- | Chaotic noise function.------  Crackle [KR,AR] chaosParam=1.5-crackle :: Rate -> UGen -> UGen-crackle rate chaosParam = mkUGen Nothing [KR,AR] (Left rate) "Crackle" [chaosParam] Nothing 1 (Special 0) NoId---- | Cusp map chaotic generator------  CuspL [AR] freq=22050.0 a=1.0 b=1.9 xi=0.0-cuspL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-cuspL rate freq a b xi = mkUGen Nothing [AR] (Left rate) "CuspL" [freq,a,b,xi] Nothing 1 (Special 0) NoId---- | Cusp map chaotic generator------  CuspN [AR] freq=22050.0 a=1.0 b=1.9 xi=0.0-cuspN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-cuspN rate freq a b xi = mkUGen Nothing [AR] (Left rate) "CuspN" [freq,a,b,xi] Nothing 1 (Special 0) NoId---- | Create a constant amplitude signal------  DC [KR,AR] in=0.0-dc :: Rate -> UGen -> UGen-dc rate in_ = mkUGen Nothing [KR,AR] (Left rate) "DC" [in_] Nothing 1 (Special 0) NoId---- | Demand rate brownian movement generator.------  Dbrown [DR] length=1.0e8 lo=0.0 hi=1.0 step=1.0e-2;    REORDERS INPUTS: [1,2,3,0], DEMAND/NONDET-dbrown :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen-dbrown z length_ lo hi step = mkUGen Nothing [DR] (Left DR) "Dbrown" [length_,lo,hi,step] Nothing 1 (Special 0) (toUId z)---- | Buffer read demand ugen------  Dbufrd [DR] bufnum=0.0 phase=0.0 loop=1.0;    ENUMERATION INPUTS: 2=Loop, DEMAND/NONDET-dbufrd :: ID a => a -> UGen -> UGen -> Loop -> UGen-dbufrd z bufnum phase loop = mkUGen Nothing [DR] (Left DR) "Dbufrd" [bufnum,phase,(from_loop loop)] Nothing 1 (Special 0) (toUId z)---- | Buffer write demand ugen------  Dbufwr [DR] bufnum=0.0 phase=0.0 loop=1.0 input=0.0;    REORDERS INPUTS: [3,0,1,2], ENUMERATION INPUTS: 3=Loop, DEMAND/NONDET-dbufwr :: ID a => a -> UGen -> UGen -> UGen -> Loop -> UGen-dbufwr z bufnum phase loop input = mkUGen Nothing [DR] (Left DR) "Dbufwr" [bufnum,phase,loop,(from_loop input)] Nothing 1 (Special 0) (toUId z)---- | Exponential decay------  Decay [KR,AR] in=0.0 decayTime=1.0;    FILTER: TRUE-decay :: UGen -> UGen -> UGen-decay in_ decayTime = mkUGen Nothing [KR,AR] (Right [0]) "Decay" [in_,decayTime] Nothing 1 (Special 0) NoId---- | Exponential decay------  Decay2 [KR,AR] in=0.0 attackTime=1.0e-2 decayTime=1.0;    FILTER: TRUE-decay2 :: UGen -> UGen -> UGen -> UGen-decay2 in_ attackTime decayTime = mkUGen Nothing [KR,AR] (Right [0]) "Decay2" [in_,attackTime,decayTime] Nothing 1 (Special 0) NoId---- | 2D Ambisonic B-format decoder.------  DecodeB2 [KR,AR] w=0.0 x=0.0 y=0.0 orientation=0.5;    NC INPUT: True-decodeB2 :: Int -> Rate -> UGen -> UGen -> UGen -> UGen -> UGen-decodeB2 numChannels rate w x y orientation = mkUGen Nothing [KR,AR] (Left rate) "DecodeB2" [w,x,y,orientation] Nothing numChannels (Special 0) NoId---- | Convert signal to modal pitch.------  DegreeToKey [KR,AR] bufnum=0.0 in=0.0 octave=12.0;    FILTER: TRUE-degreeToKey :: UGen -> UGen -> UGen -> UGen-degreeToKey bufnum in_ octave = mkUGen Nothing [KR,AR] (Right [1]) "DegreeToKey" [bufnum,in_,octave] Nothing 1 (Special 0) NoId---- | Tap a delay line from a DelTapWr UGen------  DelTapRd [KR,AR] buffer=0.0 phase=0.0 delTime=0.0 interp=1.0;    FILTER: TRUE-delTapRd :: UGen -> UGen -> UGen -> UGen -> UGen-delTapRd buffer phase delTime interp = mkUGen Nothing [KR,AR] (Right [1]) "DelTapRd" [buffer,phase,delTime,interp] Nothing 1 (Special 0) NoId---- | Write to a buffer for a DelTapRd UGen------  DelTapWr [KR,AR] buffer=0.0 in=0.0;    FILTER: TRUE-delTapWr :: UGen -> UGen -> UGen-delTapWr buffer in_ = mkUGen Nothing [KR,AR] (Right [1]) "DelTapWr" [buffer,in_] Nothing 1 (Special 0) NoId---- | Single sample delay.------  Delay1 [KR,AR] in=0.0;    FILTER: TRUE-delay1 :: UGen -> UGen-delay1 in_ = mkUGen Nothing [KR,AR] (Right [0]) "Delay1" [in_] Nothing 1 (Special 0) NoId---- | Two sample delay.------  Delay2 [KR,AR] in=0.0;    FILTER: TRUE-delay2 :: UGen -> UGen-delay2 in_ = mkUGen Nothing [KR,AR] (Right [0]) "Delay2" [in_] Nothing 1 (Special 0) NoId---- | Simple delay line with cubic interpolation.------  DelayC [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2;    FILTER: TRUE-delayC :: UGen -> UGen -> UGen -> UGen-delayC in_ maxdelaytime delaytime = mkUGen Nothing [KR,AR] (Right [0]) "DelayC" [in_,maxdelaytime,delaytime] Nothing 1 (Special 0) NoId---- | Simple delay line with linear interpolation.------  DelayL [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2;    FILTER: TRUE-delayL :: UGen -> UGen -> UGen -> UGen-delayL in_ maxdelaytime delaytime = mkUGen Nothing [KR,AR] (Right [0]) "DelayL" [in_,maxdelaytime,delaytime] Nothing 1 (Special 0) NoId---- | Simple delay line with no interpolation.------  DelayN [KR,AR] in=0.0 maxdelaytime=0.2 delaytime=0.2;    FILTER: TRUE-delayN :: UGen -> UGen -> UGen -> UGen-delayN in_ maxdelaytime delaytime = mkUGen Nothing [KR,AR] (Right [0]) "DelayN" [in_,maxdelaytime,delaytime] Nothing 1 (Special 0) NoId---- | Demand results from demand rate UGens.------  Demand [KR,AR] trig=0.0 reset=0.0 *demandUGens=0.0;    MCE, FILTER: TRUE-demand :: UGen -> UGen -> UGen -> UGen-demand trig_ reset demandUGens = mkUGen Nothing [KR,AR] (Right [0]) "Demand" [trig_,reset] (Just demandUGens) (length (mceChannels demandUGens) + 0) (Special 0) NoId---- | Demand rate envelope generator------  DemandEnvGen [KR,AR] level=0.0 dur=0.0 shape=1.0 curve=0.0 gate=1.0 reset=1.0 levelScale=1.0 levelBias=0.0 timeScale=1.0 doneAction=0.0;    ENUMERATION INPUTS: 9=DoneAction-demandEnvGen :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> DoneAction -> UGen-demandEnvGen rate level dur shape curve gate_ reset levelScale levelBias timeScale doneAction = mkUGen Nothing [KR,AR] (Left rate) "DemandEnvGen" [level,dur,shape,curve,gate_,reset,levelScale,levelBias,timeScale,(from_done_action doneAction)] Nothing 1 (Special 0) NoId---- | Search a buffer for a value------  DetectIndex [KR,AR] bufnum=0.0 in=0.0;    FILTER: TRUE-detectIndex :: UGen -> UGen -> UGen-detectIndex bufnum in_ = mkUGen Nothing [KR,AR] (Right [1]) "DetectIndex" [bufnum,in_] Nothing 1 (Special 0) NoId---- | When input falls below a threshhold, evaluate doneAction.------  DetectSilence [KR,AR] in=0.0 amp=1.0e-4 time=0.1 doneAction=0.0;    FILTER: TRUE, ENUMERATION INPUTS: 3=DoneAction-detectSilence :: UGen -> UGen -> UGen -> DoneAction -> UGen-detectSilence in_ amp time doneAction = mkUGen Nothing [KR,AR] (Right [0]) "DetectSilence" [in_,amp,time,(from_done_action doneAction)] Nothing 1 (Special 0) NoId---- | Demand rate geometric series UGen.------  Dgeom [DR] length=1.0e8 start=1.0 grow=2.0;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET-dgeom :: ID a => a -> UGen -> UGen -> UGen -> UGen-dgeom z length_ start grow = mkUGen Nothing [DR] (Left DR) "Dgeom" [length_,start,grow] Nothing 1 (Special 0) (toUId z)---- | Demand rate brownian movement generator.------  Dibrown [DR] length=1.0e8 lo=0.0 hi=1.0 step=1.0e-2;    REORDERS INPUTS: [1,2,3,0], DEMAND/NONDET-dibrown :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen-dibrown z length_ lo hi step = mkUGen Nothing [DR] (Left DR) "Dibrown" [length_,lo,hi,step] Nothing 1 (Special 0) (toUId z)---- | Stream in audio from a file.------  DiskIn [AR] bufnum=0.0 loop=0.0;    NC INPUT: True, ENUMERATION INPUTS: 1=Loop-diskIn :: Int -> UGen -> Loop -> UGen-diskIn numChannels bufnum loop = mkUGen Nothing [AR] (Left AR) "DiskIn" [bufnum,(from_loop loop)] Nothing numChannels (Special 0) NoId---- | Record to a soundfile to disk.------  DiskOut [AR] bufnum=0.0 *channelsArray=0.0;    MCE-diskOut :: UGen -> UGen -> UGen-diskOut bufnum input = mkUGen Nothing [AR] (Left AR) "DiskOut" [bufnum] (Just input) 1 (Special 0) NoId---- | Demand rate white noise random generator.------  Diwhite [DR] length=1.0e8 lo=0.0 hi=1.0;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET-diwhite :: ID a => a -> UGen -> UGen -> UGen -> UGen-diwhite z length_ lo hi = mkUGen Nothing [DR] (Left DR) "Diwhite" [length_,lo,hi] Nothing 1 (Special 0) (toUId z)---- | (Undocumented class)------  Donce [DR] in=0.0;    DEMAND/NONDET-donce :: ID a => a -> UGen -> UGen-donce z in_ = mkUGen Nothing [DR] (Left DR) "Donce" [in_] Nothing 1 (Special 0) (toUId z)---- | Monitors another UGen to see when it is finished------  Done [KR] src=0.0-done :: UGen -> UGen-done src = mkUGen Nothing [KR] (Left KR) "Done" [src] Nothing 1 (Special 0) NoId---- | Print the current output value of a demand rate UGen------  Dpoll [DR] in=0.0 label=0.0 run=1.0 trigid=-1.0;    DEMAND/NONDET-dpoll :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen-dpoll z in_ label_ run trigid = mkUGen Nothing [DR] (Left DR) "Dpoll" [in_,label_,run,trigid] Nothing 1 (Special 0) (toUId z)---- | Demand rate random sequence generator.------  Drand [DR] repeats=1.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-drand :: ID a => a -> UGen -> UGen -> UGen-drand z repeats list_ = mkUGen Nothing [DR] (Left DR) "Drand" [repeats] (Just list_) 1 (Special 0) (toUId z)---- | demand rate reset------  Dreset [DR] in=0.0 reset=0.0;    DEMAND/NONDET-dreset :: ID a => a -> UGen -> UGen -> UGen-dreset z in_ reset = mkUGen Nothing [DR] (Left DR) "Dreset" [in_,reset] Nothing 1 (Special 0) (toUId z)---- | Demand rate sequence generator.------  Dseq [DR] repeats=1.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-dseq :: ID a => a -> UGen -> UGen -> UGen-dseq z repeats list_ = mkUGen Nothing [DR] (Left DR) "Dseq" [repeats] (Just list_) 1 (Special 0) (toUId z)---- | Demand rate sequence generator.------  Dser [DR] repeats=1.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-dser :: ID a => a -> UGen -> UGen -> UGen-dser z repeats list_ = mkUGen Nothing [DR] (Left DR) "Dser" [repeats] (Just list_) 1 (Special 0) (toUId z)---- | Demand rate arithmetic series UGen.------  Dseries [DR] length=1.0e8 start=1.0 step=1.0;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET-dseries :: ID a => a -> UGen -> UGen -> UGen -> UGen-dseries z length_ start step = mkUGen Nothing [DR] (Left DR) "Dseries" [length_,start,step] Nothing 1 (Special 0) (toUId z)---- | Demand rate random sequence generator------  Dshuf [DR] repeats=1.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-dshuf :: ID a => a -> UGen -> UGen -> UGen-dshuf z repeats list_ = mkUGen Nothing [DR] (Left DR) "Dshuf" [repeats] (Just list_) 1 (Special 0) (toUId z)---- | Demand rate input replicator------  Dstutter [DR] n=0.0 in=0.0;    DEMAND/NONDET-dstutter :: ID a => a -> UGen -> UGen -> UGen-dstutter z n in_ = mkUGen Nothing [DR] (Left DR) "Dstutter" [n,in_] Nothing 1 (Special 0) (toUId z)---- | Demand rate generator for embedding different inputs------  Dswitch [DR] index=0.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-dswitch :: ID a => a -> UGen -> UGen -> UGen-dswitch z index_ list_ = mkUGen Nothing [DR] (Left DR) "Dswitch" [index_] (Just list_) 1 (Special 0) (toUId z)---- | Demand rate generator for switching between inputs.------  Dswitch1 [DR] index=0.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-dswitch1 :: ID a => a -> UGen -> UGen -> UGen-dswitch1 z index_ list_ = mkUGen Nothing [DR] (Left DR) "Dswitch1" [index_] (Just list_) 1 (Special 0) (toUId z)---- | Return the same unique series of values for several demand streams------  Dunique [DR] source=0.0 maxBufferSize=1024.0 protected=1.0;    DEMAND/NONDET-dunique :: ID a => a -> UGen -> UGen -> UGen -> UGen-dunique z source maxBufferSize protected = mkUGen Nothing [DR] (Left DR) "Dunique" [source,maxBufferSize,protected] Nothing 1 (Special 0) (toUId z)---- | Random impulses.------  Dust [KR,AR] density=0.0;    NONDET-dust :: ID a => a -> Rate -> UGen -> UGen-dust z rate density = mkUGen Nothing [KR,AR] (Left rate) "Dust" [density] Nothing 1 (Special 0) (toUId z)---- | Random impulses.------  Dust2 [KR,AR] density=0.0;    NONDET-dust2 :: ID a => a -> Rate -> UGen -> UGen-dust2 z rate density = mkUGen Nothing [KR,AR] (Left rate) "Dust2" [density] Nothing 1 (Special 0) (toUId z)---- | Demand results from demand rate UGens.------  Duty [KR,AR] dur=1.0 reset=0.0 doneAction=0.0 level=1.0;    REORDERS INPUTS: [0,1,3,2], ENUMERATION INPUTS: 2=DoneAction-duty :: Rate -> UGen -> UGen -> DoneAction -> UGen -> UGen-duty rate dur reset doneAction level = mkUGen Nothing [KR,AR] (Left rate) "Duty" [dur,reset,(from_done_action doneAction),level] Nothing 1 (Special 0) NoId---- | Demand rate white noise random generator.------  Dwhite [DR] length=1.0e8 lo=0.0 hi=1.0;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET-dwhite :: ID a => a -> UGen -> UGen -> UGen -> UGen-dwhite z length_ lo hi = mkUGen Nothing [DR] (Left DR) "Dwhite" [length_,lo,hi] Nothing 1 (Special 0) (toUId z)---- | Demand rate random sequence generator.------  Dxrand [DR] repeats=1.0 *list=0.0;    MCE, REORDERS INPUTS: [1,0], DEMAND/NONDET-dxrand :: ID a => a -> UGen -> UGen -> UGen-dxrand z repeats list_ = mkUGen Nothing [DR] (Left DR) "Dxrand" [repeats] (Just list_) 1 (Special 0) (toUId z)---- | Envelope generator------  EnvGen [KR,AR] gate=1.0 levelScale=1.0 levelBias=0.0 timeScale=1.0 doneAction=0.0 *envelope=0.0;    MCE, REORDERS INPUTS: [5,0,1,2,3,4,5], ENUMERATION INPUTS: 4=DoneAction, 5=Envelope UGen-envGen :: Rate -> UGen -> UGen -> UGen -> UGen -> DoneAction -> Envelope UGen -> UGen-envGen rate gate_ levelScale levelBias timeScale doneAction envelope_ = mkUGen Nothing [KR,AR] (Left rate) "EnvGen" [gate_,levelScale,levelBias,timeScale,(from_done_action doneAction)] (Just (envelope_to_ugen envelope_)) 1 (Special 0) NoId---- | Exponential single random number generator.------  ExpRand [IR] lo=1.0e-2 hi=1.0;    FILTER: TRUE, NONDET-expRand :: ID a => a -> UGen -> UGen -> UGen-expRand z lo hi = mkUGen Nothing [IR] (Left IR) "ExpRand" [lo,hi] Nothing 1 (Special 0) (toUId z)---- | Feedback sine with chaotic phase indexing------  FBSineC [AR] freq=22050.0 im=1.0 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1-fbSineC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fbSineC rate freq im fb a c xi yi = mkUGen Nothing [AR] (Left rate) "FBSineC" [freq,im,fb,a,c,xi,yi] Nothing 1 (Special 0) NoId---- | Feedback sine with chaotic phase indexing------  FBSineL [AR] freq=22050.0 im=1.0 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1-fbSineL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fbSineL rate freq im fb a c xi yi = mkUGen Nothing [AR] (Left rate) "FBSineL" [freq,im,fb,a,c,xi,yi] Nothing 1 (Special 0) NoId---- | Feedback sine with chaotic phase indexing------  FBSineN [AR] freq=22050.0 im=1.0 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1-fbSineN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fbSineN rate freq im fb a c xi yi = mkUGen Nothing [AR] (Left rate) "FBSineN" [freq,im,fb,a,c,xi,yi] Nothing 1 (Special 0) NoId---- | Fast Fourier Transform------  FFT [KR] buffer=0.0 in=0.0 hop=0.5 wintype=0.0 active=1.0 winsize=0.0-fft :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fft buffer in_ hop wintype active winsize = mkUGen Nothing [KR] (Left KR) "FFT" [buffer,in_,hop,wintype,active,winsize] Nothing 1 (Special 0) NoId---- | First order filter section.------  FOS [KR,AR] in=0.0 a0=0.0 a1=0.0 b1=0.0;    FILTER: TRUE-fos :: UGen -> UGen -> UGen -> UGen -> UGen-fos in_ a0 a1 b1 = mkUGen Nothing [KR,AR] (Right [0]) "FOS" [in_,a0,a1,b1] Nothing 1 (Special 0) NoId---- | Fast sine oscillator.------  FSinOsc [KR,AR] freq=440.0 iphase=0.0-fSinOsc :: Rate -> UGen -> UGen -> UGen-fSinOsc rate freq iphase = mkUGen Nothing [KR,AR] (Left rate) "FSinOsc" [freq,iphase] Nothing 1 (Special 0) NoId---- | Fold a signal outside given thresholds.------  Fold [IR,KR,AR] in=0.0 lo=0.0 hi=1.0;    FILTER: TRUE-fold :: UGen -> UGen -> UGen -> UGen-fold in_ lo hi = mkUGen Nothing [IR,KR,AR] (Right [0]) "Fold" [in_,lo,hi] Nothing 1 (Special 0) NoId---- | Formant oscillator------  Formant [AR] fundfreq=440.0 formfreq=1760.0 bwfreq=880.0-formant :: Rate -> UGen -> UGen -> UGen -> UGen-formant rate fundfreq formfreq bwfreq = mkUGen Nothing [AR] (Left rate) "Formant" [fundfreq,formfreq,bwfreq] Nothing 1 (Special 0) NoId---- | FOF-like filter.------  Formlet [KR,AR] in=0.0 freq=440.0 attacktime=1.0 decaytime=1.0;    FILTER: TRUE-formlet :: UGen -> UGen -> UGen -> UGen -> UGen-formlet in_ freq attacktime decaytime = mkUGen Nothing [KR,AR] (Right [0]) "Formlet" [in_,freq,attacktime,decaytime] Nothing 1 (Special 0) NoId---- | When triggered, frees a node.------  Free [KR] trig=0.0 id=0.0;    FILTER: TRUE-free :: UGen -> UGen -> UGen-free trig_ id_ = mkUGen Nothing [KR] (Right [0]) "Free" [trig_,id_] Nothing 1 (Special 0) NoId---- | When triggered, free enclosing synth.------  FreeSelf [KR] in=0.0-freeSelf :: UGen -> UGen-freeSelf in_ = mkUGen Nothing [KR] (Left KR) "FreeSelf" [in_] Nothing 1 (Special 0) NoId---- | Free the enclosing synth when a UGen is finished------  FreeSelfWhenDone [KR] src=0.0-freeSelfWhenDone :: UGen -> UGen-freeSelfWhenDone src = mkUGen Nothing [KR] (Left KR) "FreeSelfWhenDone" [src] Nothing 1 (Special 0) NoId---- | A reverb------  FreeVerb [AR] in=0.0 mix=0.33 room=0.5 damp=0.5;    FILTER: TRUE-freeVerb :: UGen -> UGen -> UGen -> UGen -> UGen-freeVerb in_ mix room damp = mkUGen Nothing [AR] (Right [0]) "FreeVerb" [in_,mix,room,damp] Nothing 1 (Special 0) NoId---- | A two-channel reverb------  FreeVerb2 [AR] in=0.0 in2=0.0 mix=0.33 room=0.5 damp=0.5;    FILTER: TRUE-freeVerb2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-freeVerb2 in_ in2 mix room damp = mkUGen Nothing [AR] (Right [0]) "FreeVerb2" [in_,in2,mix,room,damp] Nothing 2 (Special 0) NoId---- | Frequency Shifter.------  FreqShift [AR] in=0.0 freq=0.0 phase=0.0-freqShift :: UGen -> UGen -> UGen -> UGen-freqShift in_ freq phase = mkUGen Nothing [AR] (Left AR) "FreqShift" [in_,freq,phase] Nothing 1 (Special 0) NoId---- | A two-channel reverb------  GVerb [AR] in=0.0 roomsize=10.0 revtime=3.0 damping=0.5 inputbw=0.5 spread=15.0 drylevel=1.0 earlyreflevel=0.7 taillevel=0.5 maxroomsize=300.0;    FILTER: TRUE-gVerb :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-gVerb in_ roomsize revtime damping inputbw spread drylevel earlyreflevel taillevel maxroomsize = mkUGen Nothing [AR] (Right [0]) "GVerb" [in_,roomsize,revtime,damping,inputbw,spread,drylevel,earlyreflevel,taillevel,maxroomsize] Nothing 2 (Special 0) NoId---- | Gate or hold.------  Gate [KR,AR] in=0.0 trig=0.0;    FILTER: TRUE-gate :: UGen -> UGen -> UGen-gate in_ trig_ = mkUGen Nothing [KR,AR] (Right [0]) "Gate" [in_,trig_] Nothing 1 (Special 0) NoId---- | Gingerbreadman map chaotic generator------  GbmanL [AR] freq=22050.0 xi=1.2 yi=2.1-gbmanL :: Rate -> UGen -> UGen -> UGen -> UGen-gbmanL rate freq xi yi = mkUGen Nothing [AR] (Left rate) "GbmanL" [freq,xi,yi] Nothing 1 (Special 0) NoId---- | Gingerbreadman map chaotic generator------  GbmanN [AR] freq=22050.0 xi=1.2 yi=2.1-gbmanN :: Rate -> UGen -> UGen -> UGen -> UGen-gbmanN rate freq xi yi = mkUGen Nothing [AR] (Left rate) "GbmanN" [freq,xi,yi] Nothing 1 (Special 0) NoId---- | Dynamic stochastic synthesis generator.------  Gendy1 [KR,AR] ampdist=1.0 durdist=1.0 adparam=1.0 ddparam=1.0 minfreq=440.0 maxfreq=660.0 ampscale=0.5 durscale=0.5 initCPs=12.0 knum=0.0;    NONDET-gendy1 :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-gendy1 z rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUGen Nothing [KR,AR] (Left rate) "Gendy1" [ampdist,durdist,adparam,ddparam,minfreq,maxfreq,ampscale,durscale,initCPs,knum] Nothing 1 (Special 0) (toUId z)---- | Dynamic stochastic synthesis generator.------  Gendy2 [KR,AR] ampdist=1.0 durdist=1.0 adparam=1.0 ddparam=1.0 minfreq=440.0 maxfreq=660.0 ampscale=0.5 durscale=0.5 initCPs=12.0 knum=0.0 a=1.17 c=0.31;    NONDET-gendy2 :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-gendy2 z rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum a c = mkUGen Nothing [KR,AR] (Left rate) "Gendy2" [ampdist,durdist,adparam,ddparam,minfreq,maxfreq,ampscale,durscale,initCPs,knum,a,c] Nothing 1 (Special 0) (toUId z)---- | Dynamic stochastic synthesis generator.------  Gendy3 [KR,AR] ampdist=1.0 durdist=1.0 adparam=1.0 ddparam=1.0 freq=440.0 ampscale=0.5 durscale=0.5 initCPs=12.0 knum=0.0;    NONDET-gendy3 :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-gendy3 z rate ampdist durdist adparam ddparam freq ampscale durscale initCPs knum = mkUGen Nothing [KR,AR] (Left rate) "Gendy3" [ampdist,durdist,adparam,ddparam,freq,ampscale,durscale,initCPs,knum] Nothing 1 (Special 0) (toUId z)---- | Granular synthesis with sound stored in a buffer------  GrainBuf [AR] trigger=0.0 dur=1.0 sndbuf=0.0 rate=1.0 pos=0.0 interp=2.0 pan=0.0 envbufnum=-1.0 maxGrains=512.0;    NC INPUT: True-grainBuf :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainBuf numChannels trigger dur sndbuf rate_ pos interp pan envbufnum maxGrains = mkUGen Nothing [AR] (Left AR) "GrainBuf" [trigger,dur,sndbuf,rate_,pos,interp,pan,envbufnum,maxGrains] Nothing numChannels (Special 0) NoId---- | Granular synthesis with frequency modulated sine tones------  GrainFM [AR] trigger=0.0 dur=1.0 carfreq=440.0 modfreq=200.0 index=1.0 pan=0.0 envbufnum=-1.0 maxGrains=512.0;    NC INPUT: True-grainFM :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainFM numChannels trigger dur carfreq modfreq index_ pan envbufnum maxGrains = mkUGen Nothing [AR] (Left AR) "GrainFM" [trigger,dur,carfreq,modfreq,index_,pan,envbufnum,maxGrains] Nothing numChannels (Special 0) NoId---- | Granulate an input signal------  GrainIn [AR] trigger=0.0 dur=1.0 in=0.0 pan=0.0 envbufnum=-1.0 maxGrains=512.0;    NC INPUT: True-grainIn :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainIn numChannels trigger dur in_ pan envbufnum maxGrains = mkUGen Nothing [AR] (Left AR) "GrainIn" [trigger,dur,in_,pan,envbufnum,maxGrains] Nothing numChannels (Special 0) NoId---- | Granular synthesis with sine tones------  GrainSin [AR] trigger=0.0 dur=1.0 freq=440.0 pan=0.0 envbufnum=-1.0 maxGrains=512.0;    NC INPUT: True-grainSin :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainSin numChannels trigger dur freq pan envbufnum maxGrains = mkUGen Nothing [AR] (Left AR) "GrainSin" [trigger,dur,freq,pan,envbufnum,maxGrains] Nothing numChannels (Special 0) NoId---- | Gray Noise.------  GrayNoise [KR,AR] ;    NONDET-grayNoise :: ID a => a -> Rate -> UGen-grayNoise z rate = mkUGen Nothing [KR,AR] (Left rate) "GrayNoise" [] Nothing 1 (Special 0) (toUId z)---- | 2nd order Butterworth highpass filter.------  HPF [KR,AR] in=0.0 freq=440.0;    FILTER: TRUE-hpf :: UGen -> UGen -> UGen-hpf in_ freq = mkUGen Nothing [KR,AR] (Right [0]) "HPF" [in_,freq] Nothing 1 (Special 0) NoId---- | Two point difference filter------  HPZ1 [KR,AR] in=0.0;    FILTER: TRUE-hpz1 :: UGen -> UGen-hpz1 in_ = mkUGen Nothing [KR,AR] (Right [0]) "HPZ1" [in_] Nothing 1 (Special 0) NoId---- | Two zero fixed midcut.------  HPZ2 [KR,AR] in=0.0;    FILTER: TRUE-hPZ2 :: UGen -> UGen-hPZ2 in_ = mkUGen Nothing [KR,AR] (Right [0]) "HPZ2" [in_] Nothing 1 (Special 0) NoId---- | Randomized value.------  Hasher [KR,AR] in=0.0;    FILTER: TRUE-hasher :: UGen -> UGen-hasher in_ = mkUGen Nothing [KR,AR] (Right [0]) "Hasher" [in_] Nothing 1 (Special 0) NoId---- | Henon map chaotic generator------  HenonC [AR] freq=22050.0 a=1.4 b=0.3 x0=0.0 x1=0.0-henonC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-henonC rate freq a b x0 x1 = mkUGen Nothing [AR] (Left rate) "HenonC" [freq,a,b,x0,x1] Nothing 1 (Special 0) NoId---- | Henon map chaotic generator------  HenonL [AR] freq=22050.0 a=1.4 b=0.3 x0=0.0 x1=0.0-henonL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-henonL rate freq a b x0 x1 = mkUGen Nothing [AR] (Left rate) "HenonL" [freq,a,b,x0,x1] Nothing 1 (Special 0) NoId---- | Henon map chaotic generator------  HenonN [AR] freq=22050.0 a=1.4 b=0.3 x0=0.0 x1=0.0-henonN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-henonN rate freq a b x0 x1 = mkUGen Nothing [AR] (Left rate) "HenonN" [freq,a,b,x0,x1] Nothing 1 (Special 0) NoId---- | Applies the Hilbert transform to an input signal.------  Hilbert [AR] in=0.0;    FILTER: TRUE-hilbert :: UGen -> UGen-hilbert in_ = mkUGen Nothing [AR] (Right [0]) "Hilbert" [in_] Nothing 2 (Special 0) NoId---- | Applies the Hilbert transform to an input signal.------  HilbertFIR [AR] in=0.0 buffer=0.0-hilbertFIR :: Rate -> UGen -> UGen -> UGen-hilbertFIR rate in_ buffer = mkUGen Nothing [AR] (Left rate) "HilbertFIR" [in_,buffer] Nothing 2 (Special 0) NoId---- | Envelope generator for polling values from an Env------  IEnvGen [KR,AR] index=0.0 *envelope=0.0;    MCE, REORDERS INPUTS: [1,0], ENUMERATION INPUTS: 1=Envelope UGen-iEnvGen :: Rate -> UGen -> Envelope UGen -> UGen-iEnvGen rate index_ envelope_ = mkUGen Nothing [KR,AR] (Left rate) "IEnvGen" [index_] (Just (envelope_to_ugen envelope_)) 1 (Special 0) NoId---- | Inverse Fast Fourier Transform------  IFFT [KR,AR] buffer=0.0 wintype=0.0 winsize=0.0-ifft :: UGen -> UGen -> UGen -> UGen-ifft buffer wintype winsize = mkUGen Nothing [KR,AR] (Left AR) "IFFT" [buffer,wintype,winsize] Nothing 1 (Special 0) NoId---- | Single integer random number generator.------  IRand [IR] lo=0.0 hi=127.0;    NONDET-iRand :: ID a => a -> UGen -> UGen -> UGen-iRand z lo hi = mkUGen Nothing [IR] (Left IR) "IRand" [lo,hi] Nothing 1 (Special 0) (toUId z)---- | Impulse oscillator.------  Impulse [KR,AR] freq=440.0 phase=0.0-impulse :: Rate -> UGen -> UGen -> UGen-impulse rate freq phase = mkUGen Nothing [KR,AR] (Left rate) "Impulse" [freq,phase] Nothing 1 (Special 0) NoId---- | Read a signal from a bus.------  In [KR,AR] bus=0.0;    NC INPUT: True-in' :: Int -> Rate -> UGen -> UGen-in' numChannels rate bus = mkUGen Nothing [KR,AR] (Left rate) "In" [bus] Nothing numChannels (Special 0) NoId---- | Read signal from a bus with a current or one cycle old timestamp.------  InFeedback [AR] bus=0.0;    NC INPUT: True-inFeedback :: Int -> UGen -> UGen-inFeedback numChannels bus = mkUGen Nothing [AR] (Left AR) "InFeedback" [bus] Nothing numChannels (Special 0) NoId---- | Tests if a signal is within a given range.------  InRange [IR,KR,AR] in=0.0 lo=0.0 hi=1.0;    FILTER: TRUE-inRange :: UGen -> UGen -> UGen -> UGen-inRange in_ lo hi = mkUGen Nothing [IR,KR,AR] (Right [0]) "InRange" [in_,lo,hi] Nothing 1 (Special 0) NoId---- | Test if a point is within a given rectangle.------  InRect [KR,AR] x=0.0 y=0.0 rect=0.0-inRect :: Rate -> UGen -> UGen -> UGen -> UGen-inRect rate x y rect = mkUGen Nothing [KR,AR] (Left rate) "InRect" [x,y,rect] Nothing 1 (Special 0) NoId---- | Generate a trigger anytime a bus is set.------  InTrig [KR] bus=0.0;    NC INPUT: True-inTrig :: Int -> UGen -> UGen-inTrig numChannels bus = mkUGen Nothing [KR] (Left KR) "InTrig" [bus] Nothing numChannels (Special 0) NoId---- | Index into a table with a signal------  Index [KR,AR] bufnum=0.0 in=0.0;    FILTER: TRUE-index :: UGen -> UGen -> UGen-index bufnum in_ = mkUGen Nothing [KR,AR] (Right [1]) "Index" [bufnum,in_] Nothing 1 (Special 0) NoId---- | Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values------  IndexInBetween [KR,AR] bufnum=0.0 in=0.0;    FILTER: TRUE-indexInBetween :: UGen -> UGen -> UGen-indexInBetween bufnum in_ = mkUGen Nothing [KR,AR] (Right [1]) "IndexInBetween" [bufnum,in_] Nothing 1 (Special 0) NoId---- | Index into a table with a signal, linear interpolated------  IndexL [KR,AR] bufnum=0.0 in=0.0-indexL :: Rate -> UGen -> UGen -> UGen-indexL rate bufnum in_ = mkUGen Nothing [KR,AR] (Left rate) "IndexL" [bufnum,in_] Nothing 1 (Special 0) NoId---- | Base class for info ugens------  InfoUGenBase [IR]-infoUGenBase :: Rate -> UGen-infoUGenBase rate = mkUGen Nothing [IR] (Left rate) "InfoUGenBase" [] Nothing 1 (Special 0) NoId---- | A leaky integrator.------  Integrator [KR,AR] in=0.0 coef=1.0;    FILTER: TRUE-integrator :: UGen -> UGen -> UGen-integrator in_ coef = mkUGen Nothing [KR,AR] (Right [0]) "Integrator" [in_,coef] Nothing 1 (Special 0) NoId---- | Control to audio rate converter.------  K2A [AR] in=0.0-k2A :: UGen -> UGen-k2A in_ = mkUGen Nothing [AR] (Left AR) "K2A" [in_] Nothing 1 (Special 0) NoId---- | Respond to the state of a key------  KeyState [KR] keycode=0.0 minval=0.0 maxval=1.0 lag=0.2-keyState :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-keyState rate keycode minval maxval lag_ = mkUGen Nothing [KR] (Left rate) "KeyState" [keycode,minval,maxval,lag_] Nothing 1 (Special 0) NoId---- | Key tracker------  KeyTrack [KR] chain=0.0 keydecay=2.0 chromaleak=0.5-keyTrack :: Rate -> UGen -> UGen -> UGen -> UGen-keyTrack rate chain keydecay chromaleak = mkUGen Nothing [KR] (Left rate) "KeyTrack" [chain,keydecay,chromaleak] Nothing 1 (Special 0) NoId---- | Sine oscillator bank------  Klang [AR] freqscale=1.0 freqoffset=0.0 *specificationsArrayRef=0.0;    MCE, REORDERS INPUTS: [2,0,1]-klang :: Rate -> UGen -> UGen -> UGen -> UGen-klang rate freqscale freqoffset specificationsArrayRef = mkUGen Nothing [AR] (Left rate) "Klang" [freqscale,freqoffset] (Just specificationsArrayRef) 1 (Special 0) NoId---- | Bank of resonators------  Klank [AR] input=0.0 freqscale=1.0 freqoffset=0.0 decayscale=1.0 *specificationsArrayRef=0.0;    MCE, FILTER: TRUE, REORDERS INPUTS: [4,0,1,2,3]-klank :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-klank input freqscale freqoffset decayscale specificationsArrayRef = mkUGen Nothing [AR] (Right [0]) "Klank" [input,freqscale,freqoffset,decayscale] (Just specificationsArrayRef) 1 (Special 0) NoId---- | Clipped noise------  LFClipNoise [KR,AR] freq=500.0;    NONDET-lfClipNoise :: ID a => a -> Rate -> UGen -> UGen-lfClipNoise z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFClipNoise" [freq] Nothing 1 (Special 0) (toUId z)---- | A sine like shape made of two cubic pieces------  LFCub [KR,AR] freq=440.0 iphase=0.0-lfCub :: Rate -> UGen -> UGen -> UGen-lfCub rate freq iphase = mkUGen Nothing [KR,AR] (Left rate) "LFCub" [freq,iphase] Nothing 1 (Special 0) NoId---- | Dynamic clipped noise------  LFDClipNoise [KR,AR] freq=500.0;    NONDET-lfdClipNoise :: ID a => a -> Rate -> UGen -> UGen-lfdClipNoise z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFDClipNoise" [freq] Nothing 1 (Special 0) (toUId z)---- | Dynamic step noise------  LFDNoise0 [KR,AR] freq=500.0;    NONDET-lfdNoise0 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise0 z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFDNoise0" [freq] Nothing 1 (Special 0) (toUId z)---- | Dynamic ramp noise------  LFDNoise1 [KR,AR] freq=500.0;    NONDET-lfdNoise1 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise1 z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFDNoise1" [freq] Nothing 1 (Special 0) (toUId z)---- | Dynamic cubic noise------  LFDNoise3 [KR,AR] freq=500.0;    NONDET-lfdNoise3 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise3 z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFDNoise3" [freq] Nothing 1 (Special 0) (toUId z)---- | Gaussian function oscillator------  LFGauss [KR,AR] duration=1.0 width=0.1 iphase=0.0 loop=1.0 doneAction=0.0;    ENUMERATION INPUTS: 3=Loop, 4=DoneAction-lfGauss :: Rate -> UGen -> UGen -> UGen -> Loop -> DoneAction -> UGen-lfGauss rate duration width iphase loop doneAction = mkUGen Nothing [KR,AR] (Left rate) "LFGauss" [duration,width,iphase,(from_loop loop),(from_done_action doneAction)] Nothing 1 (Special 0) NoId---- | Step noise------  LFNoise0 [KR,AR] freq=500.0;    NONDET-lfNoise0 :: ID a => a -> Rate -> UGen -> UGen-lfNoise0 z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFNoise0" [freq] Nothing 1 (Special 0) (toUId z)---- | Ramp noise------  LFNoise1 [KR,AR] freq=500.0;    NONDET-lfNoise1 :: ID a => a -> Rate -> UGen -> UGen-lfNoise1 z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFNoise1" [freq] Nothing 1 (Special 0) (toUId z)---- | Quadratic noise.------  LFNoise2 [KR,AR] freq=500.0;    NONDET-lfNoise2 :: ID a => a -> Rate -> UGen -> UGen-lfNoise2 z rate freq = mkUGen Nothing [KR,AR] (Left rate) "LFNoise2" [freq] Nothing 1 (Special 0) (toUId z)---- | Parabolic oscillator------  LFPar [KR,AR] freq=440.0 iphase=0.0-lfPar :: Rate -> UGen -> UGen -> UGen-lfPar rate freq iphase = mkUGen Nothing [KR,AR] (Left rate) "LFPar" [freq,iphase] Nothing 1 (Special 0) NoId---- | pulse oscillator------  LFPulse [KR,AR] freq=440.0 iphase=0.0 width=0.5-lfPulse :: Rate -> UGen -> UGen -> UGen -> UGen-lfPulse rate freq iphase width = mkUGen Nothing [KR,AR] (Left rate) "LFPulse" [freq,iphase,width] Nothing 1 (Special 0) NoId---- | Sawtooth oscillator------  LFSaw [KR,AR] freq=440.0 iphase=0.0-lfSaw :: Rate -> UGen -> UGen -> UGen-lfSaw rate freq iphase = mkUGen Nothing [KR,AR] (Left rate) "LFSaw" [freq,iphase] Nothing 1 (Special 0) NoId---- | Triangle oscillator------  LFTri [KR,AR] freq=440.0 iphase=0.0-lfTri :: Rate -> UGen -> UGen -> UGen-lfTri rate freq iphase = mkUGen Nothing [KR,AR] (Left rate) "LFTri" [freq,iphase] Nothing 1 (Special 0) NoId---- | 2nd order Butterworth lowpass filter------  LPF [KR,AR] in=0.0 freq=440.0;    FILTER: TRUE-lpf :: UGen -> UGen -> UGen-lpf in_ freq = mkUGen Nothing [KR,AR] (Right [0]) "LPF" [in_,freq] Nothing 1 (Special 0) NoId---- | Two point average filter------  LPZ1 [KR,AR] in=0.0;    FILTER: TRUE-lpz1 :: UGen -> UGen-lpz1 in_ = mkUGen Nothing [KR,AR] (Right [0]) "LPZ1" [in_] Nothing 1 (Special 0) NoId---- | Two zero fixed lowpass------  LPZ2 [KR,AR] in=0.0;    FILTER: TRUE-lPZ2 :: UGen -> UGen-lPZ2 in_ = mkUGen Nothing [KR,AR] (Right [0]) "LPZ2" [in_] Nothing 1 (Special 0) NoId---- | Exponential lag------  Lag [KR,AR] in=0.0 lagTime=0.1;    FILTER: TRUE-lag :: UGen -> UGen -> UGen-lag in_ lagTime = mkUGen Nothing [KR,AR] (Right [0]) "Lag" [in_,lagTime] Nothing 1 (Special 0) NoId---- | Exponential lag------  Lag2 [KR,AR] in=0.0 lagTime=0.1;    FILTER: TRUE-lag2 :: UGen -> UGen -> UGen-lag2 in_ lagTime = mkUGen Nothing [KR,AR] (Right [0]) "Lag2" [in_,lagTime] Nothing 1 (Special 0) NoId---- | Exponential lag------  Lag2UD [KR,AR] in=0.0 lagTimeU=0.1 lagTimeD=0.1;    FILTER: TRUE-lag2UD :: UGen -> UGen -> UGen -> UGen-lag2UD in_ lagTimeU lagTimeD = mkUGen Nothing [KR,AR] (Right [0]) "Lag2UD" [in_,lagTimeU,lagTimeD] Nothing 1 (Special 0) NoId---- | Exponential lag------  Lag3 [KR,AR] in=0.0 lagTime=0.1;    FILTER: TRUE-lag3 :: UGen -> UGen -> UGen-lag3 in_ lagTime = mkUGen Nothing [KR,AR] (Right [0]) "Lag3" [in_,lagTime] Nothing 1 (Special 0) NoId---- | Exponential lag------  Lag3UD [KR,AR] in=0.0 lagTimeU=0.1 lagTimeD=0.1;    FILTER: TRUE-lag3UD :: UGen -> UGen -> UGen -> UGen-lag3UD in_ lagTimeU lagTimeD = mkUGen Nothing [KR,AR] (Right [0]) "Lag3UD" [in_,lagTimeU,lagTimeD] Nothing 1 (Special 0) NoId---- | Read a control signal from a bus with a lag------  LagIn [KR] bus=0.0 lag=0.1;    NC INPUT: True-lagIn :: Int -> UGen -> UGen -> UGen-lagIn numChannels bus lag_ = mkUGen Nothing [KR] (Left KR) "LagIn" [bus,lag_] Nothing numChannels (Special 0) NoId---- | Exponential lag------  LagUD [KR,AR] in=0.0 lagTimeU=0.1 lagTimeD=0.1;    FILTER: TRUE-lagUD :: UGen -> UGen -> UGen -> UGen-lagUD in_ lagTimeU lagTimeD = mkUGen Nothing [KR,AR] (Right [0]) "LagUD" [in_,lagTimeU,lagTimeD] Nothing 1 (Special 0) NoId---- | Output the last value before the input changed------  LastValue [KR,AR] in=0.0 diff=1.0e-2;    FILTER: TRUE-lastValue :: UGen -> UGen -> UGen-lastValue in_ diff = mkUGen Nothing [KR,AR] (Right [0]) "LastValue" [in_,diff] Nothing 1 (Special 0) NoId---- | Sample and hold------  Latch [KR,AR] in=0.0 trig=0.0;    FILTER: TRUE-latch :: UGen -> UGen -> UGen-latch in_ trig_ = mkUGen Nothing [KR,AR] (Right [0]) "Latch" [in_,trig_] Nothing 1 (Special 0) NoId---- | Latoocarfian chaotic generator------  LatoocarfianC [AR] freq=22050.0 a=1.0 b=3.0 c=0.5 d=0.5 xi=0.5 yi=0.5-latoocarfianC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-latoocarfianC rate freq a b c d xi yi = mkUGen Nothing [AR] (Left rate) "LatoocarfianC" [freq,a,b,c,d,xi,yi] Nothing 1 (Special 0) NoId---- | Latoocarfian chaotic generator------  LatoocarfianL [AR] freq=22050.0 a=1.0 b=3.0 c=0.5 d=0.5 xi=0.5 yi=0.5-latoocarfianL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-latoocarfianL rate freq a b c d xi yi = mkUGen Nothing [AR] (Left rate) "LatoocarfianL" [freq,a,b,c,d,xi,yi] Nothing 1 (Special 0) NoId---- | Latoocarfian chaotic generator------  LatoocarfianN [AR] freq=22050.0 a=1.0 b=3.0 c=0.5 d=0.5 xi=0.5 yi=0.5-latoocarfianN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-latoocarfianN rate freq a b c d xi yi = mkUGen Nothing [AR] (Left rate) "LatoocarfianN" [freq,a,b,c,d,xi,yi] Nothing 1 (Special 0) NoId---- | Remove DC------  LeakDC [KR,AR] in=0.0 coef=0.995;    FILTER: TRUE-leakDC :: UGen -> UGen -> UGen-leakDC in_ coef = mkUGen Nothing [KR,AR] (Right [0]) "LeakDC" [in_,coef] Nothing 1 (Special 0) NoId---- | Output least changed------  LeastChange [KR,AR] a=0.0 b=0.0-leastChange :: Rate -> UGen -> UGen -> UGen-leastChange rate a b = mkUGen Nothing [KR,AR] (Left rate) "LeastChange" [a,b] Nothing 1 (Special 0) NoId---- | Peak limiter------  Limiter [AR] in=0.0 level=1.0 dur=1.0e-2;    FILTER: TRUE-limiter :: UGen -> UGen -> UGen -> UGen-limiter in_ level dur = mkUGen Nothing [AR] (Right [0]) "Limiter" [in_,level,dur] Nothing 1 (Special 0) NoId---- | Linear congruential chaotic generator------  LinCongC [AR] freq=22050.0 a=1.1 c=0.13 m=1.0 xi=0.0-linCongC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linCongC rate freq a c m xi = mkUGen Nothing [AR] (Left rate) "LinCongC" [freq,a,c,m,xi] Nothing 1 (Special 0) NoId---- | Linear congruential chaotic generator------  LinCongL [AR] freq=22050.0 a=1.1 c=0.13 m=1.0 xi=0.0-linCongL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linCongL rate freq a c m xi = mkUGen Nothing [AR] (Left rate) "LinCongL" [freq,a,c,m,xi] Nothing 1 (Special 0) NoId---- | Linear congruential chaotic generator------  LinCongN [AR] freq=22050.0 a=1.1 c=0.13 m=1.0 xi=0.0-linCongN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linCongN rate freq a c m xi = mkUGen Nothing [AR] (Left rate) "LinCongN" [freq,a,c,m,xi] Nothing 1 (Special 0) NoId---- | Map a linear range to an exponential range------  LinExp [IR,KR,AR] in=0.0 srclo=0.0 srchi=1.0 dstlo=1.0 dsthi=2.0;    FILTER: TRUE-linExp :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linExp in_ srclo srchi dstlo dsthi = mkUGen Nothing [IR,KR,AR] (Right [0]) "LinExp" [in_,srclo,srchi,dstlo,dsthi] Nothing 1 (Special 0) NoId---- | Two channel linear pan.------  LinPan2 [KR,AR] in=0.0 pos=0.0 level=1.0;    FILTER: TRUE-linPan2 :: UGen -> UGen -> UGen -> UGen-linPan2 in_ pos level = mkUGen Nothing [KR,AR] (Right [0]) "LinPan2" [in_,pos,level] Nothing 2 (Special 0) NoId---- | Skewed random number generator.------  LinRand [IR] lo=0.0 hi=1.0 minmax=0.0;    NONDET-linRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-linRand z lo hi minmax = mkUGen Nothing [IR] (Left IR) "LinRand" [lo,hi,minmax] Nothing 1 (Special 0) (toUId z)---- | Two channel linear crossfade.------  LinXFade2 [KR,AR] inA=0.0 inB=0.0 pan=0.0 level=1.0;    FILTER: TRUE, PSUEDO INPUTS: [3]-linXFade2 :: UGen -> UGen -> UGen -> UGen -> UGen-linXFade2 inA inB pan level = mkUGen Nothing [KR,AR] (Right [0,1]) "LinXFade2" [inA,inB,pan,level] Nothing 1 (Special 0) NoId---- | Line generator.------  Line [KR,AR] start=0.0 end=1.0 dur=1.0 doneAction=0.0;    ENUMERATION INPUTS: 3=DoneAction-line :: Rate -> UGen -> UGen -> UGen -> DoneAction -> UGen-line rate start end dur doneAction = mkUGen Nothing [KR,AR] (Left rate) "Line" [start,end,dur,(from_done_action doneAction)] Nothing 1 (Special 0) NoId---- | Simple linear envelope generator.------  Linen [KR] gate=1.0 attackTime=1.0e-2 susLevel=1.0 releaseTime=1.0 doneAction=0.0;    ENUMERATION INPUTS: 4=DoneAction-linen :: UGen -> UGen -> UGen -> UGen -> DoneAction -> UGen-linen gate_ attackTime susLevel releaseTime doneAction = mkUGen Nothing [KR] (Left KR) "Linen" [gate_,attackTime,susLevel,releaseTime,(from_done_action doneAction)] Nothing 1 (Special 0) NoId---- | Allocate a buffer local to the synth------  LocalBuf [IR] numChannels=1.0 numFrames=1.0;    REORDERS INPUTS: [1,0], NONDET-localBuf :: ID a => a -> UGen -> UGen -> UGen-localBuf z numChannels numFrames = mkUGen Nothing [IR] (Left IR) "LocalBuf" [numChannels,numFrames] Nothing 1 (Special 0) (toUId z)---- | Define and read from buses local to a synth.------  LocalIn [KR,AR] *default=0.0;    MCE, NC INPUT: True-localIn :: Int -> Rate -> UGen -> UGen-localIn numChannels rate default_ = mkUGen Nothing [KR,AR] (Left rate) "LocalIn" [] (Just default_) numChannels (Special 0) NoId---- | Write to buses local to a synth.------  LocalOut [KR,AR] *channelsArray=0.0;    MCE, FILTER: TRUE-localOut :: UGen -> UGen-localOut input = mkUGen Nothing [KR,AR] (Right [0]) "LocalOut" [] (Just input) 0 (Special 0) NoId---- | Chaotic noise function------  Logistic [KR,AR] chaosParam=3.0 freq=1000.0 init=0.5-logistic :: Rate -> UGen -> UGen -> UGen -> UGen-logistic rate chaosParam freq init_ = mkUGen Nothing [KR,AR] (Left rate) "Logistic" [chaosParam,freq,init_] Nothing 1 (Special 0) NoId---- | Lorenz chaotic generator------  LorenzL [AR] freq=22050.0 s=10.0 r=28.0 b=2.667 h=5.0e-2 xi=0.1 yi=0.0 zi=0.0-lorenzL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-lorenzL rate freq s r b h xi yi zi = mkUGen Nothing [AR] (Left rate) "LorenzL" [freq,s,r,b,h,xi,yi,zi] Nothing 1 (Special 0) NoId---- | Extraction of instantaneous loudness in sones------  Loudness [KR] chain=0.0 smask=0.25 tmask=1.0-loudness :: UGen -> UGen -> UGen -> UGen-loudness chain smask tmask = mkUGen Nothing [KR] (Left KR) "Loudness" [chain,smask,tmask] Nothing 1 (Special 0) NoId---- | Mel frequency cepstral coefficients------  MFCC [KR] chain=0.0 numcoeff=13.0-mFCC :: Rate -> UGen -> UGen -> UGen-mFCC rate chain numcoeff = mkUGen Nothing [KR] (Left rate) "MFCC" [chain,numcoeff] Nothing 13 (Special 0) NoId---- | Reduce precision.------  MantissaMask [KR,AR] in=0.0 bits=3.0;    FILTER: TRUE-mantissaMask :: UGen -> UGen -> UGen-mantissaMask in_ bits = mkUGen Nothing [KR,AR] (Right [0]) "MantissaMask" [in_,bits] Nothing 1 (Special 0) NoId---- | Median filter.------  Median [KR,AR] length=3.0 in=0.0;    FILTER: TRUE-median :: UGen -> UGen -> UGen-median length_ in_ = mkUGen Nothing [KR,AR] (Right [1]) "Median" [length_,in_] Nothing 1 (Special 0) NoId---- | Parametric filter.------  MidEQ [KR,AR] in=0.0 freq=440.0 rq=1.0 db=0.0;    FILTER: TRUE-midEQ :: UGen -> UGen -> UGen -> UGen -> UGen-midEQ in_ freq rq db = mkUGen Nothing [KR,AR] (Right [0]) "MidEQ" [in_,freq,rq,db] Nothing 1 (Special 0) NoId---- | Minimum difference of two values in modulo arithmetics------  ModDif [IR,KR,AR] x=0.0 y=0.0 mod=1.0-modDif :: Rate -> UGen -> UGen -> UGen -> UGen-modDif rate x y mod_ = mkUGen Nothing [IR,KR,AR] (Left rate) "ModDif" [x,y,mod_] Nothing 1 (Special 0) NoId---- | Moog VCF implementation, designed by Federico Fontana------  MoogFF [KR,AR] in=0.0 freq=100.0 gain=2.0 reset=0.0;    FILTER: TRUE-moogFF :: UGen -> UGen -> UGen -> UGen -> UGen-moogFF in_ freq gain reset = mkUGen Nothing [KR,AR] (Right [0]) "MoogFF" [in_,freq,gain,reset] Nothing 1 (Special 0) NoId---- | Output most changed.------  MostChange [KR,AR] a=0.0 b=0.0;    FILTER: TRUE-mostChange :: UGen -> UGen -> UGen-mostChange a b = mkUGen Nothing [KR,AR] (Right [0,1]) "MostChange" [a,b] Nothing 1 (Special 0) NoId---- | Mouse button UGen.------  MouseButton [KR] minval=0.0 maxval=1.0 lag=0.2-mouseButton :: Rate -> UGen -> UGen -> UGen -> UGen-mouseButton rate minval maxval lag_ = mkUGen Nothing [KR] (Left rate) "MouseButton" [minval,maxval,lag_] Nothing 1 (Special 0) NoId---- | Cursor tracking UGen.------  MouseX [KR] minval=0.0 maxval=1.0 warp=0.0 lag=0.2;    ENUMERATION INPUTS: 2=Warp-mouseX :: Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseX rate minval maxval warp lag_ = mkUGen Nothing [KR] (Left rate) "MouseX" [minval,maxval,(from_warp warp),lag_] Nothing 1 (Special 0) NoId---- | Cursor tracking UGen.------  MouseY [KR] minval=0.0 maxval=1.0 warp=0.0 lag=0.2;    ENUMERATION INPUTS: 2=Warp-mouseY :: Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseY rate minval maxval warp lag_ = mkUGen Nothing [KR] (Left rate) "MouseY" [minval,maxval,(from_warp warp),lag_] Nothing 1 (Special 0) NoId---- | Sum of uniform distributions.------  NRand [IR] lo=0.0 hi=1.0 n=0.0;    NONDET-nRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-nRand z lo hi n = mkUGen Nothing [IR] (Left IR) "NRand" [lo,hi,n] Nothing 1 (Special 0) (toUId z)---- | Flattens dynamics.------  Normalizer [AR] in=0.0 level=1.0 dur=1.0e-2;    FILTER: TRUE-normalizer :: UGen -> UGen -> UGen -> UGen-normalizer in_ level dur = mkUGen Nothing [AR] (Right [0]) "Normalizer" [in_,level,dur] Nothing 1 (Special 0) NoId---- | Number of audio busses.------  NumAudioBuses [IR]-numAudioBuses :: UGen-numAudioBuses = mkUGen Nothing [IR] (Left IR) "NumAudioBuses" [] Nothing 1 (Special 0) NoId---- | Number of open buffers.------  NumBuffers [IR]-numBuffers :: UGen-numBuffers = mkUGen Nothing [IR] (Left IR) "NumBuffers" [] Nothing 1 (Special 0) NoId---- | Number of control busses.------  NumControlBuses [IR]-numControlBuses :: UGen-numControlBuses = mkUGen Nothing [IR] (Left IR) "NumControlBuses" [] Nothing 1 (Special 0) NoId---- | Number of input busses.------  NumInputBuses [IR]-numInputBuses :: UGen-numInputBuses = mkUGen Nothing [IR] (Left IR) "NumInputBuses" [] Nothing 1 (Special 0) NoId---- | Number of output busses.------  NumOutputBuses [IR]-numOutputBuses :: UGen-numOutputBuses = mkUGen Nothing [IR] (Left IR) "NumOutputBuses" [] Nothing 1 (Special 0) NoId---- | Number of currently running synths.------  NumRunningSynths [IR,KR]-numRunningSynths :: UGen-numRunningSynths = mkUGen Nothing [IR,KR] (Left IR) "NumRunningSynths" [] Nothing 1 (Special 0) NoId---- | Write a signal to a bus with sample accurate timing.------  OffsetOut [KR,AR] bus=0.0 *channelsArray=0.0;    MCE, FILTER: TRUE-offsetOut :: UGen -> UGen -> UGen-offsetOut bus input = mkUGen Nothing [KR,AR] (Right [1]) "OffsetOut" [bus] (Just input) 0 (Special 0) NoId---- | One pole filter.------  OnePole [KR,AR] in=0.0 coef=0.5;    FILTER: TRUE-onePole :: UGen -> UGen -> UGen-onePole in_ coef = mkUGen Nothing [KR,AR] (Right [0]) "OnePole" [in_,coef] Nothing 1 (Special 0) NoId---- | One zero filter.------  OneZero [KR,AR] in=0.0 coef=0.5;    FILTER: TRUE-oneZero :: UGen -> UGen -> UGen-oneZero in_ coef = mkUGen Nothing [KR,AR] (Right [0]) "OneZero" [in_,coef] Nothing 1 (Special 0) NoId---- | Onset detector------  Onsets [KR] chain=0.0 threshold=0.5 odftype=3.0 relaxtime=1.0 floor=0.1 mingap=10.0 medianspan=11.0 whtype=1.0 rawodf=0.0-onsets :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-onsets chain threshold odftype relaxtime floor_ mingap medianspan whtype rawodf = mkUGen Nothing [KR] (Left KR) "Onsets" [chain,threshold,odftype,relaxtime,floor_,mingap,medianspan,whtype,rawodf] Nothing 1 (Special 0) NoId---- | Interpolating wavetable oscillator.------  Osc [KR,AR] bufnum=0.0 freq=440.0 phase=0.0-osc :: Rate -> UGen -> UGen -> UGen -> UGen-osc rate bufnum freq phase = mkUGen Nothing [KR,AR] (Left rate) "Osc" [bufnum,freq,phase] Nothing 1 (Special 0) NoId---- | Noninterpolating wavetable oscillator.------  OscN [KR,AR] bufnum=0.0 freq=440.0 phase=0.0-oscN :: Rate -> UGen -> UGen -> UGen -> UGen-oscN rate bufnum freq phase = mkUGen Nothing [KR,AR] (Left rate) "OscN" [bufnum,freq,phase] Nothing 1 (Special 0) NoId---- | Write a signal to a bus.------  Out [KR,AR] bus=0.0 *channelsArray=0.0;    MCE, FILTER: TRUE-out :: UGen -> UGen -> UGen-out bus input = mkUGen Nothing [KR,AR] (Right [1]) "Out" [bus] (Just input) 0 (Special 0) NoId---- | Very fast sine grain with a parabolic envelope------  PSinGrain [AR] freq=440.0 dur=0.2 amp=1.0-pSinGrain :: Rate -> UGen -> UGen -> UGen -> UGen-pSinGrain rate freq dur amp = mkUGen Nothing [AR] (Left rate) "PSinGrain" [freq,dur,amp] Nothing 1 (Special 0) NoId---- | Complex addition.------  PV_Add [KR] bufferA=0.0 bufferB=0.0-pv_Add :: UGen -> UGen -> UGen-pv_Add bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_Add" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Scramble bins.------  PV_BinScramble [KR] buffer=0.0 wipe=0.0 width=0.2 trig=0.0;    NONDET-pv_BinScramble :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen-pv_BinScramble z buffer wipe width trig_ = mkUGen Nothing [KR] (Left KR) "PV_BinScramble" [buffer,wipe,width,trig_] Nothing 1 (Special 0) (toUId z)---- | Shift and stretch bin position.------  PV_BinShift [KR] buffer=0.0 stretch=1.0 shift=0.0 interp=0.0-pv_BinShift :: UGen -> UGen -> UGen -> UGen -> UGen-pv_BinShift buffer stretch shift interp = mkUGen Nothing [KR] (Left KR) "PV_BinShift" [buffer,stretch,shift,interp] Nothing 1 (Special 0) NoId---- | Combine low and high bins from two inputs.------  PV_BinWipe [KR] bufferA=0.0 bufferB=0.0 wipe=0.0-pv_BinWipe :: UGen -> UGen -> UGen -> UGen-pv_BinWipe bufferA bufferB wipe = mkUGen Nothing [KR] (Left KR) "PV_BinWipe" [bufferA,bufferB,wipe] Nothing 1 (Special 0) NoId---- | Zero bins.------  PV_BrickWall [KR] buffer=0.0 wipe=0.0-pv_BrickWall :: UGen -> UGen -> UGen-pv_BrickWall buffer wipe = mkUGen Nothing [KR] (Left KR) "PV_BrickWall" [buffer,wipe] Nothing 1 (Special 0) NoId---- | Base class for UGens that alter FFT chains------  PV_ChainUGen [KR] maxSize=0.0-pv_ChainUGen :: UGen -> UGen-pv_ChainUGen maxSize = mkUGen Nothing [KR] (Left KR) "PV_ChainUGen" [maxSize] Nothing 1 (Special 0) NoId---- | Complex plane attack.------  PV_ConformalMap [KR] buffer=0.0 areal=0.0 aimag=0.0-pv_ConformalMap :: UGen -> UGen -> UGen -> UGen-pv_ConformalMap buffer areal aimag = mkUGen Nothing [KR] (Left KR) "PV_ConformalMap" [buffer,areal,aimag] Nothing 1 (Special 0) NoId---- | Complex conjugate------  PV_Conj [KR] buffer=0.0-pv_Conj :: UGen -> UGen-pv_Conj buffer = mkUGen Nothing [KR] (Left KR) "PV_Conj" [buffer] Nothing 1 (Special 0) NoId---- | Copy an FFT buffer------  PV_Copy [KR] bufferA=0.0 bufferB=0.0-pv_Copy :: UGen -> UGen -> UGen-pv_Copy bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_Copy" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Copy magnitudes and phases.------  PV_CopyPhase [KR] bufferA=0.0 bufferB=0.0-pv_CopyPhase :: UGen -> UGen -> UGen-pv_CopyPhase bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_CopyPhase" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Random phase shifting.------  PV_Diffuser [KR] buffer=0.0 trig=0.0-pv_Diffuser :: UGen -> UGen -> UGen-pv_Diffuser buffer trig_ = mkUGen Nothing [KR] (Left KR) "PV_Diffuser" [buffer,trig_] Nothing 1 (Special 0) NoId---- | Complex division------  PV_Div [KR] bufferA=0.0 bufferB=0.0-pv_Div :: UGen -> UGen -> UGen-pv_Div bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_Div" [bufferA,bufferB] Nothing 1 (Special 0) NoId--pv_HainsworthFoote :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_HainsworthFoote buf h f thr wt = mkUGen Nothing [KR] (Left KR) "PV_HainsworthFoote" [buf,h,f,thr,wt] Nothing 1 (Special 0) NoId--pv_JensenAndersen :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_JensenAndersen buf sc hfe hfc sf thr wt = mkUGen Nothing [KR] (Left KR) "PV_JensenAndersen" [buf,sc,hfe,hfc,sf,thr,wt] Nothing 1 (Special 0) NoId--{- hsc3-db----- | FFT onset detector.------  PV_HainsworthFoote [KR,AR] maxSize=0.0-pv_HainsworthFoote :: UGen -> UGen-pv_HainsworthFoote maxSize = mkUGen Nothing [KR,AR] (Left KR) "PV_HainsworthFoote" [maxSize] Nothing 1 (Special 0) NoId---- | FFT feature detector for onset detection.------  PV_JensenAndersen [KR,AR] maxSize=0.0-pv_JensenAndersen :: UGen -> UGen-pv_JensenAndersen maxSize = mkUGen Nothing [KR,AR] (Left KR) "PV_JensenAndersen" [maxSize] Nothing 1 (Special 0) NoId--}---- | Pass bins which are a local maximum.------  PV_LocalMax [KR] buffer=0.0 threshold=0.0-pv_LocalMax :: UGen -> UGen -> UGen-pv_LocalMax buffer threshold = mkUGen Nothing [KR] (Left KR) "PV_LocalMax" [buffer,threshold] Nothing 1 (Special 0) NoId---- | Pass bins above a threshold.------  PV_MagAbove [KR] buffer=0.0 threshold=0.0-pv_MagAbove :: UGen -> UGen -> UGen-pv_MagAbove buffer threshold = mkUGen Nothing [KR] (Left KR) "PV_MagAbove" [buffer,threshold] Nothing 1 (Special 0) NoId---- | Pass bins below a threshold.------  PV_MagBelow [KR] buffer=0.0 threshold=0.0-pv_MagBelow :: UGen -> UGen -> UGen-pv_MagBelow buffer threshold = mkUGen Nothing [KR] (Left KR) "PV_MagBelow" [buffer,threshold] Nothing 1 (Special 0) NoId---- | Clip bins to a threshold.------  PV_MagClip [KR] buffer=0.0 threshold=0.0-pv_MagClip :: UGen -> UGen -> UGen-pv_MagClip buffer threshold = mkUGen Nothing [KR] (Left KR) "PV_MagClip" [buffer,threshold] Nothing 1 (Special 0) NoId---- | Division of magnitudes------  PV_MagDiv [KR] bufferA=0.0 bufferB=0.0 zeroed=1.0e-4-pv_MagDiv :: UGen -> UGen -> UGen -> UGen-pv_MagDiv bufferA bufferB zeroed = mkUGen Nothing [KR] (Left KR) "PV_MagDiv" [bufferA,bufferB,zeroed] Nothing 1 (Special 0) NoId---- | Freeze magnitudes.------  PV_MagFreeze [KR] buffer=0.0 freeze=0.0-pv_MagFreeze :: UGen -> UGen -> UGen-pv_MagFreeze buffer freeze = mkUGen Nothing [KR] (Left KR) "PV_MagFreeze" [buffer,freeze] Nothing 1 (Special 0) NoId---- | Multiply magnitudes.------  PV_MagMul [KR] bufferA=0.0 bufferB=0.0-pv_MagMul :: UGen -> UGen -> UGen-pv_MagMul bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_MagMul" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Multiply magnitudes by noise.------  PV_MagNoise [KR] buffer=0.0-pv_MagNoise :: UGen -> UGen-pv_MagNoise buffer = mkUGen Nothing [KR] (Left KR) "PV_MagNoise" [buffer] Nothing 1 (Special 0) NoId---- | shift and stretch magnitude bin position.------  PV_MagShift [KR] buffer=0.0 stretch=1.0 shift=0.0-pv_MagShift :: UGen -> UGen -> UGen -> UGen-pv_MagShift buffer stretch shift = mkUGen Nothing [KR] (Left KR) "PV_MagShift" [buffer,stretch,shift] Nothing 1 (Special 0) NoId---- | Average magnitudes across bins.------  PV_MagSmear [KR] buffer=0.0 bins=0.0-pv_MagSmear :: UGen -> UGen -> UGen-pv_MagSmear buffer bins = mkUGen Nothing [KR] (Left KR) "PV_MagSmear" [buffer,bins] Nothing 1 (Special 0) NoId---- | Square magnitudes.------  PV_MagSquared [KR] buffer=0.0-pv_MagSquared :: UGen -> UGen-pv_MagSquared buffer = mkUGen Nothing [KR] (Left KR) "PV_MagSquared" [buffer] Nothing 1 (Special 0) NoId---- | Maximum magnitude.------  PV_Max [KR] bufferA=0.0 bufferB=0.0-pv_Max :: UGen -> UGen -> UGen-pv_Max bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_Max" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Minimum magnitude.------  PV_Min [KR] bufferA=0.0 bufferB=0.0-pv_Min :: UGen -> UGen -> UGen-pv_Min bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_Min" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Complex multiply.------  PV_Mul [KR] bufferA=0.0 bufferB=0.0-pv_Mul :: UGen -> UGen -> UGen-pv_Mul bufferA bufferB = mkUGen Nothing [KR] (Left KR) "PV_Mul" [bufferA,bufferB] Nothing 1 (Special 0) NoId---- | Shift phase.------  PV_PhaseShift [KR] buffer=0.0 shift=0.0 integrate=0.0-pv_PhaseShift :: UGen -> UGen -> UGen -> UGen-pv_PhaseShift buffer shift integrate = mkUGen Nothing [KR] (Left KR) "PV_PhaseShift" [buffer,shift,integrate] Nothing 1 (Special 0) NoId---- | Shift phase by 270 degrees.------  PV_PhaseShift270 [KR] buffer=0.0-pv_PhaseShift270 :: UGen -> UGen-pv_PhaseShift270 buffer = mkUGen Nothing [KR] (Left KR) "PV_PhaseShift270" [buffer] Nothing 1 (Special 0) NoId---- | Shift phase by 90 degrees.------  PV_PhaseShift90 [KR] buffer=0.0-pv_PhaseShift90 :: UGen -> UGen-pv_PhaseShift90 buffer = mkUGen Nothing [KR] (Left KR) "PV_PhaseShift90" [buffer] Nothing 1 (Special 0) NoId---- | Pass random bins.------  PV_RandComb [KR] buffer=0.0 wipe=0.0 trig=0.0;    NONDET-pv_RandComb :: ID a => a -> UGen -> UGen -> UGen -> UGen-pv_RandComb z buffer wipe trig_ = mkUGen Nothing [KR] (Left KR) "PV_RandComb" [buffer,wipe,trig_] Nothing 1 (Special 0) (toUId z)---- | Crossfade in random bin order.------  PV_RandWipe [KR] bufferA=0.0 bufferB=0.0 wipe=0.0 trig=0.0;    NONDET-pv_RandWipe :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen-pv_RandWipe z bufferA bufferB wipe trig_ = mkUGen Nothing [KR] (Left KR) "PV_RandWipe" [bufferA,bufferB,wipe,trig_] Nothing 1 (Special 0) (toUId z)---- | Make gaps in spectrum.------  PV_RectComb [KR] buffer=0.0 numTeeth=0.0 phase=0.0 width=0.5-pv_RectComb :: UGen -> UGen -> UGen -> UGen -> UGen-pv_RectComb buffer numTeeth phase width = mkUGen Nothing [KR] (Left KR) "PV_RectComb" [buffer,numTeeth,phase,width] Nothing 1 (Special 0) NoId---- | Make gaps in spectrum.------  PV_RectComb2 [KR] bufferA=0.0 bufferB=0.0 numTeeth=0.0 phase=0.0 width=0.5-pv_RectComb2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_RectComb2 bufferA bufferB numTeeth phase width = mkUGen Nothing [KR] (Left KR) "PV_RectComb2" [bufferA,bufferB,numTeeth,phase,width] Nothing 1 (Special 0) NoId---- | Two channel equal power pan.------  Pan2 [KR,AR] in=0.0 pos=0.0 level=1.0;    FILTER: TRUE-pan2 :: UGen -> UGen -> UGen -> UGen-pan2 in_ pos level = mkUGen Nothing [KR,AR] (Right [0]) "Pan2" [in_,pos,level] Nothing 2 (Special 0) NoId---- | Four channel equal power pan.------  Pan4 [KR,AR] in=0.0 xpos=0.0 ypos=0.0 level=1.0-pan4 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-pan4 rate in_ xpos ypos level = mkUGen Nothing [KR,AR] (Left rate) "Pan4" [in_,xpos,ypos,level] Nothing 4 (Special 0) NoId---- | Azimuth panner------  PanAz [KR,AR] in=0.0 pos=0.0 level=1.0 width=2.0 orientation=0.5;    NC INPUT: True, FILTER: TRUE-panAz :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-panAz numChannels in_ pos level width orientation = mkUGen Nothing [KR,AR] (Right [0]) "PanAz" [in_,pos,level,width,orientation] Nothing numChannels (Special 0) NoId---- | Ambisonic B-format panner.------  PanB [KR,AR] in=0.0 azimuth=0.0 elevation=0.0 gain=1.0-panB :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-panB rate in_ azimuth elevation gain = mkUGen Nothing [KR,AR] (Left rate) "PanB" [in_,azimuth,elevation,gain] Nothing 4 (Special 0) NoId---- | 2D Ambisonic B-format panner.------  PanB2 [KR,AR] in=0.0 azimuth=0.0 gain=1.0-panB2 :: Rate -> UGen -> UGen -> UGen -> UGen-panB2 rate in_ azimuth gain = mkUGen Nothing [KR,AR] (Left rate) "PanB2" [in_,azimuth,gain] Nothing 3 (Special 0) NoId---- | Real-time partitioned convolution------  PartConv [AR] in=0.0 fftsize=0.0 irbufnum=0.0-partConv :: UGen -> UGen -> UGen -> UGen-partConv in_ fftsize irbufnum = mkUGen Nothing [AR] (Left AR) "PartConv" [in_,fftsize,irbufnum] Nothing 1 (Special 0) NoId---- | When triggered, pauses a node.------  Pause [KR] gate=0.0 id=0.0-pause :: UGen -> UGen -> UGen-pause gate_ id_ = mkUGen Nothing [KR] (Left KR) "Pause" [gate_,id_] Nothing 1 (Special 0) NoId---- | When triggered, pause enclosing synth.------  PauseSelf [KR] in=0.0-pauseSelf :: UGen -> UGen-pauseSelf in_ = mkUGen Nothing [KR] (Left KR) "PauseSelf" [in_] Nothing 1 (Special 0) NoId---- | FIXME: PauseSelfWhenDone purpose.------  PauseSelfWhenDone [KR] src=0.0-pauseSelfWhenDone :: UGen -> UGen-pauseSelfWhenDone src = mkUGen Nothing [KR] (Left KR) "PauseSelfWhenDone" [src] Nothing 1 (Special 0) NoId---- | Track peak signal amplitude.------  Peak [KR,AR] in=0.0 trig=0.0;    FILTER: TRUE-peak :: UGen -> UGen -> UGen-peak in_ trig_ = mkUGen Nothing [KR,AR] (Right [0]) "Peak" [in_,trig_] Nothing 1 (Special 0) NoId---- | Track peak signal amplitude.------  PeakFollower [KR,AR] in=0.0 decay=0.999;    FILTER: TRUE-peakFollower :: UGen -> UGen -> UGen-peakFollower in_ decay_ = mkUGen Nothing [KR,AR] (Right [0]) "PeakFollower" [in_,decay_] Nothing 1 (Special 0) NoId---- | A resettable linear ramp between two levels.------  Phasor [KR,AR] trig=0.0 rate=1.0 start=0.0 end=1.0 resetPos=0.0-phasor :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-phasor rate trig_ rate_ start end resetPos = mkUGen Nothing [KR,AR] (Left rate) "Phasor" [trig_,rate_,start,end,resetPos] Nothing 1 (Special 0) NoId---- | Pink Noise.------  PinkNoise [KR,AR] ;    NONDET-pinkNoise :: ID a => a -> Rate -> UGen-pinkNoise z rate = mkUGen Nothing [KR,AR] (Left rate) "PinkNoise" [] Nothing 1 (Special 0) (toUId z)---- | Autocorrelation pitch follower------  Pitch [KR] in=0.0 initFreq=440.0 minFreq=60.0 maxFreq=4000.0 execFreq=100.0 maxBinsPerOctave=16.0 median=1.0 ampThreshold=1.0e-2 peakThreshold=0.5 downSample=1.0 clar=0.0-pitch :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pitch in_ initFreq minFreq maxFreq execFreq maxBinsPerOctave median_ ampThreshold peakThreshold downSample clar = mkUGen Nothing [KR] (Left KR) "Pitch" [in_,initFreq,minFreq,maxFreq,execFreq,maxBinsPerOctave,median_,ampThreshold,peakThreshold,downSample,clar] Nothing 2 (Special 0) NoId---- | Time domain pitch shifter.------  PitchShift [AR] in=0.0 windowSize=0.2 pitchRatio=1.0 pitchDispersion=0.0 timeDispersion=0.0;    FILTER: TRUE-pitchShift :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pitchShift in_ windowSize pitchRatio pitchDispersion timeDispersion = mkUGen Nothing [AR] (Right [0]) "PitchShift" [in_,windowSize,pitchRatio,pitchDispersion,timeDispersion] Nothing 1 (Special 0) NoId---- | Sample playback oscillator.------  PlayBuf [KR,AR] bufnum=0.0 rate=1.0 trigger=1.0 startPos=0.0 loop=0.0 doneAction=0.0;    NC INPUT: True, ENUMERATION INPUTS: 4=Loop, 5=DoneAction-playBuf :: Int -> Rate -> UGen -> UGen -> UGen -> UGen -> Loop -> DoneAction -> UGen-playBuf numChannels rate bufnum rate_ trigger startPos loop doneAction = mkUGen Nothing [KR,AR] (Left rate) "PlayBuf" [bufnum,rate_,trigger,startPos,(from_loop loop),(from_done_action doneAction)] Nothing numChannels (Special 0) NoId---- | A Karplus-Strong UGen------  Pluck [AR] in=0.0 trig=1.0 maxdelaytime=0.2 delaytime=0.2 decaytime=1.0 coef=0.5;    FILTER: TRUE-pluck :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pluck in_ trig_ maxdelaytime delaytime decaytime coef = mkUGen Nothing [AR] (Right [0]) "Pluck" [in_,trig_,maxdelaytime,delaytime,decaytime,coef] Nothing 1 (Special 0) NoId---- | Band limited pulse wave.------  Pulse [KR,AR] freq=440.0 width=0.5-pulse :: Rate -> UGen -> UGen -> UGen-pulse rate freq width = mkUGen Nothing [KR,AR] (Left rate) "Pulse" [freq,width] Nothing 1 (Special 0) NoId---- | Pulse counter.------  PulseCount [KR,AR] trig=0.0 reset=0.0;    FILTER: TRUE-pulseCount :: UGen -> UGen -> UGen-pulseCount trig_ reset = mkUGen Nothing [KR,AR] (Right [0]) "PulseCount" [trig_,reset] Nothing 1 (Special 0) NoId---- | Pulse divider.------  PulseDivider [KR,AR] trig=0.0 div=2.0 start=0.0;    FILTER: TRUE-pulseDivider :: UGen -> UGen -> UGen -> UGen-pulseDivider trig_ div_ start = mkUGen Nothing [KR,AR] (Right [0]) "PulseDivider" [trig_,div_,start] Nothing 1 (Special 0) NoId---- | General quadratic map chaotic generator------  QuadC [AR] freq=22050.0 a=1.0 b=-1.0 c=-0.75 xi=0.0-quadC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-quadC rate freq a b c xi = mkUGen Nothing [AR] (Left rate) "QuadC" [freq,a,b,c,xi] Nothing 1 (Special 0) NoId---- | General quadratic map chaotic generator------  QuadL [AR] freq=22050.0 a=1.0 b=-1.0 c=-0.75 xi=0.0-quadL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-quadL rate freq a b c xi = mkUGen Nothing [AR] (Left rate) "QuadL" [freq,a,b,c,xi] Nothing 1 (Special 0) NoId---- | General quadratic map chaotic generator------  QuadN [AR] freq=22050.0 a=1.0 b=-1.0 c=-0.75 xi=0.0-quadN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-quadN rate freq a b c xi = mkUGen Nothing [AR] (Left rate) "QuadN" [freq,a,b,c,xi] Nothing 1 (Special 0) NoId---- | A resonant high pass filter.------  RHPF [KR,AR] in=0.0 freq=440.0 rq=1.0;    FILTER: TRUE-rhpf :: UGen -> UGen -> UGen -> UGen-rhpf in_ freq rq = mkUGen Nothing [KR,AR] (Right [0]) "RHPF" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | A resonant low pass filter.------  RLPF [KR,AR] in=0.0 freq=440.0 rq=1.0;    FILTER: TRUE-rlpf :: UGen -> UGen -> UGen -> UGen-rlpf in_ freq rq = mkUGen Nothing [KR,AR] (Right [0]) "RLPF" [in_,freq,rq] Nothing 1 (Special 0) NoId---- | Number of radians per sample.------  RadiansPerSample [IR]-radiansPerSample :: UGen-radiansPerSample = mkUGen Nothing [IR] (Left IR) "RadiansPerSample" [] Nothing 1 (Special 0) NoId---- | Break a continuous signal into line segments------  Ramp [KR,AR] in=0.0 lagTime=0.1;    FILTER: TRUE-ramp :: UGen -> UGen -> UGen-ramp in_ lagTime = mkUGen Nothing [KR,AR] (Right [0]) "Ramp" [in_,lagTime] Nothing 1 (Special 0) NoId---- | Single random number generator.------  Rand [IR] lo=0.0 hi=1.0;    NONDET-rand :: ID a => a -> UGen -> UGen -> UGen-rand z lo hi = mkUGen Nothing [IR] (Left IR) "Rand" [lo,hi] Nothing 1 (Special 0) (toUId z)---- | Set the synth's random generator ID.------  RandID [IR,KR] id=0.0-randID :: Rate -> UGen -> UGen-randID rate id_ = mkUGen Nothing [IR,KR] (Left rate) "RandID" [id_] Nothing 0 (Special 0) NoId---- | Sets the synth's random generator seed.------  RandSeed [IR,KR,AR] trig=0.0 seed=56789.0-randSeed :: Rate -> UGen -> UGen -> UGen-randSeed rate trig_ seed = mkUGen Nothing [IR,KR,AR] (Left rate) "RandSeed" [trig_,seed] Nothing 0 (Special 0) NoId---- | Record or overdub into a Buffer.------  RecordBuf [KR,AR] bufnum=0.0 offset=0.0 recLevel=1.0 preLevel=0.0 run=1.0 loop=1.0 trigger=1.0 doneAction=0.0 *inputArray=0.0;    MCE, REORDERS INPUTS: [8,0,1,2,3,4,5,6,7], ENUMERATION INPUTS: 5=Loop, 7=DoneAction-recordBuf :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> Loop -> UGen -> DoneAction -> UGen -> UGen-recordBuf rate bufnum offset recLevel preLevel run loop trigger doneAction inputArray = mkUGen Nothing [KR,AR] (Left rate) "RecordBuf" [bufnum,offset,recLevel,preLevel,run,(from_loop loop),trigger,(from_done_action doneAction)] (Just inputArray) 1 (Special 0) NoId---- | Send signal to a bus, overwriting previous contents.------  ReplaceOut [KR,AR] bus=0.0 *channelsArray=0.0;    MCE, FILTER: TRUE-replaceOut :: UGen -> UGen -> UGen-replaceOut bus input = mkUGen Nothing [KR,AR] (Right [1]) "ReplaceOut" [bus] (Just input) 0 (Special 0) NoId---- | Resonant filter.------  Resonz [KR,AR] in=0.0 freq=440.0 bwr=1.0;    FILTER: TRUE-resonz :: UGen -> UGen -> UGen -> UGen-resonz in_ freq bwr = mkUGen Nothing [KR,AR] (Right [0]) "Resonz" [in_,freq,bwr] Nothing 1 (Special 0) NoId---- | Ringing filter.------  Ringz [KR,AR] in=0.0 freq=440.0 decaytime=1.0;    FILTER: TRUE-ringz :: UGen -> UGen -> UGen -> UGen-ringz in_ freq decaytime = mkUGen Nothing [KR,AR] (Right [0]) "Ringz" [in_,freq,decaytime] Nothing 1 (Special 0) NoId---- | Rotate a sound field.------  Rotate2 [KR,AR] x=0.0 y=0.0 pos=0.0;    FILTER: TRUE-rotate2 :: UGen -> UGen -> UGen -> UGen-rotate2 x y pos = mkUGen Nothing [KR,AR] (Right [0,1]) "Rotate2" [x,y,pos] Nothing 2 (Special 0) NoId---- | Track maximum level.------  RunningMax [KR,AR] in=0.0 trig=0.0;    FILTER: TRUE-runningMax :: UGen -> UGen -> UGen-runningMax in_ trig_ = mkUGen Nothing [KR,AR] (Right [0]) "RunningMax" [in_,trig_] Nothing 1 (Special 0) NoId---- | Track minimum level.------  RunningMin [KR,AR] in=0.0 trig=0.0;    FILTER: TRUE-runningMin :: UGen -> UGen -> UGen-runningMin in_ trig_ = mkUGen Nothing [KR,AR] (Right [0]) "RunningMin" [in_,trig_] Nothing 1 (Special 0) NoId---- | Running sum over n frames------  RunningSum [KR,AR] in=0.0 numsamp=40.0;    FILTER: TRUE-runningSum :: UGen -> UGen -> UGen-runningSum in_ numsamp = mkUGen Nothing [KR,AR] (Right [0]) "RunningSum" [in_,numsamp] Nothing 1 (Special 0) NoId---- | Second order filter section (biquad).------  SOS [KR,AR] in=0.0 a0=0.0 a1=0.0 a2=0.0 b1=0.0 b2=0.0;    FILTER: TRUE-sos :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-sos in_ a0 a1 a2 b1 b2 = mkUGen Nothing [KR,AR] (Right [0]) "SOS" [in_,a0,a1,a2,b1,b2] Nothing 1 (Special 0) NoId---- | Duration of one sample.------  SampleDur [IR]-sampleDur :: UGen-sampleDur = mkUGen Nothing [IR] (Left IR) "SampleDur" [] Nothing 1 (Special 0) NoId---- | Server sample rate.------  SampleRate [IR]-sampleRate :: UGen-sampleRate = mkUGen Nothing [IR] (Left IR) "SampleRate" [] Nothing 1 (Special 0) NoId---- | Band limited sawtooth.------  Saw [KR,AR] freq=440.0-saw :: Rate -> UGen -> UGen-saw rate freq = mkUGen Nothing [KR,AR] (Left rate) "Saw" [freq] Nothing 1 (Special 0) NoId---- | Schmidt trigger.------  Schmidt [IR,KR,AR] in=0.0 lo=0.0 hi=1.0-schmidt :: UGen -> UGen -> UGen -> UGen-schmidt in_ lo hi = mkUGen Nothing [IR,KR,AR] (Right [0]) "Schmidt" [in_,lo,hi] Nothing 1 (Special 0) NoId---- | FIXME: ScopeOut purpose.------  ScopeOut [KR,AR] inputArray=0.0 bufnum=0.0-scopeOut :: Rate -> UGen -> UGen -> UGen-scopeOut rate inputArray bufnum = mkUGen Nothing [KR,AR] (Left rate) "ScopeOut" [inputArray,bufnum] Nothing 0 (Special 0) NoId---- | (Undocumented class)------  ScopeOut2 [KR,AR] inputArray=0.0 scopeNum=0.0 maxFrames=4096.0 scopeFrames=0.0-scopeOut2 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-scopeOut2 rate inputArray scopeNum maxFrames scopeFrames = mkUGen Nothing [KR,AR] (Left rate) "ScopeOut2" [inputArray,scopeNum,maxFrames,scopeFrames] Nothing 0 (Special 0) NoId---- | Select output from an array of inputs.------  Select [IR,KR,AR] which=0.0 *array=0.0;    MCE, FILTER: TRUE-select :: UGen -> UGen -> UGen-select which array = mkUGen Nothing [IR,KR,AR] (Right [0,1]) "Select" [which] (Just array) 1 (Special 0) NoId---- | Send a trigger message from the server back to the client.------  SendTrig [KR,AR] in=0.0 id=0.0 value=0.0;    FILTER: TRUE-sendTrig :: UGen -> UGen -> UGen -> UGen-sendTrig in_ id_ value = mkUGen Nothing [KR,AR] (Right [0]) "SendTrig" [in_,id_,value] Nothing 0 (Special 0) NoId---- | Set-reset flip flop.------  SetResetFF [KR,AR] trig=0.0 reset=0.0;    FILTER: TRUE-setResetFF :: UGen -> UGen -> UGen-setResetFF trig_ reset = mkUGen Nothing [KR,AR] (Right [0]) "SetResetFF" [trig_,reset] Nothing 1 (Special 0) NoId---- | Wave shaper.------  Shaper [KR,AR] bufnum=0.0 in=0.0;    FILTER: TRUE-shaper :: UGen -> UGen -> UGen-shaper bufnum in_ = mkUGen Nothing [KR,AR] (Right [1]) "Shaper" [bufnum,in_] Nothing 1 (Special 0) NoId---- | Interpolating sine wavetable oscillator.------  SinOsc [KR,AR] freq=440.0 phase=0.0-sinOsc :: Rate -> UGen -> UGen -> UGen-sinOsc rate freq phase = mkUGen Nothing [KR,AR] (Left rate) "SinOsc" [freq,phase] Nothing 1 (Special 0) NoId---- | Feedback FM oscillator------  SinOscFB [KR,AR] freq=440.0 feedback=0.0-sinOscFB :: Rate -> UGen -> UGen -> UGen-sinOscFB rate freq feedback = mkUGen Nothing [KR,AR] (Left rate) "SinOscFB" [freq,feedback] Nothing 1 (Special 0) NoId---- | Slew rate limiter.------  Slew [KR,AR] in=0.0 up=1.0 dn=1.0;    FILTER: TRUE-slew :: UGen -> UGen -> UGen -> UGen-slew in_ up dn = mkUGen Nothing [KR,AR] (Right [0]) "Slew" [in_,up,dn] Nothing 1 (Special 0) NoId---- | Slope of signal------  Slope [KR,AR] in=0.0;    FILTER: TRUE-slope :: UGen -> UGen-slope in_ = mkUGen Nothing [KR,AR] (Right [0]) "Slope" [in_] Nothing 1 (Special 0) NoId---- | Spectral centroid------  SpecCentroid [KR] buffer=0.0-specCentroid :: Rate -> UGen -> UGen-specCentroid rate buffer = mkUGen Nothing [KR] (Left rate) "SpecCentroid" [buffer] Nothing 1 (Special 0) NoId---- | Spectral Flatness measure------  SpecFlatness [KR] buffer=0.0-specFlatness :: Rate -> UGen -> UGen-specFlatness rate buffer = mkUGen Nothing [KR] (Left rate) "SpecFlatness" [buffer] Nothing 1 (Special 0) NoId---- | Find a percentile of FFT magnitude spectrum------  SpecPcile [KR] buffer=0.0 fraction=0.5 interpolate=0.0-specPcile :: Rate -> UGen -> UGen -> UGen -> UGen-specPcile rate buffer fraction interpolate = mkUGen Nothing [KR] (Left rate) "SpecPcile" [buffer,fraction,interpolate] Nothing 1 (Special 0) NoId---- | physical model of resonating spring------  Spring [KR,AR] in=0.0 spring=1.0 damp=0.0-spring :: Rate -> UGen -> UGen -> UGen -> UGen-spring rate in_ spring_ damp = mkUGen Nothing [KR,AR] (Left rate) "Spring" [in_,spring_,damp] Nothing 1 (Special 0) NoId---- | Standard map chaotic generator------  StandardL [AR] freq=22050.0 k=1.0 xi=0.5 yi=0.0-standardL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-standardL rate freq k xi yi = mkUGen Nothing [AR] (Left rate) "StandardL" [freq,k,xi,yi] Nothing 1 (Special 0) NoId---- | Standard map chaotic generator------  StandardN [AR] freq=22050.0 k=1.0 xi=0.5 yi=0.0-standardN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-standardN rate freq k xi yi = mkUGen Nothing [AR] (Left rate) "StandardN" [freq,k,xi,yi] Nothing 1 (Special 0) NoId---- | Pulse counter.------  Stepper [KR,AR] trig=0.0 reset=0.0 min=0.0 max=7.0 step=1.0 resetval=0.0;    FILTER: TRUE-stepper :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stepper trig_ reset min_ max_ step resetval = mkUGen Nothing [KR,AR] (Right [0]) "Stepper" [trig_,reset,min_,max_,step,resetval] Nothing 1 (Special 0) NoId---- | Stereo real-time convolver with linear interpolation------  StereoConvolution2L [AR] in=0.0 kernelL=0.0 kernelR=0.0 trigger=0.0 framesize=2048.0 crossfade=1.0-stereoConvolution2L :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stereoConvolution2L rate in_ kernelL kernelR trigger framesize crossfade = mkUGen Nothing [AR] (Left rate) "StereoConvolution2L" [in_,kernelL,kernelR,trigger,framesize,crossfade] Nothing 2 (Special 0) NoId---- | Offset from synth start within one sample.------  SubsampleOffset [IR]-subsampleOffset :: UGen-subsampleOffset = mkUGen Nothing [IR] (Left IR) "SubsampleOffset" [] Nothing 1 (Special 0) NoId---- | Sum three signals------  Sum3 [] in0=0.0 in1=0.0 in2=0.0;    FILTER: TRUE-sum3 :: UGen -> UGen -> UGen -> UGen-sum3 in0 in1 in2 = mkUGen Nothing [IR,KR,AR,DR] (Right [0,1,2]) "Sum3" [in0,in1,in2] Nothing 1 (Special 0) NoId---- | Sum four signals------  Sum4 [] in0=0.0 in1=0.0 in2=0.0 in3=0.0;    FILTER: TRUE-sum4 :: UGen -> UGen -> UGen -> UGen -> UGen-sum4 in0 in1 in2 in3 = mkUGen Nothing [IR,KR,AR,DR] (Right [0,1,2,3]) "Sum4" [in0,in1,in2,in3] Nothing 1 (Special 0) NoId---- | Triggered linear ramp------  Sweep [KR,AR] trig=0.0 rate=1.0;    FILTER: TRUE-sweep :: UGen -> UGen -> UGen-sweep trig_ rate_ = mkUGen Nothing [KR,AR] (Right [0]) "Sweep" [trig_,rate_] Nothing 1 (Special 0) NoId---- | Hard sync sawtooth wave.------  SyncSaw [KR,AR] syncFreq=440.0 sawFreq=440.0-syncSaw :: Rate -> UGen -> UGen -> UGen-syncSaw rate syncFreq sawFreq = mkUGen Nothing [KR,AR] (Left rate) "SyncSaw" [syncFreq,sawFreq] Nothing 1 (Special 0) NoId---- | Control rate trigger to audio rate trigger converter------  T2A [AR] in=0.0 offset=0.0-t2A :: UGen -> UGen -> UGen-t2A in_ offset = mkUGen Nothing [AR] (Left AR) "T2A" [in_,offset] Nothing 1 (Special 0) NoId---- | Audio rate trigger to control rate trigger converter------  T2K [KR] in=0.0-t2K :: Rate -> UGen -> UGen-t2K rate in_ = mkUGen Nothing [KR] (Left rate) "T2K" [in_] Nothing 1 (Special 0) NoId---- | physical model of bouncing object------  TBall [KR,AR] in=0.0 g=10.0 damp=0.0 friction=1.0e-2-tBall :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-tBall rate in_ g damp friction = mkUGen Nothing [KR,AR] (Left rate) "TBall" [in_,g,damp,friction] Nothing 1 (Special 0) NoId---- | Trigger delay.------  TDelay [KR,AR] in=0.0 dur=0.1;    FILTER: TRUE-tDelay :: UGen -> UGen -> UGen-tDelay in_ dur = mkUGen Nothing [KR,AR] (Right [0]) "TDelay" [in_,dur] Nothing 1 (Special 0) NoId---- | Demand results as trigger from demand rate UGens.------  TDuty [KR,AR] dur=1.0 reset=0.0 doneAction=0.0 level=1.0 gapFirst=0.0;    REORDERS INPUTS: [0,1,3,2,4], ENUMERATION INPUTS: 2=DoneAction-tDuty :: Rate -> UGen -> UGen -> DoneAction -> UGen -> UGen -> UGen-tDuty rate dur reset doneAction level gapFirst = mkUGen Nothing [KR,AR] (Left rate) "TDuty" [dur,reset,(from_done_action doneAction),level,gapFirst] Nothing 1 (Special 0) NoId---- | Triggered exponential random number generator.------  TExpRand [KR,AR] lo=1.0e-2 hi=1.0 trig=0.0;    FILTER: TRUE, NONDET-tExpRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tExpRand z lo hi trig_ = mkUGen Nothing [KR,AR] (Right [2]) "TExpRand" [lo,hi,trig_] Nothing 1 (Special 0) (toUId z)---- | Buffer granulator.------  TGrains [AR] trigger=0.0 bufnum=0.0 rate=1.0 centerPos=0.0 dur=0.1 pan=0.0 amp=0.1 interp=4.0;    NC INPUT: True-tGrains :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-tGrains numChannels trigger bufnum rate_ centerPos dur pan amp interp = mkUGen Nothing [AR] (Left AR) "TGrains" [trigger,bufnum,rate_,centerPos,dur,pan,amp,interp] Nothing numChannels (Special 0) NoId---- | Triggered integer random number generator.------  TIRand [KR,AR] lo=0.0 hi=127.0 trig=0.0;    FILTER: TRUE, NONDET-tIRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tIRand z lo hi trig_ = mkUGen Nothing [KR,AR] (Right [2]) "TIRand" [lo,hi,trig_] Nothing 1 (Special 0) (toUId z)---- | Triggered random number generator.------  TRand [KR,AR] lo=0.0 hi=1.0 trig=0.0;    FILTER: TRUE, NONDET-tRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tRand z lo hi trig_ = mkUGen Nothing [KR,AR] (Right [2]) "TRand" [lo,hi,trig_] Nothing 1 (Special 0) (toUId z)---- | Triggered windex.------  TWindex [KR,AR] in=0.0 normalize=0.0 *array=0.0;    MCE, FILTER: TRUE, REORDERS INPUTS: [0,2,1], NONDET-tWindex :: ID a => a -> UGen -> UGen -> UGen -> UGen-tWindex z in_ normalize array = mkUGen Nothing [KR,AR] (Right [0]) "TWindex" [in_,normalize] (Just array) 1 (Special 0) (toUId z)---- | Returns time since last triggered.------  Timer [KR,AR] trig=0.0;    FILTER: TRUE-timer :: UGen -> UGen-timer trig_ = mkUGen Nothing [KR,AR] (Right [0]) "Timer" [trig_] Nothing 1 (Special 0) NoId---- | Toggle flip flop.------  ToggleFF [KR,AR] trig=0.0;    FILTER: TRUE-toggleFF :: UGen -> UGen-toggleFF trig_ = mkUGen Nothing [KR,AR] (Right [0]) "ToggleFF" [trig_] Nothing 1 (Special 0) NoId---- | Timed trigger.------  Trig [KR,AR] in=0.0 dur=0.1;    FILTER: TRUE-trig :: UGen -> UGen -> UGen-trig in_ dur = mkUGen Nothing [KR,AR] (Right [0]) "Trig" [in_,dur] Nothing 1 (Special 0) NoId---- | Timed trigger.------  Trig1 [KR,AR] in=0.0 dur=0.1;    FILTER: TRUE-trig1 :: UGen -> UGen -> UGen-trig1 in_ dur = mkUGen Nothing [KR,AR] (Right [0]) "Trig1" [in_,dur] Nothing 1 (Special 0) NoId---- | FIXME: TrigControl purpose.------  TrigControl [IR,KR] values=0.0-trigControl :: Rate -> UGen -> UGen-trigControl rate values = mkUGen Nothing [IR,KR] (Left rate) "TrigControl" [values] Nothing 0 (Special 0) NoId---- | Two pole filter.------  TwoPole [KR,AR] in=0.0 freq=440.0 radius=0.8;    FILTER: TRUE-twoPole :: UGen -> UGen -> UGen -> UGen-twoPole in_ freq radius = mkUGen Nothing [KR,AR] (Right [0]) "TwoPole" [in_,freq,radius] Nothing 1 (Special 0) NoId---- | Two zero filter.------  TwoZero [KR,AR] in=0.0 freq=440.0 radius=0.8;    FILTER: TRUE-twoZero :: UGen -> UGen -> UGen -> UGen-twoZero in_ freq radius = mkUGen Nothing [KR,AR] (Right [0]) "TwoZero" [in_,freq,radius] Nothing 1 (Special 0) NoId---- | Apply a unary operation to the values of an input ugen------  UnaryOpUGen [] a=0.0;    FILTER: TRUE-unaryOpUGen :: UGen -> UGen-unaryOpUGen a = mkUGen Nothing [IR,KR,AR,DR] (Right [0]) "UnaryOpUGen" [a] Nothing 1 (Special 0) NoId---- | Stream in audio from a file, with variable rate------  VDiskIn [AR] bufnum=0.0 rate=1.0 loop=0.0 sendID=0.0;    NC INPUT: True, ENUMERATION INPUTS: 2=Loop-vDiskIn :: Int -> UGen -> UGen -> Loop -> UGen -> UGen-vDiskIn numChannels bufnum rate_ loop sendID = mkUGen Nothing [AR] (Left AR) "VDiskIn" [bufnum,rate_,(from_loop loop),sendID] Nothing numChannels (Special 0) NoId---- | Variable wavetable oscillator.------  VOsc [KR,AR] bufpos=0.0 freq=440.0 phase=0.0-vOsc :: Rate -> UGen -> UGen -> UGen -> UGen-vOsc rate bufpos freq phase = mkUGen Nothing [KR,AR] (Left rate) "VOsc" [bufpos,freq,phase] Nothing 1 (Special 0) NoId---- | Three variable wavetable oscillators.------  VOsc3 [KR,AR] bufpos=0.0 freq1=110.0 freq2=220.0 freq3=440.0-vOsc3 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-vOsc3 rate bufpos freq1 freq2 freq3 = mkUGen Nothing [KR,AR] (Left rate) "VOsc3" [bufpos,freq1,freq2,freq3] Nothing 1 (Special 0) NoId---- | Variable shaped lag------  VarLag [KR,AR] in=0.0 time=0.1 curvature=0.0 warp=5.0 start=0.0-varLag :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-varLag in_ time curvature warp start = mkUGen Nothing [KR,AR] (Right [0]) "VarLag" [in_,time,curvature,warp,start] Nothing 1 (Special 0) NoId---- | Variable duty saw------  VarSaw [KR,AR] freq=440.0 iphase=0.0 width=0.5-varSaw :: Rate -> UGen -> UGen -> UGen -> UGen-varSaw rate freq iphase width = mkUGen Nothing [KR,AR] (Left rate) "VarSaw" [freq,iphase,width] Nothing 1 (Special 0) NoId---- | The Vibrato oscillator models a slow frequency modulation.------  Vibrato [KR,AR] freq=440.0 rate=6.0 depth=2.0e-2 delay=0.0 onset=0.0 rateVariation=4.0e-2 depthVariation=0.1 iphase=0.0;    NONDET-vibrato :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-vibrato z rate freq rate_ depth delay onset rateVariation depthVariation iphase = mkUGen Nothing [KR,AR] (Left rate) "Vibrato" [freq,rate_,depth,delay,onset,rateVariation,depthVariation,iphase] Nothing 1 (Special 0) (toUId z)---- | Warp a buffer with a time pointer------  Warp1 [AR] bufnum=0.0 pointer=0.0 freqScale=1.0 windowSize=0.2 envbufnum=-1.0 overlaps=8.0 windowRandRatio=0.0 interp=1.0;    NC INPUT: True-warp1 :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-warp1 numChannels bufnum pointer freqScale windowSize envbufnum overlaps windowRandRatio interp = mkUGen Nothing [AR] (Left AR) "Warp1" [bufnum,pointer,freqScale,windowSize,envbufnum,overlaps,windowRandRatio,interp] Nothing numChannels (Special 0) NoId---- | White noise.------  WhiteNoise [KR,AR] ;    NONDET-whiteNoise :: ID a => a -> Rate -> UGen-whiteNoise z rate = mkUGen Nothing [KR,AR] (Left rate) "WhiteNoise" [] Nothing 1 (Special 0) (toUId z)---- | (Undocumented class)------  WidthFirstUGen [] maxSize=0.0-widthFirstUGen :: Rate -> UGen -> UGen-widthFirstUGen rate maxSize = mkUGen Nothing [IR,KR,AR,DR] (Left rate) "WidthFirstUGen" [maxSize] Nothing 1 (Special 0) NoId---- | Wrap a signal outside given thresholds.------  Wrap [IR,KR,AR] in=0.0 lo=0.0 hi=1.0;    FILTER: TRUE-wrap :: UGen -> UGen -> UGen -> UGen-wrap in_ lo hi = mkUGen Nothing [IR,KR,AR] (Right [0]) "Wrap" [in_,lo,hi] Nothing 1 (Special 0) NoId---- | Index into a table with a signal.------  WrapIndex [KR,AR] bufnum=0.0 in=0.0;    FILTER: TRUE-wrapIndex :: UGen -> UGen -> UGen-wrapIndex bufnum in_ = mkUGen Nothing [KR,AR] (Right [1]) "WrapIndex" [bufnum,in_] Nothing 1 (Special 0) NoId---- | Equal power two channel cross fade.------  XFade2 [KR,AR] inA=0.0 inB=0.0 pan=0.0 level=1.0;    FILTER: TRUE-xFade2 :: UGen -> UGen -> UGen -> UGen -> UGen-xFade2 inA inB pan level = mkUGen Nothing [KR,AR] (Right [0,1]) "XFade2" [inA,inB,pan,level] Nothing 1 (Special 0) NoId---- | Exponential line generator.------  XLine [KR,AR] start=1.0 end=2.0 dur=1.0 doneAction=0.0;    ENUMERATION INPUTS: 3=DoneAction-xLine :: Rate -> UGen -> UGen -> UGen -> DoneAction -> UGen-xLine rate start end dur doneAction = mkUGen Nothing [KR,AR] (Left rate) "XLine" [start,end,dur,(from_done_action doneAction)] Nothing 1 (Special 0) NoId---- | Send signal to a bus, crossfading with previous contents.------  XOut [KR,AR] bus=0.0 xfade=0.0 *channelsArray=0.0;    MCE, FILTER: TRUE-xOut :: UGen -> UGen -> UGen -> UGen-xOut bus xfade input = mkUGen Nothing [KR,AR] (Right [2]) "XOut" [bus,xfade] (Just input) 0 (Special 0) NoId---- | Zero crossing frequency follower------  ZeroCrossing [KR,AR] in=0.0;    FILTER: TRUE-zeroCrossing :: UGen -> UGen-zeroCrossing in_ = mkUGen Nothing [KR,AR] (Right [0]) "ZeroCrossing" [in_] Nothing 1 (Special 0) NoId---- | LocalBuf count------  MaxLocalBufs [IR] count=0.0-maxLocalBufs :: Rate -> UGen -> UGen-maxLocalBufs rate count = mkUGen Nothing [IR] (Left rate) "MaxLocalBufs" [count] Nothing 1 (Special 0) NoId---- | Multiply add------  MulAdd [IR,KR,AR] in=0.0 mul=0.0 add=0.0;    FILTER: TRUE-mulAdd :: UGen -> UGen -> UGen -> UGen-mulAdd in_ mul add = mkUGen Nothing [IR,KR,AR] (Right [0]) "MulAdd" [in_,mul,add] Nothing 1 (Special 0) NoId---- | Set local buffer------  SetBuf [IR] buf=0.0 offset=0.0 length=0.0 *array=0.0;    MCE, REORDERS INPUTS: [0,1,2,3]-setBuf :: UGen -> UGen -> UGen -> UGen -> UGen-setBuf buf offset length_ array = mkUGen Nothing [IR] (Left IR) "SetBuf" [buf,offset,length_] (Just array) 1 (Special 0) NoId
− Sound/SC3/UGen/Bindings/HW.hs
@@ -1,48 +0,0 @@--- | Hand-written bindings.-module Sound.SC3.UGen.Bindings.HW where--import qualified Sound.SC3.UGen.Bindings.HW.Construct as C-import qualified Sound.SC3.UGen.Identifier as I-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import qualified Sound.SC3.UGen.UGen as U---- | Zero local buffer.------ ClearBuf does not copy the buffer number through so this is an MRG node.-clearBuf :: UGen -> UGen-clearBuf b = U.mrg2 b (C.mkOsc IR "ClearBuf" [b] 1)---- | Demand rate weighted random sequence generator.-dwrand :: I.ID i => i -> UGen -> UGen -> UGen -> UGen-dwrand z repeats weights list_ =-    let n = mceDegree_err list_-        weights' = mceExtend n weights-        inp = repeats : constant n : weights'-    in mkUGen Nothing [DR] (Left DR) "Dwrand" inp (Just list_) 1 (Special 0) (U.toUId z)---- | Outputs signal for @FFT@ chains, without performing FFT.-fftTrigger :: UGen -> UGen -> UGen -> UGen-fftTrigger b h p = C.mkOsc KR "FFTTrigger" [b,h,p] 1---- | Pack demand-rate FFT bin streams into an FFT chain.-packFFT :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-packFFT b sz from to z mp =-    let n = constant (mceDegree_err mp)-    in C.mkOscMCE KR "PackFFT" [b, sz, from, to, z, n] mp 1---- | Poll value of input UGen when triggered.-poll :: UGen -> UGen -> UGen -> UGen -> UGen-poll t i l tr = C.mkFilter "Poll" ([t,i,tr] ++ U.unpackLabel l) 0---- | Send a reply message from the server back to all registered clients.-sendReply :: UGen -> UGen -> String -> [UGen] -> UGen-sendReply i k n v =-    let n' = map (fromIntegral . fromEnum) n-        s = fromIntegral (length n')-    in C.mkFilter "SendReply" ([i,k,s] ++ n' ++ v) 0---- | Unpack a single value (magnitude or phase) from an FFT chain-unpack1FFT :: UGen -> UGen -> UGen -> UGen -> UGen-unpack1FFT buf size index' which = C.mkOsc DR "Unpack1FFT" [buf, size, index', which] 1-
− Sound/SC3/UGen/Bindings/HW/Construct.hs
@@ -1,82 +0,0 @@--- | For hand-writing UGens.-module Sound.SC3.UGen.Bindings.HW.Construct where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type---- | Oscillator constructor with constrained set of operating 'Rate's.-mk_osc :: [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen-mk_osc rs z r c i o =-    if r `elem` rs-    then mkUGen Nothing rs (Left r) c i Nothing o (Special 0) z-    else error ("mk_osc: rate restricted: " ++ show (r, rs, c))---- | Oscillator constructor with 'all_rates'.-mkOsc :: Rate -> String -> [UGen] -> Int -> UGen-mkOsc = mk_osc all_rates no_id---- | Oscillator constructor, rate restricted variant.-mkOscR :: [Rate] -> Rate -> String -> [UGen] -> Int -> UGen-mkOscR rs = mk_osc rs no_id---- | Rate restricted oscillator constructor, setting identifier.-mkOscIdR :: [Rate] -> UGenId -> Rate -> String -> [UGen] -> Int -> UGen-mkOscIdR = mk_osc---- | Oscillator constructor, setting identifier.-mkOscId :: UGenId -> Rate -> String -> [UGen] -> Int -> UGen-mkOscId = mk_osc all_rates---- | Provided 'UGenId' variant of 'mkOscMCE'.-mk_osc_mce :: UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen-mk_osc_mce z r c i j =-    let i' = i ++ mceChannels j-    in mk_osc all_rates z r c i'---- | Variant oscillator constructor with MCE collapsing input.-mkOscMCE :: Rate -> String -> [UGen] -> UGen -> Int -> UGen-mkOscMCE = mk_osc_mce no_id---- | Variant oscillator constructor with MCE collapsing input.-mkOscMCEId :: UGenId -> Rate -> String -> [UGen] -> UGen -> Int -> UGen-mkOscMCEId = mk_osc_mce---- | Rate constrained filter 'UGen' constructor.-mk_filter :: [Rate] -> [Int] -> UGenId -> String -> [UGen] -> Int -> UGen-mk_filter rs ix z c i o = mkUGen Nothing rs (Right ix) c i Nothing o (Special 0) z---- | Filter UGen constructor.-mkFilterIdR :: [Rate] -> UGenId -> String -> [UGen] -> Int -> UGen-mkFilterIdR rs z nm i = mk_filter rs [0 .. length i - 1] z nm i---- | Filter UGen constructor.-mkFilterR :: [Rate] -> String -> [UGen] -> Int -> UGen-mkFilterR rs = mkFilterIdR rs no_id---- | Filter 'UGen' constructor.-mkFilter :: String -> [UGen] -> Int -> UGen-mkFilter = mkFilterR all_rates---- | Filter UGen constructor.-mkFilterId :: UGenId -> String -> [UGen] -> Int -> UGen-mkFilterId = mkFilterIdR all_rates---- | Provided 'UGenId' filter with 'mce' input.-mk_filter_mce :: [Rate] -> UGenId -> String -> [UGen] -> UGen -> Int -> UGen-mk_filter_mce rs z c i j = mkFilterIdR rs z c (i ++ mceChannels j)---- | Variant filter constructor with MCE collapsing input.-mkFilterMCER :: [Rate] -> String -> [UGen] -> UGen -> Int -> UGen-mkFilterMCER rs = mk_filter_mce rs no_id---- | Variant filter constructor with MCE collapsing input.-mkFilterMCE :: String -> [UGen] -> UGen -> Int -> UGen-mkFilterMCE = mk_filter_mce all_rates no_id---- | Variant filter constructor with MCE collapsing input.-mkFilterMCEId :: UGenId -> String -> [UGen] -> UGen -> Int -> UGen-mkFilterMCEId = mk_filter_mce all_rates---- | Information unit generators are very specialized.-mkInfo :: String -> UGen-mkInfo name = mkOsc IR name [] 1
− Sound/SC3/UGen/Bindings/HW/External.hs
@@ -1,6 +0,0 @@--- | Bindings to unit generators not distributed with SuperCollider proper.-module Sound.SC3.UGen.Bindings.HW.External (module U) where--import Sound.SC3.UGen.Bindings.HW.External.F0 as U-import Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins as U-import Sound.SC3.UGen.Bindings.HW.External.Zita as U
− Sound/SC3/UGen/Bindings/HW/External/F0.hs
@@ -1,20 +0,0 @@--- | F0 UGens.-module Sound.SC3.UGen.Bindings.HW.External.F0 where--import Sound.SC3.UGen.Bindings.HW.Construct-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type---- * f0plugins---- | Emulation of the sound generation hardware of the Atari TIA chip.-atari2600 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-atari2600 audc0 audc1 audf0 audf1 audv0 audv1 rate = mkOsc AR "Atari2600" [audc0,audc1,audf0,audf1,audv0,audv1,rate] 1---- | POKEY Chip Sound Simulator-mzPokey :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-mzPokey f1 c1 f2 c2 f3 c3 f4 c4 ctl = mkOsc AR "MZPokey" [f1,c1,f2,c2,f3,c3,f4,c4,ctl] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Bindings/HW/External/SC3_Plugins.hs
@@ -1,357 +0,0 @@--- | Bindings to unit generators in sc3-plugins.-module Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins where--import Sound.SC3.UGen.Bindings.HW.Construct-import Sound.SC3.UGen.Identifier-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- * AntiAliasingOscillators (Nick Collins)---- | Band limited impulse generation-blitB3 :: Rate -> UGen -> UGen-blitB3 rate freq = mkOscR [AR] rate "BlitB3" [freq] 1---- | BLIT derived sawtooth-blitB3Saw :: Rate -> UGen -> UGen -> UGen-blitB3Saw rate freq leak = mkOscR [AR] rate "BlitB3Saw" [freq,leak] 1---- | Bipolar BLIT derived square waveform-blitB3Square :: Rate -> UGen -> UGen -> UGen-blitB3Square rate freq leak = mkOscR [AR] rate "BlitB3Square" [freq,leak] 1---- | Bipolar BLIT derived triangle-blitB3Tri :: Rate -> UGen -> UGen -> UGen -> UGen-blitB3Tri rate freq leak leak2 = mkOscR [AR] rate "BlitB3Tri" [freq,leak,leak2] 1---- | Triangle via 3rd order differerentiated polynomial waveform-dPW3Tri :: Rate -> UGen -> UGen-dPW3Tri rate freq = mkOscR [AR] rate "DPW3Tri" [freq] 1---- | Sawtooth via 4th order differerentiated polynomial waveform-dPW4Saw :: Rate -> UGen -> UGen-dPW4Saw rate freq = mkOscR [AR] rate "DPW4Saw" [freq] 1---- * AuditoryModeling---- | Single gammatone filter-gammatone :: UGen -> UGen -> UGen -> UGen-gammatone input centrefrequency bandwidth = mkFilterR [AR] "Gammatone" [input,centrefrequency,bandwidth] 1---- | Simple cochlear hair cell model-hairCell :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-hairCell input spontaneousrate boostrate restorerate loss = mkFilterR [AR,KR] "HairCell" [input,spontaneousrate,boostrate,restorerate,loss] 1---- | Meddis cochlear hair cell model-meddis :: UGen -> UGen-meddis input = mkFilterR [AR,KR] "Meddis" [input] 1---- * AY---- | Emulation of AY (aka YM) soundchip, used in Spectrum\/Atari.-ay :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-ay ta tb tc n c va vb vc ef es ct = mkOsc AR "AY" [ta, tb, tc, n, c, va, vb, vc, ef, es, ct] 1---- | Convert frequency value to value appropriate for AY tone inputs.-ayFreqToTone :: Fractional a => a -> a-ayFreqToTone f = 110300 / (f - 0.5)---- * BatUGens---- | An amplitude tracking based onset detector-coyote :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-coyote rate in_ trackFall slowLag fastLag fastMul thresh minDur = mkOscR [KR] rate "Coyote" [in_,trackFall,slowLag,fastLag,fastMul,thresh,minDur] 1---- | Windowed amplitude follower-wAmp :: Rate -> UGen -> UGen -> UGen-wAmp rate in_ winSize = mkOscR [KR] rate "WAmp" [in_,winSize] 1---- * BhobUGens---- | Impulses around a certain frequency-gaussTrig :: Rate -> UGen -> UGen -> UGen-gaussTrig rate freq dev = mkOscR [AR,KR] rate "GaussTrig" [freq,dev] 1---- | random walk step-lfBrownNoise0 :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen-lfBrownNoise0 z r freq dev dist = mkOscIdR [AR,KR] (toUId z) r "LFBrownNoise0" [freq,dev,dist] 1---- | random walk linear interp-lfBrownNoise1 :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen-lfBrownNoise1 z r freq dev dist = mkOscIdR [AR,KR] (toUId z) r "LFBrownNoise1" [freq,dev,dist] 1---- | random walk cubic interp-lfBrownNoise2 :: ID a => a -> Rate -> UGen -> UGen -> UGen -> UGen-lfBrownNoise2 z r freq dev dist = mkOscIdR [AR,KR] (toUId z) r "LFBrownNoise2" [freq,dev,dist] 1---- | String resonance filter-streson :: UGen -> UGen -> UGen -> UGen-streson input delayTime res = mkFilter "Streson" [input,delayTime,res] 1---- | Triggered beta random distribution-tBetaRand :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-tBetaRand z lo hi prob1 prob2 trig_ = mkFilterIdR [AR,KR] (toUId z) "TBetaRand" [lo,hi,prob1,prob2,trig_] 1---- | Triggered random walk generator-tBrownRand :: ID a => a -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-tBrownRand z lo hi dev dist trig_ = mkFilterIdR [AR,KR] (toUId z) "TBrownRand" [lo,hi,dev,dist,trig_] 1---- | Triggered gaussian random distribution-tGaussRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tGaussRand z lo hi trig_ = mkFilterIdR [AR,KR] (toUId z) "TGaussRand" [lo,hi,trig_] 1---- * Concat---- | Concatenative cross-synthesis.-concat' :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-concat' ctl src sz sk sd ml fs zcr lms sc st rs = mkOsc AR "Concat" [ctl,src,sz,sk,sd,ml,fs,zcr,lms,sc,st,rs] 1---- | Concatenative cross-synthesis (variant).-concat2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-concat2 ctl src sz sk sd ml fs zcr lms sc st rs th = mkOsc AR "Concat2" [ctl,src,sz,sk,sd,ml,fs,zcr,lms,sc,st,rs,th] 1---- * DEIND UGens---- | FM-modulable resonating filter-complexRes :: Rate -> UGen -> UGen -> UGen -> UGen-complexRes rate in_ freq decay_ = mkOscR [AR] rate "ComplexRes" [in_,freq,decay_] 1---- | Ring modulation based on the physical model of a diode.-diodeRingMod :: Rate -> UGen -> UGen -> UGen-diodeRingMod rate car mod_ = mkOscR [AR] rate "DiodeRingMod" [car,mod_] 1---- | Demand rate implementation of a Wiard noise ring-dNoiseRing :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-dNoiseRing rate change chance shift numBits resetval = mkOscR [] rate "DNoiseRing" [change,chance,shift,numBits,resetval] 1---- | algorithmic delay-greyholeRaw :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-greyholeRaw rate in1 in2 damping delaytime diffusion feedback moddepth modfreq size = mkOscR [AR] rate "GreyholeRaw" [in1,in2,damping,delaytime,diffusion,feedback,moddepth,modfreq,size] 1---- | Raw version of the JPverb algorithmic reverberator, designed to produce long tails with chorusing-jPverbRaw :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-jPverbRaw rate in1 in2 damp earlydiff highband highx lowband lowx mdepth mfreq midx size t60 = mkOscR [AR,KR] rate "JPverbRaw" [in1,in2,damp,earlydiff,highband,highx,lowband,lowx,mdepth,mfreq,midx,size,t60] 1---- * Distortion---- | Brown noise.-disintegrator :: ID a => a -> UGen -> UGen -> UGen -> UGen-disintegrator z i p m = mkFilterId (toUId z) "Disintegrator" [i,p,m] 1---- * DWGUGens---- | Plucked physical model.-dWGPlucked2 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-dWGPlucked2 rate freq amp gate_ pos c1 c3 inp release mistune mp gc = mkOscR [AR] rate "DWGPlucked2" [freq,amp,gate_,pos,c1,c3,inp,release,mistune,mp,gc] 1---- * Josh---- | Resynthesize sinusoidal ATS analysis data.-atsSynth :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-atsSynth b np ps pk fp m a = mkOsc AR "AtsSynth" [b, np, ps, pk, fp, m, a] 1---- | Resynthesize sinusoidal and critical noise ATS analysis data.-atsNoiSynth :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-atsNoiSynth b np ps pk fp sr nr m a nb bs bk = mkOsc AR "AtsNoiSynth" [b, np, ps, pk, fp, sr, nr, m, a, nb, bs, bk] 1---- | Granular synthesis with FM grains.-fmGrain :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fmGrain trigger dur carfreq modfreq ix = mkOsc AR "FMGrain" [trigger,dur,carfreq,modfreq,ix] 1---- | Granular synthesis with FM grains and user supplied envelope.-fmGrainB :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fmGrainB trigger dur carfreq modfreq ix e = mkOsc AR "FMGrain" [trigger,dur,carfreq,modfreq,ix,e] 1---- | Resynthesize LPC analysis data.-lpcSynth :: UGen -> UGen -> UGen -> UGen-lpcSynth b s ptr = mkOsc AR "LPCSynth" [b, s, ptr] 1---- | Extract cps, rmso and err signals from LPC data.-lpcVals :: Rate -> UGen -> UGen -> UGen-lpcVals r b ptr = mkOsc r "LPCVals" [b, ptr] 3---- | Metronome-metro :: Rate -> UGen -> UGen -> UGen-metro rt bpm nb = mkOsc rt "Metro" [bpm,nb] 1---- | Delay and Feedback on a bin by bin basis.-pv_BinDelay :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_BinDelay buffer maxdelay delaybuf fbbuf hop = mkOsc KR "PV_BinDelay" [buffer,maxdelay,delaybuf,fbbuf,hop] 1---- | Play FFT data from a memory buffer.-pv_BufRd :: UGen -> UGen -> UGen -> UGen-pv_BufRd buffer playbuf_ point = mkOsc KR "PV_BufRd" [buffer,playbuf_,point] 1---- | /dur/ and /hop/ are in seconds, /frameSize/ and /sampleRate/ in--- frames, though the latter maybe fractional.------ > pv_calcPVRecSize 4.2832879818594 1024 0.25 48000.0 == 823299-pv_calcPVRecSize :: Double -> Int -> Double -> Double -> Int-pv_calcPVRecSize dur frameSize hop sampleRate =-    let frameSize' = fromIntegral frameSize-        rawsize = ceiling ((dur * sampleRate) / frameSize') * frameSize-    in ceiling (fromIntegral rawsize * recip hop + 3)---- | Invert FFT amplitude data.-pv_Invert :: UGen -> UGen-pv_Invert b = mkOsc KR "PV_Invert" [b] 1---- | Plays FFT data from a memory buffer.-pv_PlayBuf :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_PlayBuf buffer playbuf_ rate_ offset loop = mkOsc KR "PV_PlayBuf" [buffer,playbuf_,rate_,offset,loop] 1---- | Records FFT data to a memory buffer.-pv_RecordBuf :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_RecordBuf buffer recbuf offset run loop hop wintype = mkOsc KR "PV_RecordBuf" [buffer,recbuf,offset,run,loop,hop,wintype] 1---- | Sample looping oscillator-loopBuf :: Int -> Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-loopBuf numChannels rate bufnum rate_ gate_ startPos startLoop endLoop interpolation = mkOscR [AR] rate "LoopBuf" [bufnum,rate_,gate_,startPos,startLoop,endLoop,interpolation] numChannels---- * MCLD---- | Detect the largest value (and its position) in an array of UGens-arrayMax :: Rate -> UGen -> UGen-arrayMax rate array = mkOscR [AR,KR] rate "ArrayMax" [array] 2---- | Detect the smallest value (and its position) in an array of UGens-arrayMin :: Rate -> UGen -> UGen-arrayMin rate array = mkOscR [AR,KR] rate "ArrayMin" [array] 2---- | Detect the largest value (and its position) in an array of UGens-bufMax :: Rate -> UGen -> UGen -> UGen-bufMax rate bufnum gate_ = mkOscR [KR] rate "BufMax" [bufnum,gate_] 2---- | Detect the largest value (and its position) in an array of UGens-bufMin :: Rate -> UGen -> UGen -> UGen-bufMin rate bufnum gate_ = mkOscR [KR] rate "BufMin" [bufnum,gate_] 2---- | 3D Perlin Noise-perlin3 :: Rate -> UGen -> UGen -> UGen -> UGen-perlin3 rate x y z = mkOscR [AR,KR] rate "Perlin3" [x,y,z] 1---- | Wave squeezer. Maybe a kind of pitch shifter.-squiz :: UGen -> UGen -> UGen -> UGen -> UGen-squiz in_ pitchratio zcperchunk memlen = mkFilterR [AR,KR] "Squiz" [in_,pitchratio,zcperchunk,memlen] 1---- * Membrane---- | Triangular waveguide mesh of a drum-like membrane.-membraneCircle :: UGen -> UGen -> UGen -> UGen-membraneCircle i t l = mkOsc AR "MembraneCircle" [i, t, l] 1---- | Triangular waveguide mesh of a drum-like membrane.-membraneHexagon :: UGen -> UGen -> UGen -> UGen-membraneHexagon i t l = mkOsc AR "MembraneHexagon" [i, t, l] 1---- * NCAnalysisUGens---- | Spectral Modeling Synthesis-sms :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-sms input maxpeaks currentpeaks tolerance noisefloor freqmult freqadd formantpreserve useifft ampmult graphicsbufnum = mkFilterR [AR] "SMS" [input,maxpeaks,currentpeaks,tolerance,noisefloor,freqmult,freqadd,formantpreserve,useifft,ampmult,graphicsbufnum] 2---- | Tracking Phase Vocoder-tpv :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-tpv chain windowsize hopsize maxpeaks currentpeaks freqmult tolerance noisefloor = mkOsc AR "TPV" [chain,windowsize,hopsize,maxpeaks,currentpeaks,freqmult,tolerance,noisefloor] 1---- * PitchDetection---- | Tartini model pitch tracker.-tartini ::  Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-tartini r input threshold n k overlap smallCutoff = mkOscR [KR] r "Tartini" [input,threshold,n,k,overlap,smallCutoff] 2---- | Constant Q transform pitch follower.-qitch ::  Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-qitch r input databufnum ampThreshold algoflag ampbufnum minfreq maxfreq = mkOscR [KR] r "Qitch" [input,databufnum,ampThreshold,algoflag,ampbufnum,minfreq,maxfreq] 2---- * RFWUGens---- | Calculates mean average of audio or control rate signal.-averageOutput :: UGen -> UGen -> UGen-averageOutput in_ trig_ = mkFilterR [KR,AR] "AverageOutput" [in_,trig_] 1---- | Feedback delay line implementing switch-and-ramp buffer jumping.-switchDelay :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-switchDelay in_ drylevel wetlevel delaytime delayfactor maxdelaytime = mkFilterR [AR] "SwitchDelay" [in_,drylevel,wetlevel,delaytime,delayfactor,maxdelaytime] 1---- * SCMIRUGens---- | Octave chroma band based representation of energy in a signal; Chromagram for nTET tuning systems with any base reference-chromagram :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-chromagram rate fft_ fftsize n tuningbase octaves integrationflag coeff = mkOscR [KR] rate "Chromagram" [fft_,fftsize,n,tuningbase,octaves,integrationflag,coeff] 1---- * skUG---- | Phase modulation oscillator matrix.-fm7 :: [[UGen]] -> [[UGen]] -> UGen-fm7 ctl m0d = mkOsc AR "FM7" (concat ctl ++ concat m0d) 6---- * SLU---- | Prigogine oscillator-brusselator :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-brusselator rate reset rate_ mu gamma initx inity = mkOscR [AR] rate "Brusselator" [reset,rate_,mu,gamma,initx,inity] 2---- | Forced DoubleWell Oscillator-doubleWell3 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-doubleWell3 rate reset rate_ f delta initx inity = mkOscR [AR] rate "DoubleWell3" [reset,rate_,f,delta,initx,inity] 1---- | Envelope Follower Filter-envDetect :: Rate -> UGen -> UGen -> UGen -> UGen-envDetect rate in_ attack release = mkOscR [AR] rate "EnvDetect" [in_,attack,release] 1---- | Envelope Follower-envFollow :: Rate -> UGen -> UGen -> UGen-envFollow rate input decaycoeff = mkOscR [AR,KR] rate "EnvFollow" [input,decaycoeff] 1---- | Linear Time Invariant General Filter Equation-lti :: Rate -> UGen -> UGen -> UGen -> UGen-lti rate input bufnuma bufnumb = mkOscR [AR] rate "LTI" [input,bufnuma,bufnumb] 1---- | Experimental time domain onset detector-sLOnset :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-sLOnset rate input memorysize1 before after threshold hysteresis = mkOscR [KR] rate "SLOnset" [input,memorysize1,before,after,threshold,hysteresis] 1---- | wave terrain synthesis-waveTerrain :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-waveTerrain rate bufnum x y xsize ysize = mkOscR [AR] rate "WaveTerrain" [bufnum,x,y,xsize,ysize] 1---- * Stk---- | STK bowed string model.-stkBowed :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkBowed rt f pr po vf vg l g at dc = mkOsc rt "StkBowed" [f, pr, po, vf, vg, l, g, at, dc] 1---- | STK flute model.-stkFlute :: Rate-> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkFlute rt f jd ng vf vg bp tr = mkOsc rt "StkFlute" [f, jd, ng, vf, vg, bp, tr] 1---- | STK mandolin model.-stkMandolin :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkMandolin rt f bs pp dm dt at tr = mkOsc rt "StkMandolin" [f, bs, pp, dm, dt, at, tr] 1---- | STK modal bar models.-stkModalBar :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkModalBar rt f i sh sp vg vf mx v tr = mkOsc rt "StkModalBar" [f, i, sh, sp, vg, vf, mx, v, tr] 1---- | STK shaker models.-stkShakers :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkShakers rt i e d o rf tr = mkOsc rt "StkShakers" [i, e, d, o, rf, tr] 1---- * TJUGens---- | Digitally modelled analog filter-dfm1 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-dfm1 i f r g ty nl = mkFilter "DFM1" [i,f,r,g,ty,nl] 1---- * VOSIM---- | Vocal simulation due to W. Kaegi.-vosim :: UGen -> UGen -> UGen -> UGen -> UGen-vosim t f nc d = mkOsc AR "VOSIM" [t, f, nc, d] 1----- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Bindings/HW/External/Wavelets.hs
@@ -1,31 +0,0 @@--- | Wavelet unit generators (Nick Collins).-module Sound.SC3.UGen.Bindings.HW.External.Wavelets where--import Sound.SC3.UGen.Bindings.HW.Construct-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type---- | Forward wavelet transform.-dwt :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-dwt buf i h wnt a wns wlt = mkOsc KR "DWT" [buf,i,h,wnt,a,wns,wlt] 1---- | Inverse of 'dwt'.-idwt :: UGen -> UGen -> UGen -> UGen -> UGen-idwt buf wnt wns wlt = mkOsc AR "IDWT" [buf,wnt,wns,wlt] 1---- | Pass wavelets above a threshold, ie. 'pv_MagAbove'.-wt_MagAbove :: UGen -> UGen -> UGen-wt_MagAbove buf thr = mkOsc KR "WT_MagAbove" [buf,thr] 1---- | Pass wavelets with /scale/ above threshold.-wt_FilterScale :: UGen -> UGen -> UGen-wt_FilterScale buf wp = mkOsc KR "WT_FilterScale" [buf,wp] 1---- | Pass wavelets with /time/ above threshold.-wt_TimeWipe :: UGen -> UGen -> UGen-wt_TimeWipe buf wp = mkOsc KR "WT_TimeWipe" [buf,wp] 1---- | Product in /W/ domain, ie. 'pv_Mul'.-wt_Mul :: UGen -> UGen -> UGen-wt_Mul ba bb = mkOsc KR "WT_Mul" [ba,bb] 1-
− Sound/SC3/UGen/Bindings/HW/External/Zita.hs
@@ -1,58 +0,0 @@--- | Zita UGen definitions.------ To build the SC3 plugin run @faust2supercollider -d@ on--- @zita_rev1.dsp@, which is in the @examples@ directory of Faust, see--- <http://faust.grame.fr/>.-module Sound.SC3.UGen.Bindings.HW.External.Zita where--import Sound.SC3.UGen.Bindings.HW.Construct-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type--data ZitaRev1 a =-    ZitaRev1 {zr1_in1 :: a-             ,zr1_in2 :: a-             ,zr1_delay :: a-             ,zr1_xover :: a-             ,zr1_rtlow :: a-             ,zr1_rtmid :: a-             ,zr1_fdamp :: a-             ,zr1_eq1fr :: a-             ,zr1_eq1gn :: a-             ,zr1_eq2fr :: a-             ,zr1_eq2gn :: a-             ,zr1_opmix :: a -- ^ (-1,+1)-             ,zr1_level :: a}--zitaRev1_r :: ZitaRev1 UGen -> UGen-zitaRev1_r r =-    let (ZitaRev1 in1 in2 dly xov rtl rtm fda e1f e1g e2f e2g opm lvl) = r-    in zitaRev1 in1 in2 dly xov rtl rtm fda e1f e1g e2f e2g opm lvl--zitaRev1 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-zitaRev1 in1 in2 dly xov rtl rtm fda e1f e1g e2f e2g opm lvl = mkFilterR [AR] "FaustZitaRev1" [in1,in2,dly,xov,rtl,rtm,fda,e1f,e1g,e2f,e2g,opm,lvl] 2--{--hsc3-db:--std_I :: Int -> String -> Double -> I-std_I ix nm df = I (ix,ix) nm df Nothing--zitaRev1_dsc :: U-zitaRev1_dsc =-    let i = [std_I 0 "in1" 0.0-            ,std_I 1 "in2" 0.0-            ,std_I 2 "delay" 0.04-            ,std_I 3 "xover" 200.0-            ,std_I 4 "rtlow" 3.0-            ,std_I 5 "rtmid" 2.0-            ,std_I 6 "fdamp" 6.0e3-            ,std_I 7 "eq1fr" 160-            ,std_I 8 "eq1gn" 0.0-            ,std_I 9 "eq2fr" 2.5e3-            ,std_I 10 "eq2gn" 0.0-            ,std_I 11 "opmix" 0.5-            ,std_I 12 "level" (-20)]-    in U "FaustZitaRev1" [AR] AR Nothing i Nothing (Left 2) "Zita Reverb 1"--}-
− Sound/SC3/UGen/Bindings/Monad.hs
@@ -1,195 +0,0 @@--- | Monad constructors for 'UGen's.-module Sound.SC3.UGen.Bindings.Monad where--import Sound.SC3.UGen.Bindings.DB-import Sound.SC3.UGen.Bindings.HW-import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UId---- * Demand---- | Buffer demand ugen.-dbufrdM :: (UId m) => UGen -> UGen -> Loop -> m UGen-dbufrdM = liftUId3 dbufrd---- | Buffer write on demand unit generator.-dbufwrM :: (UId m) => UGen -> UGen -> UGen -> Loop -> m UGen-dbufwrM = liftUId4 dbufwr---- | Demand rate white noise.-dwhiteM :: (UId m) => UGen -> UGen -> UGen -> m UGen-dwhiteM = liftUId3 dwhite---- | Demand rate integer white noise.-diwhiteM :: (UId m) => UGen -> UGen -> UGen -> m UGen-diwhiteM = liftUId3 diwhite---- | Demand rate brown noise.-dbrownM :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-dbrownM = liftUId4 dbrown---- | Demand rate integer brown noise.-dibrownM :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-dibrownM = liftUId4 dibrown---- | Demand rate random selection.-drandM :: (UId m) => UGen -> UGen -> m UGen-drandM = liftUId2 drand---- | Demand rate weighted random sequence generator.-dwrandM :: (UId m) => UGen -> UGen -> UGen -> m UGen-dwrandM = liftUId3 dwrand---- | Demand rate random selection with no immediate repetition.-dxrandM :: (UId m) => UGen -> UGen -> m UGen-dxrandM = liftUId2 dxrand---- | Demand rate arithmetic series.-dseriesM :: (UId m) => UGen -> UGen -> UGen -> m UGen-dseriesM = liftUId3 dseries---- | Demand rate geometric series.-dgeomM :: (UId m) => UGen -> UGen -> UGen -> m UGen-dgeomM = liftUId3 dgeom---- | Demand rate sequence generator.-dseqM :: (UId m) => UGen -> UGen -> m UGen-dseqM = liftUId2 dseq---- | Demand rate series generator.-dserM :: (UId m) => UGen -> UGen -> m UGen-dserM = liftUId2 dser---- | Demand rate sequence shuffler.-dshufM :: (UId m) => UGen -> UGen -> m UGen-dshufM = liftUId2 dshuf---- | Demand input replication-dstutterM :: (UId m) => UGen -> UGen -> m UGen-dstutterM = liftUId2 dstutter---- | Demand rate input switching.-dswitch1M :: (UId m) => UGen -> UGen -> m UGen-dswitch1M = liftUId2 dswitch1---- | Demand rate input switching.-dswitchM :: (UId m) => UGen -> UGen -> m UGen-dswitchM = liftUId2 dswitch---- * FFT---- | Randomize order of bins.-pv_BinScrambleM :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-pv_BinScrambleM = liftUId4 pv_BinScramble---- | Randomly clear bins.-pv_RandCombM :: (UId m) => UGen -> UGen -> UGen -> m UGen-pv_RandCombM = liftUId3 pv_RandComb---- | Cross fade, copying bins in random order.-pv_RandWipeM :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-pv_RandWipeM = liftUId4 pv_RandWipe---- * Noise---- | Brown noise.-brownNoiseM :: (UId m) => Rate -> m UGen-brownNoiseM = liftUId brownNoise---- | Clip noise.-clipNoiseM :: (UId m) => Rate -> m UGen-clipNoiseM = liftUId clipNoise---- | Randomly pass or block triggers.-coinGateM :: (UId m) => UGen -> UGen -> m UGen-coinGateM = liftUId2 coinGate---- | Random impulses in (-1, 1).-dust2M :: (UId m) => Rate -> UGen -> m UGen-dust2M = liftUId2 dust2---- | Random impulse in (0,1).-dustM :: (UId m) => Rate -> UGen -> m UGen-dustM = liftUId2 dust---- | Random value in exponential distribution.-expRandM :: (UId m) => UGen -> UGen -> m UGen-expRandM = liftUId2 expRand---- | Gray noise.-grayNoiseM :: (UId m) => Rate -> m UGen-grayNoiseM = liftUId grayNoise---- | Random integer in uniform distribution.-iRandM :: (UId m) => UGen -> UGen -> m UGen-iRandM = liftUId2 iRand---- | Clip noise.-lfClipNoiseM :: (UId m) => Rate -> UGen -> m UGen-lfClipNoiseM = liftUId2 lfClipNoise---- | Dynamic clip noise.-lfdClipNoiseM :: (UId m) => Rate -> UGen -> m UGen-lfdClipNoiseM = liftUId2 lfdClipNoise---- | Dynamic step noise.-lfdNoise0M :: (UId m) => Rate -> UGen -> m UGen-lfdNoise0M = liftUId2 lfdNoise0---- | Dynamic ramp noise.-lfdNoise1M :: (UId m) => Rate -> UGen -> m UGen-lfdNoise1M = liftUId2 lfdNoise1---- | Dynamic cubic noise-lfdNoise3M :: (UId m) => Rate -> UGen -> m UGen-lfdNoise3M = liftUId2 lfdNoise3---- | Step noise.-lfNoise0M :: (UId m) => Rate -> UGen -> m UGen-lfNoise0M = liftUId2 lfNoise0---- | Ramp noise.-lfNoise1M :: (UId m) => Rate -> UGen -> m UGen-lfNoise1M = liftUId2 lfNoise1---- | Quadratic noise.-lfNoise2M :: (UId m) => Rate -> UGen -> m UGen-lfNoise2M = liftUId2 lfNoise2---- | Random value in skewed linear distribution.-linRandM :: (UId m) => UGen -> UGen -> UGen -> m UGen-linRandM = liftUId3 linRand---- | Random value in sum of n linear distribution.-nRandM :: (UId m) => UGen -> UGen -> UGen -> m UGen-nRandM = liftUId3 nRand---- | Pink noise.-pinkNoiseM :: (UId m) => Rate -> m UGen-pinkNoiseM = liftUId pinkNoise---- | Random value in uniform distribution.-randM :: (UId m) => UGen -> UGen -> m UGen-randM = liftUId2 rand---- | Random value in exponential distribution on trigger.-tExpRandM :: (UId m) => UGen -> UGen -> UGen -> m UGen-tExpRandM = liftUId3 tExpRand---- | Random integer in uniform distribution on trigger.-tIRandM :: (UId m) => UGen -> UGen -> UGen -> m UGen-tIRandM = liftUId3 tIRand---- | Random value in uniform distribution on trigger.-tRandM :: (UId m) => UGen -> UGen -> UGen -> m UGen-tRandM = liftUId3 tRand---- | Triggered windex.-tWindexM :: (UId m) => UGen -> UGen -> UGen -> m UGen-tWindexM = liftUId3 tWindex---- | White noise.-whiteNoiseM :: (UId m) => Rate -> m UGen-whiteNoiseM = liftUId whiteNoise
− Sound/SC3/UGen/Enum.hs
@@ -1,85 +0,0 @@--- | Data types for enumerated and non signal unit generator inputs.-module Sound.SC3.UGen.Enum where--import qualified Sound.SC3.Common.Envelope as E-import Sound.SC3.UGen.Type---- | Loop indicator input.-data Loop' t = Loop-             | NoLoop-             | WithLoop t-               deriving (Eq, Show)---- | Type-specialised 'Loop''.-type Loop = Loop' UGen---- | Resolve 'Loop''.-from_loop :: Num t => Loop' t -> t-from_loop e =-    case e of-      NoLoop -> 0-      Loop -> 1-      WithLoop u -> u---- | Interpolation indicator input.-data Interpolation = NoInterpolation-                   | LinearInterpolation-                   | CubicInterpolation-                   | Interpolation UGen-                     deriving (Eq, Show)---- | Resolve 'Interpolation'.-from_interpolation :: Interpolation -> UGen-from_interpolation e =-    case e of-      NoInterpolation -> 1-      LinearInterpolation -> 2-      CubicInterpolation -> 4-      Interpolation u -> u---- | Completion mode indicator input.-data DoneAction = DoNothing-                | PauseSynth-                | RemoveSynth-                | RemoveGroup-                | DoneAction UGen-                  deriving (Eq, Show)---- | Resolve 'DoneAction'.-from_done_action :: DoneAction -> UGen-from_done_action e =-    case e of-      DoNothing -> 0-      PauseSynth -> 1-      RemoveSynth -> 2-      RemoveGroup -> 14-      DoneAction u -> u---- | Warp interpolation indicator input.-data Warp = Linear-          | Exponential-          | Warp UGen-            deriving (Eq, Show)---- | Resolve 'Warp'.-from_warp :: Warp -> UGen-from_warp e =-    case e of-      Linear -> 0-      Exponential -> 1-      Warp u -> u---- | Type specialised ('UGen') envelope curve.-type EnvCurve = E.Envelope_Curve UGen---- | Unification of integer and 'UGen' buffer identifiers.-data Buffer = Buffer_Id Int-            | Buffer UGen-              deriving (Eq, Show)---- | Lift to 'UGen'.-from_buffer :: Buffer -> UGen-from_buffer b =-    case b of-      Buffer_Id i -> constant i-      Buffer u -> u
− Sound/SC3/UGen/Envelope.hs
@@ -1,39 +0,0 @@--- | Envelope / UGen.-module Sound.SC3.UGen.Envelope where--import Sound.SC3.Common.Envelope--import Sound.SC3.UGen.Bindings-import Sound.SC3.UGen.Math-import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen--{- | Trapezoidal envelope generator.--> import Sound.SC3.Plot-> plotEnvelope [envTrapezoid 0.99 0.5 1 1,envTrapezoid 0.5 0.75 0.65 0.35]---}-envTrapezoid :: OrdE t => t -> t -> t -> t -> Envelope t-envTrapezoid = envTrapezoid_f ((<=*),(>=*))---- | Singleton fade envelope.-envGate :: UGen -> UGen -> UGen -> DoneAction -> Envelope_Curve UGen -> UGen-envGate level gate_ fadeTime doneAction curve =-    let startVal = fadeTime <=* 0-        e = Envelope [startVal,1,0] [1,1] [curve] (Just 1) Nothing-    in envGen KR gate_ level 0 fadeTime doneAction e---- | Variant with default values for all inputs.  @gate@ and--- @fadeTime@ are 'control's, @doneAction@ is 'RemoveSynth', @curve@--- is 'EnvSin'.-envGate' :: UGen-envGate' =-    let level = 1-        gate_ = meta_control KR "gate" 1 (0,1,"lin",1,"")-        fadeTime = meta_control KR "fadeTime" 0.02 (0,10,"lin",0,"s")-        doneAction = RemoveSynth-        curve = EnvSin-    in envGate level gate_ fadeTime doneAction curve
− Sound/SC3/UGen/Graph.hs
@@ -1,503 +0,0 @@--- | 'Graph' and related types.-module Sound.SC3.UGen.Graph where--import qualified Data.IntMap as M {- containers -}-import Data.Function {- base -}-import Data.List{- base -}-import Data.Maybe{- base -}--import qualified Sound.SC3.UGen.Analysis as A-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- * Type---- | Node identifier.-type NodeId = Int---- | Port index.-type PortIndex = Int---- | Type to represent unit generator graph.-data Graph = Graph {nextId :: NodeId-                   ,constants :: [Node]-                   ,controls :: [Node]-                   ,ugens :: [Node]}-            deriving (Show)---- | Enumeration of the four operating rates for controls.-data KType = K_IR | K_KR | K_TR | K_AR-             deriving (Eq,Show,Ord)---- | Type to represent the left hand side of an edge in a unit---   generator graph.-data FromPort = FromPort_C {port_nid :: NodeId}-              | FromPort_K {port_nid :: NodeId,port_kt :: KType}-              | FromPort_U {port_nid :: NodeId,port_idx :: Maybe PortIndex}-                deriving (Eq,Show)---- | A destination port.-data ToPort = ToPort NodeId PortIndex deriving (Eq,Show)---- | A connection from 'FromPort' to 'ToPort'.-type Edge = (FromPort,ToPort)---- | Type to represent nodes in unit generator graph.-data Node = NodeC {node_id :: NodeId-                  ,node_c_value :: Sample}-          | NodeK {node_id :: NodeId-                  ,node_k_rate :: Rate-                  ,node_k_index :: Maybe Int-                  ,node_k_name :: String-                  ,node_k_default :: Sample-                  ,node_k_type :: KType-                  ,node_k_meta :: Maybe (C_Meta Sample)}-          | NodeU {node_id :: NodeId-                  ,node_u_rate :: Rate-                  ,node_u_name :: String-                  ,node_u_inputs :: [FromPort]-                  ,node_u_outputs :: [Output]-                  ,node_u_special :: Special-                  ,node_u_ugenid :: UGenId}-          | NodeP {node_id :: NodeId-                  ,node_p_node :: Node-                  ,node_p_index :: PortIndex}-            deriving (Show)--node_k_eq :: Node -> Node -> Bool-node_k_eq p q =-    case (p,q) of-      (NodeK k rt ix nm df tr me,NodeK k' rt' ix' nm' df' tr' me') ->-          k == k' && rt == rt' && ix == ix' && nm == nm' && df == df' && tr == tr' && me == me'-      _ -> error "node_k_eq? not Node_K"---- | 'Rate' of 'Node', ie. 'IR' for constants, & see through 'NodeP'.-node_rate :: Node -> Rate-node_rate n =-    case n of-      NodeC {} -> IR-      NodeK {} -> node_k_rate n-      NodeU {} -> node_u_rate n-      NodeP _ n' _ -> node_rate n'---- * Building---- | Find 'Node' with indicated 'NodeId'.-find_node :: Graph -> NodeId -> Maybe Node-find_node (Graph _ cs ks us) n =-    let f x = node_id x == n-    in find f (cs ++ ks ++ us)---- | Generate a label for 'Node' using the /type/ and the 'node_id'.-node_label :: Node -> String-node_label nd =-    case nd of-      NodeC n _ -> "c_" ++ show n-      NodeK n _ _ _ _ _ _ -> "k_" ++ show n-      NodeU n _ _ _ _ _ _ -> "u_" ++ show n-      NodeP n _ _ -> "p_" ++ show n---- | Get 'port_idx' for 'FromPort_U', else @0@.-port_idx_or_zero :: FromPort -> PortIndex-port_idx_or_zero p =-    case p of-      FromPort_U _ (Just x) -> x-      _ -> 0---- | Is 'Node' a /constant/.-is_node_c :: Node -> Bool-is_node_c n =-    case n of-      NodeC _ _ -> True-      _ -> False---- | Is 'Node' a /control/.-is_node_k :: Node -> Bool-is_node_k n =-    case n of-      NodeK {} -> True-      _ -> False---- | Is 'Node' a /UGen/.-is_node_u :: Node -> Bool-is_node_u n =-    case n of-      NodeU {} -> True-      _ -> False---- | Calculate all edges given a set of 'NodeU'.-edges :: [Node] -> [Edge]-edges =-    let f n = case n of-                NodeU x _ _ i _ _ _ -> zip i (map (ToPort x) [0..])-                _ -> error "edges: non NodeU input node"-    in concatMap f---- | Transform 'Node' to 'FromPort'.-as_from_port :: Node -> FromPort-as_from_port d =-    case d of-      NodeC n _ -> FromPort_C n-      NodeK n _ _ _ _ t _ -> FromPort_K n t-      NodeU n _ _ _ o _ _ ->-          case o of-            [_] -> FromPort_U n Nothing-            _ -> error (show ("as_from_port: non unary NodeU",d))-      NodeP _ u p -> FromPort_U (node_id u) (Just p)---- | Locate 'Node' of 'FromPort' in 'Graph'.-from_port_node :: Graph -> FromPort -> Maybe Node-from_port_node g fp = find_node g (port_nid fp)---- | The empty 'Graph'.-empty_graph :: Graph-empty_graph = Graph 0 [] [] []---- | Find the maximum 'NodeId' used at 'Graph' (this ought normally be--- the 'nextId').-graph_maximum_id :: Graph -> NodeId-graph_maximum_id (Graph _ c k u) = maximum (map node_id (c ++ k ++ u))---- | Compare 'NodeK' values 'on' 'node_k_type'.-node_k_cmp :: Node -> Node -> Ordering-node_k_cmp = compare `on` node_k_type---- | Determine class of control given 'Rate' and /trigger/ status.-ktype :: Rate -> Bool -> KType-ktype r tr =-    if tr-    then case r of-           KR -> K_TR-           _ -> error "ktype: non KR trigger control"-    else case r of-           IR -> K_IR-           KR -> K_KR-           AR -> K_AR-           DR -> error "ktype: DR control"---- | Predicate to determine if 'Node' is a constant with indicated /value/.-find_c_p :: Sample -> Node -> Bool-find_c_p x n =-    case n of-      NodeC _ y -> x == y-      _ -> error "find_c_p: non NodeC"---- | Insert a constant 'Node' into the 'Graph'.-push_c :: Sample -> Graph -> (Node,Graph)-push_c x g =-    let n = NodeC (nextId g) x-    in (n,g {constants = n : constants g-            ,nextId = nextId g + 1})---- | Either find existing 'Constant' 'Node', or insert a new 'Node'.-mk_node_c :: Constant -> Graph -> (Node,Graph)-mk_node_c (Constant x) g =-    let y = find (find_c_p x) (constants g)-    in maybe (push_c x g) (\y' -> (y',g)) y---- | Predicate to determine if 'Node' is a control with indicated--- /name/.  Names must be unique.-find_k_p :: String -> Node -> Bool-find_k_p x n =-    case n of-      NodeK _ _ _ y _ _ _ -> x == y-      _ -> error "find_k_p"---- | Insert a control node into the 'Graph'.-push_k :: Control -> Graph -> (Node,Graph)-push_k (Control r ix nm d tr meta) g =-    let n = NodeK (nextId g) r ix nm d (ktype r tr) meta-    in (n,g {controls = n : controls g-            ,nextId = nextId g + 1})---- | Either find existing 'Control' 'Node', or insert a new 'Node'.-mk_node_k :: Control -> Graph -> (Node,Graph)-mk_node_k c g =-    let nm = controlName c-        y = find (find_k_p nm) (controls g)-    in maybe (push_k c g) (\y' -> (y',g)) y--type UGenParts = (Rate,String,[FromPort],[Output],Special,UGenId)---- | Predicate to locate primitive, names must be unique.-find_u_p :: UGenParts -> Node -> Bool-find_u_p (r,n,i,o,s,d) nd =-    case nd of-      NodeU _ r' n' i' o' s' d' ->-          r == r' && n == n' && i == i' && o == o' && s == s' && d == d'-      _ ->  error "find_u_p"---- | Insert a /primitive/ 'NodeU' into the 'Graph'.-push_u :: UGenParts -> Graph -> (Node,Graph)-push_u (r,nm,i,o,s,d) g =-    let n = NodeU (nextId g) r nm i o s d-    in (n,g {ugens = n : ugens g-            ,nextId = nextId g + 1})--mk_node_u_acc :: [UGen] -> [Node] -> Graph -> ([Node],Graph)-mk_node_u_acc u n g =-    case u of-      [] -> (reverse n,g)-      x:xs -> let (y,g') = mk_node x g-              in mk_node_u_acc xs (y:n) g'---- | Either find existing 'Primitive' node, or insert a new 'Node'.-mk_node_u :: Primitive -> Graph -> (Node,Graph)-mk_node_u (Primitive r nm i o s d) g =-    let (i',g') = mk_node_u_acc i [] g-        i'' = map as_from_port i'-        u = (r,nm,i'',o,s,d)-        y = find (find_u_p u) (ugens g')-    in maybe (push_u u g') (\y' -> (y',g')) y---- | Proxies do not get stored in the graph.-mk_node_p :: Node -> PortIndex -> Graph -> (Node,Graph)-mk_node_p n p g =-    let z = nextId g-    in (NodeP z n p,g {nextId = z + 1})---- | Transform 'UGen' into 'Graph', appending to existing 'Graph'.-mk_node :: UGen -> Graph -> (Node,Graph)-mk_node u g =-    case u of-      Constant_U c -> mk_node_c c g-      Control_U k -> mk_node_k k g-      Label_U _ -> error (show ("mk_node: label",u))-      Primitive_U p -> mk_node_u p g-      Proxy_U p ->-          let (n,g') = mk_node_u (proxySource p) g-          in mk_node_p n (proxyIndex p) g'-      MRG_U m ->-          -- allow RHS of MRG node to be MCE (splice all nodes into graph)-          let f g' l = case l of-                         [] -> g'-                         n:l' -> let (_,g'') = mk_node n g' in f g'' l'-          in mk_node (mrgLeft m) (f g (mceChannels (mrgRight m)))-      MCE_U _ -> error (show ("mk_node: mce",u))---- | Transform /mce/ nodes to /mrg/ nodes-prepare_root :: UGen -> UGen-prepare_root u =-    case u of-      MCE_U m -> mrg (mceProxies m)-      MRG_U m -> mrg2 (prepare_root (mrgLeft m)) (prepare_root (mrgRight m))-      _ -> u---- | If controls have been given indices they must be coherent.-sort_controls :: [Node] -> [Node]-sort_controls c =-    let node_k_ix n = fromMaybe maxBound (node_k_index n)-        cmp = compare `on` node_k_ix-        c' = sortBy cmp c-        coheres z = maybe True (== z) . node_k_index-        coherent = all id (zipWith coheres [0..] c')-    in if coherent then c' else error (show ("sort_controls: incoherent",c))---- | Variant on 'mk_node' starting with an empty graph, reverses the--- 'UGen' list and sorts the 'Control' list, and adds implicit nodes.-mk_graph :: UGen -> Graph-mk_graph u =-    let (_,g) = mk_node (prepare_root u) empty_graph-        g' = g {ugens = reverse (ugens g)-               ,controls = sort_controls (controls g)}-    in add_implicit g'---- * Encoding--type Map = M.IntMap Int--type Maps = (Map,[Node],Map,Map,[(KType,Int)])---- | Determine 'KType' of a /control/ UGen at 'NodeU', or not.-node_ktype :: Node -> Maybe KType-node_ktype n =-    case (node_u_name n,node_u_rate n) of-      ("Control",IR) -> Just K_IR-      ("Control",KR) -> Just K_KR-      ("TrigControl",KR) -> Just K_TR-      ("AudioControl",AR) -> Just K_AR-      _ -> Nothing---- | Map associating 'KType' with UGen index.-mk_ktype_map :: [Node] -> [(KType,Int)]-mk_ktype_map =-    let f (i,n) = let g ty = (ty,i) in fmap g (node_ktype n)-    in mapMaybe f . zip [0..]---- | Lookup 'KType' index from map (erroring variant of 'lookup').-ktype_map_lookup :: KType -> [(KType,Int)] -> Int-ktype_map_lookup k =-    let e = error (show ("ktype_map_lookup",k))-    in fromMaybe e . lookup k---- | Generate 'Maps' translating node identifiers to synthdef indexes.-mk_maps :: Graph -> Maps-mk_maps (Graph _ cs ks us) =-    (M.fromList (zip (map node_id cs) [0..])-    ,ks-    ,M.fromList (zip (map node_id ks) [0..])-    ,M.fromList (zip (map node_id us) [0..])-    ,mk_ktype_map us)---- | Locate index in map given node identifer 'NodeId'.-fetch :: NodeId -> Map -> Int-fetch = M.findWithDefault (error "fetch")---- | Controls are a special case.  We need to know not the overall--- index but the index in relation to controls of the same type.-fetch_k :: NodeId -> KType -> [Node] -> Int-fetch_k z t =-    let recur i ns =-            case ns of-              [] -> error "fetch_k"-              n:ns' -> if z == node_id n-                       then i-                       else if t == node_k_type n-                            then recur (i + 1) ns'-                            else recur i ns'-    in recur 0---- * Implicit (Control, MaxLocalBuf)---- | 4-tuple to count 'KType's.-type KS_COUNT = (Int,Int,Int,Int)---- | Count the number of /controls/ of each 'KType'.-ks_count :: [Node] -> KS_COUNT-ks_count =-    let recur r ns =-            let (i,k,t,a) = r-            in case ns of-                 [] -> r-                 n:ns' -> let r' = case node_k_type n of-                                     K_IR -> (i+1,k,t,a)-                                     K_KR -> (i,k+1,t,a)-                                     K_TR -> (i,k,t+1,a)-                                     K_AR -> (i,k,t,a+1)-                          in recur r' ns'-    in recur (0,0,0,0)---- | Construct implicit /control/ unit generator 'Nodes'.  Unit--- generators are only constructed for instances of control types that--- are present.-mk_implicit_ctl :: [Node] -> [Node]-mk_implicit_ctl ks =-    let (ni,nk,nt,na) = ks_count ks-        mk_n t n o =-            let (nm,r) = case t of-                            K_IR -> ("Control",IR)-                            K_KR -> ("Control",KR)-                            K_TR -> ("TrigControl",KR)-                            K_AR -> ("AudioControl",AR)-                i = replicate n r-            in if n == 0-               then Nothing-               else Just (NodeU (-1) r nm [] i (Special o) no_id)-    in catMaybes [mk_n K_IR ni 0-                 ,mk_n K_KR nk ni-                 ,mk_n K_TR nt (ni + nk)-                 ,mk_n K_AR na (ni + nk + nt)]---- | Add implicit /control/ UGens to 'Graph'.-add_implicit_ctl :: Graph -> Graph-add_implicit_ctl g =-    let (Graph z cs ks us) = g-        ks' = sortBy node_k_cmp ks-        im = if null ks' then [] else mk_implicit_ctl ks'-        us' = im ++ us-    in Graph z cs ks' us'---- | Zero if no local buffers, or if maxLocalBufs is given.-localbuf_count :: [Node] -> Int-localbuf_count us =-    case find ((==) "MaxLocalBufs" . node_u_name) us of-      Nothing -> length (filter ((==) "LocalBuf" . node_u_name) us)-      Just _ -> 0---- | Add implicit 'maxLocalBufs' if not present.-add_implicit_buf :: Graph -> Graph-add_implicit_buf g =-    case localbuf_count (ugens g) of-      0 -> g-      n -> let (c,g') = mk_node_c (Constant (fromIntegral n)) g-               p = as_from_port c-               u = NodeU (-1) IR "MaxLocalBufs" [p] [] (Special 0) no_id-           in g' {ugens = u : ugens g'}---- | 'add_implicit_buf' and 'add_implicit_ctl'.-add_implicit :: Graph -> Graph-add_implicit = add_implicit_buf . add_implicit_ctl---- | Is 'Node' an /implicit/ control UGen?-is_implicit_control :: Node -> Bool-is_implicit_control n =-    let cs = ["AudioControl","Control","TrigControl"]-    in case n of-        NodeU x _ s _ _ _ _ -> x == -1 && s `elem` cs-        _ -> False---- | Is Node implicit?-is_implicit :: Node -> Bool-is_implicit n = node_u_name n == "MaxLocalBufs" || is_implicit_control n---- | Remove implicit UGens from 'Graph'-remove_implicit :: Graph -> Graph-remove_implicit g =-    let u = filter (not . is_implicit) (ugens g)-    in g {ugens = u}---- * Queries---- | Is 'FromPort' 'FromPort_U'.-is_from_port_u :: FromPort -> Bool-is_from_port_u p =-    case p of-      FromPort_U _ _ -> True-      _ -> False---- | List of 'FromPort_U' at /e/ with multiple out edges.-multiple_u_out_edges :: [Edge] -> [FromPort]-multiple_u_out_edges e =-    let p = filter is_from_port_u (map fst e)-        p' = group (sortBy (compare `on` port_nid) p)-    in map head (filter ((> 1) . length) p')---- | Descendents at 'Graph' of 'Node'.-node_descendents :: Graph -> Node -> [Node]-node_descendents g n =-    let e = edges (ugens g)-        c = filter ((== node_id n) . port_nid . fst) e-        f (ToPort k _) = k-    in mapMaybe (find_node g . f . snd) c---- * PV edge accounting---- | List @PV@ 'Node's at 'Graph' with multiple out edges.-pv_multiple_out_edges :: Graph -> [Node]-pv_multiple_out_edges g =-    let e = edges (ugens g)-        p = multiple_u_out_edges e-        n = mapMaybe (find_node g . port_nid) p-    in filter (A.primitive_is_pv_rate . node_u_name) n---- | Error if graph has invalid @PV@ subgraph, ie. multiple out edges--- at @PV@ node not connecting to @Unpack1FFT@ & @PackFFT@.-pv_validate :: Graph -> Graph-pv_validate g =-    case pv_multiple_out_edges g of-      [] -> g-      n -> let d = concatMap (map node_u_name . node_descendents g) n-           in if any A.primitive_is_pv_rate d || any (`elem` ["IFFT"]) d-              then error (show-                          ("pv_validate: multiple out edges, see pv_split"-                          ,map node_u_name n-                          ,d))-              else g---- | Transform a unit generator into a graph.------ > import Sound.SC3.UGen--- > ugen_to_graph (out 0 (pan2 (sinOsc AR 440 0) 0.5 0.1))-ugen_to_graph :: UGen -> Graph-ugen_to_graph = pv_validate . mk_graph
− Sound/SC3/UGen/Graph/Reconstruct.hs
@@ -1,143 +0,0 @@--- | A /disassembler/ for UGen graphs.-module Sound.SC3.UGen.Graph.Reconstruct where--import Data.Char {- base -}-import Data.Function {- base -}-import Data.List {- base -}-import Text.Printf {- base -}--import Sound.SC3.UGen.Graph-import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen--node_sort :: [Node] -> [Node]-node_sort = sortBy (compare `on` node_id)--from_port_label :: Char -> FromPort -> String-from_port_label jn fp =-    case fp of-      FromPort_C n -> printf "c_%d" n-      FromPort_K n _ -> printf "k_%d" n-      FromPort_U n Nothing -> printf "u_%d" n-      FromPort_U n (Just i) -> printf "u_%d%co_%d" n jn i--is_operator_name :: String -> Bool-is_operator_name nm =-    case nm of-      c:_ -> not (isLetter c)-      _ -> False--parenthesise_operator :: String -> String-parenthesise_operator nm =-    if is_operator_name nm-    then printf "(%s)" nm-    else nm--reconstruct_graph :: Graph -> ([String],String)-reconstruct_graph g =-    let (Graph _ c k u) = g-        ls = concat [map reconstruct_c_str (node_sort c)-                    ,map reconstruct_k_str (node_sort k)-                    ,concatMap reconstruct_u_str u]-    in (filter (not . null) ls,reconstruct_mrg_str u)--reconstruct_graph_module :: String -> Graph -> [String]-reconstruct_graph_module nm gr =-  let imp = ["import Sound.SC3"-            ,"import Sound.SC3.Common"-            ,"import Sound.SC3.UGen.Plain"]-      (b0:bnd,res) = reconstruct_graph gr-      hs = ("  let " ++ b0) : map ("      " ++ ) bnd ++ ["  in " ++ res]-      pre = [nm ++ " :: UGen",nm ++ " ="]-  in (imp ++ pre ++ hs)--{- | Generate a reconstruction of a 'Graph'.--> import Sound.SC3--> let {k = control KR "bus" 0->     ;o = sinOsc AR 440 0 + whiteNoise 'a' AR->     ;u = out k (pan2 (o * 0.1) 0 1)->     ;m = mrg [u,out 1 (impulse AR 1 0 * 0.1)]}-> in putStrLn (reconstruct_graph_str "anon" (ugen_to_graph m))---}-reconstruct_graph_str :: String -> Graph -> String-reconstruct_graph_str nm = unlines . reconstruct_graph_module nm--reconstruct_c_str :: Node -> String-reconstruct_c_str u =-    let l = node_label u-        c = node_c_value u-    in printf "%s = constant (%f::Sample)" l c--reconstruct_c_ugen :: Node -> UGen-reconstruct_c_ugen u = constant (node_c_value u)---- | Discards index.-reconstruct_k_rnd :: Node -> (Rate,String,Sample)-reconstruct_k_rnd u =-    let r = node_k_rate u-        n = node_k_name u-        d = node_k_default u-    in (r,n,d)--reconstruct_k_str :: Node -> String-reconstruct_k_str u =-    let l = node_label u-        (r,n,d) = reconstruct_k_rnd u-    in printf "%s = control %s \"%s\" %f" l (show r) n d--reconstruct_k_ugen :: Node -> UGen-reconstruct_k_ugen u =-    let (r,n,d) = reconstruct_k_rnd u-    in control_f64 r Nothing n d--ugen_qname :: String -> Special -> (String,String)-ugen_qname nm (Special n) =-    case nm of-      "UnaryOpUGen" -> ("uop CS",unaryName n)-      "BinaryOpUGen" -> ("binop CS",binaryName n)-      _ -> ("ugen",nm)--reconstruct_mce_str :: Node -> String-reconstruct_mce_str u =-    let o = length (node_u_outputs u)-        l = node_label u-        p = map (printf "%s_o_%d" l) [0 .. o - 1]-        p' = intercalate "," p-    in if o <= 1-       then ""-       else printf "[%s] = mceChannels %s" p' l--reconstruct_u_str :: Node -> [String]-reconstruct_u_str u =-    let l = node_label u-        r = node_u_rate u-        i = node_u_inputs u-        i_s = unwords (map (from_port_label '_') i)-        i_l = intercalate "," (map (from_port_label '_') i)-        s = node_u_special u-        (q,n) = ugen_qname (node_u_name u) s-        z = node_id u-        o = length (node_u_outputs u)-        u_s = printf "%s = ugen \"%s\" %s [%s] %d" l n (show r) i_l o-        nd_s = let t = "%s = nondet \"%s\" (UId %d) %s [%s] %d"-               in printf t l n z (show r) i_l o-        c = case q of-              "ugen" -> if node_u_ugenid u == NoId then u_s else nd_s-              _ -> printf "%s = %s \"%s\" %s %s" l q n (show r) i_s-        m = reconstruct_mce_str u-    in if is_implicit_control u-       then []-       else if null m then [c] else [c,m]--reconstruct_mrg_str :: [Node] -> String-reconstruct_mrg_str u =-    let zero_out n = not (is_implicit_control n) && null (node_u_outputs n)-    in case map node_label (filter zero_out u) of-         [] -> error "reconstruct_mrg_str"-         [o] -> printf "%s" o-         o -> printf "mrg [%s]" (intercalate "," o)
− Sound/SC3/UGen/Graph/Transform.hs
@@ -1,78 +0,0 @@--- | Transformations over 'Graph' structure.-module Sound.SC3.UGen.Graph.Transform where--import Data.Either {- base -}-import Data.List {- base -}-import Data.Maybe {- base -}--import Sound.SC3.UGen.Graph-import Sound.SC3.UGen.Rate---- * Lift constants---- | Transform 'NodeC' to 'NodeK', 'id' for other 'Node' types.------ > let r = (NodeK 8 KR Nothing "k_8" 0.1 K_KR,9)--- > in constant_to_control 8 (NodeC 0 0.1) == r-constant_to_control :: NodeId -> Node -> (NodeId,Node)-constant_to_control z n =-    case n of-      NodeC _ k -> (z+1,NodeK z KR Nothing ("k_" ++ show z) k K_KR Nothing)-      _ -> (z,n)---- | Erroring variant of 'from_port_node'.-from_port_node_err :: Graph -> FromPort -> Node-from_port_node_err g fp =-    let e = error "from_port_node_err"-    in fromMaybe e (from_port_node g fp)---- | If the 'FromPort' is a /constant/ generate a /control/ 'Node',--- else retain 'FromPort'.-c_lift_from_port :: Graph -> NodeId -> FromPort -> (NodeId,Either FromPort Node)-c_lift_from_port g z fp =-    case fp of-      FromPort_C _ -> let n = from_port_node_err g fp-                          (z',n') = constant_to_control z n-                      in (z',Right n')-      _ -> (z,Left fp)---- | Lift a set of 'NodeU' /inputs/ from constants to controls.  The--- result triple gives the incremented 'NodeId', the transformed--- 'FromPort' list, and the list of newly minted control 'Node's.-c_lift_inputs :: Graph -> NodeId -> [FromPort] -> (NodeId,[FromPort],[Node])-c_lift_inputs g z i =-    let (z',r) = mapAccumL (c_lift_from_port g) z i-        f e = case e of-                Left fp -> fp-                Right n -> as_from_port n-        r' = map f r-    in (z',r',rights r)--c_lift_ugen :: Graph -> NodeId -> Node -> (NodeId,Node,[Node])-c_lift_ugen g z n =-    let i = node_u_inputs n-        (z',i',k) = c_lift_inputs g z i-    in (z',n {node_u_inputs = i'},k)--c_lift_ugens :: Graph -> NodeId -> [Node] -> (NodeId,[Node],[Node])-c_lift_ugens g  =-    let recur (k,r) z u =-            case u of-              [] -> (z,k,reverse r)-              n:u' -> let (z',n',k') = c_lift_ugen g z n-                      in recur (k++k',n':r) z' u'-    in recur ([],[])---- > import Sound.SC3--- > import Sound.SC3.UGen.Dot------ > let u = out 0 (sinOsc AR 440 0 * 0.1)--- > let g = synth u--- > draw g--- > draw (lift_constants g)-lift_constants :: Graph -> Graph-lift_constants g =-    let (Graph z _ k u) = remove_implicit g-        (z',k',u') = c_lift_ugens g z u-        g' = Graph z' [] (nubBy node_k_eq (k ++ k')) u'-    in add_implicit g'
− Sound/SC3/UGen/HS.hs
@@ -1,326 +0,0 @@--- | Haskell implementations of SC3 UGens.-module Sound.SC3.UGen.HS where--import Data.List {- base -}-import qualified System.Random as R {- random -}--import Sound.SC3.Common.Math---- | F = function, ST = state-type F_ST0 st o = st -> (o,st)-type F_ST1 st i o = (i,st) -> (o,st)---- | U = uniform-type F_U2 n = n -> n -> n-type F_U3 n = n -> n -> n -> n-type F_U4 n = n -> n -> n -> n -> n-type F_U5 n = n -> n -> n -> n -> n -> n-type F_U6 n = n -> n -> n -> n -> n -> n -> n-type F_U7 n = n -> n -> n -> n -> n -> n -> n -> n-type F_U8 n = n -> n -> n -> n -> n -> n -> n -> n -> n-type F_U9 n = n -> n -> n -> n -> n -> n -> n -> n -> n -> n---- | T = tuple-type T2 n = (n,n)-type T3 n = (n,n,n)-type T4 n = (n,n,n,n)-type T5 n = (n,n,n,n,n)-type T6 n = (n,n,n,n,n,n)-type T7 n = (n,n,n,n,n,n,n)-type T8 n = (n,n,n,n,n,n,n,n)-type T9 n = (n,n,n,n,n,n,n,n,n)---- | avg = average-avg2 :: Fractional n => F_U2 n-avg2 p q = (p + q) / 2--avg3 :: Fractional n => F_U3 n-avg3 p q r = (p + q + r) / 3--avg4 :: Fractional n => F_U4 n-avg4 p q r s = (p + q + r + s) / 4--avg5 :: Fractional n => F_U5 n-avg5 p q r s t = (p + q + r + s + t) / 5--avg9 :: Fractional n => F_U9 n-avg9 p q r s t u v w x = (p + q + r + s + t + u + v + w + x) / 9---- | fir = finite impulse response-fir1 :: F_U2 n -> F_ST1 n n n-fir1 f (n,z0) = (f n z0,n)--fir2 :: F_U3 n -> F_ST1 (T2 n) n n-fir2 f (n,(z1,z0)) = (f n z0 z1,(z0,n))--fir3 :: F_U4 n -> F_ST1 (T3 n) n n-fir3 f (n,(z2,z1,z0)) = (f n z0 z1 z2,(z1,z0,n))--fir4 :: F_U5 n -> F_ST1 (T4 n) n n-fir4 f (n,(z3,z2,z1,z0)) = (f n z0 z1 z2 z3,(z2,z1,z0,n))--fir8 :: F_U9 n -> F_ST1 (T8 n) n n-fir8 f (n,(z7,z6,z5,z4,z3,z2,z1,z0)) = (f n z0 z1 z2 z3 z4 z5 z6 z7,(z6,z5,z4,z4,z2,z1,z0,n))---- | iir = infinite impulse response-iir1 :: F_U2 n -> F_ST1 n n n-iir1 f (n,y0) = let r = f n y0 in (r,r)--iir2 :: F_U3 n -> F_ST1 (T2 n) n n-iir2 f (n,(y1,y0)) = let r = f n y0 y1 in (r,(y0,r))--biquad :: F_U5 n -> F_ST1 (T4 n) n n-biquad f (n,(x1,x0,y1,y0)) = let r = f n x0 x1 y0 y1 in (r,(x0,n,y0,r))---- | sos = second order section-sos_f :: Num n => T5 n -> F_U5 n-sos_f (a0,a1,a2,b1,b2) x x1 x2 y1 y2 = a0*x + a1*x1 + a2*x2 - b1*y1 - b2*y2--sos :: Num n => T5 n -> F_ST1 (T4 n) n n-sos p = biquad (sos_f p)---- | hp = high pass-hpz1 :: Fractional n => F_ST1 n n n-hpz1 = fir1 (\n z0 -> 0.5 * (n - z0))--hpz2 :: Fractional n => F_ST1 (T2 n) n n-hpz2 = fir2 (\n z0 z1 -> 0.25 * (n - (2 * z0) + z1))---- | lp = low pass-lpz1 :: Fractional n => F_ST1 n n n-lpz1 = fir1 avg2--lpz2 :: Fractional n => F_ST1 (T2 n) n n-lpz2 = fir2 (\n z0 z1 -> 0.25 * (n + (2 * z0) + z1))---- | bp = band pass-bpz2 :: Fractional n => F_ST1 (T2 n) n n-bpz2 = fir2 (\n _z0 z1 -> 0.5 * (n - z1))---- | br = band reject-brz2 :: Fractional n => F_ST1 (T2 n) n n-brz2 = fir2 (\n _z0 z1 -> 0.5 * (n + z1))---- | mavg = moving average-mavg5 :: Fractional n => F_ST1 (T4 n) n n-mavg5 = fir4 avg5--mavg9 :: Fractional n => F_ST1 (T8 n) n n-mavg9 = fir8 avg9---- | Sample rate (SR) to radians per sample (RPS).------ > sr_to_rps 44100 == 0.00014247585730565955-sr_to_rps :: Floating n => n -> n-sr_to_rps sr = two_pi / sr--resonz_f :: Floating n => T3 n -> (n -> n -> n -> T2 n)-resonz_f (radians_per_sample,f,rq) x y1 y2 =-    let ff = f * radians_per_sample-        b = ff * rq-        r = 1.0 - b * 0.5-        two_r = 2.0 * r-        r2 = r * r-        ct = (two_r * cos ff) / (1.0 + r2)-        b1 = two_r * ct-        b2 = negate r2-        a0 = (1.0 - r2) * 0.5-        y0 = x + b1 * y1 + b2 * y2-    in (a0 * (y0 - y2),y0)---- | ff = feed-forward, fb = feed-back-iir2_ff_fb :: (n -> n -> n -> T2 n) -> (n,T2 n) -> (n,T2 n)-iir2_ff_fb f (n,(y1,y0)) = let (r,y0') = f n y0 y1 in (r,(y0,y0'))---- | ir = initialization rate-resonz_ir :: Floating n => T3 n -> F_ST1 (T2 n) n n-resonz_ir p = iir2_ff_fb (resonz_f p)---- | rlp = resonant low pass-rlpf_f :: Floating n => (n -> n -> n) -> T3 n -> F_U3 n-rlpf_f max_f (radians_per_sample,f,rq) x y1 y2 =-    let qr = max_f 0.001 rq-        pf = f * radians_per_sample-        d = tan (pf * qr * 0.5)-        c = (1.0 - d) / (1.0 + d)-        b1 = (1.0 + c) * cos pf-        b2 = negate c-        a0 = (1.0 + c - b1) * 0.25-    in a0 * x + b1 * y1 + b2 * y2--rlpf_ir :: (Floating n, Ord n) => T3 n -> F_ST1 (T2 n) n n-rlpf_ir p = iir2 (rlpf_f max p)--bw_lpf_or_hpf_coef :: Floating n => Bool -> n -> n -> T5 n-bw_lpf_or_hpf_coef is_hpf sample_rate f =-    let f' = f * pi / sample_rate-        c = if is_hpf then tan f' else 1.0 / tan f'-        c2 = c * c-        s2c = sqrt 2.0 * c-        a0 = 1.0 / (1.0 + s2c + c2)-        a1 = if is_hpf then -2.0 * a0 else 2.0 * a0-        a2 = a0-        b1 = if is_hpf then 2.0 * (c2 - 1.0) * a0 else 2.0 * (1.0 - c2) * a0-        b2 = (1.0 - s2c + c2) * a0-    in (a0,a1,a2,b1,b2)--bw_hpf_ir :: Floating n => T2 n -> F_ST1 (T4 n) n n-bw_hpf_ir (sample_rate,f) = sos (bw_lpf_or_hpf_coef True sample_rate f)--bw_lpf_ir :: Floating n => T2 n -> F_ST1 (T4 n) n n-bw_lpf_ir (sample_rate,f) = sos (bw_lpf_or_hpf_coef False sample_rate f)--white_noise :: (R.RandomGen g, Fractional n, R.Random n) => F_ST0 g n-white_noise = R.randomR (-1.0,1.0)--brown_noise_f :: (Fractional n, Ord n) => n -> n -> n-brown_noise_f x y1 =-    let z = x + y1-    in if z > 1.0 then 2.0 - z else if z < (-1.0) then (-2.0) - z else z--brown_noise :: (R.RandomGen g, Fractional n, R.Random n, Ord n) => F_ST0 (g,n) n-brown_noise (g,y1) =-    let (n,g') = white_noise g-        r = brown_noise_f (n / 8.0) y1-    in (r,(g',r))--decay_f :: Floating a => a -> a -> a -> a -> a-decay_f sr dt x y1 =-    let b1 = exp (log 0.001 / (dt * sr))-    in x + b1 * y1--lag_f :: Floating a => a -> a -> a -> a -> a-lag_f sr t x y1 =-    let b1 = exp (log (0.001 / (t * sr)))-    in x + b1 * (y1 - x)--lag :: Floating t => t -> F_ST1 t (t,t) t-lag sr ((i,t),st) = let r = lag_f sr t i st in (r,r)--latch :: F_ST1 t (t,Bool) t-latch ((n,b),y1) = let r = if b then n else y1 in (r,r)--as_trig :: (Fractional t,Ord t) => F_ST1 t t Bool-as_trig (n,y1) = (y1 <= 0.0 && n > 0.0,n)--phasor :: RealFrac t => F_ST1 t (Bool,t,t,t,t) t-phasor ((trig,rate,start,end,resetPos),ph) =-    let r = if trig then resetPos else sc_wrap start end (ph + rate)-    in (ph,r)---- | * LIST PROCESSING--l_apply_f_st0 :: F_ST0 st o -> st -> [o]-l_apply_f_st0 f st = let (r,st') = f st in r : l_apply_f_st0 f st'--l_white_noise :: (Enum e, Fractional n, R.Random n) => e -> [n]-l_white_noise e = l_apply_f_st0 white_noise (R.mkStdGen (fromEnum e))--l_brown_noise :: (Enum e, Fractional n, Ord n, R.Random n) => e -> [n]-l_brown_noise e = l_apply_f_st0 brown_noise (R.mkStdGen (fromEnum e),0.0)--l_apply_f_st1 :: F_ST1 st i o -> st -> [i] -> [o]-l_apply_f_st1 f st xs =-    case xs of-      [] -> []-      x:xs' -> let (r,st') = f (x,st) in r : l_apply_f_st1 f st' xs'--l_lag :: Floating t => t -> [t] -> [t] -> [t]-l_lag sr i t = l_apply_f_st1 (lag sr) 0 (zip i t)---- > let rp = repeat--- > take 10 (l_phasor (rp False) (rp 1) (rp 0) (rp 4) (rp 0)) == [0,1,2,3,0,1,2,3,0,1]-l_phasor :: RealFrac n => [Bool] -> [n] -> [n] -> [n] -> [n] -> [n]-l_phasor trig rate start end resetPos =-    let i = zip5 trig rate start end resetPos-    in l_apply_f_st1 phasor (head start) i--l_phasor_osc :: RealFrac n => n -> n -> [n] -> [n]-l_phasor_osc sr k f =-    let rp = repeat-    in l_phasor (rp False) (map (cps_to_incr sr k) f) (rp 0) (rp k) (rp 0)--l_sin_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]-l_sin_osc sr f = map sin (l_phasor_osc sr two_pi f)--l_cos_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]-l_cos_osc sr f = map cos (l_phasor_osc sr two_pi f)--l_hpz1 :: Fractional n => [n] -> [n]-l_hpz1 = l_apply_f_st1 hpz1 0--l_hpz2 :: Fractional n => [n] -> [n]-l_hpz2 = l_apply_f_st1 hpz2 (0,0)--l_lpz1 :: Fractional n => [n] -> [n]-l_lpz1 = l_apply_f_st1 lpz1 0--l_lpz2 :: Fractional n => [n] -> [n]-l_lpz2 = l_apply_f_st1 lpz2 (0,0)--l_bpz2 :: Fractional n => [n] -> [n]-l_bpz2 = l_apply_f_st1 bpz2 (0,0)--l_brz2 :: Fractional n => [n] -> [n]-l_brz2 = l_apply_f_st1 brz2 (0,0)--l_bw_hpf :: Floating n => T2 n -> [n] -> [n]-l_bw_hpf p = l_apply_f_st1 (bw_hpf_ir p) (0,0,0,0)--l_bw_lpf :: Floating n => T2 n -> [n] -> [n]-l_bw_lpf p = l_apply_f_st1 (bw_lpf_ir p) (0,0,0,0)--l_resonz_ir :: Floating n => T3 n -> [n] -> [n]-l_resonz_ir p = l_apply_f_st1 (resonz_ir p) (0,0)--l_rlpf_ir :: (Floating n, Ord n) => T3 n -> [n] -> [n]-l_rlpf_ir p = l_apply_f_st1 (rlpf_ir p) (0,0)--l_mavg5 :: Fractional n => [n] -> [n]-l_mavg5 = l_apply_f_st1 mavg5 (0,0,0,0)--l_mavg9 :: Fractional n => [n] -> [n]-l_mavg9 = l_apply_f_st1 mavg9 (0,0,0,0,0,0,0,0)--{---import Sound.SC3.Plot {- hsc3-plot -}-import Sound.SC3.Plot.FFT {- hsc3-plot -}--let n = take 4096 (l_white_noise 'α')--plotTable1 n-plotTable1 (take 4096 (l_brown_noise 'α'))--plotTable1 (l_lpz1 n)-plotTable1 (l_lpz2 n)-plotTable1 (l_hpz1 n)-plotTable1 (l_hpz2 n)--plotTable1 (rfft_pure n)-plotTable1 (rfft_pure (l_lpz1 n))-plotTable1 (rfft_pure (l_lpz2 n))-plotTable1 (rfft_pure (l_hpz1 n))-plotTable1 (rfft_pure (l_hpz2 n))-plotTable1 (rfft_pure (l_bpz2 n))-plotTable1 (rfft_pure (l_brz2 n))-plotTable1 (rfft_pure (l_bw_lpf (44100,9000) n))-plotTable1 (rfft_pure (l_bw_hpf (44100,9000) n))-plotTable1 (rfft_pure (l_resonz_ir (sr_to_rps 44100,440,0.1) n))-plotTable1 (rfft_pure (l_rlpf_ir (sr_to_rps 44100,1200,0.1) n))--import Sound.SC3.Common.Math--plot_fft1_mnn 44100 (rfft_pure (l_bw_lpf (44100,midi_to_cps 60) n))-plot_fft1_mnn 44100 (rfft_pure (l_resonz_ir (sr_to_rps 44100,midi_to_cps 69,0.1) n))-plot_fft1_mnn 44100 (rfft_pure (l_rlpf_ir (sr_to_rps 44100,midi_to_cps 86,0.1) n))--plotTable1 (l_mavg9 (rfft_pure n))-plotTable1 (l_mavg9 (rfft_pure (l_lpz2 n)))-plotTable1 (l_mavg9 (rfft_pure (l_hpz2 n)))-plotTable1 (l_mavg9 (rfft_pure (l_bpz2 n)))-plotTable1 (l_mavg9 (l_mavg9 (l_mavg9 (l_mavg9 (rfft_pure (l_brz2 n))))))--plotTable1 (take 512 (l_sin_osc 48000 (repeat 440)))-plotTable1 (take 512 (l_cos_osc 48000 (repeat 440)))--}
− Sound/SC3/UGen/Help.hs
@@ -1,109 +0,0 @@--- | Functions to provide mediated access to the SC3 help system.------ Requires the HTML files generated by SCDoc.renderAll (sclang).-module Sound.SC3.UGen.Help where--import Control.Exception-import Control.Monad-import Data.List.Split {- split -}-import Data.Maybe-import System.IO.Error-import System.Process {- process -}-import System.Directory {- directory -}-import System.Environment-import System.FilePath {- filepath -}---- | Guarded variant of 'getEnv' with default value.-get_env_default :: String -> String -> IO String-get_env_default e k = do-  r <- tryJust (guard . isDoesNotExistError) (getEnv e)-  case r of-    Right v -> return v-    _ -> return k---- | 'lookupEnv' with default value.------ > lookup_env_default "PATH" "/usr/bin"-lookup_env_default :: String -> String -> IO String-lookup_env_default e k = fmap (fromMaybe k) (lookupEnv e)---- | Read the environment variable @SC3_HELP@, the default value is--- @~\/.local\/share\/SuperCollider/Help@.-sc3HelpDirectory :: IO String-sc3HelpDirectory = do-  h <- getEnv "HOME"-  let d = h </> ".local/share/SuperCollider/Help"-  get_env_default "SC3_HELP" d---- | Locate path to indicated SC3 class help file.------ > import System.FilePath--- >--- > d <- sc3HelpDirectory--- > h <- sc3HelpClassFile d "SinOsc"--- > h == Just (d </> "Classes/SinOsc.html")-sc3HelpClassFile :: FilePath -> String -> IO (Maybe FilePath)-sc3HelpClassFile d c = do-  let f = d </> "Classes" </> c <.> "html"-  e <- doesFileExist f-  return (if e then Just f else Nothing)---- | Generate path to indicated SC3 operator help file.------ > sc3HelpOperatorEntry "." "+" == "./Overviews/Operators.html#.+"-sc3HelpOperatorEntry :: FilePath -> String -> FilePath-sc3HelpOperatorEntry d o = d </> "Overviews/Operators.html#." ++ o---- | Generate path to indicated SC3 method help.------ > sc3HelpMethod "." '*' ("C","m") == "./Classes/C.html#*m"-sc3HelpMethod :: FilePath -> Char -> (String,String) -> FilePath-sc3HelpMethod d z (c,m) = d </> "Classes" </> c <.> "html#" ++ [z] ++ m---- | Generate path to indicated SC3 class method help.------ > sc3HelpClassMethod "." ("C","m") == "./Classes/C.html#*m"-sc3HelpClassMethod :: FilePath -> (String,String) -> FilePath-sc3HelpClassMethod d = sc3HelpMethod d '*'---- | Generate path to indicated SC3 instance method help.------ > sc3HelpInstanceMethod "." ("C","m") == "./Classes/C.html#-m"-sc3HelpInstanceMethod :: FilePath -> (String,String) -> FilePath-sc3HelpInstanceMethod d = sc3HelpMethod d '-'---- | The name of the local SC3 Help file documenting `u'.  Deletes--- @\@@ to allow use on haddock quoted comments.------ > import Sound.SC3.UGen.Name--- >--- > ugenSC3HelpFile "Collection.*fill"--- > ugenSC3HelpFile "Collection.inject"--- > ugenSC3HelpFile (toSC3Name "sinOsc")-ugenSC3HelpFile :: String -> IO FilePath-ugenSC3HelpFile x = do-  let s = filter (`notElem` "@") x-  d <- sc3HelpDirectory-  cf <- sc3HelpClassFile d s-  case splitOn "." s of-    ["Operator",m] -> return (sc3HelpOperatorEntry d m)-    [c,'*':m] -> return (sc3HelpClassMethod d (c,m))-    [c,m] -> return (sc3HelpInstanceMethod d (c,m))-    _ -> case cf of-           Just cf' -> return cf'-           Nothing -> error (show ("ugenSC3HelpFile",d,cf,x,s))---- | Use @BROWSER@ or @x-www-browser@ to view SC3 help file for `u'.------ > get_env_default "BROWSER" "x-www-browser"------ > import Sound.SC3.UGen.Name--- >--- > viewSC3Help (toSC3Name "Collection.*fill")--- > viewSC3Help (toSC3Name "Collection.inject")--- > viewSC3Help (toSC3Name "sinOsc")-viewSC3Help :: String -> IO ()-viewSC3Help u = do-  nm <- ugenSC3HelpFile u-  br <- get_env_default "BROWSER" "x-www-browser"-  void (rawSystem br ["file://" ++ nm])
− Sound/SC3/UGen/Help/Graph.hs
@@ -1,82 +0,0 @@--- | Standard SC3 graphs, referenced in documentation.-module Sound.SC3.UGen.Help.Graph where--import Sound.SC3.Common.Envelope--import Sound.SC3.UGen.Bindings-import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- | The SC3 /default/ instrument 'UGen' graph.-default_ugen_graph :: UGen-default_ugen_graph =-    let f = control KR "freq" 440-        a = control KR "amp" 0.1-        p = control KR "pan" 0-        g = control KR "gate" 1-        o = control KR "out" 0-        e = linen g 0.01 0.7 0.3 RemoveSynth-        f3 = mce [f,f + rand 'α' (-0.4) 0,f + rand 'β' 0 0.4]-        l = xLine KR (rand 'γ' 4000 5000) (rand 'δ' 2500 3200) 1 DoNothing-        z = lpf (mix (varSaw AR f3 0 0.3 * 0.3)) l * e-    in out o (pan2 z p a)---- | A /Gabor/ grain, envelope is by 'lfGauss'.-gabor_grain_ugen_graph :: UGen-gabor_grain_ugen_graph =-    let o = control IR "out" 0-        f = control IR "freq" 440-        d = control IR "sustain" 1-        l = control IR "pan" 0-        a = control IR "amp" 0.1-        w = control IR "width" 0.25-        e = lfGauss AR d w 0 NoLoop RemoveSynth-        s = fSinOsc AR f (0.5 * pi) * e-    in offsetOut o (pan2 s l a)---- | A /sine/ grain, envelope is by 'envGen' of 'envSine'.-sine_grain_ugen_graph :: UGen-sine_grain_ugen_graph =-    let o = control IR "out" 0-        f = control IR "freq" 440-        d = control IR "sustain" 1-        l = control IR "pan" 0-        a = control IR "amp" 0.1-        w = control IR "width" 0.25-        e = envGen AR 1 1 0 1 RemoveSynth (envSine (d * w) 1)-        s = fSinOsc AR f (0.5 * pi) * e-    in offsetOut o (pan2 s l a)---- | Trivial file playback instrument.------ If /use_gate/ is 'True' there is a /gate/ parameter and the synth--- ends either when the sound file ends or the gate closes, else there--- is a /sustain/ parameter to indicate the duration.  In both cases a--- linear envelope with a decay time of /decay/ is applied.------ The /rdelay/ parameter sets the maximum pre-delay time (in--- seconds), each instance is randomly pre-delayed between zero and--- the indicated time.  The /ramplitude/ parameter sets the maximum--- amplitude offset of the /amp/ parameter, each instance is randomly--- amplified between zero and the indicated value.-default_sampler_ugen_graph :: Bool -> UGen-default_sampler_ugen_graph use_gate =-    let b = control KR "bufnum" 0-        l = control KR "pan" 0-        a = control KR "amp" 0.1-        r = control KR "rate" 1-        m = control KR "rdelay" 0-        v = control KR "ramplitude" 0-        w = control KR "attack" 0-        y = control KR "decay" 0.5-        r' = bufRateScale KR b * r-        p = playBuf 1 AR b r' 1 0 NoLoop RemoveSynth-        e = if use_gate-            then let g = control KR "gate" 1-                 in envGen KR g 1 0 1 RemoveSynth (envASR w 1 y EnvSin)-            else let s = control KR "sustain" 1-                 in envGen KR 1 1 0 1 RemoveSynth (envLinen w s y 1)-        d = delayC (p * e) m (rand 'α' 0 m)-    in out 0 (pan2 d l (a + rand 'β' 0 v))
− Sound/SC3/UGen/Identifier.hs
@@ -1,21 +0,0 @@--- | Typeclass and functions to manage UGen identifiers.-module Sound.SC3.UGen.Identifier where--import qualified Data.Hashable as H {- hashable -}---- | Typeclass to constrain UGen identifiers.-class H.Hashable a => ID a where-    resolveID :: a -> Int-    resolveID = H.hash--instance ID Int where-instance ID Integer where-instance ID Char where-instance ID Float where-instance ID Double where---- | Hash 'ID's /p/ and /q/ and sum to form an 'Int'.------ > 'a' `joinID` (1::Int) == 1627429042-joinID :: (ID a,ID b) => a -> b -> Int-joinID p q = H.hash p `H.hashWithSalt` H.hash q
− Sound/SC3/UGen/MCE.hs
@@ -1,49 +0,0 @@--- | The SC3 multiple channel expansion rules over an abstract type.-module Sound.SC3.UGen.MCE where---- | Multiple channel expansion.-data MCE n = MCE_Unit n | MCE_Vector [n]-             deriving (Eq,Read,Show)--mce_elem :: MCE t -> [t]-mce_elem m =-    case m of-      MCE_Unit e -> [e]-      MCE_Vector e -> e---- | Extend 'MCE' to specified degree.-mce_extend :: Int -> MCE n -> MCE n-mce_extend n m =-    case m of-      MCE_Unit e -> MCE_Vector (replicate n e)-      MCE_Vector e -> MCE_Vector (take n (cycle e))--mce_map :: (a -> b) -> MCE a -> MCE b-mce_map f m =-    case m of-      MCE_Unit e -> MCE_Unit (f e)-      MCE_Vector e -> MCE_Vector (map f e)--mce_binop :: (a -> b -> c) -> MCE a -> MCE b -> MCE c-mce_binop f m1 m2 =-    case (m1,m2) of-      (MCE_Unit e1,MCE_Unit e2) -> MCE_Unit (f e1 e2)-      (MCE_Unit e1,MCE_Vector e2) -> MCE_Vector (map (f e1) e2)-      (MCE_Vector e1,MCE_Unit e2) -> MCE_Vector (map (`f` e2) e1)-      (MCE_Vector e1,MCE_Vector e2) ->-          let n = max (length e1) (length e2)-              ext = take n . cycle-          in MCE_Vector (zipWith f (ext e1) (ext e2))--instance Num n => Num (MCE n) where-    (+) = mce_binop (+)-    (-) = mce_binop (-)-    (*) = mce_binop (*)-    abs = mce_map abs-    negate = mce_map negate-    signum = mce_map signum-    fromInteger = MCE_Unit . fromInteger--instance Fractional n => Fractional (MCE n) where-    (/) = mce_binop (/)-    fromRational = MCE_Unit . fromRational
− Sound/SC3/UGen/Math.hs
@@ -1,384 +0,0 @@--- | Non-standard mathematical classes and class instances.-module Sound.SC3.UGen.Math where--import qualified Data.Fixed as F {- base -}-import Data.Int {- base -}--import Sound.SC3.Common.Math-import Sound.SC3.UGen.Bindings.DB (mulAdd)-import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.Type---- | Pseudo-infinite constant UGen.-dinf :: UGen-dinf = constant (9e8::Float)---- | True is conventionally 1.  The test to determine true is @> 0@.-sc3_true :: Num n => n-sc3_true = 1---- | False is conventionally 0.-sc3_false :: Num n => n-sc3_false = 0---- | Lifted 'not'.------ > sc3_not sc3_true == sc3_false--- > sc3_not sc3_false == sc3_true-sc3_not :: (Ord n,Num n) => n -> n-sc3_not = sc3_bool . not . (> 0)---- | Translate 'Bool' to 'sc3_true' and 'sc3_false'.-sc3_bool :: Num n => Bool -> n-sc3_bool b = if b then sc3_true else sc3_false---- | Lift comparison function.-sc3_comparison :: Num n => (n -> n -> Bool) -> n -> n -> n-sc3_comparison f p q = sc3_bool (f p q)---- | Lifted '=='.-sc3_eq :: (Num n, Eq n) => n -> n -> n-sc3_eq = sc3_comparison (==)---- | Lifted '/='.-sc3_neq :: (Num n, Eq n) => n -> n -> n-sc3_neq = sc3_comparison (/=)---- | Lifted '<'.-sc3_lt :: (Num n, Ord n) => n -> n -> n-sc3_lt = sc3_comparison (<)---- | Lifted '<='.-sc3_lte :: (Num n, Ord n) => n -> n -> n-sc3_lte = sc3_comparison (<=)---- | Lifted '>'.-sc3_gt :: (Num n, Ord n) => n -> n -> n-sc3_gt = sc3_comparison (>)---- | Lifted '>='.-sc3_gte :: (Num n, Ord n) => n -> n -> n-sc3_gte = sc3_comparison (>=)---- | Association table for 'Binary' to haskell function implementing operator.-binop_hs_tbl :: (Real n,Floating n,RealFrac n) => [(Binary,n -> n -> n)]-binop_hs_tbl =-    [(Add,(+))-    ,(Sub,(-))-    ,(FDiv,(/))-    ,(IDiv,sc3_idiv)-    ,(Mod,sc3_mod)-    ,(EQ_,sc3_eq)-    ,(NE,sc3_neq)-    ,(LT_,sc3_lt)-    ,(LE,sc3_lte)-    ,(GT_,sc3_gt)-    ,(GE,sc3_gte)-    ,(Min,min)-    ,(Max,max)-    ,(Mul,(*))-    ,(Pow,(**))-    ,(Min,min)-    ,(Max,max)-    ,(Round,sc3_round_to)]---- | 'lookup' 'binop_hs_tbl' via 'toEnum'.-binop_special_hs :: (RealFrac n,Floating n) => Int -> Maybe (n -> n -> n)-binop_special_hs z = lookup (toEnum z) binop_hs_tbl---- | Association table for 'Unary' to haskell function implementing operator.-uop_hs_tbl :: (RealFrac n,Floating n) => [(Unary,n -> n)]-uop_hs_tbl =-    [(Neg,negate)-    ,(Not,\z -> if z > 0 then 0 else 1)-    ,(Abs,abs)-    ,(Ceil,sc_ceiling)-    ,(Floor,sc_floor)-    ,(Squared,\z -> z * z)-    ,(Cubed,\z -> z * z * z)-    ,(Sqrt,sqrt)-    ,(Recip,recip)-    ,(MIDICPS,midi_to_cps)-    ,(CPSMIDI,cps_to_midi)-    ,(Sin,sin)-    ,(Cos,cos)-    ,(Tan,tan)]---- | 'lookup' 'uop_hs_tbl' via 'toEnum'.-uop_special_hs :: (RealFrac n,Floating n) => Int -> Maybe (n -> n)-uop_special_hs z = lookup (toEnum z) uop_hs_tbl---- The Eq and Ord classes in the Prelude require Bool, hence the name--- mangling.  True is 1.0, False is 0.0---- | Variant on Eq class, result is of the same type as the values compared.-class (Eq a,Num a) => EqE a where-    (==*) :: a -> a -> a-    (==*) = sc3_eq-    (/=*) :: a -> a -> a-    (/=*) = sc3_neq--instance EqE Int where-instance EqE Integer where-instance EqE Int32 where-instance EqE Int64 where-instance EqE Float where-instance EqE Double where--instance EqE UGen where-    (==*) = mkBinaryOperator EQ_ (==*)-    (/=*) = mkBinaryOperator NE (/=*)---- | Variant on Ord class, result is of the same type as the values compared.-class (Ord a,Num a) => OrdE a where-    (<*) :: a -> a -> a-    (<*) = sc3_lt-    (<=*) :: a -> a -> a-    (<=*) = sc3_lte-    (>*) :: a -> a -> a-    (>*) = sc3_gt-    (>=*) :: a -> a -> a-    (>=*) = sc3_gte--instance OrdE Int-instance OrdE Integer-instance OrdE Int32 where-instance OrdE Int64 where-instance OrdE Float-instance OrdE Double--instance OrdE UGen where-    (<*) = mkBinaryOperator LT_ sc3_lt-    (<=*) = mkBinaryOperator LE sc3_lte-    (>*) = mkBinaryOperator GT_ sc3_gt-    (>=*) = mkBinaryOperator GE sc3_gte---- | Variant of 'RealFrac' with non 'Integral' results.-class RealFrac a => RealFracE a where-  properFractionE :: a -> (a,a)-  properFractionE = sc3_properFraction-  truncateE :: a -> a-  truncateE = sc_truncate-  roundE :: a -> a-  roundE = sc_round-  ceilingE :: a -> a-  ceilingE = sc_ceiling-  floorE :: a -> a-  floorE = sc_floor--instance RealFracE Float-instance RealFracE Double---- | 'UGen' form or 'sc3_round_to'.-roundTo :: UGen -> UGen -> UGen-roundTo = mkBinaryOperator Round sc3_round_to--instance RealFracE UGen where-    properFractionE = error "UGen.properFractionE"-    truncateE = error "UGen.truncateE"-    roundE i = roundTo i 1-    ceilingE = mkUnaryOperator Ceil ceilingE-    floorE = mkUnaryOperator Floor floorE---- | 'UGen' form of 'ceilingE'.-ceil :: UGen -> UGen-ceil = ceilingE---- | Unary operator class.------ > map (floor . (* 1e4) . dbAmp) [-90,-60,-30,0] == [0,10,316,10000]-class (Floating a, Ord a) => UnaryOp a where-    ampDb :: a -> a-    ampDb = amp_to_db-    asFloat :: a -> a-    asFloat = error "asFloat"-    asInt :: a -> a-    asInt = error "asInt"-    cpsMIDI :: a -> a-    cpsMIDI = cps_to_midi-    cpsOct :: a -> a-    cpsOct = cps_to_oct-    cubed :: a -> a-    cubed n = n * n * n-    dbAmp :: a -> a-    dbAmp = db_to_amp-    distort :: a -> a-    distort = error "distort"-    frac :: a -> a-    frac = error "frac"-    isNil :: a -> a-    isNil a = if a == 0.0 then 0.0 else 1.0-    log10 :: a -> a-    log10 = logBase 10-    log2 :: a -> a-    log2 = logBase 2-    midiCPS :: a -> a-    midiCPS = midi_to_cps-    midiRatio :: a -> a-    midiRatio = midi_to_ratio-    notE :: a -> a-    notE a = if a > 0.0 then 0.0 else 1.0-    notNil :: a -> a-    notNil a = if a /= 0.0 then 0.0 else 1.0-    octCPS :: a -> a-    octCPS = oct_to_cps-    ramp_ :: a -> a-    ramp_ _ = error "ramp_"-    ratioMIDI :: a -> a-    ratioMIDI = ratio_to_midi-    softClip :: a -> a-    softClip = error "softClip"-    squared :: a -> a-    squared = \z -> z * z--instance UnaryOp Float where-instance UnaryOp Double where--instance UnaryOp UGen where-    ampDb = mkUnaryOperator AmpDb ampDb-    asFloat = mkUnaryOperator AsFloat asFloat-    asInt = mkUnaryOperator AsInt asInt-    cpsMIDI = mkUnaryOperator CPSMIDI cpsMIDI-    cpsOct = mkUnaryOperator CPSOct cpsOct-    cubed = mkUnaryOperator Cubed cubed-    dbAmp = mkUnaryOperator DbAmp dbAmp-    distort = mkUnaryOperator Distort distort-    frac = mkUnaryOperator Frac frac-    isNil = mkUnaryOperator IsNil isNil-    log10 = mkUnaryOperator Log10 log10-    log2 = mkUnaryOperator Log2 log2-    midiCPS = mkUnaryOperator MIDICPS midiCPS-    midiRatio = mkUnaryOperator MIDIRatio midiRatio-    notE = mkUnaryOperator Not notE-    notNil = mkUnaryOperator NotNil notNil-    octCPS = mkUnaryOperator OctCPS octCPS-    ramp_ = mkUnaryOperator Ramp_ ramp_-    ratioMIDI = mkUnaryOperator RatioMIDI ratioMIDI-    softClip = mkUnaryOperator SoftClip softClip-    squared = mkUnaryOperator Squared squared---- | Binary operator class.-class (Floating a,RealFrac a, Ord a) => BinaryOp a where-    absDif :: a -> a -> a-    absDif a b = abs (a - b)-    amClip :: a -> a -> a-    amClip a b = if b <= 0 then 0 else a * b-    atan2E :: a -> a -> a-    atan2E a b = atan (b/a)-    clip2 :: a -> a -> a-    clip2 a b = sc_clip a (-b) b-    difSqr :: a -> a -> a-    difSqr = sc_dif_sqr-    excess :: a -> a -> a-    excess a b = a - sc_clip a (-b) b-    exprandRange :: a -> a -> a-    exprandRange = error "exprandRange"-    fill :: a -> a -> a-    fill = error "fill"-    firstArg :: a -> a -> a-    firstArg a _ = a-    fold2 :: a -> a -> a-    fold2 a b = fold_ a (-b) b-    gcdE :: a -> a -> a-    gcdE = error "gcdE"-    hypot :: a -> a -> a-    hypot = sc_hypot-    hypotx :: a -> a -> a-    hypotx = sc_hypotx-    iDiv :: a -> a -> a-    iDiv = sc3_idiv-    lcmE :: a -> a -> a-    lcmE = error "lcmE"-    modE :: a -> a -> a-    modE = error "modE"-    randRange :: a -> a -> a-    randRange = error "randRange"-    ring1 :: a -> a -> a-    ring1 a b = a * b + a-    ring2 :: a -> a -> a-    ring2 a b = a * b + a + b-    ring3 :: a -> a -> a-    ring3 a b = a * a * b-    ring4 :: a -> a -> a-    ring4 a b = a * a * b - a * b * b-    roundUp :: a -> a -> a-    roundUp = error "roundUp"-    scaleNeg :: a -> a -> a-    scaleNeg a b = (abs a - a) * b' + a where b' = 0.5 * b + 0.5-    sqrDif :: a -> a -> a-    sqrDif a b = (a-b) * (a-b)-    sqrSum :: a -> a -> a-    sqrSum a b = (a+b) * (a+b)-    sumSqr :: a -> a -> a-    sumSqr a b = (a*a) + (b*b)-    thresh :: a -> a -> a-    thresh a b = if a <  b then 0 else a-    trunc :: a -> a -> a-    trunc = error "trunc"-    wrap2 :: a -> a -> a-    wrap2 = error "wrap2"--instance BinaryOp Float where-    fold2 a b = fold_ a (-b) b-    modE = F.mod'-    roundUp a b = if b == 0 then a else ceilingE (a/b + 0.5) * b-    wrap2 a b = sc_wrap_ni a (-b) b--instance BinaryOp Double where-    fold2 a b = fold_ a (-b) b-    modE = F.mod'-    roundUp a b = if b == 0 then a else ceilingE (a/b + 0.5) * b-    wrap2 a b = sc_wrap_ni a (-b) b--instance BinaryOp UGen where-    iDiv = mkBinaryOperator IDiv iDiv-    modE = mkBinaryOperator Mod F.mod'-    lcmE = mkBinaryOperator LCM lcmE-    gcdE = mkBinaryOperator GCD gcdE-    roundUp = mkBinaryOperator RoundUp roundUp-    trunc = mkBinaryOperator Trunc trunc-    atan2E = mkBinaryOperator Atan2 atan2E-    hypot = mkBinaryOperator Hypot hypot-    hypotx = mkBinaryOperator Hypotx hypotx-    fill = mkBinaryOperator Fill fill-    ring1 = mkBinaryOperator Ring1 ring1-    ring2 = mkBinaryOperator Ring2 ring2-    ring3 = mkBinaryOperator Ring3 ring3-    ring4 = mkBinaryOperator Ring4 ring4-    difSqr = mkBinaryOperator DifSqr difSqr-    sumSqr = mkBinaryOperator SumSqr sumSqr-    sqrSum = mkBinaryOperator SqrSum sqrSum-    sqrDif = mkBinaryOperator SqrDif sqrDif-    absDif = mkBinaryOperator AbsDif absDif-    thresh = mkBinaryOperator Thresh thresh-    amClip = mkBinaryOperator AMClip amClip-    scaleNeg = mkBinaryOperator ScaleNeg scaleNeg-    clip2 = mkBinaryOperator Clip2 clip2-    excess = mkBinaryOperator Excess excess-    fold2 = mkBinaryOperator Fold2 fold2-    wrap2 = mkBinaryOperator Wrap2 wrap2-    firstArg = mkBinaryOperator FirstArg firstArg-    randRange = mkBinaryOperator RandRange randRange-    exprandRange = mkBinaryOperator ExpRandRange exprandRange---- | MulAdd operator class.-class Num a => MulAdd a where-    mul_add :: a -> a -> a -> a-    mul_add i m a = i * m + a--instance MulAdd UGen where mul_add = mulAdd-instance MulAdd Float where-instance MulAdd Double where---- | Map from one linear range to another linear range.-linlin_ma :: (Fractional a,MulAdd a) => a -> a -> a -> a -> a -> a-linlin_ma i sl sr dl dr = let (m,a) = linlin_muladd sl sr dl dr in mul_add i m a---- | Scale uni-polar (0,1) input to linear (l,r) range-urange_ma :: (Fractional a,MulAdd a) => a -> a -> a -> a-urange_ma l r i = let m = r - l in mul_add i m l---- | Scale bi-polar (-1,1) input to linear (l,r) range.  Note that the--- argument order is not the same as 'linLin'.-range_ma :: (Fractional a,MulAdd a) => a -> a -> a -> a-range_ma l r i = let (m,a) = range_muladd l r in mul_add i m a
− Sound/SC3/UGen/Math/Composite.hs
@@ -1,20 +0,0 @@-module Sound.SC3.UGen.Math.Composite where--import Sound.SC3.UGen.Math-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen--ugen_if :: Num a => a -> a -> a -> a-ugen_if p q r = (p * q) + ((1 - p) * r)---- > ugen_integral_and_fractional_parts 1.5 == mce2 1 0.5-ugen_integral_and_fractional_parts :: UGen -> UGen-ugen_integral_and_fractional_parts n =-    let gt_eq_0 = let n' = floorE n in mce2 n' (n - n')-        lt_0 = let n' = ceilingE n in mce2 n' (n - n')-    in ugen_if (n >=* 0) gt_eq_0 lt_0--ugen_fmidi_to_midi_detune :: UGen -> UGen-ugen_fmidi_to_midi_detune mnn =-    let (n,c) = unmce2 (ugen_integral_and_fractional_parts mnn)-    in mce2 n (c * 100)
− Sound/SC3/UGen/Name.hs
@@ -1,99 +0,0 @@--- | Functions to normalise UGen names.  @SC3@ UGen names are--- capitalised, @hsc3@ cannot use the same names for UGen constructor--- functions.  The functions here are heuristics, and are likely only--- partial.-module Sound.SC3.UGen.Name where--import Data.Char {- base -}-import Data.List.Split {- split -}--import Sound.SC3.Common.Prelude {- hsc3 -}-import Sound.SC3.UGen.Rate {- hsc3 -}---- | Convert from @hsc3@ name to @SC3@ name.------ > toSC3Name "sinOsc" == "SinOsc"--- > toSC3Name "lfSaw" == "LFSaw"--- > toSC3Name "pv_Copy" == "PV_Copy"--- > map toSC3Name ["bpf","fft","tpv","out","in'","fbSineN"]-toSC3Name :: String -> String-toSC3Name nm =-    case nm of-      "in'" -> "In"-      "bpz2" -> "BPZ2"-      "brz2" -> "BRZ2"-      "ifft" -> "IFFT"-      "out" -> "Out"-      "rhpf" -> "RHPF"-      "rlpf" -> "RLPF"-      'f':'b':nm' -> "FB" ++ nm'-      'h':'p':'z':nm' -> "HPZ" ++ nm'-      'l':'f':'d':nm' -> "LFD" ++ nm'-      'l':'p':'z':nm' -> "LPZ" ++ nm'-      'l':'f':nm' -> "LF" ++ nm'-      'p':'v':'_':nm' -> "PV_" ++ nm'-      p:q -> if all isLower nm && length nm <= 3-             then map toUpper nm-             else toUpper p : q-      [] -> []---- | Inverse of 'toSC3Name'.------ > let nm = ["SinOsc","LFSaw","PV_Copy","FBSineN"]--- > in map fromSC3Name nm == ["sinOsc","lfSaw","pv_Copy","fbSineN"]------ > map fromSC3Name ["BPF","FFT","TPV"] == ["bpf","fft","tpv"]------ > map fromSC3Name (words "HPZ1 RLPF")-fromSC3Name :: String -> String-fromSC3Name nm =-    case nm of-      "In" -> "in'"-      "BPZ2" -> "bpz2"-      "BRZ2" -> "brz2"-      "IFFT" -> "ifft"-      "RHPF" -> "rhpf"-      "RLPF" -> "rlpf"-      'F':'B':nm' -> "fb" ++ nm'-      'H':'P':'Z':nm' -> "hpz" ++ nm'-      'L':'F':'D':nm' -> "lfd" ++ nm'-      'L':'P':'Z':nm' -> "lpz" ++ nm'-      'L':'F':nm' -> "lf" ++ nm'-      'P':'V':'_':nm' -> "pv_" ++ nm'-      p:q -> if all isUpper nm && length nm <= 3-             then map toLower nm-             else toLower p : q-      [] -> []---- | Find SC3 name edges.------ > sc3_name_edges "SinOsc" == [False,False,False,True,False,False]-sc3_name_edges :: String -> [Bool]-sc3_name_edges =-    let f t = case t of-                (Nothing,_,_) -> False-                (Just p,q,Just r) ->-                    (isLower p && isUpper q) ||-                    (isUpper p && isUpper q && isLower r && [p,q,r] /= "UGe")-                (Just p,q,Nothing) -> isLower p && isUpper q-    in map f . pcn_triples---- | Convert from SC3 name to Lisp style name.------ > let {s = words "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF TGrains"--- >     ;l = words "sin-osc lf-saw fft pv-add allpass-n b-hi-pass binary-op-ugen hpz1 rlpf t-grains"}--- > in map sc3_name_to_lisp_name s == l-sc3_name_to_lisp_name :: String -> String-sc3_name_to_lisp_name s =-    let f (c,e) = if e then ['-',c] else if c == '_' then "-" else [c]-    in concatMap f (zip (map toLower s) (sc3_name_edges s))---- | SC3 UGen /names/ are given with rate suffixes if oscillators, without if filters.------ > map sc3_ugen_name_sep (words "SinOsc.ar LPF *")-sc3_ugen_name_sep :: String -> Maybe (String,Maybe Rate)-sc3_ugen_name_sep u =-    case splitOn "." u of-      [nm,rt] -> Just (nm,rate_parse (map toUpper rt))-      [nm] -> Just (nm,Nothing)-      _ -> Nothing
− Sound/SC3/UGen/Operator.hs
@@ -1,211 +0,0 @@--- | Enumerations of the unary and binary math unit generators.  Names--- that conflict with existing names have a @_@ suffix.-module Sound.SC3.UGen.Operator where--import Control.Monad {- base -}-import Data.Maybe {- base -}--import Sound.SC3.Common.Prelude {- hsc3 -}---- * Unary---- | Enumeration of @SC3@ unary operator UGens.-data Unary  = Neg-            | Not-            | IsNil-            | NotNil-            | BitNot-            | Abs-            | AsFloat-            | AsInt-            | Ceil-            | Floor-            | Frac-            | Sign-            | Squared-            | Cubed-            | Sqrt-            | Exp-            | Recip-            | MIDICPS-            | CPSMIDI-            | MIDIRatio-            | RatioMIDI-            | DbAmp-            | AmpDb-            | OctCPS-            | CPSOct-            | Log-            | Log2-            | Log10-            | Sin-            | Cos-            | Tan-            | ArcSin-            | ArcCos-            | ArcTan-            | SinH-            | CosH-            | TanH-            | Rand_ -- UGen-            | Rand2-            | LinRand_ -- UGen-            | BiLinRand-            | Sum3Rand-            | Distort-            | SoftClip-            | Coin-            | DigitValue-            | Silence-            | Thru-            | RectWindow-            | HanWindow-            | WelchWindow-            | TriWindow-            | Ramp_ -- UGen-            | SCurve-              deriving (Eq,Show,Enum,Bounded,Read)---- | Type-specialised 'parse_enum'.-parse_unary :: Case_Rule -> String -> Maybe Unary-parse_unary = parse_enum---- | Table of symbolic names for standard unary operators.-unaryTable :: [(Unary,String)]-unaryTable = [] -- (Neg,"-")---- | Lookup possibly symbolic name for standard unary operators.-unaryName :: Int -> String-unaryName n =-    let e = toEnum n-    in fromMaybe (show e) (lookup e unaryTable)---- | Given name of unary operator derive index.------ > mapMaybe (unaryIndex CI) (words "NEG CUBED") == [0,13]--- > unaryIndex CS "SinOsc" == Nothing-unaryIndex :: Case_Rule -> String -> Maybe Int-unaryIndex cr nm =-    let ix = rlookup_str cr nm unaryTable-        ix' = parse_unary cr nm-    in fmap fromEnum (mplus ix' ix)---- | 'isJust' of 'unaryIndex'.------ > map (is_unary CI) (words "ABS MIDICPS NEG")--- > map (is_unary CI) (words "- RAND")-is_unary :: Case_Rule -> String -> Bool-is_unary cr = isJust . unaryIndex cr---- * Binary---- | Enumeration of @SC3@ unary operator UGens.------ > map show [minBound :: Binary .. maxBound]-data Binary = Add -- 0-            | Sub -- 1-            | Mul -- 2-            | IDiv-            | FDiv -- 4-            | Mod -- 5-            | EQ_ -- 6-            | NE -- 7-            | LT_ -- 8-            | GT_ -- 9-            | LE -- 10-            | GE -- 11-            | Min -- 12-            | Max-            | BitAnd-            | BitOr-            | BitXor-            | LCM-            | GCD-            | Round-            | RoundUp-            | Trunc-            | Atan2-            | Hypot-            | Hypotx-            | Pow -- 25-            | ShiftLeft-            | ShiftRight-            | UnsignedShift-            | Fill-            | Ring1-            | Ring2-            | Ring3-            | Ring4-            | DifSqr-            | SumSqr-            | SqrSum-            | SqrDif-            | AbsDif-            | Thresh-            | AMClip-            | ScaleNeg-            | Clip2-            | Excess-            | Fold2-            | Wrap2-            | FirstArg-            | RandRange-            | ExpRandRange-              deriving (Eq,Show,Enum,Bounded,Read)---- | Type-specialised 'parse_enum'.-parse_binary :: Case_Rule -> String -> Maybe Binary-parse_binary = parse_enum---- | Table of symbolic names for standard binary operators.-binaryTable :: [(Binary,String)]-binaryTable =-    [(Add,"+")-    ,(Sub,"-")-    ,(Mul,"*")-    ,(FDiv,"/")-    ,(Mod,"%")-    ,(EQ_,"==")-    ,(NE,"/=")-    ,(LT_,"<")-    ,(GT_,">")-    ,(LE,"<=")-    ,(GE,">=")-    ,(Pow,"**")]---- | Lookup possibly symbolic name for standard binary operators.------ > map binaryName [1,2,8,12] == ["-","*","<","Min"]-binaryName :: Int -> String-binaryName n =-    let e = toEnum n-    in fromMaybe (show e) (lookup e binaryTable)---- | Given name of binary operator derive index.------ > mapMaybe (binaryIndex CI) (words "* MUL RING1") == [2,2,30]--- > binaryIndex CI "SINOSC" == Nothing-binaryIndex :: Case_Rule -> String -> Maybe Int-binaryIndex cr nm =-    let ix = rlookup_str cr nm binaryTable-        ix' = parse_binary cr nm-    in fmap fromEnum (mplus ix' ix)---- | 'isJust' of 'binaryIndex'.------ > map (is_binary CI) (words "== > % TRUNC MAX")-is_binary :: Case_Rule -> String -> Bool-is_binary cr = isJust . binaryIndex cr---- * Operator---- | Order of lookup: binary then unary.------ > map (resolve_operator CI) (words "+ - ADD SUB NEG")-resolve_operator :: Case_Rule -> String -> (String,Maybe Int)-resolve_operator cr nm =-    case binaryIndex cr nm of-      Just sp -> ("BinaryOpUGen",Just sp)-      Nothing -> case unaryIndex cr nm of-                   Just sp -> ("UnaryOpUGen",Just sp)-                   _ -> (nm,Nothing)
− Sound/SC3/UGen/Optimise.hs
@@ -1,80 +0,0 @@--- | Optimisations of UGen graphs.-module Sound.SC3.UGen.Optimise where--import System.Random {- random -}--import Sound.SC3.UGen.Math-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- | Constant form of 'rand' UGen.-c_rand :: Random a => Int -> a -> a -> a-c_rand z l r = fst (randomR (l,r) (mkStdGen z))---- | Constant form of 'iRand' UGen.-c_irand :: (Num b, RealFrac a, Random a) => Int -> a -> a -> b-c_irand z l r = fromInteger (round (c_rand z l r))---- | 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------ > let u = sinOsc AR (rand 'a' 220 440) 0 * 0.1--- > in draw (u + ugen_optimise_ir_rand u)-ugen_optimise_ir_rand :: UGen -> UGen-ugen_optimise_ir_rand =-    let f u =-            case u of-              Primitive_U p ->-                  case p of-                    Primitive IR "Rand" [Constant_U (Constant l),Constant_U (Constant r)] [IR] _ (UId z) ->-                        Constant_U (Constant (c_rand z l r))-                    Primitive IR "IRand" [Constant_U (Constant l),Constant_U (Constant r)] [IR] _ (UId z) ->-                        Constant_U (Constant (c_irand z l r))-                    _ -> u-              _ -> u-    in ugenTraverse f---- | 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']))-ugen_optimise_const_operator :: UGen -> UGen-ugen_optimise_const_operator =-    let f u =-            case u of-              Primitive_U p ->-                  case p of-                    Primitive _ "BinaryOpUGen" [Constant_U (Constant l),Constant_U (Constant r)] [_] (Special z) _ ->-                        case binop_special_hs z of-                          Just fn -> Constant_U (Constant (fn l r))-                          _ -> u-                    Primitive _ "UnaryOpUGen" [Constant_U (Constant i)] [_] (Special z) _ ->-                        case uop_special_hs z of-                          Just fn -> Constant_U (Constant (fn i))-                          _ -> u-                    _ -> u-              _ -> u-    in ugenTraverse f--constant_opt :: UGen -> Maybe Sample-constant_opt = u_constant . ugen_optimise_ir_rand-
− Sound/SC3/UGen/PP.hs
@@ -1,40 +0,0 @@-module Sound.SC3.UGen.PP where--import Data.List {- split -}-import Data.Ratio {- base -}-import Numeric {- base -}--import Sound.SC3.UGen.MCE-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- | The default show is odd, 0.05 shows as 5.0e-2.-double_pp :: Int -> Double -> String-double_pp k n =-    let f = reverse . dropWhile (== '0') . reverse-    in f (showFFloat (Just k) n "")---- | Print as integer if integral, else as real.-real_pp :: Double -> String-real_pp n =-    let r = toRational n-    in if denominator r == 1 then show (numerator r) else double_pp 5 n--bracketed :: (a,a) -> [a] -> [a]-bracketed (l,r) x = l : x ++ [r]---- | Print constants and labels directly, primitives as un-adorned--- names, mce as [p,q], mrg as p&q, contols as nm=def and proxies as--- u@n.-ugen_concise_pp :: UGen -> String-ugen_concise_pp u =-    let prim_pp (Primitive _ nm _ _ sp _) = ugen_user_name nm sp-    in case u of-         Constant_U (Constant n) -> real_pp n-         Control_U (Control _ _ nm def _ _) -> nm ++ "=" ++ real_pp def-         Label_U (Label s) -> bracketed ('"','"') s-         Primitive_U p -> prim_pp p-         Proxy_U (Proxy p n) -> prim_pp p ++ "@" ++ show n-         MCE_U (MCE_Unit u') -> ugen_concise_pp u'-         MCE_U (MCE_Vector v) -> bracketed ('[',']') (intercalate "," (map ugen_concise_pp v))-         MRG_U (MRG l r) -> unwords [ugen_concise_pp l,"&",ugen_concise_pp r]
− Sound/SC3/UGen/Plain.hs
@@ -1,52 +0,0 @@--- | Plain notation for SuperCollider UGen graphs.------ > let {s = ugen "SinOsc" AR [440,0] 1--- >     ;m = binop "*" AR s 0.1--- >     ;o = ugen "Out" AR [0,m] 0}--- > in Sound.SC3.Server.Play.audition o >> Sound.SC3.UGen.Dot.draw o------ > audition (out 0 (sinOsc AR 440 0 * 0.1))-module Sound.SC3.UGen.Plain where--import Sound.SC3.Common.Prelude-import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.Type---- | Variant of 'mkUGen'.-mk_plain :: Rate -> String -> [UGen] -> Int -> Special -> UGenId -> UGen-mk_plain r nm inp = mkUGen Nothing all_rates (Left r) nm inp Nothing---- | Construct unary operator, the name can textual or symbolic.------ > uop CI "NEG" AR 1-uop :: Case_Rule -> String -> Rate -> UGen -> UGen-uop cr nm r p =-    case unaryIndex cr nm of-      Just s -> mk_plain r "UnaryOpUGen" [p] 1 (Special s) NoId-      Nothing -> error "uop"---- | Construct binary operator, the name can textual or symbolic.------ > binop CI "*" AR 1 2 == binop CI "MUL" AR 1 2--- > binop CS "*" AR (ugen "SinOsc" AR [440,0] 1) 0.1 == sinOsc AR 440 0 * 0.1-binop :: Case_Rule -> String -> Rate -> UGen -> UGen -> UGen-binop cr nm r p q =-    case binaryIndex cr nm of-      Just s -> mk_plain r "BinaryOpUGen" [p,q] 1 (Special s) NoId-      Nothing -> error "binop"---- | Construct deterministic UGen.------ > let o = ugen "SinOsc" AR [440,0] 1--- > o == sinOsc AR 440 0--- > ugen "Out" AR [0,o] 0 == out 0 (sinOsc AR 440 0)-ugen :: String -> Rate -> [UGen] -> Int -> UGen-ugen nm r i nc = mk_plain r nm i nc (Special 0) NoId---- | Construct non-deterministic UGen.------ > import Sound.SC3.ID--- > nondet "WhiteNoise" (UId (fromEnum 'a')) AR [] 1 == whiteNoise 'a' AR-nondet :: String -> UGenId -> Rate -> [UGen] -> Int -> UGen-nondet nm z r i nc = mk_plain r nm i nc (Special 0) z
− Sound/SC3/UGen/Protect.hs
@@ -1,58 +0,0 @@--- | Functions to re-write assigned node identifiers at UGen graphs.--- Used carefully it allows for composition of sub-graphs with--- psuedo-random nodes.-module Sound.SC3.UGen.Protect where--import Sound.SC3.UGen.Identifier-import Sound.SC3.UGen.Type-import Sound.SC3.UGen.UGen---- | Collect Ids at UGen graph-ugenIds :: UGen -> [UGenId]-ugenIds =-    let f u = case u of-                Primitive_U p -> [ugenId p]-                _ -> []-    in ugenFoldr ((++) . f) []---- | Apply /f/ at 'UId', or no-op at 'NoId'.-atUGenId :: (Int -> Int) -> UGenId -> UGenId-atUGenId f z =-    case z of-      NoId -> NoId-      UId i -> UId (f i)---- | Add 'idHash' of /e/ to all 'Primitive_U' at /u/.-uprotect :: ID a => a -> UGen -> UGen-uprotect e =-    let e' = resolveID e-        f u = case u of-                Primitive_U p -> Primitive_U (p {ugenId = atUGenId (+ e') (ugenId p)})-                _ -> u-    in ugenTraverse f---- | Variant of 'uprotect' with subsequent identifiers derived by--- incrementing initial identifier.-uprotect' :: ID a => a -> [UGen] -> [UGen]-uprotect' e =-    let n = map (+ resolveID e) [1..]-    in zipWith uprotect n---- | Make /n/ parallel instances of 'UGen' with protected identifiers.-uclone' :: ID a => a -> Int -> UGen -> [UGen]-uclone' e n = uprotect' e . replicate n---- | 'mce' variant of 'uclone''.-uclone :: ID a => a -> Int -> UGen -> UGen-uclone e n = mce . uclone' e n---- | Left to right UGen function composition with 'UGenId' protection.-ucompose :: ID a => a -> [UGen -> UGen] -> UGen -> UGen-ucompose e xs =-    let go [] u = u-        go ((f,k):f') u = go f' (uprotect k (f u))-    in go (zip xs [resolveID e ..])---- | Make /n/ sequential instances of `f' with protected Ids.-useq :: ID a => a -> Int -> (UGen -> UGen) -> UGen -> UGen-useq e n f = ucompose e (replicate n f)
− Sound/SC3/UGen/Rate.hs
@@ -1,50 +0,0 @@--- | Operating rate definitions and utilities.-module Sound.SC3.UGen.Rate where--import Data.Char {- base -}-import Data.Function {- base -}---- | Operating rate of unit generator.-data Rate = IR | KR | AR | DR-            deriving (Eq,Enum,Bounded,Show,Read)--instance Ord Rate where-    compare = compare `on` rate_ord---- | Integer rate identifier, as required for scsynth bytecode.-rateId :: Rate -> Int-rateId = fromEnum---- | Rates as ordered for filter rate selection.-rate_ord :: Rate -> Int-rate_ord r =-    case r of-      IR -> 0-      KR -> 1-      AR -> 2-      DR -> 3 -- ?---- | Color identifiers for each 'Rate'.-rate_color :: Rate -> String-rate_color r =-    case r of-      AR -> "black"-      KR -> "blue"-      IR -> "yellow"-      DR -> "red"---- | Set of all 'Rate' values.-all_rates :: [Rate]-all_rates = [minBound .. maxBound]---- | Case insensitive parser for rate.------ > Data.Maybe.mapMaybe rate_parse (words "ar kR IR Dr") == [AR,KR,IR,DR]-rate_parse :: String -> Maybe Rate-rate_parse r =-    case map toUpper r of-      "AR" -> Just AR-      "KR" -> Just KR-      "IR" -> Just IR-      "DR" -> Just DR-      _ -> Nothing
− Sound/SC3/UGen/Type.hs
@@ -1,500 +0,0 @@---  | Unit Generator ('UGen'), and associated types and instances.-module Sound.SC3.UGen.Type where--import Data.Bits {- base -}-import Data.List {- base -}-import Data.Maybe {- base -}-import Safe {- safe -}-import System.Random {- random -}-import qualified Text.Read as R {- base -}--import Sound.SC3.UGen.MCE-import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.Rate---- * Basic types---- | Data type for internalised identifier at 'UGen'.-data UGenId = NoId | UId Int-              deriving (Eq,Read,Show)---- | Alias of 'NoId', the 'UGenId' used for deterministic UGens.-no_id :: UGenId-no_id = NoId---- | SC3 samples are 32-bit 'Float'.  hsc3 represents data as 64-bit--- 'Double'.  If 'UGen' values are used more generally (ie. see--- hsc3-forth) 'Float' may be too imprecise, ie. for representing time--- stamps.-type Sample = Double---- | Constants.------ > Constant 3 == Constant 3--- > (Constant 3 > Constant 1) == True-data Constant = Constant {constantValue :: Sample}-                deriving (Eq,Ord,Read,Show)---- | Control meta-data.-data C_Meta n =-    C_Meta {ctl_min :: n -- ^ Minimum-           ,ctl_max :: n -- ^ Maximum-           ,ctl_warp :: String -- ^ @(0,1)@ @(min,max)@ transfer function.-           ,ctl_step :: n -- ^ The step to increment & decrement by.-           ,ctl_units :: String -- ^ Unit of measure (ie hz, ms etc.).-           }-    deriving (Eq,Read,Show)---- | 5-tuple form of 'C_Meta' data.-type C_Meta_T5 n = (n,n,String,n,String)---- | Lift 'C_Meta_5' to 'C_Meta' allowing type coercion.-c_meta_t5 :: (n -> m) -> C_Meta_T5 n -> C_Meta m-c_meta_t5 f (l,r,w,stp,u) = C_Meta (f l) (f r) w (f stp) u---- | Control inputs.  It is an invariant that controls with equal--- names within a UGen graph must be equal in all other respects.-data Control = Control {controlOperatingRate :: Rate-                       ,controlIndex :: Maybe Int-                       ,controlName :: String-                       ,controlDefault :: Sample-                       ,controlTriggered :: Bool-                       ,controlMeta :: Maybe (C_Meta Sample)}-               deriving (Eq,Read,Show)---- | Labels.-data Label = Label {ugenLabel :: String}-             deriving (Eq,Read,Show)---- | Unit generator output descriptor.-type Output = Rate---- | Operating mode of unary and binary operators.-newtype Special = Special Int-    deriving (Eq,Read,Show)---- | UGen primitives.-data Primitive = Primitive {ugenRate :: Rate-                           ,ugenName :: String-                           ,ugenInputs :: [UGen]-                           ,ugenOutputs :: [Output]-                           ,ugenSpecial :: Special-                           ,ugenId :: UGenId}-                 deriving (Eq,Read,Show)---- | Proxy to multiple channel input.-data Proxy = Proxy {proxySource :: Primitive-                   ,proxyIndex :: Int}-            deriving (Eq,Read,Show)---- | Multiple root graph.-data MRG = MRG {mrgLeft :: UGen-               ,mrgRight :: UGen}-           deriving (Eq,Read,Show)---- | Union type of Unit Generator forms.-data UGen = Constant_U Constant-          | Control_U Control-          | Label_U Label-          | Primitive_U Primitive-          | Proxy_U Proxy-          | MCE_U (MCE UGen)-          | MRG_U MRG-            deriving (Eq,Read,Show)---- * Parser---- | Type-specialised 'R.readMaybe'.-parse_double :: String -> Maybe Double-parse_double = R.readMaybe--parse_constant :: String -> Maybe UGen-parse_constant = fmap constant . parse_double---- * Accessors---- | See into 'Constant_U'.-un_constant :: UGen -> Maybe Constant-un_constant u =-    case u of-      Constant_U c -> Just c-      _ -> Nothing---- | Value of 'Constant_U' 'Constant'.-u_constant :: UGen -> Maybe Sample-u_constant = fmap constantValue . un_constant---- | Erroring variant.-u_constant_err :: UGen -> Sample-u_constant_err = fromMaybe (error "u_constant") . u_constant---- * MRG---- | Multiple root graph constructor.-mrg :: [UGen] -> UGen-mrg u =-    case u of-      [] -> error "mrg: []"-      [x] -> x-      (x:xs) -> MRG_U (MRG x (mrg xs))---- | See into 'MRG_U', follows leftmost rule until arriving at non-MRG node.-mrg_leftmost :: UGen -> UGen-mrg_leftmost u =-    case u of-      MRG_U m -> mrg_leftmost (mrgLeft m)-      _ -> u---- * Predicates---- | Constant node predicate.-isConstant :: UGen -> Bool-isConstant = isJust . un_constant---- | True if input is a sink 'UGen', ie. has no outputs.  Sees into MRG.-isSink :: UGen -> Bool-isSink u =-    case mrg_leftmost u of-      Primitive_U p -> null (ugenOutputs p)-      MCE_U m -> all isSink (mce_elem m)-      _ -> False---- | See into 'Proxy_U'.-un_proxy :: UGen -> Maybe Proxy-un_proxy u =-    case u of-      Proxy_U p -> Just p-      _ -> Nothing--isProxy :: UGen -> Bool-isProxy = isJust . un_proxy---- * MCE---- | Multiple channel expansion node constructor.-mce :: [UGen] -> UGen-mce xs =-    case xs of-      [] -> error "mce: []"-      [x] -> x-      _ -> MCE_U (MCE_Vector xs)---- | Type specified 'mce_elem'.-mceProxies :: MCE UGen -> [UGen]-mceProxies = mce_elem---- | Multiple channel expansion node ('MCE_U') predicate.  Sees into MRG.-isMCE :: UGen -> Bool-isMCE u =-    case mrg_leftmost u of-      MCE_U _ -> True-      _ -> False---- | Output channels of UGen as a list.  If required, preserves the--- RHS of and MRG node in channel 0.-mceChannels :: UGen -> [UGen]-mceChannels u =-    case u of-      MCE_U m -> mce_elem m-      MRG_U (MRG x y) -> let r:rs = mceChannels x in MRG_U (MRG r y) : rs-      _ -> [u]---- | Number of channels to expand to.  This function sees into MRG,--- and is defined only for MCE nodes.-mceDegree :: UGen -> Maybe Int-mceDegree u =-    case mrg_leftmost u of-      MCE_U m -> Just (length (mceProxies m))-      _ -> Nothing---- | Erroring variant.-mceDegree_err :: UGen -> Int-mceDegree_err = fromMaybe (error "mceDegree: not mce") . mceDegree---- | Extend UGen to specified degree.  Follows "leftmost" rule for MRG nodes.-mceExtend :: Int -> UGen -> [UGen]-mceExtend n u =-    case u of-      MCE_U m -> mceProxies (mce_extend n m)-      MRG_U (MRG x y) -> let (r:rs) = mceExtend n x-                         in MRG_U (MRG r y) : rs-      _ -> replicate n u---- | Apply MCE transform to a list of inputs.-mceInputTransform :: [UGen] -> Maybe [[UGen]]-mceInputTransform i =-    if any isMCE i-    then let n = maximum (map mceDegree_err (filter isMCE i))-         in Just (transpose (map (mceExtend n) i))-    else Nothing---- | Build a UGen after MCE transformation of inputs.-mceBuild :: ([UGen] -> UGen) -> [UGen] -> UGen-mceBuild f i =-    case mceInputTransform i of-      Nothing -> f i-      Just i' -> MCE_U (MCE_Vector (map (mceBuild f) i'))---- | True if MCE is an immediate proxy for a multiple-out Primitive.---   This is useful when disassembling graphs, ie. ugen_graph_forth_pp at hsc3-db.-mce_is_direct_proxy :: MCE UGen -> Bool-mce_is_direct_proxy m =-    case m of-      MCE_Unit _ -> False-      MCE_Vector v ->-          let p = map un_proxy v-              p' = catMaybes p-          in all isJust p &&-             length (nub (map proxySource p')) == 1 &&-             map proxyIndex p' `isPrefixOf` [0..]---- * Validators---- | Ensure input 'UGen' is valid, ie. not a sink.-checkInput :: UGen -> UGen-checkInput u =-    if isSink u-    then error ("checkInput: " ++ show u)-    else u---- * Constructors---- | Constant value node constructor.-constant :: Real n => n -> UGen-constant = Constant_U . Constant . realToFrac---- | Type specialised 'constant'.-int_to_ugen :: Int -> UGen-int_to_ugen = constant---- | Type specialised 'constant'.-float_to_ugen :: Float -> UGen-float_to_ugen = constant---- | Type specialised 'constant'.-double_to_ugen :: Double -> UGen-double_to_ugen = constant---- | Unit generator proxy node constructor.-proxy :: UGen -> Int -> UGen-proxy u n =-    case u of-      Primitive_U p -> Proxy_U (Proxy p n)-      _ -> error "proxy: not primitive"---- | Determine the rate of a UGen.-rateOf :: UGen -> Rate-rateOf u =-    case u of-      Constant_U _ -> IR-      Control_U c -> controlOperatingRate c-      Label_U _ -> IR-      Primitive_U p -> ugenRate p-      Proxy_U p -> ugenRate (proxySource p)-      MCE_U _ -> maximum (map rateOf (mceChannels u))-      MRG_U m -> rateOf (mrgLeft m)---- | Apply proxy transformation if required.-proxify :: UGen -> UGen-proxify u =-    case u of-      MCE_U m -> mce (map proxify (mce_elem m))-      MRG_U m -> mrg [proxify (mrgLeft m), mrgRight m]-      Primitive_U p ->-          let o = ugenOutputs p-          in case o of-               _:_:_ -> mce (map (proxy u) [0..(length o - 1)])-               _ -> u-      Constant_U _ -> u-      _ -> error "proxify: illegal ugen"---- | Construct proxied and multiple channel expanded UGen.------ cf = constant function, rs = rate set, r = rate, nm = name, i =--- inputs, o = outputs.-mkUGen :: Maybe ([Sample] -> Sample) -> [Rate] -> Either Rate [Int] ->-          String -> [UGen] -> Maybe UGen -> Int -> Special -> UGenId -> UGen-mkUGen cf rs r nm i i_mce o s z =-    let i' = maybe i ((i ++) . mceChannels) i_mce-        f h = let r' = either id (maximum . map (rateOf . atNote ("mkUGen: " ++ nm) h)) r-                  o' = replicate o r'-                  u = Primitive_U (Primitive r' nm h o' s z)-              in if r' `elem` rs-                 then case cf of-                        Just cf' ->-                            if all isConstant h-                            then constant (cf' (mapMaybe u_constant h))-                            else u-                        Nothing -> u-                 else error ("mkUGen: rate restricted: " ++ show (r,rs,nm))-    in proxify (mceBuild f (map checkInput i'))---- * Operators---- | Operator UGen constructor.-mkOperator :: ([Sample] -> Sample) -> String -> [UGen] -> Int -> UGen-mkOperator f c i s =-    let ix = [0 .. length i - 1]-    in mkUGen (Just f) all_rates (Right ix) c i Nothing 1 (Special s) NoId---- | Unary math constructor with constant optimization.-mkUnaryOperator :: Unary -> (Sample -> Sample) -> UGen -> UGen-mkUnaryOperator i f a =-    let g [x] = f x-        g _ = error "mkUnaryOperator: non unary input"-    in mkOperator g "UnaryOpUGen" [a] (fromEnum i)---- | Binary math constructor with constant optimization.------ > let o = sinOsc AR 440 0------ > o * 1 == o && 1 * o == o && o * 2 /= o--- > o + 0 == o && 0 + o == o && o + 1 /= o--- > o - 0 == o && 0 - o /= o--- > o / 1 == o && 1 / o /= o--- > o ** 1 == o && o ** 2 /= o-mkBinaryOperator_optimize :: Binary -> (Sample -> Sample -> Sample) ->-                             (Either Sample Sample -> Bool) ->-                             UGen -> UGen -> UGen-mkBinaryOperator_optimize i f o a b =-   let g [x,y] = f x y-       g _ = error "mkBinaryOperator: non binary input"-       r = case (a,b) of-             (Constant_U (Constant a'),_) ->-                 if o (Left a') then Just b else Nothing-             (_,Constant_U (Constant b')) ->-                 if o (Right b') then Just a else Nothing-             _ -> Nothing-   in fromMaybe (mkOperator g "BinaryOpUGen" [a, b] (fromEnum i)) r---- | Binary math constructor with constant optimization.-mkBinaryOperator :: Binary -> (Sample -> Sample -> Sample) -> UGen -> UGen -> UGen-mkBinaryOperator i f a b =-   let g [x,y] = f x y-       g _ = error "mkBinaryOperator: non binary input"-   in mkOperator g "BinaryOpUGen" [a, b] (fromEnum i)---- * Numeric instances---- | Unit generators are numbers.-instance Num UGen where-    negate = mkUnaryOperator Neg negate-    (+) = mkBinaryOperator_optimize Add (+) (`elem` [Left 0,Right 0])-    (-) = mkBinaryOperator_optimize Sub (-) (Right 0 ==)-    (*) = mkBinaryOperator_optimize Mul (*) (`elem` [Left 1,Right 1])-    abs = mkUnaryOperator Abs abs-    signum = mkUnaryOperator Sign signum-    fromInteger = Constant_U . Constant . fromInteger---- | Unit generators are fractional.-instance Fractional UGen where-    recip = mkUnaryOperator Recip recip-    (/) = mkBinaryOperator_optimize FDiv (/) (Right 1 ==)-    fromRational = Constant_U . Constant . fromRational---- | Unit generators are floating point.-instance Floating UGen where-    pi = Constant_U (Constant pi)-    exp = mkUnaryOperator Exp exp-    log = mkUnaryOperator Log log-    sqrt = mkUnaryOperator Sqrt sqrt-    (**) = mkBinaryOperator_optimize Pow (**) (Right 1 ==)-    logBase a b = log b / log a-    sin = mkUnaryOperator Sin sin-    cos = mkUnaryOperator Cos cos-    tan = mkUnaryOperator Tan tan-    asin = mkUnaryOperator ArcSin asin-    acos = mkUnaryOperator ArcCos acos-    atan = mkUnaryOperator ArcTan atan-    sinh = mkUnaryOperator SinH sinh-    cosh = mkUnaryOperator CosH cosh-    tanh = mkUnaryOperator TanH tanh-    asinh x = log (sqrt (x*x+1) + x)-    acosh x = log (sqrt (x*x-1) + x)-    atanh x = (log (1+x) - log (1-x)) / 2---- | Unit generators are real.-instance Real UGen where-    toRational (Constant_U (Constant n)) = toRational n-    toRational _ = error "UGen.toRational: non-constant"---- | Unit generators are integral.-instance Integral UGen where-    quot = mkBinaryOperator IDiv (error "UGen.quot")-    rem = mkBinaryOperator Mod (error "UGen.rem")-    quotRem a b = (quot a b, rem a b)-    div = mkBinaryOperator IDiv (error "UGen.div")-    mod = mkBinaryOperator Mod (error "UGen.mod")-    toInteger (Constant_U (Constant n)) = floor n-    toInteger _ = error "UGen.toInteger: non-constant"--instance RealFrac UGen where-  properFraction = error "UGen.properFraction, see properFractionE"-  round = error "UGen.round, see roundE"-  ceiling = error "UGen.ceiling, see ceilingE"-  floor = error "UGen.floor, see floorE"---- | Unit generators are orderable (when 'Constants').------ > (constant 2 > constant 1) == True-instance Ord UGen where-    (Constant_U a) < (Constant_U b) = a < b-    _ < _ = error "UGen.<, see <*"-    (Constant_U a) <= (Constant_U b) = a <= b-    _ <= _ = error "UGen.<= at, see <=*"-    (Constant_U a) > (Constant_U b) = a > b-    _ > _ = error "UGen.>, see >*"-    (Constant_U a) >= (Constant_U b) = a >= b-    _ >= _ = error "UGen.>=, see >=*"-    min = mkBinaryOperator Min min-    max = mkBinaryOperator Max max---- | Unit generators are enumerable.-instance Enum UGen where-    succ u = u + 1-    pred u = u - 1-    toEnum n = Constant_U (Constant (fromIntegral n))-    fromEnum (Constant_U (Constant n)) = truncate n-    fromEnum _ = error "UGen.fromEnum: non-constant"-    enumFrom = iterate (+1)-    enumFromThen n m = iterate (+(m-n)) n-    enumFromTo n m = takeWhile (<= m+1/2) (enumFrom n)-    enumFromThenTo n n' m =-        let p = if n' >= n then (>=) else (<=)-        in takeWhile (p (m + (n'-n)/2)) (enumFromThen n n')---- | Unit generators are stochastic.-instance Random UGen where-    randomR (Constant_U (Constant l),Constant_U (Constant r)) g =-        let (n, g') = randomR (l,r) g-        in (Constant_U (Constant n), g')-    randomR _ _ = error "UGen.randomR: non constant (l,r)"-    random = randomR (-1.0, 1.0)---- | UGens are bit patterns.-instance Bits UGen where-    (.&.) = mkBinaryOperator BitAnd undefined-    (.|.) = mkBinaryOperator BitOr undefined-    xor = mkBinaryOperator BitXor undefined-    complement = mkUnaryOperator BitNot undefined-    shift = error "UGen.shift"-    rotate = error "UGen.rotate"-    bitSize = error "UGen.bitSize"-    bit = error "UGen.bit"-    testBit = error "UGen.testBit"-    popCount = error "UGen.popCount"-    bitSizeMaybe = error "UGen.bitSizeMaybe"-    isSigned _ = True--{--import Sound.SC3.UGen.Identifier---- * UGen ID Instance---- | Hash function for unit generators.-hashUGen :: UGen -> Int-hashUGen = hash . show--instance ID UGen where-    resolveID = hashUGen--}
− Sound/SC3/UGen/UGen.hs
@@ -1,240 +0,0 @@--- | UGen data structure representation and associated functions.-module Sound.SC3.UGen.UGen where--import qualified Data.Char as C {- base -}-import Data.Maybe {- base -}-import Data.List {- base -}--import qualified Sound.SC3.Common.Envelope as E-import qualified Sound.SC3.Common.Prelude as P-import qualified Sound.SC3.UGen.Identifier as ID-import qualified Sound.SC3.UGen.Operator as O-import qualified Sound.SC3.UGen.Rate as R-import Sound.SC3.UGen.Type---- | 'UId' of 'resolveID'.-toUId :: ID.ID a => a -> UGenId-toUId = UId . ID.resolveID---- | Lookup operator name for operator UGens, else UGen name.-ugen_user_name :: String -> Special -> String-ugen_user_name nm (Special n) =-    case nm of-      "UnaryOpUGen" -> O.unaryName n-      "BinaryOpUGen" -> O.binaryName n-      _ -> nm---- * UGen graph functions---- | Depth first traversal of graph at `u' applying `f' to each node.-ugenTraverse :: (UGen -> UGen) -> UGen -> UGen-ugenTraverse f u =-    let recur = ugenTraverse f-    in case u of-         Primitive_U p ->-             let i = ugenInputs p-             in f (Primitive_U (p {ugenInputs = map recur i}))-         Proxy_U p ->-             let s = Primitive_U (proxySource p)-             in case recur s of-                  Primitive_U p' -> f (Proxy_U (p {proxySource = p'}))-                  _ -> error "ugenTraverse"-         MCE_U m -> f (mce (map recur (mceProxies m)))-         MRG_U (MRG l r) -> f (MRG_U (MRG (recur l) (recur r)))-         _ -> f u---- | Right fold of UGen graph.-ugenFoldr :: (UGen -> a -> a) -> a -> UGen -> a-ugenFoldr f st u =-    let recur = flip (ugenFoldr f)-    in case u of-         Primitive_U p ->-             let i = ugenInputs p-             in f u (foldr recur st i)-         Proxy_U p ->-             let s = proxySource p-             in f u (f (Primitive_U s) st)-         MCE_U m -> f u (foldr recur st (mceProxies m))-         MRG_U (MRG l r) -> f u (f l (f r st))-         _ -> f u st---- * Unit generator node constructors---- | Control input node constructor.-control_f64 :: R.Rate -> Maybe Int -> String -> Sample -> UGen-control_f64 r ix nm d = Control_U (Control r ix nm d False Nothing)---- | 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'.-control :: R.Rate -> String -> Double -> UGen-control r = control_f64 r Nothing---- | Variant of 'control' with meta data.-meta_control :: R.Rate -> String -> Double -> C_Meta_T5 Double -> UGen-meta_control rt nm df meta =-    let m = c_meta_t5 id meta-    in Control_U (Control rt Nothing nm df False (Just m))---- | Triggered (kr) control input node constructor.-tr_control_f64 :: Maybe Int -> String -> Sample -> UGen-tr_control_f64 ix nm d = Control_U (Control R.KR ix nm d True Nothing)---- | Triggered (kr) control input node constructor.-tr_control :: String -> Double -> UGen-tr_control = tr_control_f64 Nothing---- | Set indices at a list of controls.-control_set :: [UGen] -> [UGen]-control_set =-    let f ix u = case u of-                   Control_U c -> Control_U (c {controlIndex = Just ix})-                   _ -> error "control_set: non control input?"-    in zipWith f [0..]---- | Multiple root graph node constructor.-mrg2 :: UGen -> UGen -> UGen-mrg2 u = MRG_U . MRG u---- * Multiple channel expansion---- | Multiple channel expansion for two inputs.-mce2 :: UGen -> UGen -> UGen-mce2 x y = mce [x,y]---- | Extract two channels from possible MCE, if there is only one--- channel it is duplicated.-mce2c :: UGen -> (UGen,UGen)-mce2c u =-    case mceChannels u of-      [] -> error "mce2c"-      [p] -> (p,p)-      p:q:_ -> (p,q)--t2_from_list :: [t] -> (t,t)-t2_from_list l = case l of {[p,q] -> (p,q);_ -> error "t2_from_list"}---- | Variant of 'mce2c' that requires input to have two channels.-unmce2 :: UGen -> (UGen, UGen)-unmce2 = t2_from_list . mceChannels---- | Multiple channel expansion for two inputs.-mce3 :: UGen -> UGen -> UGen -> UGen-mce3 x y z = mce [x,y,z]---- | Apply a function to each channel at a unit generator.-mceMap :: (UGen -> UGen) -> UGen -> UGen-mceMap f u = mce (map f (mceChannels u))---- | Map with element index.-map_ix :: ((Int,a) -> b) -> [a] -> [b]-map_ix f = map f . zip [0..]---- | Variant of 'mceMap' with element index.-mce_map_ix :: ((Int,UGen) -> UGen) -> UGen -> UGen-mce_map_ix f u = mce (map_ix f (mceChannels u))---- | Apply UGen list operation on MCE contents.-mceEdit :: ([UGen] -> [UGen]) -> UGen -> UGen-mceEdit f u =-    case u of-      MCE_U m -> mce (f (mceProxies m))-      _ -> error "mceEdit: non MCE value"---- | Reverse order of channels at MCE.-mceReverse :: UGen -> UGen-mceReverse = mceEdit reverse---- | Obtain indexed channel at MCE.-mceChannel :: Int -> UGen -> UGen-mceChannel n u =-    case u of-      MCE_U m -> mceProxies m !! n-      _ -> error "mceChannel: non MCE value"---- | Transpose rows and columns, ie. {{a,b},{c,d}} to {{a,c},{b,d}}.-mceTranspose :: UGen -> UGen-mceTranspose = mce . map mce . transpose . map mceChannels . mceChannels---- | Collapse mce by summing (see also mix and mixN).-mceSum :: UGen -> UGen-mceSum = sum . mceChannels---- * Transform---- | Given /unmce/ function make halt mce transform.-halt_mce_transform' :: (a -> [a]) -> [a] -> [a]-halt_mce_transform' f l =-    let (l',e) = fromMaybe (error "halt_mce_transform: null?") (P.sep_last l)-    in l' ++ f e---- | The halt MCE transform, ie. lift channels of last input into list.------ > halt_mce_transform [1,2,mce2 3 4] == [1,2,3,4]-halt_mce_transform :: [UGen] -> [UGen]-halt_mce_transform = halt_mce_transform' mceChannels---- * Multiple root graphs---- * Labels---- | Lift a 'String' to a UGen label (ie. for 'poll').-label :: String -> UGen-label = Label_U . Label---- | Unpack a label to a length prefixed list of 'Constant's.  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.-unpackLabel :: UGen -> [UGen]-unpackLabel u =-    case u of-      Label_U (Label s) ->-          let q = fromEnum '?'-              f c = if C.isAscii c then fromEnum c else q-              s' = map (fromIntegral . f) s-              n = fromIntegral (length s)-          in n : s'-      MCE_U m ->-          let x = map unpackLabel (mceProxies m)-          in if P.equal_length_p x-             then map mce (transpose x)-             else error (show ("unpackLabel: mce length /=",x))-      _ -> error (show ("unpackLabel: non-label",u))---- * Envelope--envelope_to_ugen :: E.Envelope UGen -> UGen-envelope_to_ugen =-    let err = error "envGen: bad Envelope"-    in mce . fromMaybe err . E.envelope_sc3_array---- * Bitwise--bitAnd :: UGen -> UGen -> UGen-bitAnd = mkBinaryOperator O.BitAnd undefined--bitOr :: UGen -> UGen -> UGen-bitOr = mkBinaryOperator O.BitOr undefined--bitXOr :: UGen -> UGen -> UGen-bitXOr = mkBinaryOperator O.BitXor undefined--bitNot :: UGen -> UGen-bitNot = mkUnaryOperator O.BitNot undefined--shiftLeft :: UGen -> UGen -> UGen-shiftLeft = mkBinaryOperator O.ShiftLeft undefined--shiftRight :: UGen -> UGen -> UGen-shiftRight = mkBinaryOperator O.ShiftRight undefined--unsignedShift :: UGen -> UGen -> UGen-unsignedShift = mkBinaryOperator O.UnsignedShift undefined--(.<<.) :: UGen -> UGen -> UGen-(.<<.) = shiftLeft--(.>>.) :: UGen -> UGen -> UGen-(.>>.) = shiftRight
− Sound/SC3/UGen/UId.hs
@@ -1,95 +0,0 @@-{-# LANGUAGE FlexibleInstances #-}---- | Unique identifier class for use by non-deterministic (noise) and--- non-sharable (demand) unit generators.-module Sound.SC3.UGen.UId where--import Control.Monad {- base -}-import Data.Functor.Identity {- base -}-import Data.List {- base -}-import qualified Data.Unique as U {- base -}--import qualified Control.Monad.Trans.Reader as R {- transformers -}-import qualified Control.Monad.Trans.State as S {- transformers -}--import Sound.SC3.UGen.Type {- hsc3 -}---- | A class indicating a monad (and functor and applicative) that will--- generate a sequence of unique integer identifiers.-class (Functor m,Applicative m,Monad m) => UId m where-   generateUId :: m Int---- | 'S.State' UId.-type UId_ST = S.State Int---- | 'S.evalState' with initial state of zero.------ > uid_st_eval (replicateM 3 generateUId) == [0,1,2]-uid_st_eval :: UId_ST t -> t-uid_st_eval x = S.evalState x 0---- | Thread state through sequence of 'S.runState'.-uid_st_seq :: [UId_ST t] -> ([t],Int)-uid_st_seq =-    let swap (p,q) = (q,p)-        step_f n x = swap (S.runState x n)-    in swap . mapAccumL step_f 0---- | 'fst' of 'uid_st_seq'.------ > uid_st_seq_ (replicate 3 generateUId) == [0,1,2]-uid_st_seq_ :: [UId_ST t] -> [t]-uid_st_seq_ = fst . uid_st_seq--instance UId (S.StateT Int Identity) where-    generateUId = S.get >>= \n -> S.put (n + 1) >> return n--instance UId IO where-    generateUId = liftM U.hashUnique U.newUnique--instance UId m => UId (R.ReaderT t m) where-   generateUId = R.ReaderT (const generateUId)---- * Lift---- | Unary function.-type Fn1 a b = a -> b---- | Binary function.-type Fn2 a b c = a -> b -> c---- | Ternary function.-type Fn3 a b c d = a -> b -> c -> d---- | Quaternary function.-type Fn4 a b c d e = a -> b -> c -> d -> e---- | Unary UId lift.-liftUId :: UId m => (Int -> Fn1 a b) -> Fn1 a (m b)-liftUId f a = do-  n <- generateUId-  return (f n a)---- | Binary UId lift.-liftUId2 :: UId m => (Int -> Fn2 a b c) -> Fn2 a b (m c)-liftUId2 f a b = do-  n <- generateUId-  return (f n a b)---- | Ternary UId lift.-liftUId3 :: UId m => (Int -> Fn3 a b c d) -> Fn3 a b c (m d)-liftUId3 f a b c = do-  n <- generateUId-  return (f n a b c)---- | Quaternary UId lift.-liftUId4 :: UId m => (Int -> Fn4 a b c d e) -> Fn4 a b c d (m e)-liftUId4 f a b c d = do-  n <- generateUId-  return (f n a b c d)---- * Clone---- | Clone a unit generator (mce . replicateM).-clone :: (UId m) => Int -> m UGen -> m UGen-clone n = liftM mce . replicateM n
+ Sound/Sc3.hs view
@@ -0,0 +1,9 @@+{- | Composite of "Sound.Sc3.Common", "Sound.Sc3.Server.Monad",+"Sound.Sc3.Ugen" and "Sound.Sc3.Ugen.Bindings".+-}+module Sound.Sc3 (module M) where++import Sound.Sc3.Common as M+import Sound.Sc3.Server.Monad as M+import Sound.Sc3.Ugen as M+import Sound.Sc3.Ugen.Bindings as M
+ Sound/Sc3/Common.hs view
@@ -0,0 +1,15 @@+-- | Composite of SC3.Common sub-modules.+module Sound.Sc3.Common (module M) where++import Sound.Sc3.Common.Buffer as M+import Sound.Sc3.Common.Enum as M+import Sound.Sc3.Common.Envelope as M+import Sound.Sc3.Common.Help as M+import Sound.Sc3.Common.Math as M+import Sound.Sc3.Common.Math.Operator as M+import Sound.Sc3.Common.Math.Warp as M+import Sound.Sc3.Common.Mce as M+import Sound.Sc3.Common.Monad as M+import Sound.Sc3.Common.Rate as M+import Sound.Sc3.Common.SoundFile as M+import Sound.Sc3.Common.Uid as M
+ Sound/Sc3/Common/Base.hs view
@@ -0,0 +1,369 @@+-- | Common core functions.+module Sound.Sc3.Common.Base where++import Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import Data.Ord {- base -}++import qualified Safe {- safe -}++-- * Function++-- | Unary function.+type Fn1 a b = a -> b++-- | Binary function.+type Fn2 a b c = a -> b -> c++-- | Ternary function.+type Fn3 a b c d = a -> b -> c -> d++-- | Quaternary function.+type Fn4 a b c d e = a -> b -> c -> d -> e++-- | 5-parameter function.+type Fn5 a b c d e f = a -> b -> c -> d -> e -> f++-- | 6-parameter function.+type Fn6 a b c d e f g = a -> b -> c -> d -> e -> f -> g++-- | 10-parameter function.+type Fn10 a b c d e f g h i j k = a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k++-- | 11-parameter function.+type Fn11 a b c d e f g h i j k l = a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l++{- | Apply /f/ n times, ie. iterate f x !! n++>>> iter 3 (* 2) 1+8++>>> iterate (* 2) 1 !! 3+8+-}+iter :: Int -> (a -> a) -> a -> a+iter n f x = if n == 0 then x else f (iter (n - 1) f x)++-- * Functor++-- | This is the same function as Control.Monad.void, which however hugs does not know of.+fvoid :: Functor f => f a -> f ()+fvoid = fmap (const ())++-- * Read++-- | Variant of 'reads' requiring exact match.+reads_exact :: Read a => String -> Maybe a+reads_exact s =+  case reads s of+    [(r, "")] -> Just r+    _ -> Nothing++-- * String++{- | Similar to Data.List.Split.splitOn, which however hugs doesn't know of.++>>> string_split_at_char ':' "/usr/local/bin:/usr/bin:/bin"+["/usr/local/bin","/usr/bin","/bin"]++>>> string_split_at_char ':' "/usr/local/bin"+["/usr/local/bin"]+-}+string_split_at_char :: Char -> String -> [String]+string_split_at_char c s =+  case break (== c) s of+    (lhs, []) -> [lhs]+    (lhs, _ : rhs) -> lhs : string_split_at_char c rhs++-- * String / Case++-- | Ci = Case insensitive, Cs = case sensitive, Sci = separator & case insensitive+data Case_Rule = Ci | Cs | Sci deriving (Eq)++string_op :: (String -> String -> t) -> Case_Rule -> String -> String -> t+string_op f cr x y =+  let ci_form = map toLower+      sci_form = filter (`notElem` "-_") . ci_form+  in case cr of+      Ci -> f (ci_form x) (ci_form y)+      Cs -> f x y+      Sci -> f (sci_form x) (sci_form y)++{- | String equality with 'Case_Rule'.++>>> string_eq Ci "sinOsc" "SinOsc"+True++>>> string_eq Sci "sin-osc" "SinOsc"+True+-}+string_eq :: Case_Rule -> String -> String -> Bool+string_eq = string_op (==)++string_cmp :: Case_Rule -> String -> String -> Ordering+string_cmp = string_op compare++-- | 'rlookup_by' of 'string_eq'.+rlookup_str :: Case_Rule -> String -> [(a, String)] -> Maybe a+rlookup_str = rlookup_by . string_eq++{- | 'Enum' parser with 'Case_Rule'.++>>> parse_enum Ci "false" :: Maybe Bool+Just False+-}+parse_enum :: (Show t, Enum t, Bounded t) => Case_Rule -> String -> Maybe t+parse_enum cr nm =+  let u = [minBound .. maxBound]+      t = zip (map show u) u+  in lookup_by (string_eq cr) nm t++-- * List++{- | Left to right composition of a list of functions.++>>> compose_l [(* 2),(+ 1)] 3+7+-}+compose_l :: [t -> t] -> t -> t+compose_l = flip (foldl (\x f -> f x))++{- | Right to left composition of a list of functions.++>>> compose_r [(* 2),(+ 1)] 3+8+-}+compose_r :: [t -> t] -> t -> t+compose_r = flip (foldr ($))++{- | SequenceableCollection.differentiate++> [3,4,1,1].differentiate == [3,1,-3,0]++>>> d_dx [3,4,1,1]+[3,1,-3,0]++>>> d_dx [0,1,3,6]+[0,1,2,3]+-}+d_dx :: (Num a) => [a] -> [a]+d_dx l = zipWith (-) l (0 : l)++{- | Variant that does not prepend zero to input, ie. 'tail' of 'd_dx'.++>> d_dx' [3,4,1,1]+[1,-3,0]++>>> d_dx' [0,1,3,6]+[1,2,3]+-}+d_dx' :: Num n => [n] -> [n]+d_dx' l = zipWith (-) (Safe.tailNote "d_dx'" l) l++{- | SequenceableCollection.integrate++> [3,4,1,1].integrate == [3,7,8,9]++>>> dx_d [3,4,1,1]+[3,7,8,9]++>>> dx_d (d_dx [0,1,3,6])+[0,1,3,6]++>>> dx_d [0.5,0.5]+[0.5,1.0]+-}+dx_d :: Num n => [n] -> [n]+dx_d = scanl1 (+)++{- | Variant pre-prending zero to output.++>>> dx_d' [3,4,1,1]+[0,3,7,8,9]++>>> dx_d' (d_dx' [0,1,3,6])+[0,1,3,6]++>>> dx_d' [0.5,0.5]+[0.0,0.5,1.0]+-}+dx_d' :: Num n => [n] -> [n]+dx_d' = (0 :) . dx_d++-- | 'lookup' with equality function.+lookup_by :: (a -> t -> Bool) -> a -> [(t, b)] -> Maybe b+lookup_by f x = fmap snd . find (f x . fst)++-- | Erroring variant, with message.+lookup_by_note :: String -> (a -> t -> Bool) -> a -> [(t, b)] -> b+lookup_by_note msg f x = fromMaybe (error ("lookup_by: " ++ msg)) . lookup_by f x++-- | Erroring variant.+lookup_by_err :: (a -> t -> Bool) -> a -> [(t, b)] -> b+lookup_by_err = lookup_by_note "error"++-- | Reverse 'lookup' with equality function.+rlookup_by :: (b -> b -> Bool) -> b -> [(a, b)] -> Maybe a+rlookup_by f x = fmap fst . find (f x . snd)++{- | (prev,cur,next) triples.++>>> pcn_triples [1..3]+[(Nothing,1,Just 2),(Just 1,2,Just 3),(Just 2,3,Nothing)]+-}+pcn_triples :: [a] -> [(Maybe a, a, Maybe a)]+pcn_triples =+  let f e l = case l of+        e1 : e2 : l' -> (e, e1, Just e2) : f (Just e1) (e2 : l')+        [e'] -> [(e, e', Nothing)]+        [] -> undefined+  in f Nothing++{- | Separate first list element.++>>> sep_first "astring"+Just ('a',"string")+-}+sep_first :: [t] -> Maybe (t, [t])+sep_first l =+  case l of+    e : l' -> Just (e, l')+    _ -> Nothing++{- | Separate last list element.++>>> sep_last "stringb"+Just ("string",'b')+-}+sep_last :: [t] -> Maybe ([t], t)+sep_last =+  let f (e, l) = (reverse l, e)+  in fmap f . sep_first . reverse++{- | Are lists of equal length?++>>> equal_length_p ["t1","t2"]+True++>>> equal_length_p ["t","t1","t2"]+False+-}+equal_length_p :: [[a]] -> Bool+equal_length_p = (== 1) . length . nub . map length++-- | Histogram+histogram :: Ord a => [a] -> [(a, Int)]+histogram x =+  let g = group (sort x)+  in zip (map (Safe.headNote "histogram") g) (map length g)++-- | !! with localised error message+at_with_error_message :: String -> [t] -> Int -> t+at_with_error_message msg list index =+  if index >= length list+    then error ("!!: index out of range: " ++ msg)+    else list !! index++-- | concat of intersperse.  This is the same function as intercalate, which hugs doesn't know of.+concat_intersperse :: [a] -> [[a]] -> [a]+concat_intersperse x = concat . intersperse x++{- | Similar to Data.List.Split.splitOn, which however hugs doesn't know of.++>>> list_split_at_elem ' ' "a sequence of words"+["a","sequence","of","words"]+-}+list_split_at_elem :: Eq t => t -> [t] -> [[t]]+list_split_at_elem c s =+  case break (== c) s of+    (lhs, []) -> [lhs]+    (lhs, _ : rhs) -> lhs : list_split_at_elem c rhs++{- | Data.List.sortOn, which however hugs does not know of.++>>> sort_on snd [('a',1),('b',0)]+[('b',0),('a',1)]+-}+sort_on :: (Ord b) => (a -> b) -> [a] -> [a]+sort_on = sortBy . comparing++{- | Inserts at the first position where it compares less but not equal to the next element.++>>> import Data.Function+>>> insertBy (compare `on` fst) (3,'x') (zip [1..5] ['a'..])+[(1,'a'),(2,'b'),(3,'x'),(3,'c'),(4,'d'),(5,'e')]++>>> insertBy_post (compare `on` fst) (3,'x') (zip [1..5] ['a'..])+[(1,'a'),(2,'b'),(3,'c'),(3,'x'),(4,'d'),(5,'e')]+-}+insertBy_post :: (a -> a -> Ordering) -> a -> [a] -> [a]+insertBy_post cmp e l =+  case l of+    [] -> [e]+    h : l' -> case cmp e h of+      LT -> e : l+      _ -> h : insertBy_post cmp e l'++-- | 'insertBy_post' using 'compare'.+insert_post :: Ord t => t -> [t] -> [t]+insert_post = insertBy_post compare++{- | Apply /f/ at all but last element, and /g/ at last element.++>>> at_last (* 2) negate [1..4]+[2,4,6,-4]+-}+at_last :: (a -> b) -> (a -> b) -> [a] -> [b]+at_last f g x =+  case x of+    [] -> []+    [i] -> [g i]+    i : x' -> f i : at_last f g x'++-- * Tuples++-- | Zip two 4-tuples.+p4_zip :: (a, b, c, d) -> (e, f, g, h) -> ((a, e), (b, f), (c, g), (d, h))+p4_zip (a, b, c, d) (e, f, g, h) = ((a, e), (b, f), (c, g), (d, h))++-- | Two-tuple.+type T2 a = (a, a)++-- | Three-tuple.+type T3 a = (a, a, a)++-- | Four-tuple.+type T4 a = (a, a, a, a)++-- | t -> (t,t)+dup2 :: t -> T2 t+dup2 t = (t, t)++-- | t -> (t,t,t)+dup3 :: t -> T3 t+dup3 t = (t, t, t)++-- | t -> (t,t,t,t)+dup4 :: t -> T4 t+dup4 t = (t, t, t, t)++-- | 'concatMap' of /f/ at /x/ and /g/ at /y/.+mk_duples :: (a -> c) -> (b -> c) -> [(a, b)] -> [c]+mk_duples a b = concatMap (\(x, y) -> [a x, b y])++-- | Length prefixed list variant of 'mk_duples'.+mk_duples_l :: (Int -> c) -> (a -> c) -> (b -> c) -> [(a, [b])] -> [c]+mk_duples_l i a b = concatMap (\(x, y) -> a x : i (length y) : map b y)++-- | 'concatMap' of /f/ at /x/ and /g/ at /y/ and /h/ at /z/.+mk_triples :: (a -> d) -> (b -> d) -> (c -> d) -> [(a, b, c)] -> [d]+mk_triples a b c = concatMap (\(x, y, z) -> [a x, b y, c z])++-- | [x,y] -> (x,y)+t2_from_list :: [t] -> T2 t+t2_from_list l = case l of [p, q] -> (p, q); _ -> error "t2_from_list"++-- | [x,y,z] -> (x,y,z)+t3_from_list :: [t] -> (t, t, t)+t3_from_list l = case l of [p, q, r] -> (p, q, r); _ -> error "t3_from_list"
+ Sound/Sc3/Common/Base/System.hs view
@@ -0,0 +1,30 @@+module Sound.Sc3.Common.Base.System where++import Control.Exception {- base -}+import Data.Maybe {- base -}+import System.Environment {- base -}++{- | 'getEnv' with error handler to return default value.  This almost works in hugs (IOException should be Exception, the signature can be elided)++>>> get_env_with_default "undefined_environment_variable" "default"+"default"+-}+get_env_with_default :: String -> String -> IO String+get_env_with_default variableName defaultValue =+  Control.Exception.catch (getEnv variableName) ((\_ -> return defaultValue) :: IOException -> IO String)++{- | 'getEnvironment' with lookup and default value.++> get_env_default "PATH" "/usr/bin"+-}+get_env_default :: String -> String -> IO String+get_env_default variableName defaultValue = do+  env <- getEnvironment+  return (fromMaybe defaultValue (lookup variableName env))++{- | 'lookupEnv' with default value.++> lookup_env_default "PATH" "/usr/bin"+-}+lookup_env_default :: String -> String -> IO String+lookup_env_default e k = fmap (fromMaybe k) (lookupEnv e)
+ Sound/Sc3/Common/Buffer.hs view
@@ -0,0 +1,218 @@+-- | Signals & wavetables+module Sound.Sc3.Common.Buffer where++import Data.List {- base -}++import qualified Sound.Sc3.Common.Math as S {- hsc3 -}++{- | /z/ ranges from 0 (for /i/) to 1 (for /j/).++> 1.5.blend(2.0,0.50)+1.75+> 1.5.blend(2.0,0.75)+1.875++>>> blend 0.50 1.5 2+1.75++>>> blend 0.75 1.5 2+1.875+-}+blend :: Num a => a -> a -> a -> a+blend z i j = i + (z * (j - i))++{- | Variant of '(!!)' but values for index greater than the size of the collection will be clipped to the last index.++>>> map (\x -> clipAt x "abc") [-1,0,1,2,3]+"aabcc"+-}+clipAt :: Int -> [a] -> a+clipAt ix c = if ix > length c - 1 then last c else if ix < 0 then c !! 0 else c !! ix++-- | 'blendAt' with @clip@ function as argument.+blendAtBy :: (Integral i, RealFrac n) => (i -> t -> n) -> n -> t -> n+blendAtBy f ix c =+  let m = floor ix+      m' = fromIntegral m+  in blend (S.absdif ix m') (f m c) (f (m + 1) c)++{- | @SequenceableCollection.blendAt@ returns a linearly interpolated value between the two closest indices.+Inverse operation is 'indexInBetween'.++> [2,5,6].blendAt(0.4)+3.2++>>> blendAt 0 [2,5,6]+2.0+>>> blendAt 0.4 [2,5,6]+3.2+-}+blendAt :: RealFrac a => a -> [a] -> a+blendAt = blendAtBy clipAt++-- | Resampling function, /n/ is destination length, /r/ is source length, /f/ is the indexing function, /c/ is the collection.+resamp1_gen :: (Integral i, RealFrac n) => i -> i -> (i -> t -> n) -> t -> i -> n+resamp1_gen n r f c =+  let n' = fromIntegral n+      fwd = (fromIntegral r - 1) / (n' - 1)+      gen i = blendAtBy f (fromIntegral i * fwd) c+  in gen++{- | @SequenceableCollection.resamp1@ returns a new collection of the desired length, with values resampled evenly-spaced from the receiver with linear interpolation.++> [1].resamp1(3) == [1,1,1]+> [1,2,3,4].resamp1(12)+> [1,2,3,4].resamp1(3) == [1,2.5,4]++>>> resamp1 3 [1]+[1.0,1.0,1.0]++>>> resamp1 7 [1,2,3,4]+[1.0,1.5,2.0,2.5,3.0,3.5,4.0]++>>> resamp1 3 [1,2,3,4]+[1.0,2.5,4.0]+-}+resamp1 :: RealFrac n => Int -> [n] -> [n]+resamp1 n c =+  let gen = resamp1_gen n (length c) clipAt c+  in map gen [0 .. n - 1]++{- | @ArrayedCollection.normalizeSum@ ensures sum of elements is one.++> [1,2,3].normalizeSum == [1/6,1/3,0.5]++>>> normalizeSum [1,2,3] == [1/6,2/6,3/6]+True+-}+normalizeSum :: (Fractional a) => [a] -> [a]+normalizeSum l = let n = sum l in map (/ n) l++-- | Variant that specifies range of input sequence separately.+normalise_rng :: Fractional n => (n, n) -> (n, n) -> [n] -> [n]+normalise_rng (il, ir) (l, r) = map (\e -> S.sc3_linlin e il ir l r)++{- | @ArrayedCollection.normalize@ returns a new Array with the receiver items normalized between min and max.++> [1,2,3].normalize == [0,0.5,1]+> [1,2,3].normalize(-20,10) == [-20,-5,10]++>>> normalize 0 1 [1,2,3]+[0.0,0.5,1.0]++>>> normalize (-20) 10 [1,2,3]+[-20.0,-5.0,10.0]+-}+normalize :: (Fractional n, Ord n) => n -> n -> [n] -> [n]+normalize l r c = normalise_rng (minimum c, maximum c) (l, r) c++{- | List of 2-tuples of elements at distance (stride) /n/.++>>> t2_window 3 [1..9]+[(1,2),(4,5),(7,8)]+-}+t2_window :: Integral i => i -> [t] -> [(t, t)]+t2_window n x =+  case x of+    i : j : _ -> (i, j) : t2_window n (genericDrop n x)+    _ -> []++{- | List of 2-tuples of adjacent elements.++>>> t2_adjacent [1..6]+[(1,2),(3,4),(5,6)]++>>> t2_adjacent [1..5]+[(1,2),(3,4)]+-}+t2_adjacent :: [t] -> [(t, t)]+t2_adjacent = t2_window (2 :: Int)++{- | List of 2-tuples of overlapping elements.++>>> t2_overlap [1..4]+[(1,2),(2,3),(3,4)]+-}+t2_overlap :: [b] -> [(b, b)]+t2_overlap x =+  case uncons x of+    Nothing -> error "t2_overlap"+    Just (_, t) -> zip x t++{- | Concat of 2-tuples.++>>> t2_concat (t2_adjacent [1..6])+[1,2,3,4,5,6]++>>> t2_concat (t2_overlap [1..4])+[1,2,2,3,3,4]+-}+t2_concat :: [(a, a)] -> [a]+t2_concat x =+  case x of+    [] -> []+    (i, j) : x' -> i : j : t2_concat x'++{- | A Signal is half the size of a Wavetable, each element is the sum+of two adjacent elements of the Wavetable.++>>> from_wavetable [-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5]+[0.0,0.5,1.0,0.5]++>>> let s = [0,0.5,1,0.5]+>>> from_wavetable (to_wavetable s) == s+True+-}+from_wavetable :: Num n => [n] -> [n]+from_wavetable = map (uncurry (+)) . t2_adjacent++{- | A Wavetable has n * 2 elements, where n is the number of elements of the Signal.+     Each signal element e0 expands to the two elements (2 * e0 - e1, e1 - e0)+     where e1 is the next element, or zero at the final element.+     Properly wavetables are only of power of two element signals.++> Signal[0,0.5,1,0.5].asWavetable == Wavetable[-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5]++>>> to_wavetable [0,0.5,1,0.5]+[-0.5,0.5,0.0,0.5,1.5,-0.5,1.0,-0.5]+-}+to_wavetable :: Num a => [a] -> [a]+to_wavetable = to_wavetable_nowrap . (++ [0])++{- | Shaper requires wavetables without wrap.++>>> to_wavetable_nowrap [0,0.5,1,0.5]+[-0.5,0.5,0.0,0.5,1.5,-0.5]+-}+to_wavetable_nowrap :: Num a => [a] -> [a]+to_wavetable_nowrap =+  let f (e0, e1) = (2 * e0 - e1, e1 - e0)+  in t2_concat . map f . t2_overlap++{- | Variant of 'sineFill' that gives each component table.++>>> let t = sineGen 1024 (map recip [1, 2, 3, 5, 8, 13, 21, 34, 55]) (replicate 9 0)+>>> map length t == replicate 9 1024+True++> Sound.Sc3.Plot.plot_p1_ln t+-}+sineGen :: (Floating n, Enum n) => Int -> [n] -> [n] -> [[n]]+sineGen n =+  let incr = (2 * pi) / fromIntegral n+      ph partial = take n [0, incr * partial ..]+      f h amp iph = map (\z -> sin (z + iph) * amp) (ph h)+  in zipWith3 f [1 ..]++{- | @Signal.*sineFill@ is a table generator.+     Frequencies are partials, amplitudes and initial phases are as given.+     Result is normalised.++> let a = [[21,5,34,3,2,13,1,8,55],[13,8,55,34,5,21,3,1,2],[55,34,1,3,2,13,5,8,21]]+> let t = map (\amp -> sineFill 1024 (map recip amp) (replicate 9 0)) a+> Sound.Sc3.Plot.plot_p1_ln t+-}+sineFill :: (Ord n, Floating n, Enum n) => Int -> [n] -> [n] -> [n]+sineFill n amp iph =+  let t = sineGen n amp iph+  in normalize (-1) 1 (map sum (transpose t))
+ Sound/Sc3/Common/Buffer/Array.hs view
@@ -0,0 +1,35 @@+{- | Array variants of "Sound.Sc3.Common.Buffer".+These functions have the same names as the plain forms and are not re-exported by "Sound.Sc3.Common".+-}+module Sound.Sc3.Common.Buffer.Array where++import qualified Data.Array as A {- array -}++import qualified Sound.Sc3.Common.Buffer as Common.Buffer {- hsc3 -}++-- | 'Common.Buffer.clipAt'.+clipAt :: Int -> A.Array Int a -> a+clipAt ix c =+  let (l, r) = A.bounds c+      f = (A.!) c+  in if ix < l then f l else if ix > r then f r else f ix++{- | 'C.blendAtBy' of 'clipAt'.++> Sound.Sc3.Common.Buffer.Array.blendAt 0 (A.listArray (0,2) [2,5,6]) == 2+> Sound.Sc3.Common.Buffer.Array.blendAt 0.4 (A.listArray (0,2) [2,5,6]) == 3.2+-}+blendAt :: RealFrac a => a -> A.Array Int a -> a+blendAt = Common.Buffer.blendAtBy clipAt++{- | 'C.resamp1'.++> Sound.Sc3.Common.Buffer.Array.resamp1 12 (A.listArray (0,3) [1,2,3,4])+> Sound.Sc3.Common.Buffer.Array.resamp1 3 (A.listArray (0,3) [1,2,3,4]) == A.listArray (0,2) [1,2.5,4]+-}+resamp1 :: RealFrac n => Int -> A.Array Int n -> A.Array Int n+resamp1 n c =+  let (_, r) = A.bounds c+      gen = Common.Buffer.resamp1_gen n (r + 1) clipAt c+      rs = map gen [0 .. n - 1]+  in A.listArray (0, n - 1) rs
+ Sound/Sc3/Common/Buffer/Gen.hs view
@@ -0,0 +1,128 @@+{- | Implementation of server b_gen routines.++The naming scheme is: _p generates one partial, _l generates a list+of partials, _nrm is the unit normalised form.+-}+module Sound.Sc3.Common.Buffer.Gen where++import Data.List {- base -}++import qualified Sound.Sc3.Common.Buffer as Buffer {- hsc3 -}+import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++-- | Sum (mix) multiple tables into one.+sum_l :: Num n => [[n]] -> [n]+sum_l = map sum . transpose++-- | Unit normalisation.+nrm_u :: (Fractional n, Ord n) => [n] -> [n]+nrm_u = Buffer.normalize (-1) 1++-- * sine1++{- | 'sine3_p' with zero phase.++> import Sound.Sc3.Plot+> plot_p1_ln [sine1_p 512 (1, 1)]+-}+sine1_p :: (Enum n, Floating n) => Int -> (n, n) -> [n]+sine1_p n (pfreq, ampl) = sine3_p n (pfreq, ampl, 0)++-- | Series of sine wave harmonics using specified amplitudes.+sine1_l :: (Enum n, Floating n) => Int -> [n] -> [[n]]+sine1_l n = zipWith (curry (sine1_p n)) [1 ..]++{- | 'sum_l' of 'sine1_l'.++> plot_p1_ln [sine1 256 [1, 0.95 .. 0.5]]+-}+sine1 :: (Enum n, Floating n) => Int -> [n] -> [n]+sine1 n = sum_l . sine1_l n++{- | 'nrm_u' of 'sine1_l'.++> Sound.Sc3.Plot.plot_p1_ln [sine1_nrm 256 [1, 0.95 .. 0.5]]+> Sound.Sc3.Plot.plot_p1_ln [sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]]+-}+sine1_nrm :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+sine1_nrm n = nrm_u . sine1 n++-- | Variant that generates a wavetable (without guard point) suitable for the Shaper Ugen.+sine1Tbl :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+sine1Tbl n = Buffer.to_wavetable . sine1_nrm n++-- * sine2++-- | Series of /n/ sine wave partials using specified frequencies and amplitudes.+sine2_l :: (Enum n, Floating n) => Int -> [(n, n)] -> [[n]]+sine2_l n = map (sine1_p n)++{- | 'sum_l' of 'sine2_l'.++> Sound.Sc3.Plot.plot_p1_ln [sine2 256 (zip [1, 2..] [1, 0.95 .. 0.5])]+> Sound.Sc3.Plot.plot_p1_ln [sine2 256 (zip [1, 1.5 ..] [1, 0.95 .. 0.5])]+-}+sine2 :: (Enum n, Floating n) => Int -> [(n, n)] -> [n]+sine2 n = sum_l . sine2_l n++-- | 'nrm_u' of 'sine2_l'.+sine2_nrm :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+sine2_nrm n = nrm_u . sine1 n++-- * sine3++{- | Sine wave table at specified frequency, amplitude and phase.+The table does not arrive back at the starting point.++>>> map (round . (* 100)) (sine3_p 8 (1, 1, 0))+[0,71,100,71,0,-71,-100,-71]+-}+sine3_p :: (Enum n, Floating n) => Int -> (n, n, n) -> [n]+sine3_p n (pfreq, ampl, phase) =+  let incr = (Math.two_pi / (fromIntegral n - 0)) * pfreq+  in map ((*) ampl . sin) (take n [phase, phase + incr ..])++-- | 'map' of 'sine3_p'.+sine3_l :: (Enum n, Floating n) => Int -> [(n, n, n)] -> [[n]]+sine3_l n = map (sine3_p n)++{- | 'sum_l' of 'sine3_l'.++> plot_p1_ln [sine3 256 (zip3 [1,1.5 ..] [1,0.95 .. 0.5] [0,pi/7..])]+-}+sine3 :: (Enum n, Floating n) => Int -> [(n, n, n)] -> [n]+sine3 n = sum_l . sine3_l n++-- * cheby++{- | Generate Chebyshev waveshaping table, see b_gen_cheby.+Cf. <https://www.csounds.com/manual/html/GEN13.html>++> import Sound.Sc3.Plot+> let p x = plot_p1_ln [gen_cheby 512 x]++> p [1, 0, 1, 1, 0, 1]+> p [100, -50, -33, 25, 20, -16.7, -14.2, 12.5, 11.1, -10, -9.09, 8.333, 7.69, -7.14, -6.67, 6.25, 5.88, -5.55, -5.26, 5]+> p [100, 0, -33, 0, 20, 0, -14.2, 0, 11.1, 0, -9.09, 0, 7.69, 0, -6.67, 0, 5.88, 0, -5.26]+> p [100, 0, -11.11, 0, 4, 0, -2.04, 0, 1.23, 0, -0.826, 0, 0.59, 0, -0.444, 0, 0.346, 0, -0.277]+> p [1, -0.8, 0, 0.6, 0, 0, 0, 0.4, 0, 0, 0, 0, 0.1, -0.2, -0.3, 0.5]+> p [0, 0, -0.1, 0, 0.3, 0, -0.5, 0, 0.7, 0, -0.9, 0, 1, 0, -1, 0]+> p [0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, -0.1, 0, 0.1, 0, -0.2, 0.3, 0, -0.7, 0, 0.2, 0, -0.1]+> p [5, 0, 3, 0, 1]+-}+gen_cheby :: (Enum n, Floating n, Ord n, Integral i) => i -> [n] -> [n]+gen_cheby n =+  let acos' x = if x > 1 then 0 else if x < -1 then pi else acos x+      c k x = cos (k * acos' x)+      ix = [-1, -1 + (2 / (fromIntegral n - 1)) .. 1] -- increment?+      mix = map sum . transpose+      c_normalize x = let m = maximum (map abs x) in map (* recip m) x+  in c_normalize . mix . zipWith (\k a -> map ((* a) . c k) ix) [1 ..]++-- | Type specialised 'gen_cheby'.+cheby :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+cheby = gen_cheby++-- | Variant that generates a wavetable (without guard point) suitable for the Shaper Ugen.+chebyShaperTbl :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+chebyShaperTbl n = Buffer.to_wavetable_nowrap . cheby n
+ Sound/Sc3/Common/Buffer/Vector.hs view
@@ -0,0 +1,44 @@+{- | Vector variants of "Sound.Sc3.Common.Buffer".+These functions have the same names as the plain forms and are not re-exported by "Sound.Sc3.Common".+-}+module Sound.Sc3.Common.Buffer.Vector where++import qualified Data.Vector.Storable as V {- vector -}++import qualified Sound.Sc3.Common.Buffer as C {- hsc3 -}++-- | 'C.clipAt'.+clipAt :: V.Storable t => Int -> V.Vector t -> t+clipAt ix c =+  let r = V.length c+      f = (V.!) c+  in if ix > r - 1 then f (r - 1) else f ix++{- | 'C.blendAtBy' of 'clipAt'.++> Sound.Sc3.Common.Buffer.Vector.blendAt 0 (V.fromList [2,5,6]) == 2+> Sound.Sc3.Common.Buffer.Vector.blendAt 0.4 (V.fromList [2,5,6]) == 3.2+> Sound.Sc3.Common.Buffer.Vector.blendAt 2.1 (V.fromList [2,5,6]) == 6+-}+blendAt :: (V.Storable t, RealFrac t) => t -> V.Vector t -> t+blendAt = C.blendAtBy clipAt++{- | 'C.from_wavetable'++> Sound.Sc3.Common.Buffer.Vector.from_wavetable (V.fromList [-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5])+-}+from_wavetable :: (V.Storable t, Num t) => V.Vector t -> V.Vector t+from_wavetable wt =+  let n = V.length wt+      f k = let k2 = k * 2 in (wt V.! k2) + (wt V.! (k2 + 1))+  in V.generate (n `div` 2) f++{- | 'C.resamp1'.++> Sound.Sc3.Common.Buffer.Vector.resamp1 12 (V.fromList [1,2,3,4])+> Sound.Sc3.Common.Buffer.Vector.resamp1 3 (V.fromList [1,2,3,4]) == V.fromList [1,2.5,4]+-}+resamp1 :: (V.Storable t, RealFrac t) => Int -> V.Vector t -> V.Vector t+resamp1 n c =+  let gen = C.resamp1_gen n (V.length c) clipAt c+  in V.generate n gen
+ Sound/Sc3/Common/Context.hs view
@@ -0,0 +1,62 @@+-- | Interpreter (module) contexts for hsc3.+module Sound.Sc3.Common.Context where++import Text.Printf {- base -}++-- | (moduleName, qualifierName, packageName)+type Context = [(String, Maybe String, String)]++-- | Format a Context as a sequence of import commands.+context_format :: Context -> [String]+context_format =+  let f (moduleName, qualifier, packageName) =+        case qualifier of+          Nothing -> printf "import %s {- %s -}" moduleName packageName+          Just qualifierName -> printf "import qualified %s as %s {- %s -}" moduleName qualifierName packageName+  in map f++-- | writeFile of context_format+context_write :: FilePath -> Context -> IO ()+context_write fn = writeFile fn . unlines . context_format++-- | Minimal hsc3 context+min_context :: Context+min_context =+  [ ("Prelude", Nothing, "base")+  , ("Control.Monad", Nothing, "base")+  , ("Data.Bits", Nothing, "base")+  , ("Data.Function", Nothing, "base")+  , ("Data.List", Nothing, "base")+  , ("Sound.Sc3", Nothing, "hsc3")+  ]++-- | Standard hsc3 context+std_context :: Context+std_context =+  [ ("Prelude", Nothing, "base")+  , ("Control.Monad", Nothing, "base")+  , ("Data.Bits", Nothing, "base")+  , ("Data.Function", Nothing, "base")+  , ("Data.List", Nothing, "base")+  , ("System.Random", Nothing, "random")+  , ("Sound.Osc", Nothing, "hosc")+  , ("Sound.Sc3", Nothing, "hsc3")+  , ("Sound.Sc3.Common.Base", Just "Sound.Sc3.Common.Base", "hsc3")+  , ("Sound.Sc3.Common.Buffer.Gen", Just "Gen", "hsc3")+  , ("Sound.Sc3.Common.Math.Filter.Beq", Just "Sound.Sc3.Common.Math.Filter.Beq", "hsc3")+  , ("Sound.Sc3.Ugen.Bindings.Db.External", Just "X", "hsc3")+  , ("Sound.Sc3.Ugen.Bindings.Composite.External", Just "X", "hsc3")+  , ("Sound.Sc3.Ugen.Bindings.Hw.External.F0", Just "X", "hsc3")+  , ("Sound.Sc3.Ugen.Bindings.Hw.External.SC3_Plugins", Just "X", "hsc3")+  , ("Sound.Sc3.Ugen.Bindings.Hw.External.Zita", Just "X", "hsc3")+  , ("Sound.Sc3.Ugen.Bindings.Db.Rdu", Just "X", "sc3-rdu")+  , ("Sound.Sc3.Ugen.Dot", Just "Sound.Sc3.Ugen.Dot", "hsc3-dot")+  , ("Sound.Sc3.Ugen.Unsafe", Nothing, "hsc3-unsafe")+  , ("Sound.Sc3.Ugen.Unsafe", Nothing, "hsc3-unsafe")+  , ("Sound.Sc3.Ugen.Protect", Just "Protect", "hsc3-rw")+  , ("Sound.Sc3.Ui.Html", Just "Ui", "hsc3-ui")+  , ("Sound.Sc3.Ui.Plot", Just "Ui", "hsc3-ui")+  , ("Sound.Sc3.Ui.Qarma", Just "Ui", "hsc3-ui")+  , ("Sound.Sc3.Ui.ScLang", Just "Ui", "hsc3-ui")+  , ("Sound.Sc3.Ui.ScLang.Control", Just "Ui", "hsc3-ui")+  ]
+ Sound/Sc3/Common/Enum.hs view
@@ -0,0 +1,128 @@+-- | Data types for enumerated and non signal unit generator inputs.+module Sound.Sc3.Common.Enum where++-- * Loop++-- | Loop indicator input.+data Loop t+  = -- | 0+    NoLoop+  | -- | 1+    Loop+  | WithLoop t+  deriving (Eq, Show)++-- | Apply /f/ at 'WithLoop'.+loop_map :: (t -> u) -> Loop t -> Loop u+loop_map f lp =+  case lp of+    NoLoop -> NoLoop+    Loop -> Loop+    WithLoop t -> WithLoop (f t)++-- | fmap is 'loop_map'+instance Functor Loop where+  fmap = loop_map++-- | Resolve 'Loop'.+from_loop :: Num t => Loop t -> t+from_loop e =+  case e of+    NoLoop -> 0+    Loop -> 1+    WithLoop u -> u++-- * Interpolation++-- | Interpolation indicator input.+data Interpolation t+  = NoInterpolation+  | LinearInterpolation+  | CubicInterpolation+  | WithInterpolation t+  deriving (Eq, Show)++-- | Resolve 'Interpolation'.+from_interpolation :: Num t => Interpolation t -> t+from_interpolation e =+  case e of+    NoInterpolation -> 1+    LinearInterpolation -> 2+    CubicInterpolation -> 4+    WithInterpolation u -> u++-- * DoneAction++-- | Completion mode indicator input.+data DoneAction t+  = DoNothing+  | PauseSynth+  | RemoveSynth+  | RemoveGroup+  | WithDoneAction t+  deriving (Eq, Show)++-- | Apply /f/ at 'WithDoneAction'.+done_action_map :: (t -> u) -> DoneAction t -> DoneAction u+done_action_map f e =+  case e of+    DoNothing -> DoNothing+    PauseSynth -> PauseSynth+    RemoveSynth -> RemoveSynth+    RemoveGroup -> RemoveGroup+    WithDoneAction x -> WithDoneAction (f x)++-- | fmap is 'done_action_map'+instance Functor DoneAction where+  fmap = done_action_map++-- | Resolve 'DoneAction'.+from_done_action :: Num t => DoneAction t -> t+from_done_action e =+  case e of+    DoNothing -> 0+    PauseSynth -> 1+    RemoveSynth -> 2+    RemoveGroup -> 14+    WithDoneAction x -> x++-- * Warp++-- | Warp interpolation indicator input.+data Warp t+  = Linear+  | Exponential+  | WithWarp t+  deriving (Eq, Show)++{- | Resolve 'Warp'.++>>> map from_warp [Linear,Exponential]+[0,1]+-}+from_warp :: Num t => Warp t -> t+from_warp e =+  case e of+    Linear -> 0+    Exponential -> 1+    WithWarp u -> u++-- | Apply /f/ at 'WithWarp'+warp_map :: (t -> u) -> Warp t -> Warp u+warp_map f e =+  case e of+    Linear -> Linear+    Exponential -> Exponential+    WithWarp u -> WithWarp (f u)++-- | fmap = 'warp_map'+instance Functor Warp where+  fmap = warp_map++-- * Buffer++-- | Unification of integer and 'Ugen' buffer identifiers.+data Buffer t+  = Buffer_Id Int+  | Buffer t+  deriving (Eq, Show)
+ Sound/Sc3/Common/Envelope.hs view
@@ -0,0 +1,552 @@+-- | Envelope generators.+module Sound.Sc3.Common.Envelope where++import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Safe {- safe -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}+import qualified Sound.Sc3.Common.Math.Interpolate as Interpolate {- hsc3 -}++-- * Curve++-- | Envelope curve indicator input.+data Envelope_Curve a+  = EnvStep+  | EnvLin+  | EnvExp+  | EnvSin+  | -- | Note: not implemented at Sc3+    EnvWelch+  | EnvNum a+  | EnvSqr+  | EnvCub+  | EnvHold+  deriving (Eq, Show)++-- | Envelope curve pair.+type Envelope_Curve_2 a = Base.T2 (Envelope_Curve a)++-- | Envelope curve triple.+type Envelope_Curve_3 a = Base.T3 (Envelope_Curve a)++-- | Envelope curve quadruple.+type Envelope_Curve_4 a = Base.T4 (Envelope_Curve a)++{- | Convert 'Envelope_Curve' to shape value.++>>> map env_curve_shape [EnvSin,EnvSqr]+[3,6]+-}+env_curve_shape :: Num a => Envelope_Curve a -> a+env_curve_shape e =+  case e of+    EnvStep -> 0+    EnvLin -> 1+    EnvExp -> 2+    EnvSin -> 3+    EnvWelch -> 4+    EnvNum _ -> 5+    EnvSqr -> 6+    EnvCub -> 7+    EnvHold -> 8++{- | The /value/ of 'EnvCurve' is non-zero for 'EnvNum'.++>>> map env_curve_value [EnvWelch,EnvNum 2]+[0,2]+-}+env_curve_value :: Num a => Envelope_Curve a -> a+env_curve_value e =+  case e of+    EnvNum u -> u+    _ -> 0++-- | 'Interpolation_f' of 'Envelope_Curve'.+env_curve_interpolation_f :: (Ord t, Floating t) => Envelope_Curve t -> Interpolate.Interpolation_f t+env_curve_interpolation_f c =+  case c of+    EnvStep -> Interpolate.step+    EnvLin -> Interpolate.linear+    EnvExp -> Interpolate.exponential+    EnvSin -> Interpolate.sine+    EnvWelch -> Interpolate.welch+    EnvNum n -> Interpolate.curve n+    EnvSqr -> Interpolate.squared+    EnvCub -> Interpolate.cubed+    EnvHold -> undefined++-- | Apply /f/ to 'EnvNum' value.+env_curve_map :: (a -> b) -> Envelope_Curve a -> Envelope_Curve b+env_curve_map f e =+  case e of+    EnvStep -> EnvStep+    EnvLin -> EnvLin+    EnvExp -> EnvExp+    EnvSin -> EnvSin+    EnvWelch -> EnvWelch+    EnvNum x -> EnvNum (f x)+    EnvSqr -> EnvSqr+    EnvCub -> EnvCub+    EnvHold -> EnvHold++-- * Envelope++-- | Sc3 envelope segment model+data Envelope a = Envelope+  { env_levels :: [a]+  -- ^ Set of /n/ levels, n is >= 1+  , env_times :: [a]+  -- ^ Set of /n-1/ time intervals+  , env_curves :: [Envelope_Curve a]+  -- ^ Possibly empty curve set+  , env_release_node :: Maybe Int+  -- ^ Maybe index to release node+  , env_loop_node :: Maybe Int+  -- ^ Maybe index to loop node+  , env_offset :: a+  -- ^ An offset for all time values (IEnvGen only)+  }+  deriving (Eq, Show)++-- | Apply /f/ to all /a/ at 'Envelope'.+envelope_map :: (a -> b) -> Envelope a -> Envelope b+envelope_map f e =+  let Envelope l t c rn ln os = e+  in Envelope (map f l) (map f t) (map (env_curve_map f) c) rn ln (f os)++-- | fmap = 'envelope_map'+instance Functor Envelope where+  fmap = envelope_map++{- | Variant without release and loop node inputs (defaulting to nil).++> Sound.Sc3.Plot.plotEnvelope [envelope [0,1,0] [3,2] [EnvSin,EnvSin]]+-}+envelope :: Num a => [a] -> [a] -> [Envelope_Curve a] -> Envelope a+envelope l t c = Envelope l t c Nothing Nothing 0++-- | Duration of 'Envelope', ie. 'sum' '.' 'env_times'.+envelope_duration :: Num n => Envelope n -> n+envelope_duration = sum . env_times++-- | Number of segments at 'Envelope', ie. 'length' '.' 'env_times'.+envelope_n_segments :: Integral i => Envelope n -> i+envelope_n_segments = genericLength . env_times++-- | Determine which envelope segment a given time /t/ falls in.+envelope_segment_ix :: (Ord a, Num a) => Envelope a -> a -> Maybe Int+envelope_segment_ix e t =+  let d = Base.dx_d (env_times e)+  in findIndex (>= t) d++-- | A set of start time, start level, end time, end level and curve.+type Envelope_Segment t = (t, t, t, t, Envelope_Curve t)++-- | Extract envelope segment given at index /i/.+envelope_segment :: Num t => Envelope t -> Int -> Envelope_Segment t+envelope_segment e i =+  let l = env_levels e+      t = env_times e+      x0 = l !! i+      x1 = l !! (i + 1)+      t0 = (0 : Base.dx_d t) !! i+      t1 = t0 + t !! i+      c = envelope_curves e !! i+  in (t0, x0, t1, x1, c)++-- | Extract all segments.+envelope_segments :: Num t => Envelope t -> [Envelope_Segment t]+envelope_segments e =+  let n = envelope_n_segments e+  in map (envelope_segment e) [0 .. n - 1]++-- | Transform list of 'Envelope_Segment's into lists ('env_levels','env_times','env_curves').+pack_envelope_segments :: Num t => [Envelope_Segment t] -> ([t], [t], [Envelope_Curve t])+pack_envelope_segments s =+  case s of+    [] -> error ""+    [(t0, l0, t1, l1, c)] -> ([l0, l1], [t1 - t0], [c])+    (_, l0, _, _, _) : _ ->+      let t (t0, _, t1, _, _) = t1 - t0+          c (_, _, _, _, x) = x+          l (_, _, _, x, _) = x+      in (l0 : map l s, map t s, map c s)++-- | An envelope is /normal/ if it has no segments with zero duration.+envelope_is_normal :: (Eq n, Num n) => Envelope n -> Bool+envelope_is_normal = notElem 0 . env_times++-- | Normalise envelope by deleting segments of zero duration.+envelope_normalise :: (Num a, Ord a) => Envelope a -> Envelope a+envelope_normalise e =+  let s = envelope_segments e+      f (t0, _, t1, _, _) = t1 <= t0+      s' = filter (not . f) s+      (l, t, c) = pack_envelope_segments s'+  in case e of+      Envelope _ _ _ Nothing Nothing os -> Envelope l t c Nothing Nothing os+      _ -> error "envelope_normalise: has release or loop node..."++{- | Get value for 'Envelope' at time /t/, or zero if /t/ is out of+range.  By convention if the envelope has a segment of zero+duration we give the rightmost value.+-}+envelope_at :: (Ord t, Floating t) => Envelope t -> t -> t+envelope_at e t =+  case envelope_segment_ix e t of+    Just n ->+      let (t0, x0, t1, x1, c) = envelope_segment e n+          d = t1 - t0+          t' = (t - t0) / d+          f = env_curve_interpolation_f c+      in if d <= 0+          then x1+          else f x0 x1 t'+    Nothing -> 0++-- | Render 'Envelope' to breakpoint set of /n/ equi-distant places.+envelope_render :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [(t, t)]+envelope_render n e =+  let d = envelope_duration e+      k = d / (fromIntegral n - 1)+      t = [0, k .. d]+  in zip t (map (envelope_at e) t)++-- | Contruct a lookup table of /n/ places from 'Envelope'.+envelope_table :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [t]+envelope_table n = map snd . envelope_render n++{- | Variant on 'env_curves' that expands the, possibly empty, user+list by cycling (if not empty) or by filling with 'EnvLin'.+-}+envelope_curves :: Envelope a -> [Envelope_Curve a]+envelope_curves e =+  let c = env_curves e+      n = envelope_n_segments e+  in if null c+      then replicate n EnvLin+      else take n (cycle c)++{- | Linear Sc3 form of 'Envelope' data.++Form is: l0 #t reset loop l1 t0 c0 c0' ...++>>> envelope_sc3_array (envelope [0,1] [0.1] [EnvLin])+Just [0.0,1.0,-99.0,-99.0,1.0,0.1,1.0,0.0]++>>> let l = [0,0.6,0.3,1.0,0]+>>> let t = [0.1,0.02,0.4,1.1]+>>> let c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]+>>> envelope_sc3_array (Envelope l t c Nothing Nothing 0)+Just [0.0,4.0,-99.0,-99.0,0.6,0.1,1.0,0.0,0.3,2.0e-2,2.0,0.0,1.0,0.4,5.0,-6.0,0.0,1.1,3.0,0.0]+-}+envelope_sc3_array :: Num a => Envelope a -> Maybe [a]+envelope_sc3_array e =+  let Envelope l t _ rn ln _ = e+      n = length t+      n' = fromIntegral n+      rn' = fromIntegral (fromMaybe (-99) rn)+      ln' = fromIntegral (fromMaybe (-99) ln)+      c = envelope_curves e+      f i j k = [i, j, env_curve_shape k, env_curve_value k]+  in case l of+      l0 : l' -> Just (l0 : n' : rn' : ln' : concat (zipWith3 f l' t c))+      _ -> Nothing++{- | @IEnvGen@ Sc3 form of 'Envelope' data.++>>> let l = [0,0.6,0.3,1.0,0]+>>> let t = [0.1,0.02,0.4,1.1]+>>> let c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]+>>> let e = Envelope l t c Nothing Nothing 0+>>> envelope_sc3_ienvgen_array e+Just [0.0,0.0,4.0,1.62,0.1,1.0,0.0,0.6,2.0e-2,2.0,0.0,0.3,0.4,5.0,-6.0,1.0,1.1,3.0,0.0,0.0]+-}+envelope_sc3_ienvgen_array :: Num a => Envelope a -> Maybe [a]+envelope_sc3_ienvgen_array e =+  let Envelope l t _ _ _ os = e+      n = length t+      n' = fromIntegral n+      c = envelope_curves e+      f i j k = [j, env_curve_shape k, env_curve_value k, i]+  in case l of+      l0 : l' -> Just (os : l0 : n' : sum t : concat (zipWith3 f l' t c))+      _ -> Nothing++-- | 'True' if 'env_release_node' is not 'Nothing'.+env_is_sustained :: Envelope a -> Bool+env_is_sustained = isJust . env_release_node++-- | Delay the onset of the envelope (add initial segment).+env_delay :: Envelope a -> a -> Envelope a+env_delay (Envelope l t c rn ln os) d =+  let l0 = Safe.headNote "env_delay" l+      l' = l0 : l+      t' = d : t+      c' = EnvLin : c+      rn' = fmap (+ 1) rn+      ln' = fmap (+ 1) ln+  in Envelope l' t' c' rn' ln' os++{- | Connect releaseNode (or end) to first node of envelope.+z is a value that is first zero and thereafter one.+tc & cc are time and curve from first to last.+-}+env_circle_z :: Fractional a => a -> a -> Envelope_Curve a -> Envelope a -> Envelope a+env_circle_z z tc cc (Envelope l t c rn _ os) =+  let n = length t+  in case rn of+      Nothing ->+        let l' = 0 : l ++ [0]+            t' = z * tc : t ++ [1] -- inf (but drawings are poor)+            c' = cc : take n (cycle c) ++ [EnvLin]+            rn' = Just (n + 1)+        in Envelope l' t' c' rn' (Just 0) os+      Just i ->+        let l' = 0 : l+            t' = z * tc : t+            c' = cc : take n (cycle c)+            rn' = Just (i + 1)+        in Envelope l' t' c' rn' (Just 0) os++-- | env_circle_z with cycle time of zero.+env_circle_0 :: Fractional a => Envelope a -> Envelope a+env_circle_0 = env_circle_z 1 0 EnvLin++-- * Construct++{- | Trapezoidal envelope generator.++Requires (<=) and (>=) functions returning @1@ for true and @0@ for false.++The arguments are: 1. @shape@ determines the sustain time as a+proportion of @dur@, zero is a triangular envelope, one a rectangular+envelope; 2. @skew@ determines the attack\/decay ratio, zero is an+immediate attack and a slow decay, one a slow attack and an immediate+decay; 3. @duration@ in seconds; 4. @amplitude@ as linear gain.+-}+envTrapezoid_f :: Num t => (t -> t -> t, t -> t -> t) -> t -> t -> t -> t -> Envelope t+envTrapezoid_f (lte_f, gte_f) shape skew dur amp =+  let x1 = skew * (1 - shape)+      bp =+        [ (0, lte_f skew 0)+        , (x1, 1)+        , (shape + x1, 1)+        , (1, gte_f skew 1)+        ]+  in envCoord bp dur amp EnvLin++{- | Coordinate based static envelope generator.  Points are (time,value) pairs.++>>> let e = envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin+>>> envelope_sc3_array e+Just [0.0,2.0,-99.0,-99.0,1.0,0.25,1.0,0.0,0.0,0.75,1.0,0.0]++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plotEnvelope [envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin]+-}+envCoord :: Num n => [(n, n)] -> n -> n -> Envelope_Curve n -> Envelope n+envCoord xy dur amp c = envXyc (map (\(x, y) -> (x * dur, y * amp, c)) xy)++{- | Segments given as pairs of (time,level).+The input is sorted by time before processing.++>>> env_levels (envPairs [(0, 1), (3, 1.4), (2.1, 0.5)] EnvSin)+[1.0,0.5,1.4]+-}+envPairs :: (Num n, Ord n) => [(n, n)] -> Envelope_Curve n -> Envelope n+envPairs xy = envCoord (Base.sort_on fst xy) 1 1++-- | Percussive envelope, with attack, release, level and curve inputs.+envPerc_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a+envPerc_c atk rls lvl (c0, c1) =+  let c = [c0, c1]+  in Envelope [0, lvl, 0] [atk, rls] c Nothing Nothing 0++-- | Percussive envelope, with attack and release inputs.+envPerc :: Num a => a -> a -> Envelope a+envPerc atk rls =+  let cn = EnvNum (-4)+  in envPerc_c atk rls 1 (cn, cn)++{- | Triangular envelope, with duration and level inputs.++>>> let e = envTriangle 1 0.1+>>> envelope_sc3_array e+Just [0.0,2.0,-99.0,-99.0,0.1,0.5,1.0,0.0,0.0,0.5,1.0,0.0]+-}+envTriangle :: Fractional a => a -> a -> Envelope a+envTriangle dur lvl =+  let c = replicate 2 EnvLin+      d = replicate 2 (dur / 2)+  in Envelope [0, lvl, 0] d c Nothing Nothing 0++{- | Sine envelope, with duration and level inputs.++>>> envelope_sc3_array (envSine 0 0.1)+Just [0.0,2.0,-99.0,-99.0,0.1,0.0,3.0,0.0,0.0,0.0,3.0,0.0]+-}+envSine :: Fractional a => a -> a -> Envelope a+envSine dur lvl =+  let c = replicate 2 EnvSin+      d = replicate 2 (dur / 2)+  in Envelope [0, lvl, 0] d c Nothing Nothing 0++-- | Parameters for Linen envelopes.+data Linen a = Linen+  { linen_attackTime :: a+  , linen_sustainTime :: a+  , linen_releaseTime :: a+  , linen_level :: a+  , linen_curve :: Envelope_Curve_3 a+  }++-- | Sc3 defaults for Linen.+linen_def :: Fractional t => Linen t+linen_def = let c = EnvLin in Linen 0.01 1 1 1 (c, c, c)++-- | Record ('Linen') variant of 'envLinen'.+envLinen_r :: Num a => Linen a -> Envelope a+envLinen_r (Linen aT sT rT lv (c0, c1, c2)) =+  let l = [0, lv, lv, 0]+      t = [aT, sT, rT]+      c = [c0, c1, c2]+  in Envelope l t c Nothing Nothing 0++-- | Variant of 'envLinen' with user specified 'Envelope_Curve a'.+envLinen_c :: Num a => a -> a -> a -> a -> Envelope_Curve_3 a -> Envelope a+envLinen_c aT sT rT lv c = envLinen_r (Linen aT sT rT lv c)++{- | Linear envelope parameter constructor.++>>> let e = envLinen 0 1 0 1+>>> let s = envelope_segments e+>>> let p = pack_envelope_segments s+>>> p == (env_levels e,env_times e,env_curves e)+True+-}+envLinen :: Num a => a -> a -> a -> a -> Envelope a+envLinen aT sT rT lv =+  let c = (EnvLin, EnvLin, EnvLin)+  in envLinen_c aT sT rT lv c++{- | Parameters for Adsr envelopes.+  The sustain level is given as a proportion of the peak level.+-}+data Adsr a = Adsr+  { adsr_attackTime :: a+  , adsr_decayTime :: a+  , adsr_sustainLevel :: a+  , adsr_releaseTime :: a+  , adsr_peakLevel :: a+  , adsr_curve :: Envelope_Curve_3 a+  , adsr_bias :: a+  }++-- | Sc3 defaults for Adsr.+adsr_def :: Fractional n => Adsr n+adsr_def = let c = EnvNum (-4) in Adsr 0.01 0.3 0.5 1 1 (c, c, c) 0++-- | Attack, decay, sustain, release envelope parameter constructor.+envAdsr :: Num a => a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a+envAdsr aT dT sL rT pL c b = envAdsr_r (Adsr aT dT sL rT pL (c, c, c) b)++-- | Variant with defaults for pL, c and b.+envAdsr_def :: Num a => a -> a -> a -> a -> Envelope a+envAdsr_def aT dT sL rT = envAdsr aT dT sL rT 1 (EnvNum (-4)) 0++-- | Record ('Adsr') variant of 'envAdsr'.+envAdsr_r :: Num a => Adsr a -> Envelope a+envAdsr_r (Adsr aT dT sL rT pL (c0, c1, c2) b) =+  let l = map (+ b) [0, pL, pL * sL, 0]+      t = [aT, dT, rT]+      c = [c0, c1, c2]+  in Envelope l t c (Just 2) Nothing 0++-- | Parameters for Roland type Adssr envelopes.+data Adssr a = Adssr+  { adssr_attackTime :: a+  , adssr_attackLevel :: a+  , adssr_decayTime :: a+  , adssr_decayLevel :: a+  , adssr_slopeTime :: a+  , adssr_sustainLevel :: a+  , adssr_releaseTime :: a+  , adssr_curve :: Envelope_Curve_4 a+  , adssr_bias :: a+  }++-- | Attack, decay, slope, sustain, release envelope parameter constructor.+envAdssr :: Num a => a -> a -> a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a+envAdssr t1 l1 t2 l2 t3 l3 t4 c b = envAdssr_r (Adssr t1 l1 t2 l2 t3 l3 t4 (c, c, c, c) b)++-- | Record ('Adssr') variant of 'envAdssr'.+envAdssr_r :: Num a => Adssr a -> Envelope a+envAdssr_r (Adssr t1 l1 t2 l2 t3 l3 t4 (c1, c2, c3, c4) b) =+  let l = map (+ b) [0, l1, l2, l3, 0]+      t = [t1, t2, t3, t4]+      c = [c1, c2, c3, c4]+  in Envelope l t c (Just 3) Nothing 0++-- | Parameters for Asr envelopes.+data Asr a = Asr+  { asr_attackTime :: a+  , asr_sustainLevel :: a+  , asr_releaseTime :: a+  , asr_curve :: Envelope_Curve_2 a+  }++-- | Sc3 default values for Asr.+asr_def :: Fractional t => Asr t+asr_def = let c = EnvNum (-4) in Asr 0.01 1 1 (c, c)++-- | Sc3 .asr has singular curve argument, hence _c suffix.+envAsr_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a+envAsr_c aT sL rT c = envAsr_r (Asr aT sL rT c)++{- | Attack, sustain, release envelope parameter constructor.++>>> envelope_sc3_array (envAsr 3 0.1 2 EnvSin)+Just [0.0,2.0,1.0,-99.0,0.1,3.0,3.0,0.0,0.0,2.0,3.0,0.0]+-}+envAsr :: Num a => a -> a -> a -> Envelope_Curve a -> Envelope a+envAsr aT sL rT c = envAsr_c aT sL rT (c, c)++-- | Record ('Asr') variant of 'envAsr'.+envAsr_r :: Num a => Asr a -> Envelope a+envAsr_r (Asr aT sL rT (c0, c1)) =+  let l = [0, sL, 0]+      t = [aT, rT]+      c' = [c0, c1]+  in Envelope l t c' (Just 1) Nothing 0++-- | All segments are horizontal lines.+envStep :: Num a => [a] -> [a] -> Maybe Int -> Maybe Int -> Envelope a+envStep levels times releaseNode loopNode =+  if length levels /= length times+    then error "envStep: levels and times must have same size"+    else+      let levels' = Safe.headNote "envStep" levels : levels+      in Envelope levels' times [EnvStep] releaseNode loopNode 0++{- | Segments given as triples of (time,level,curve).  The final curve is ignored.++>>> env_levels (envXyc [(0, 1, EnvSin), (2.1, 0.5, EnvLin), (3, 1.4, EnvLin)])+[1.0,0.5,1.4]+-}+envXyc :: Num n => [(n, n, Envelope_Curve n)] -> Envelope n+envXyc xyc =+  let n = length xyc+      (times, levels, curves) = unzip3 xyc+      offset = times !! 0+  in Envelope levels (Base.d_dx' times) (take (n - 1) curves) Nothing Nothing offset++{- | Variant where the input is sorted by time before processing.++>>> env_levels (envXyc_sort [(0, 1, EnvSin), (3, 1.4, EnvLin), (2.1, 0.5, EnvLin)])+[1.0,0.5,1.4]+-}+envXyc_sort :: (Num n, Ord n) => [(n, n, Envelope_Curve n)] -> Envelope n+envXyc_sort = envXyc . Base.sort_on (\(x, _, _) -> x)
+ Sound/Sc3/Common/Help.hs view
@@ -0,0 +1,296 @@+-- | Functions to access to the Sc3 Rtf & Html based help systems.+module Sound.Sc3.Common.Help where++import Control.Monad {- base -}+import Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import System.Environment {- base -}++import System.FilePath {- filepath -}+import System.Process {- process -}++import qualified Data.List.Split as Split {- split -}++import qualified Sound.Sc3.Common.Base.System as Base.System {- hsc3 -}++-- * Rtf++-- | Directory containing Sc3 Rtf help files.+sc3_rtf_help_dir :: IO FilePath+sc3_rtf_help_dir = getEnv "Sc3_Rtf_Help_Dir"++{- | Find (case-insensitively) indicated file at 'sc3_rtf_help_dir'.+Runs the command "find -name" (so Unix only).++> sc3_rtf_find_file "SinOsc.help.rtf"+> sc3_rtf_find_file "lfsaw.help.rtf"+> sc3_rtf_find_file "softClip.rtf"+-}+sc3_rtf_find_file :: FilePath -> IO (Maybe FilePath)+sc3_rtf_find_file fn = do+  d <- sc3_rtf_help_dir+  r <- System.Process.readProcess "find" [d, "-iname", fn] ""+  case lines r of+    [] -> return Nothing+    [r0] -> return (Just r0)+    _ -> error "sc3_rtf_find_file: multiple files?"++-- | 'error' variant.+sc3_rtf_find_file_err :: FilePath -> IO FilePath+sc3_rtf_find_file_err = fmap (fromMaybe (error "sc3_rtf_find_file")) . sc3_rtf_find_file++-- | Run the command unrtf (so UNIX only) to convert an RTF file to a TEXT (.scd) file.+sc3_rtf_to_scd :: FilePath -> FilePath -> IO ()+sc3_rtf_to_scd rtf_fn scd_fn = do+  txt <- System.Process.readProcess "unrtf" ["--text", rtf_fn] ""+  let delete_trailing_whitespace = reverse . dropWhile isSpace . reverse+      tidy = unlines . map delete_trailing_whitespace . drop 4 . lines+  writeFile scd_fn (tidy txt)++-- | 'sc3_rtf_to_scd' of 'sc3_rtf_find_file_err', writing output to TMPDIR+sc3_rtf_help_translate :: String -> IO FilePath+sc3_rtf_help_translate nm = do+  tmp <- Base.System.get_env_default "TMPDIR" "/tmp"+  rtf_fn <- sc3_rtf_find_file_err (nm <.> "*rtf")+  let scd_fn = tmp </> takeFileName rtf_fn -<.> "scd"+  sc3_rtf_to_scd rtf_fn scd_fn+  return scd_fn++-- | 'sc3_rtf_help_translate' and run editor.+sc3_rtf_help_scd_open :: (String, [String]) -> String -> IO ()+sc3_rtf_help_scd_open (cmd, arg) nm = do+  scd_fn <- sc3_rtf_help_translate nm+  System.Process.callProcess cmd (arg ++ [scd_fn])++{- | 'sc3_rtf_help_scd_open' with emacsclient --no-wait.++> sc3_rtf_help_scd_open_emacs "lfsaw"+-}+sc3_rtf_help_scd_open_emacs :: String -> IO ()+sc3_rtf_help_scd_open_emacs = sc3_rtf_help_scd_open ("emacsclient", ["--no-wait"])++-- * Sc-Doc (Html)++-- | Url for online Sc-Doc SuperCollider documentation.+sc3_scdoc_help_url :: String+sc3_scdoc_help_url = "http://doc.sccode.org/"++{- | Read the environment variable @Sc3_ScDoc_Html_Help_Dir@.+  The default value is @~\/.local\/share\/SuperCollider/Help@.+-}+sc3_scdoc_help_dir :: IO String+sc3_scdoc_help_dir = do+  h <- getEnv "HOME"+  let d = h </> ".local/share/SuperCollider/Help"+  Base.System.get_env_default "Sc3_ScDoc_Html_Help_Dir" d++{- | Path to indicated Sc3 class help file.++>>> sc3_scdoc_help_class "SinOsc"+"Classes/SinOsc.html"+-}+sc3_scdoc_help_class :: String -> String+sc3_scdoc_help_class c = "Classes" </> c <.> "html"++{- | Generate path to indicated Sc3 operator help file.++>>> sc3_scdoc_help_operator "+"+"Overviews/Operators.html#+"+-}+sc3_scdoc_help_operator :: String -> FilePath+sc3_scdoc_help_operator = (++) "Overviews/Operators.html#"++{- | Generate path to indicated Sc3 method help.++>>> sc3_scdoc_help_method '*' ("C","m")+"Classes/C.html#*m"+-}+sc3_scdoc_help_method :: Char -> (String, String) -> FilePath+sc3_scdoc_help_method z (c, m) = "Classes" </> c <.> "html#" ++ [z] ++ m++{- | Generate path to indicated Sc3 class method help.++>>> sc3_scdoc_help_class_method ("C","m")+"Classes/C.html#*m"+-}+sc3_scdoc_help_class_method :: (String, String) -> FilePath+sc3_scdoc_help_class_method = sc3_scdoc_help_method '*'++{- | Generate path to indicated Sc3 instance method help.++>>> sc3_scdoc_help_instance_method ("C","m")+"Classes/C.html#-m"+-}+sc3_scdoc_help_instance_method :: (String, String) -> FilePath+sc3_scdoc_help_instance_method = sc3_scdoc_help_method '-'++{- | Sc3 help path documenting x.++>>> sc3_scdoc_help_path "Operator.distort"+"Overviews/Operators.html#distort"++>>> sc3_scdoc_help_path "Collection.*fill"+"Classes/Collection.html#*fill"++>>> sc3_scdoc_help_path "Collection.inject"+"Classes/Collection.html#-inject"++>>> sc3_scdoc_help_path "SinOsc"+"Classes/SinOsc.html"+-}+sc3_scdoc_help_path :: String -> String+sc3_scdoc_help_path s = do+  case Split.splitOn "." s of+    ["Operator", m] -> sc3_scdoc_help_operator m+    [c, '*' : m] -> sc3_scdoc_help_class_method (c, m)+    [c, m] -> sc3_scdoc_help_instance_method (c, m)+    _ -> sc3_scdoc_help_class s++{- | Open Sc3 help path, either the local file or the online version.+     Use @BROWSER@ or @x-www-browser@.++> Base.System.get_env_default "BROWSER" "x-www-browser"++> sc3_scdoc_help_open True (sc3_scdoc_help_path "SinOsc")+> sc3_scdoc_help_open True (sc3_scdoc_help_path "Collection.*fill")+> sc3_scdoc_help_open False (sc3_scdoc_help_path "Collection.inject")+-}+sc3_scdoc_help_open :: Bool -> String -> IO ()+sc3_scdoc_help_open use_loc p = do+  d <- sc3_scdoc_help_dir+  b <- Base.System.get_env_default "BROWSER" "x-www-browser"+  let u = if use_loc then "file://" ++ (d </> p) else sc3_scdoc_help_url ++ p+  void (System.Process.rawSystem b [u])++{- | Generate path to indicated Sc3 instance method help.+Adds initial forward slash if not present.++> let r = "Reference/Server-Command-Reference.html#/b_alloc"+> sc3_scdoc_help_server_command_path "b_alloc" == r+-}+sc3_scdoc_help_server_command_path :: String -> FilePath+sc3_scdoc_help_server_command_path c =+  let c' = case c of+        '/' : _ -> c+        _ -> '/' : c+  in "Reference/Server-Command-Reference.html" ++ ('#' : c')++{- | 'sc3_scdoc_help_open' of 'sc3_server_command_path'++> sc3_scdoc_help_server_command_open True "s_new"+> sc3_scdoc_help_server_command_open False "/b_allocRead"+-}+sc3_scdoc_help_server_command_open :: Bool -> String -> IO ()+sc3_scdoc_help_server_command_open use_loc =+  sc3_scdoc_help_open use_loc+    . sc3_scdoc_help_server_command_path++-- * Fragments++-- | Apply function at lines of string.+on_lines_of :: ([String] -> [[String]]) -> String -> [String]+on_lines_of f = map unlines . f . lines++{- | Split text into fragments at empty lines.+Hsc3 (and related projects) write help files as sets of distinct fragments.+Fragments are separated by empty lines.+A line containing the special character sequence ---- indicates the end of the fragments.++>>> on_lines_of split_multiple_fragments ";a\nb\n\n\n;c\nd"+[";a\nb\n",";c\nd\n"]+-}+split_multiple_fragments :: [String] -> [[String]]+split_multiple_fragments = filter (not . null) . Split.splitOn [[]]++{- | The text '----' appearing anywhere in a line indicates the end of the graph fragments.+The text '# ' appearing at the start of a line also indicates the end of the graph fragments.++>>> drop_post_graph_section ["a","b","c","","----d","e","f"]+["a","b","c",""]++>>> drop_post_graph_section ["a","b","c","","----d","# e","","f"]+["a","b","c",""]+-}+drop_post_graph_section :: [String] -> [String]+drop_post_graph_section =+  let isEnd x = "----" `isInfixOf` x || "# " `isPrefixOf` x+  in takeWhile (not . isEnd)++{- | Some help files are in Markdown format.+These are recognised by examing the first two characters, which must be a '#' and ' '.+-}+is_md_help :: String -> Bool+is_md_help x =+  case x of+    '#' : ' ' : _ -> True+    _ -> False++{- | There are two code block formats in markdown help files.+The first indents the block using a single tab or four spaces.+The second marks the start and end of the block by lines starting with three back ticks (`).++See:+<https://spec.commonmark.org/0.30/#indented-code-blocks>+and+<https://spec.commonmark.org/0.30/#fenced-code-blocks>+-}+data CodeBlockType = IndentedCodeBlock | FencedCodeBlock+  deriving (Bounded, Enum, Eq, Read, Show)++-- | Get code blocks from Markdown help file.+md_help_get_code_blocks :: [String] -> [(CodeBlockType, [String])]+md_help_get_code_blocks x =+  case x of+    [] -> []+    "```" : x' ->+      let (q, x'') = break (== "```") x'+      in (FencedCodeBlock, q) : md_help_get_code_blocks (drop 1 x'')+    ('\t' : _) : _ ->+      let (q, x') = span ((==) ['\t'] . take 1) x+      in (IndentedCodeBlock, (map (drop 1) q)) : md_help_get_code_blocks x'+    _ : x' ->+      md_help_get_code_blocks x'++is_doctest_block :: [String] -> Bool+is_doctest_block =+  let f x p = p `isPrefixOf` x+  in any (\x -> f x ">>> " || f x ">> ")++md_help_get_tab_indented_code_blocks :: [String] -> [[String]]+md_help_get_tab_indented_code_blocks =+  filter (not . is_doctest_block)+    . map snd+    . filter ((== IndentedCodeBlock) . fst)+    . md_help_get_code_blocks++{- | Get indented code blocks from Markdown help file.++>>> s <- readFile "/home/rohan/sw/spl/Help/Reference/AllpassC.help.sl"+>>> is_md_help s+True++>>> let b = md_help_get_fenced_code_blocks (lines s)+>>> length b+3+-}+md_help_get_fenced_code_blocks :: [String] -> [[String]]+md_help_get_fenced_code_blocks =+  filter (not . is_doctest_block)+    . map snd+    . filter ((== FencedCodeBlock) . fst)+    . md_help_get_code_blocks++get_help_file_fragments :: String -> [String]+get_help_file_fragments s =+  if is_md_help s+    then on_lines_of md_help_get_fenced_code_blocks s+    else on_lines_of (split_multiple_fragments . drop_post_graph_section) s++-- | Read text fragments from file.+read_file_fragments :: FilePath -> IO [String]+read_file_fragments = fmap get_help_file_fragments . readFile++-- | Read text fragments from set of files.+read_file_set_fragments :: [FilePath] -> IO [String]+read_file_set_fragments = fmap concat . mapM read_file_fragments
+ Sound/Sc3/Common/Help/Sc2.hs view
@@ -0,0 +1,238 @@+-- | Functions related to the Sc2 help files.+module Sound.Sc3.Common.Help.Sc2 where++{- | Approximate Ugen categorisation from Sc2.+The help files were organised in sub-directories.++> map fst sc2_ugen_categories+-}+sc2_ugen_categories :: [(String, [String])]+sc2_ugen_categories =+  [+    ( "Analysis"+    ,+      [ "Pitch"+      , "RunningSum"+      , "Slope"+      , "ZeroCrossing"+      ]+    )+  ,+    ( "BinaryOps"+    , []+    )+  ,+    ( "Buffers"+    , ["TGrains"]+    )+  ,+    ( "Controls"+    ,+      [ "DegreeToKey"+      , "GetTempo"+      , "Impulse"+      , "Index"+      , "Integrator"+      , "K2A"+      , "Lag"+      , "Latch"+      , "LFPulse"+      , "LFSaw"+      , "LFTri"+      , "LinExp"+      , "MouseX"+      , "MouseY"+      , "Osc1"+      , "Slew"+      , "WrapIndex"+      ]+    )+  ,+    ( "Delays"+    ,+      [ "AllpassC"+      , "CombC"+      , "Delay1"+      , "Delay2"+      , "DelayC"+      , "DelayWrite"+      , "MultiTapDelay"+      , "PingPongDelay"+      , "PitchShift"+      ]+    )+  ,+    ( "Envelopes"+    ,+      [ "Cutoff"+      , "Decay2"+      , "Decay"+      , "Ln"+      , "XLn"+      ]+    )+  ,+    ( "Events"+    , ["OverlapTexture"]+    )+  ,+    ( "Filters"+    ,+      [ "BPF"+      , "BPZ2"+      , "BRF"+      , "BRZ2"+      , "Formlet"+      , "FOS"+      , "HPF"+      , "HPZ1"+      , "HPZ2"+      , "LeakDC"+      , "Limiter"+      , "LPF"+      , "LPZ1"+      , "LPZ2"+      , "Median"+      , "Normalizer"+      , "OnePole"+      , "OneZero"+      , "Resonz"+      , "RHPF"+      , "RingzBank"+      , "Ringz"+      , "RLPF"+      , "SOS"+      , "TwoPole"+      , "TwoZero"+      ]+    )+  ,+    ( "Misc"+    , ["Mix"]+    )+  ,+    ( "Noise"+    ,+      [ "BrownNoise"+      , "ClipNoise"+      , "Crackle"+      , "Dust2"+      , "Dust"+      , "GrayNoise"+      , "LatoocarfianC"+      , "LFClipNoise"+      , "LFNoise0"+      , "LFNoise1"+      , "LFNoise2"+      , "LinCongC"+      , "PinkNoise"+      , "WhiteNoise"+      ]+    )+  ,+    ( "Oscillators"+    ,+      [ "Blip"+      , "Formant"+      , "FSinOsc"+      , "Impulse"+      , "LFPulse"+      , "LFSaw"+      , "LFTri"+      , "PMOsc"+      , "Pulse"+      , "Saw"+      , "SinOsc"+      , "SyncSaw"+      , "VarSaw"+      ]+    )+  ,+    ( "Panners"+    ,+      [ "LinPan2"+      , "LinXFade2"+      , "Pan2"+      , "PanAz"+      , "PanB"+      ]+    )+  ,+    ( "Random"+    ,+      [ "CoinGate"+      , "ExpRand"+      , "IRand"+      , "LinRand"+      , "NRand"+      , "Rand"+      , "TExpRand"+      , "TIRand"+      , "TRand"+      ]+    )+  ,+    ( "Samples"+    ,+      [ "AudioIn"+      , "BufRd"+      , "PlayBuf"+      ]+    )+  ,+    ( "Triggers"+    ,+      [ "Gate"+      , "InRange"+      , "PeakFollower"+      , "Phasor"+      , "PulseCount"+      , "PulseDivider"+      , "Schmidt"+      , "Stepper"+      , "Sweep"+      , "TDelay"+      , "Timer"+      , "ToggleFF"+      ]+    )+  ,+    ( "UnaryOperators"+    ,+      [ "abs"+      , "acos"+      , "ampdb"+      , "asin"+      , "atan"+      , "ceil"+      , "cos"+      , "cosh"+      , "cpsmidi"+      , "cpsoct"+      , "cubed"+      , "dbamp"+      , "distort"+      , "exp"+      , "floor"+      , "frac"+      , "isNegative"+      , "isPositive"+      , "isStrictlyPositive"+      , "log10"+      , "log2"+      , "log"+      , "midicps"+      , "neg"+      , "octcps"+      , "reciprocal"+      , "sign"+      , "sin"+      , "sinh"+      , "softclip"+      , "sqrt"+      , "squared"+      , "tan"+      , "tanh"+      ]+    )+  ]
+ Sound/Sc3/Common/Math.hs view
@@ -0,0 +1,988 @@+-- | Common math functions.+module Sound.Sc3.Common.Math where++import qualified Data.Fixed {- base -}+import Data.Maybe {- base -}+import Data.Ratio {- base -}+import qualified Numeric {- base -}++import qualified Sound.Sc3.Common.Base as Common.Base {- hsc3 -}++{- | Half pi.++>>> half_pi+1.5707963267948966+-}+half_pi :: Floating a => a+half_pi = pi / 2++{- | Two pi.++>>> two_pi+6.283185307179586+-}+two_pi :: Floating n => n+two_pi = 2 * pi++-- | 'abs' of '(-)'.+absdif :: Num a => a -> a -> a+absdif i j = abs (j - i)++-- | Sc3 MulAdd type signature, arguments in Sc3 order of input, multiply, add.+type Sc3_MulAdd t = t -> t -> t -> t++{- | Ordinary (un-optimised) multiply-add, see also mulAdd Ugen.++>>> sc3_mul_add 2 3 4 == 2 * 3 + 4+True++>>> map (\x -> sc3_mul_add x 2 3) [1,5]+[5,13]++>>> map (\x -> sc3_mul_add x 3 2) [1,5]+[5,17]+-}+sc3_mul_add :: Num t => Sc3_MulAdd t+sc3_mul_add i m a = i * m + a++{- | Ordinary Haskell order (un-optimised) multiply-add.++>>> mul_add 3 4 2 == 2 * 3 + 4+True++>>> map (mul_add 2 3) [1,5]+[5,13]++>> map (mul_add 3 4) [1,5]+[7,19]+-}+mul_add :: Num t => t -> t -> t -> t+mul_add m a = (+ a) . (* m)++{- | 'uncurry' 'mul_add'++>>> mul_add_hs (3,4) 2 == 2 * 3 + 4+True+-}+mul_add_hs :: Num t => (t, t) -> t -> t+mul_add_hs = uncurry mul_add++-- | 'fromInteger' of 'truncate'.+sc3_truncate :: RealFrac a => a -> a+sc3_truncate = fromInteger . truncate++-- | 'fromInteger' of 'round'.+sc3_round :: RealFrac a => a -> a+sc3_round = fromInteger . round++-- | 'fromInteger' of 'ceiling'.+sc3_ceiling :: RealFrac a => a -> a+sc3_ceiling = fromInteger . ceiling++-- | 'fromInteger' of 'floor'.+sc3_floor :: RealFrac a => a -> a+sc3_floor = fromInteger . floor++{- | Variant of @Sc3@ @roundTo@ function.++>>> sc3_round_to (2/3) 0.25+0.75++>>> map (`sc3_round_to` 0.25) [0,0.1 .. 1]+[0.0,0.0,0.25,0.25,0.5,0.5,0.5,0.75,0.75,1.0,1.0]++>>> map (`sc3_round_to` 5.0) [100.0 .. 110.0]+[100.0,100.0,100.0,105.0,105.0,105.0,105.0,105.0,110.0,110.0,110.0]+-}+sc3_round_to :: RealFrac n => n -> n -> n+sc3_round_to a b = if b == 0 then a else sc3_floor ((a / b) + 0.5) * b++-- | 'fromInteger' of 'div' of 'floor'.+sc3_idiv :: RealFrac n => n -> n -> n+sc3_idiv a b = fromInteger (floor a `div` floor b)++{- | 'sc3_lcm'++Least common multiple. This definition extends the usual definition+and returns a negative number if any of the operands is negative. This+makes it consistent with the lattice-theoretical interpretation and+its idempotency, commutative, associative, absorption laws.++>>> lcm 4 6+12++>>> lcm 1 1+1++>>> lcm 1624 26+21112++>>> lcm 1624 (-26) /= (-21112)+True++>>> lcm (-1624) (-26) /= (-21112)+True++>>> lcm 513 (gcd 513 44)+513+-}+sc3_lcm :: t -> t -> t+sc3_lcm = error "sc3_lcm: undefined"++{- | 'sc3_gcd'++Greatest common divisor. This definition extends the usual+definition and returns a negative number if both operands are+negative. This makes it consistent with the lattice-theoretical+interpretation and its idempotency, commutative, associative,+absorption laws. <https://www.jsoftware.com/papers/eem/gcd.htm>++>>> gcd 4 6+2++>>> gcd 0 1+1++>>> gcd 1024 256+256++>>> gcd 1024 (-256)+256++>>> gcd (-1024) (-256) /= (-256)+True++>>> gcd (-1024) (lcm (-1024) 256) /= (-1024)+True++>>> gcd 66 54 * lcm 66 54 == 66 * 54+True+-}+sc3_gcd :: t -> t -> t+sc3_gcd = error "sc3_gcd: undefined"++{- | The Sc3 @%@ Ugen operator is the 'Data.Fixed.mod'' function.++> 1.5 % 1.2 // ~= 0.3+> -1.5 % 1.2 // ~= 0.9+> 1.5 % -1.2 // ~= -0.9+> -1.5 % -1.2 // ~= -0.3++>>> let (~=) p q = abs (p - q) < 0.000001+>>> let (%) = sc3_mod+>>> (1.5 % 1.2) ~= 0.3+True++>>> ((-1.5) % 1.2) ~= 0.9+True++>>> (1.5 % (-1.2)) ~= (-0.9)+True++>>> ((-1.5) % (-1.2)) ~= (-0.3)+True++> 1.2 % 1.5 // ~= 1.2+> -1.2 % 1.5 // ~= 0.3+> 1.2 % -1.5 // ~= -0.3+> -1.2 % -1.5 // ~= -1.2++>>> (1.2 % 1.5) ~= 1.2+True++>>> ((-1.2) % 1.5) ~= 0.3+True++>>> (1.2 % (-1.5)) ~= (-0.3)+True++>>> ((-1.2) % (-1.5)) ~= (-1.2)+True++>>> map (\n -> sc3_mod n 12.0) [-1.0,12.25,15.0]+[11.0,0.25,3.0]+-}+sc3_mod :: RealFrac n => n -> n -> n+sc3_mod = Data.Fixed.mod'++-- | Type specialised 'sc3_mod'.+fmod_f32 :: Float -> Float -> Float+fmod_f32 = sc3_mod++-- | Type specialised 'sc3_mod'.+fmod_f64 :: Double -> Double -> Double+fmod_f64 = sc3_mod++{- | @Sc3@ clip function.  Clip /n/ to within range /(i,j)/.  'clip' is a 'Ugen'.++>>> map (\n -> sc3_clip n 5 10) [3..12]+[5,5,5,6,7,8,9,10,10,10]+-}+sc3_clip :: Ord a => a -> a -> a -> a+sc3_clip n i j = if n < i then i else if n > j then j else n++{- | Variant of 'sc3_clip' with haskell argument structure.++>>> map (clip_hs (5,10)) [3..12]+[5,5,5,6,7,8,9,10,10,10]+-}+clip_hs :: (Ord a) => (a, a) -> a -> a+clip_hs (i, j) n = sc3_clip n i j++{- | Fractional modulo, alternate implementation.++>>> map (\n -> sc3_mod_alt n 12.0) [-1.0,12.25,15.0]+[11.0,0.25,3.0]+-}+sc3_mod_alt :: RealFrac a => a -> a -> a+sc3_mod_alt n hi =+  let lo = 0.0+  in if n >= lo && n < hi+      then n+      else+        if hi == lo+          then lo+          else n - hi * sc3_floor (n / hi)++{- | Wrap function that is /non-inclusive/ at right edge, ie. the Wrap Ugen rule.++>>> map (round . sc3_wrap_ni 0 5) [4,5,6]+[4,0,1]++>>> map (round . sc3_wrap_ni 5 10) [3..12]+[8,9,5,6,7,8,9,5,6,7]++> Sound.Sc3.Plot.plot_fn_r1_ln (sc3_wrap_ni (-1) 1) (-2,2)+-}+sc3_wrap_ni :: RealFrac a => a -> a -> a -> a+sc3_wrap_ni lo hi n = sc3_mod (n - lo) (hi - lo) + lo++{- | sc_wrap::int++> [5,6].wrap(0,5) == [5,0]++>>> map (wrap_hs_int (0,5)) [5,6]+[5,0]++> [9,10,5,6,7,8,9,10,5,6].wrap(5,10) == [9,10,5,6,7,8,9,10,5,6]++>>> map (wrap_hs_int (5,10)) [3..12]+[9,10,5,6,7,8,9,10,5,6]+-}+wrap_hs_int :: Integral a => (a, a) -> a -> a+wrap_hs_int (i, j) n = ((n - i) `mod` (j - i + 1)) + i++{- | Wrap /n/ to within range /(i,j)/, ie. @AbstractFunction.wrap@,+ie. /inclusive/ at right edge.  'wrap' is a 'Ugen', hence prime.++> [5.0,6.0].wrap(0.0,5.0) == [0.0,1.0]++>>> map (round . wrap_hs (0,4)) [-1,0 .. 5]+[3,0,1,2,3,0,1]++>>> map (round . wrap_hs (0,5)) [5,6]+[0,1]++>>> map (round . wrap_hs (5,10)) [3..12]+[8,9,5,6,7,8,9,5,6,7]++> Sound.Sc3.Plot.plot_fn_r1_ln (wrap_hs (-1,1)) (-2,2)+-}+wrap_hs :: RealFrac n => (n, n) -> n -> n+wrap_hs (i, j) n =+  let r = j - i -- + 1+      n' = if n >= j then n - r else if n < i then n + r else n+  in if n' >= i && n' < j+      then n'+      else n' - r * sc3_floor ((n' - i) / r)++{- | Variant of 'wrap_hs' with @Sc3@ argument ordering.++>>> map (\n -> sc3_wrap n 5 10) [3..12] == map (wrap_hs (5,10)) [3..12]+True++>>> map (\n -> sc3_wrap n 0 4) [-1, 0 .. 5]+[3.0,0.0,1.0,2.0,3.0,0.0,1.0]+-}+sc3_wrap :: RealFrac n => n -> n -> n -> n+sc3_wrap index start end = wrap_hs (start, end) index++{- | Generic variant of 'wrap''.++> [5,6].wrap(0,5) == [5,0]++>>> map (generic_wrap (0,5)) [5,6]+[5,0]++> [9,10,5,6,7,8,9,10,5,6].wrap(5,10) == [9,10,5,6,7,8,9,10,5,6]++>>> map (generic_wrap (5::Integer,10)) [3..12]+[9,10,5,6,7,8,9,10,5,6]+-}+generic_wrap :: (Ord a, Num a) => (a, a) -> a -> a+generic_wrap (l, r) n =+  let d = r - l + 1+      f = generic_wrap (l, r)+  in if n < l+      then f (n + d)+      else if n > r then f (n - d) else n++{- | Given sample-rate /sr/ and bin-count /n/ calculate frequency of /i/th bin.++>>> bin_to_freq 44100 2048 32+689.0625+-}+bin_to_freq :: (Fractional n, Integral i) => n -> i -> i -> n+bin_to_freq sr n i = fromIntegral i * sr / fromIntegral n++{- | Fractional midi note number to cycles per second.++>>> map (floor . midi_to_cps) [0,24,69,120,127]+[8,32,440,8372,12543]++>>> map (floor . midi_to_cps) [-36,138]+[1,23679]++>>> map (floor . midi_to_cps) [69.0,69.25 .. 70.0]+[440,446,452,459,466]+-}+midi_to_cps :: Floating a => a -> a+midi_to_cps i = 440.0 * (2.0 ** ((i - 69.0) * (1.0 / 12.0)))++{- | Cycles per second to fractional midi note number.++>>> map (round . cps_to_midi) [8,32,440,8372,12543]+[0,24,69,120,127]++>>> map (round . cps_to_midi) [1,24000]+[-36,138]+-}+cps_to_midi :: Floating a => a -> a+cps_to_midi a = (logBase 2 (a * (1.0 / 440.0)) * 12.0) + 69.0++{- | Cycles per second to linear octave (4.75 = A4 = 440).++>>> map (cps_to_oct . midi_to_cps) [60,63,69]+[4.0,4.25,4.75]+-}+cps_to_oct :: Floating a => a -> a+cps_to_oct a = logBase 2 (a * (1.0 / 440.0)) + 4.75++{- | Linear octave to cycles per second.++> [4.0,4.25,4.75].octcps.cpsmidi == [60,63,69]++>>> map (cps_to_midi . oct_to_cps) [4.0,4.25,4.75]+[60.0,63.0,69.0]+-}+oct_to_cps :: Floating a => a -> a+oct_to_cps a = 440.0 * (2.0 ** (a - 4.75))++-- | Degree, scale and steps per octave to key.+degree_to_key :: RealFrac a => [a] -> a -> a -> a+degree_to_key s n d =+  let l = length s+      d' = round d+      a = (d - fromIntegral d') * 10.0 * (n / 12.0)+  in (n * fromIntegral (d' `div` l)) + Common.Base.at_with_error_message "degree_to_key" s (d' `mod` l) + a++{- | One-indexed piano key number (for standard 88 key piano) to midi note number.++>>> map pianokey_to_midi [1,49,88]+[21,69,108]+-}+pianokey_to_midi :: Num n => n -> n+pianokey_to_midi = (+) 20++{- | Piano key to hertz (ba.pianokey2hz in Faust).+     This is useful as a more musical gamut than midi note numbers.+     Ie. if x is in (0,1) then pianokey_to_cps of (x * 88) is in (26,4168)++>>> map (round . pianokey_to_cps) [0,1,40,49,88]+[26,28,262,440,4186]++>>> map (round . midi_to_cps) [0,60,69,127]+[8,262,440,12544]+-}+pianokey_to_cps :: Floating n => n -> n+pianokey_to_cps = midi_to_cps . pianokey_to_midi++{- | Linear amplitude to decibels.++>>> map (round . amp_to_db) [0.01,0.05,0.0625,0.125,0.25,0.5]+[-40,-26,-24,-18,-12,-6]+-}+amp_to_db :: Floating a => a -> a+amp_to_db = (* 20) . logBase 10++{- | Decibels to linear amplitude.++>>> map (floor . (* 100). db_to_amp) [-40,-26,-24,-18,-12,-6]+[1,5,6,12,25,50]++>>> let amp = map (2 **) [0 .. 15]+>>> let db = [0,-6 .. -90]+>>> map (round . amp_to_db . (/) 1) amp == db+True++>>> db_to_amp (-3)+0.7079457843841379++>>> amp_to_db 0.7079457843841379+-3.0+-}+db_to_amp :: Floating a => a -> a+db_to_amp = (10 **) . (* 0.05)++{- | Fractional midi note interval to frequency multiplier.++>>> map midi_to_ratio [-12,0,7,12]+[0.5,1.0,1.4983070768766815,2.0]+-}+midi_to_ratio :: Floating a => a -> a+midi_to_ratio a = 2.0 ** (a * (1.0 / 12.0))++{- | Inverse of 'midi_to_ratio'.++>>> map ratio_to_midi [3/2,2]+[7.019550008653875,12.0]+-}+ratio_to_midi :: Floating a => a -> a+ratio_to_midi a = 12.0 * logBase 2 a++{- | /sr/ = sample rate, /r/ = cycle (two-pi), /cps/ = frequency++>>> cps_to_incr 48000 128 375+1.0++>>> cps_to_incr 48000 two_pi 458.3662361046586+6.0e-2+-}+cps_to_incr :: Fractional a => a -> a -> a -> a+cps_to_incr sr r cps = (r / sr) * cps++{- | Inverse of 'cps_to_incr'.++>>> incr_to_cps 48000 128 1+375.0+-}+incr_to_cps :: Fractional a => a -> a -> a -> a+incr_to_cps sr r ic = ic / (r / sr)++-- | Pan2 function, identity is linear, sqrt is equal power.+pan2_f :: Fractional t => (t -> t) -> t -> t -> (t, t)+pan2_f f p q =+  let q' = (q / 2) + 0.5+  in (p * f (1 - q'), p * f q')++{- | Linear pan.++>>> map (lin_pan2 1) [-1,-0.5,0,0.5,1]+[(1.0,0.0),(0.75,0.25),(0.5,0.5),(0.25,0.75),(0.0,1.0)]+-}+lin_pan2 :: Fractional t => t -> t -> (t, t)+lin_pan2 = pan2_f id++{- | Equal power pan.++>>> map (eq_pan2 1) [-1,-0.5,0,0.5,1]+[(1.0,0.0),(0.8660254037844386,0.5),(0.7071067811865476,0.7071067811865476),(0.5,0.8660254037844386),(0.0,1.0)]+-}+eq_pan2 :: Floating t => t -> t -> (t, t)+eq_pan2 = pan2_f sqrt++-- | 'fromInteger' of 'properFraction'.+sc3_properFraction :: RealFrac t => t -> (t, t)+sc3_properFraction a =+  let (p, q) = properFraction a+  in (fromInteger p, q)++-- | a^2 - b^2.+sc3_dif_sqr :: Num a => a -> a -> a+sc3_dif_sqr a b = (a * a) - (b * b)++-- | Euclidean distance function ('sqrt' of sum of squares).+sc3_hypot :: Floating a => a -> a -> a+sc3_hypot x y = sqrt (x * x + y * y)++-- | Sc3 hypotenuse approximation function.+sc3_hypotx :: (Ord a, Floating a) => a -> a -> a+sc3_hypotx x y = abs x + abs y - ((sqrt 2 - 1) * min (abs x) (abs y))++{- | Fold /k/ to within range /(i,j)/, ie. @AbstractFunction.fold@++>>> map (foldToRange 5 10) [3..12]+[7,6,5,6,7,8,9,10,9,8]+-}+foldToRange :: (Ord a, Num a) => a -> a -> a -> a+foldToRange i j =+  let f n =+        if n > j+          then f (j - (n - j))+          else+            if n < i+              then f (i - (n - i))+              else n+  in f++-- | Variant of 'foldToRange' with @Sc3@ argument ordering.+sc3_fold :: (Ord a, Num a) => a -> a -> a -> a+sc3_fold n i j = foldToRange i j n++-- | Sc3 distort operator.+sc3_distort :: Fractional n => n -> n+sc3_distort x = x / (1 + abs x)++-- | Sc3 softclip operator.+sc3_softclip :: (Ord n, Fractional n) => n -> n+sc3_softclip x = let x' = abs x in if x' <= 0.5 then x else (x' - 0.25) / x++-- * Bool++-- | True is conventionally 1.  The test to determine true is @> 0@.+sc3_true :: Num n => n+sc3_true = 1++-- | False is conventionally 0.  The test to determine true is @<= 0@.+sc3_false :: Num n => n+sc3_false = 0++{- | Lifted 'not'.++>>> sc3_not sc3_true == sc3_false+True++>>> sc3_not sc3_false == sc3_true+True+-}+sc3_not :: (Ord n, Num n) => n -> n+sc3_not = sc3_bool . (<= 0)++-- | Translate 'Bool' to 'sc3_true' and 'sc3_false'.+sc3_bool :: Num n => Bool -> n+sc3_bool b = if b then sc3_true else sc3_false++-- | Lift comparison function.+sc3_comparison :: Num n => (n -> n -> Bool) -> n -> n -> n+sc3_comparison f p q = sc3_bool (f p q)++-- * Eq++-- | Lifted '=='.+sc3_eq :: (Num n, Eq n) => n -> n -> n+sc3_eq = sc3_comparison (==)++-- | Lifted '/='.+sc3_neq :: (Num n, Eq n) => n -> n -> n+sc3_neq = sc3_comparison (/=)++-- * Ord++-- | Lifted '<'.+sc3_lt :: (Num n, Ord n) => n -> n -> n+sc3_lt = sc3_comparison (<)++-- | Lifted '<='.+sc3_lte :: (Num n, Ord n) => n -> n -> n+sc3_lte = sc3_comparison (<=)++-- | Lifted '>'.+sc3_gt :: (Num n, Ord n) => n -> n -> n+sc3_gt = sc3_comparison (>)++-- | Lifted '>='.+sc3_gte :: (Num n, Ord n) => n -> n -> n+sc3_gte = sc3_comparison (>=)++-- * Clip Rule++-- | Enumeration of clipping rules.+data Clip_Rule = Clip_None | Clip_Left | Clip_Right | Clip_Both+  deriving (Enum, Bounded)++{- | Clip a value that is expected to be within an input range to an output range, according to a rule.++>>> let f r = map (\x -> apply_clip_rule r 0 1 (-1) 1 x) [-1,0,0.5,1,2]+>>> map f [minBound .. maxBound]+[[Nothing,Nothing,Nothing,Nothing,Nothing],[Just (-1.0),Just (-1.0),Nothing,Nothing,Nothing],[Nothing,Nothing,Nothing,Just 1.0,Just 1.0],[Just (-1.0),Just (-1.0),Nothing,Just 1.0,Just 1.0]]+-}+apply_clip_rule :: Ord n => Clip_Rule -> n -> n -> n -> n -> n -> Maybe n+apply_clip_rule clip_rule sl sr dl dr x =+  case clip_rule of+    Clip_None -> Nothing+    Clip_Left -> if x <= sl then Just dl else Nothing+    Clip_Right -> if x >= sr then Just dr else Nothing+    Clip_Both -> if x <= sl then Just dl else if x >= sr then Just dr else Nothing++-- * LinLin++-- | Scale uni-polar (0,1) input to linear (l,r) range.+urange_ma :: Fractional a => Sc3_MulAdd a -> a -> a -> a -> a+urange_ma mul_add_f l r i = mul_add_f i (r - l) l++{- | Scale (0,1) input to linear (l,r) range. u = uni-polar.++>>> map (urange 3 4) [0,0.5,1]+[3.0,3.5,4.0]+-}+urange :: Fractional a => a -> a -> a -> a+urange = urange_ma sc3_mul_add++{- | Calculate multiplier and add values for (-1,1) 'range' transform.++>>> range_muladd 3 4+(0.5,3.5)+-}+range_muladd :: Fractional t => t -> t -> (t, t)+range_muladd = linlin_muladd (-1) 1++{- | Scale bi-polar (-1,1) input to linear (l,r) range.+Note that the argument order is not the same as 'linLin'.+-}+range_ma :: Fractional a => Sc3_MulAdd a -> a -> a -> a -> a+range_ma mul_add_f l r i =+  let (m, a) = range_muladd l r+  in mul_add_f i m a++{- | Scale (-1,1) input to linear (l,r) range.+Note that the argument order is not the same as 'linlin'.+Note also that the various range Ugen methods at sclang select mul-add values given the output range of the Ugen, ie LFPulse.range selects a (0,1) input range.++>>> map (range 3 4) [-1,0,1]+[3.0,3.5,4.0]++>>> map (\x -> let (m,a) = linlin_muladd (-1) 1 3 4 in x * m + a) [-1,0,1]+[3.0,3.5,4.0]+-}+range :: Fractional a => a -> a -> a -> a+range = range_ma sc3_mul_add++-- | 'uncurry' 'range'+range_hs :: Fractional a => (a, a) -> a -> a+range_hs = uncurry range++-- | 'flip' 'range_hs'.  This allows cases such as osc `in_range` (0,1)+in_range :: Fractional a => a -> (a, a) -> a+in_range = flip range_hs++{- | Calculate multiplier and add values for 'linlin' transform.+Inputs are: input-min input-max output-min output-max++>>> range_muladd 3 4+(0.5,3.5)++>>> linlin_muladd (-1) 1 3 4+(0.5,3.5)++>>> linlin_muladd 0 1 3 4+(1.0,3.0)++>>> linlin_muladd (-1) 1 0 1+(0.5,0.5)++>>> linlin_muladd (-0.3) 1 (-1) 1+(1.5384615384615383,-0.5384615384615385)+-}+linlin_muladd :: Fractional t => t -> t -> t -> t -> (t, t)+linlin_muladd sl sr dl dr =+  let m = (dr - dl) / (sr - sl)+      a = dl - (m * sl)+  in (m, a)++{- | Map from one linear range to another linear range.++>>> linlin_ma sc3_mul_add 5 0 10 (-1) 1+0.0+-}+linlin_ma :: Fractional a => Sc3_MulAdd a -> a -> a -> a -> a -> a -> a+linlin_ma mul_add_f i sl sr dl dr =+  let (m, a) = linlin_muladd sl sr dl dr+  in mul_add_f i m a++{- | 'linLin' with a more typical haskell argument structure, ranges as pairs and input last.++>>> map (linlin_hs (0,127) (-0.5,0.5)) [0,63.5,127]+[-0.5,0.0,0.5]+-}+linlin_hs :: Fractional a => (a, a) -> (a, a) -> a -> a+linlin_hs (sl, sr) (dl, dr) = let (m, a) = linlin_muladd sl sr dl dr in (+ a) . (* m)++{- | Map from one linear range to another linear range.++>>> map (\i -> sc3_linlin i (-1) 1 0 1) [-1,-0.75 .. 1]+[0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0]+-}+sc3_linlin :: Fractional a => a -> a -> a -> a -> a -> a+sc3_linlin i sl sr dl dr = linlin_hs (sl, sr) (dl, dr) i++{- | Given enumeration from /dst/ that is in the same relation as /n/ is from /src/.++>>> linlin_enum_plain 'a' 'A' 'e'+'E'++>>> linlin_enum_plain 0 (-50) 16+-34++>>> linlin_enum_plain 0 (-50) (-1)+-51+-}+linlin_enum_plain :: (Enum t, Enum u) => t -> u -> t -> u+linlin_enum_plain src dst n = toEnum (fromEnum dst + (fromEnum n - fromEnum src))++{- | Variant of 'linlin_enum_plain' that requires /src/ and /dst/ ranges to be of equal size,+-- and for /n/ to lie in /src/.++>>> linlin_enum (0,100) (-50,50) 0x10 -- 16+Just (-34)++>>> linlin_enum (-50,50) (0,100) (-34)+Just 16++>>> linlin_enum (0,100) (-50,50) (-1)+Nothing+-}+linlin_enum :: (Enum t, Enum u) => (t, t) -> (u, u) -> t -> Maybe u+linlin_enum (l, r) (l', r') n =+  if fromEnum n >= fromEnum l && fromEnum r - fromEnum l == fromEnum r' - fromEnum l'+    then Just (linlin_enum_plain l l' n)+    else Nothing++-- | Erroring variant.+linlin_enum_err :: (Enum t, Enum u) => (t, t) -> (u, u) -> t -> u+linlin_enum_err src dst = fromMaybe (error "linlin_enum") . linlin_enum src dst++{- | Variant of 'linlin' that requires /src/ and /dst/ ranges to be of+-- equal size, thus with constraint of 'Num' and 'Eq' instead of+-- 'Fractional'.++>>> linlin_eq (0,100) (-50,50) 0x10 -- 16+Just (-34)++>>> linlin_eq (-50,50) (0,100) (-34)+Just 16+-}+linlin_eq :: (Eq a, Num a) => (a, a) -> (a, a) -> a -> Maybe a+linlin_eq (l, r) (l', r') n =+  let d = r - l+      d' = r' - l'+  in if d == d' then Just (l' + (n - l)) else Nothing++-- | Erroring variant.+linlin_eq_err :: (Eq a, Num a) => (a, a) -> (a, a) -> a -> a+linlin_eq_err src dst = fromMaybe (error "linlin_eq") . linlin_eq src dst++-- * LinExp++{- | Linear to exponential range conversion.+     Rule is as at linExp Ugen, haskell manner argument ordering.+     Destination values must be nonzero and have the same sign.++>>> map (floor . linexp_hs (1,2) (10,100)) [0,1,1.5,2,3]+[1,10,31,100,1000]++>>> map (floor . linexp_hs (-2,2) (1,100)) [-3,-2,-1,0,1,2,3]+[0,1,3,10,31,100,316]+-}+linexp_hs :: Floating a => (a, a) -> (a, a) -> a -> a+linexp_hs (in_l, in_r) (out_l, out_r) x =+  let rt = out_r / out_l+      rn = 1.0 / (in_r - in_l)+      rr = rn * negate in_l+  in out_l * (rt ** (x * rn + rr))++{- | Variant of 'linexp_hs' with argument ordering as at 'linExp' Ugen.++>>> map (\i -> lin_exp i 1 2 1 3) [1,1.1,1.9,2]+[1.0,1.1161231740339046,2.6878753795222865,3.0]++>>> map (\i -> floor (lin_exp i 1 2 10 100)) [0,1,1.5,2,3]+[1,10,31,100,1000]+-}+lin_exp :: Floating a => a -> a -> a -> a -> a -> a+lin_exp x in_l in_r out_l out_r = linexp_hs (in_l, in_r) (out_l, out_r) x++{- | @SimpleNumber.linexp@ shifts from linear to exponential ranges.++>>> map (sc3_linexp 1 2 1 3) [1,1.1,1.9,2]+[1.0,1.1161231740339046,2.6878753795222865,3.0]++> [1,1.5,2].collect({|i| i.linexp(1,2,10,100).floor}) == [10,31,100]++>>> map (floor . sc3_linexp 1 2 10 100) [0,1,1.5,2,3]+[10,10,31,100,100]+-}+sc3_linexp :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a+sc3_linexp src_l src_r dst_l dst_r x =+  case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of+    Just r -> r+    Nothing -> ((dst_r / dst_l) ** ((x - src_l) / (src_r - src_l))) * dst_l++{- | @SimpleNumber.explin@ is the inverse of linexp.++>>> map (sc3_explin 10 100 1 2) [10,10,31,100,100]+[1.0,1.0,1.4913616938342726,2.0,2.0]+-}+sc3_explin :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a+sc3_explin src_l src_r dst_l dst_r x =+  fromMaybe+    (logBase (src_r / src_l) (x / src_l) * (dst_r - dst_l) + dst_l)+    (apply_clip_rule Clip_Both src_l src_r dst_l dst_r x)++-- * ExpExp++{- | Translate from one exponential range to another.++>>> map (round . sc3_expexp 0.1 10 4.3 100) [1 .. 10]+[21,33,44,53,62,71,78,86,93,100]+-}+sc3_expexp :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a+sc3_expexp src_l src_r dst_l dst_r x =+  fromMaybe+    ((dst_r / dst_l) ** logBase (src_r / src_l) (x / src_l) * dst_l)+    (apply_clip_rule Clip_Both src_l src_r dst_l dst_r x)++-- * LinCurve++{- | Map /x/ from an assumed linear input range (src_l,src_r) to an+exponential curve output range (dst_l,dst_r). 'curve' is like the+parameter in Env.  Unlike with linexp, the output range may include+zero.++> (0..10).lincurve(0,10,-4.3,100,-3).round == [-4,24,45,61,72,81,87,92,96,98,100]++>>> let f = round . sc3_lincurve (-3) 0 10 (-4.3) 100+>>> map f [0 .. 10]+[-4,24,45,61,72,81,87,92,96,98,100]++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plotTable (map (\c-> map (sc3_lincurve c 0 1 (-1) 1) [0,0.01 .. 1]) [-6,-4 .. 6])+-}+sc3_lincurve :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a -> a+sc3_lincurve curve src_l src_r dst_l dst_r x =+  case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of+    Just r -> r+    Nothing ->+      if abs curve < 0.001+        then linlin_hs (src_l, src_r) (dst_l, dst_r) x+        else+          let grow = exp curve+              a = (dst_r - dst_l) / (1.0 - grow)+              b = dst_l + a+              scaled = (x - src_l) / (src_r - src_l)+          in b - (a * (grow ** scaled))++{- | Inverse of 'sc3_lincurve'.++>>> let f = round . sc3_curvelin (-3) (-4.3) 100 0 10+>>> map f [-4,24,45,61,72,81,87,92,96,98,100] == [0..10]+True+-}+sc3_curvelin :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a -> a+sc3_curvelin curve src_l src_r dst_l dst_r x =+  case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of+    Just r -> r+    Nothing ->+      if abs curve < 0.001+        then linlin_hs (src_l, src_r) (dst_l, dst_r) x+        else+          let grow = exp curve+              a = (src_r - src_l) / (1.0 - grow)+              b = src_l + a+          in log ((b - x) / a) * (dst_r - dst_l) / curve + dst_l++-- * Pp (pretty print)++-- | Removes all but the last trailing zero from floating point string.+double_pp_rm0 :: String -> String+double_pp_rm0 =+  let rev_f f = reverse . f . reverse+      remv l = case l of+        '0' : '.' : _ -> l+        '0' : l' -> remv l'+        _ -> l+  in rev_f remv++{- | The default show is odd, 0.05 shows as 5.0e-2.++>>> unwords (map (double_pp 4) [0.0001,0.001,0.01,0.1,1.0])+"0.0001 0.001 0.01 0.1 1.0"+-}+double_pp :: Int -> Double -> String+double_pp k n = double_pp_rm0 (Numeric.showFFloat (Just k) n "")++{- | Print as integer if integral, else as real.++>>> unwords (map (real_pp 5) [0.0001,0.001,0.01,0.1,1.0])+"0.0001 0.001 0.01 0.1 1"+-}+real_pp :: Int -> Double -> String+real_pp k n =+  let r = toRational n+  in if denominator r == 1 then show (numerator r) else double_pp k n++-- * Parser++-- | Type-specialised 'Text.Read.readMaybe'.+parse_double :: String -> Maybe Double+parse_double = Common.Base.reads_exact++-- * Optimiser++-- | Non-specialised optimised sum function (3 & 4 element adders).+sum_opt_f :: Num t => (t -> t -> t -> t) -> (t -> t -> t -> t -> t) -> [t] -> t+sum_opt_f f3 f4 =+  let recur l =+        case l of+          p : q : r : s : l' -> recur (f4 p q r s : l')+          p : q : r : l' -> recur (f3 p q r : l')+          _ -> sum l+  in recur++-- * Sin++{- | Taylor approximation of sin, (-pi, pi).++> import Sound.Sc3.Plot+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map sin_taylor_approximation xs, map sin xs]+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map (\x -> sin_taylor_approximation x - sin x) xs]+-}+sin_taylor_approximation :: Floating a => a -> a+sin_taylor_approximation x = x - (x ** 3) / (3 * 2) + (x ** 5) / (5 * 4 * 3 * 2) - (x ** 7) / (7 * 6 * 5 * 4 * 3 * 2) + (x ** 9) / (9 * 8 * 7 * 6 * 5 * 4 * 3 * 2)++{- | Bhaskara approximation of sin, (0, pi).++> import Sound.Sc3.Plot+> let xs = [0, 0.05 .. pi] in plot_p1_ln [map sin_bhaskara_approximation xs, map sin xs]+> let xs = [0, 0.05 .. pi] in plot_p1_ln [map (\x -> sin_bhaskara_approximation x - sin x) xs]+-}+sin_bhaskara_approximation :: Floating a => a -> a+sin_bhaskara_approximation x = (16 * x * (pi - x)) / ((5 * pi * pi) - (4 * x * (pi - x)))++{- | Robin Green, robin_green@playstation.sony.com, (-pi, pi)++> import Sound.Sc3.Plot+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map sin_green_approximation xs, map sin xs]+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map (\x -> sin_green_approximation x - sin x) xs]+-}+sin_green_approximation :: Floating a => a -> a+sin_green_approximation x = x - (0.166666546 * (x ** 3)) + (0.00833216076 * (x ** 5)) - (0.000195152832 * (x ** 7))++{- | Paul Adenot, (-pi, pi)++> import Sound.Sc3.Plot+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map sin_adenot_approximation xs, map sin xs]+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map (\x -> sin_adenot_approximation x - sin x) xs]+-}+sin_adenot_approximation :: Floating a => a -> a+sin_adenot_approximation x = 0.391969947653056 * x * (pi - abs x)++{- Anthony C. Robin, (0, 45).+Simple Trigonometric Approximations, The Mathematical Gazette, Vol. 79, No. 485 (Jul., 1995), pp. 385-387.++> import Sound.Sc3.Plot+> degrees_to_radians = (* pi) . (/ 180)+> let xs = [0, 0.05 .. 45] in plot_p1_ln [map sin_robin_approximation xs, map (sin . degrees_to_radians) xs]+> let xs = [0, 0.05 .. 45] in plot_p1_ln [map (\x -> sin_robin_approximation x - sin (degrees_to_radians x)) xs]+-}+sin_robin_approximation :: Floating a => a -> a+sin_robin_approximation x = let c = x * 0.01 in c * (2 - c)
+ Sound/Sc3/Common/Math/Filter.hs view
@@ -0,0 +1,89 @@+-- | Filter coefficient calculations.+module Sound.Sc3.Common.Math.Filter where++-- | Sos filter coefficients, (a0, a1, a2, b1, b2)+type SosCoef t = (t, t, t, t, t)++-- | Butterworth low pass or high pass Sos filter coefficients.+bw_lpf_or_hpf_coef :: Floating n => Bool -> n -> n -> SosCoef n+bw_lpf_or_hpf_coef is_hpf sample_rate f =+  let f' = f * pi / sample_rate+      c = if is_hpf then tan f' else 1 / tan f'+      c2 = c * c+      s2c = sqrt 2 * c+      a0 = 1 / (1 + s2c + c2)+      a1 = if is_hpf then -2 * a0 else 2 * a0+      a2 = a0+      b1 = if is_hpf then 2 * (c2 - 1.0) * a0 else 2 * (1 - c2) * a0+      b2 = (1 - s2c + c2) * a0+  in (a0, a1, a2, b1, b2)++-- | Two place infinite impulse response filter coefficients, (a0, b1, b2)+type Iir2Coef t = (t, t, t)++-- | rlpf coefficients, (a0,b1,b2).+rlpf_coef :: Floating n => (n -> n -> n) -> (n, n, n) -> Iir2Coef n+rlpf_coef max_f (radians_per_sample, f, rq) =+  let qr = max_f 0.001 rq+      pf = f * radians_per_sample+      d = tan (pf * qr * 0.5)+      c = (1 - d) / (1 + d)+      b1 = (1 + c) * cos pf+      b2 = negate c+      a0 = (1 + c - b1) * 0.25+  in (a0, b1, b2)++-- | resonz coefficients, (a0,b1,b2).+resonz_coef :: Floating n => (n, n, n) -> Iir2Coef n+resonz_coef (radians_per_sample, f, rq) =+  let ff = f * radians_per_sample+      b = ff * rq+      r = 1 - b * 0.5+      two_r = 2 * r+      r2 = r * r+      ct = (two_r * cos ff) / (1 + r2)+      b1 = two_r * ct+      b2 = negate r2+      a0 = (1 - r2) * 0.5+  in (a0, b1, b2)++-- * Pinking++type Pinking_Param t = (t, t, t, t, t, t, t)++{- | Sample rate variable pinking filter.++https://www.musicdsp.org/en/latest/Filters/76-pink-noise-filter.html+-}+pinking_filter_freq_48000 :: Fractional t => Pinking_Param t+pinking_filter_freq_48000 = (4752.456, 4030.961, 2784.711, 1538.461, 357.681, 70, 30)++pinking_filter_freq_96000 :: Fractional t => Pinking_Param t+pinking_filter_freq_96000 = (8227.219, 8227.219, 6388.570, 3302.754, 479.412, 151.070, 54.264)++pinking_filter_freq_192000 :: Fractional t => Pinking_Param t+pinking_filter_freq_192000 = (9211.912, 8621.096, 8555.228, 8292.754, 518.334, 163.712, 240.241)++{- | Pinking filter coefficients++>>> pinking_filter_coef 48000 pinking_filter_freq_48000+(0.5368186045507747,0.5899888969306109,0.6945314610687594,0.8175983529924599,0.9542588306160661,0.9908788735874952,0.9960807097281633)+-}+pinking_filter_coef :: Floating t => t -> Pinking_Param t -> Pinking_Param t+pinking_filter_coef sr (f0, f1, f2, f3, f4, f5, f6) =+  let f n = exp ((-2) * pi * n / sr)+  in (f f0, f f1, f f2, f f3, f f4, f f5, f f6)++pinking_filter_next :: Floating t => Pinking_Param t -> Pinking_Param t -> t -> (t, Pinking_Param t)+pinking_filter_next (k0, k1, k2, k3, k4, k5, k6) (m0, m1, m2, m3, m4, m5, m6) white =+  let (b0, b1, b2, b3, b4, b5, b6) =+        ( (k0 * white) + (k0 * m0)+        , (k1 * white) + (k1 * m1)+        , (k2 * white) + (k2 * m2)+        , (k3 * white) + (k3 * m3)+        , (k4 * white) + (k4 * m4)+        , (k5 * white) + (k5 * m5)+        , (k6 * white) + (k6 * m6)+        )+      pink = b0 + b1 + b2 + b3 + b4 + b5 + white - b6+  in (pink, (b0, b1, b2, b3, b4, b5, b6))
+ Sound/Sc3/Common/Math/Filter/Beq.hs view
@@ -0,0 +1,117 @@+-- | Beq filter coefficient calculations.+module Sound.Sc3.Common.Math.Filter.Beq where++-- | Beq coefficients, (a0, a1, a2, b1, b2).+type Beq t = (t, t, t, t, t)++-- | Calculate coefficients for bi-quad low pass filter.+bLowPassCoef :: Floating t => t -> t -> t -> Beq t+bLowPassCoef sr freq rq =+  let w0 = pi * 2 * freq * (1 / sr)+      cos_w0 = cos w0+      i = 1 - cos_w0+      alpha = sin w0 * 0.5 * rq+      b0rz = recip (1 + alpha)+      a0 = i * 0.5 * b0rz+      a1 = i * b0rz+      b1 = cos_w0 * 2 * b0rz+      b2 = (1 - alpha) * negate b0rz+  in (a0, a1, a0, b1, b2)++-- | Calculate coefficients for bi-quad high pass filter.+bHiPassCoef :: Floating t => t -> t -> t -> Beq t+bHiPassCoef sr freq rq =+  let w0 = pi * 2 * freq * (1 / sr)+      cos_w0 = cos w0+      i = 1 + cos_w0+      alpha = sin w0 * 0.5 * rq+      b0rz = recip (1 + alpha)+      a0 = i * 0.5 * b0rz+      a1 = negate i * b0rz+      b1 = cos_w0 * 2 * b0rz+      b2 = (1 - alpha) * negate b0rz+  in (a0, a1, a0, b1, b2)++-- | Calculate coefficients for bi-quad all pass filter.+bAllPassCoef :: Floating t => t -> t -> t -> Beq t+bAllPassCoef sr freq rq =+  let w0 = pi * 2 * freq * (1 / sr)+      alpha = sin w0 * 0.5 * rq+      b0rz = recip (1 + alpha)+      a0 = (1 - alpha) * b0rz+      b1 = 2.0 * cos w0 * b0rz+  in (a0, negate b1, 1.0, b1, negate a0)++-- | Calculate coefficients for bi-quad band pass filter.+bBandPassCoef :: Floating t => t -> t -> t -> Beq t+bBandPassCoef sr freq bw =+  let w0 = pi * 2 * freq * (1 / sr)+      sin_w0 = sin w0+      alpha = sin_w0 * sinh (0.34657359027997 * bw * w0 / sin_w0)+      b0rz = recip (1 + alpha)+      a0 = alpha * b0rz+      b1 = cos w0 * 2 * b0rz+      b2 = (1 - alpha) * negate b0rz+  in (a0, 0.0, negate a0, b1, b2)++-- | Calculate coefficients for bi-quad stop band filter.+bBandStopCoef :: Floating t => t -> t -> t -> Beq t+bBandStopCoef sr freq bw =+  let w0 = pi * 2 * freq * (1 / sr)+      sin_w0 = sin w0+      alpha = sin_w0 * sinh (0.34657359027997 * bw * w0 / sin_w0)+      b0rz = recip (1 + alpha)+      b1 = 2.0 * cos w0 * b0rz+      b2 = (1 - alpha) * negate b0rz+  in (b0rz, negate b1, b0rz, b1, b2)++-- | Calculate coefficients for bi-quad peaking Eq filter.+bPeakEqCoef :: Floating t => t -> t -> t -> t -> Beq t+bPeakEqCoef sr freq rq db =+  let a = 10 ** (db / 40)+      w0 = pi * 2 * freq * (1 / sr)+      alpha = sin w0 * 0.5 * rq+      b0rz = recip (1 + (alpha / a))+      a0 = (1 + (alpha * a)) * b0rz+      a2 = (1 - (alpha * a)) * b0rz+      b1 = 2.0 * cos w0 * b0rz+      b2 = (1 - (alpha / a)) * negate b0rz+  in (a0, negate b1, a2, b1, b2)++-- | Calculate coefficients for bi-quad low shelf filter.+bLowShelfCoef :: Floating t => t -> t -> t -> t -> Beq t+bLowShelfCoef sr freq rs db =+  let a = 10 ** (db / 40)+      w0 = pi * 2 * freq * (1 / sr)+      cos_w0 = cos w0+      sin_w0 = sin w0+      alpha = sin_w0 * 0.5 * sqrt ((a + recip a) * (rs - 1) + 2.0)+      i = (a + 1) * cos_w0+      j = (a - 1) * cos_w0+      k = 2 * sqrt a * alpha+      b0rz = recip ((a + 1) + j + k)+      a0 = a * ((a + 1) - j + k) * b0rz+      a1 = 2 * a * ((a - 1) - i) * b0rz+      a2 = a * ((a + 1) - j - k) * b0rz+      b1 = 2.0 * ((a - 1) + i) * b0rz+      b2 = ((a + 1) + j - k) * negate b0rz+  in (a0, a1, a2, b1, b2)++-- | Calculate coefficients for bi-quad high shelf filter.+bHiShelfCoef :: Floating t => t -> t -> t -> t -> Beq t+bHiShelfCoef sr freq rs db =+  let a = 10 ** (db / 40)+      w0 = pi * 2 * freq * (1 / sr)+      cos_w0 = cos w0+      sin_w0 = sin w0+      alpha = sin_w0 * 0.5 * sqrt ((a + recip a) * (rs - 1) + 2.0)+      i = (a + 1) * cos_w0+      j = (a - 1) * cos_w0+      k = 2 * sqrt a * alpha+      b0rz = recip ((a + 1) - j + k)+      a0 = a * ((a + 1) + j + k) * b0rz+      a1 = -2.0 * a * ((a - 1) + i) * b0rz+      a2 = a * ((a + 1) + j - k) * b0rz+      b1 = -2.0 * ((a - 1) - i) * b0rz+      b2 = ((a + 1) - j - k) * negate b0rz+  in (a0, a1, a2, b1, b2)
+ Sound/Sc3/Common/Math/Interpolate.hs view
@@ -0,0 +1,143 @@+{- | Interpolation functions, ie. for envelope segments.+Present naming is for qualified import.+-}+module Sound.Sc3.Common.Math.Interpolate where++import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++{- | An interpolation function takes three arguments.+     x0 is the left or begin value, x1 is the right or end value, t is a (0,1) index.+-}+type Interpolation_f t = t -> t -> t -> t++{- | Clip x to (0,1) and run f.++>>> interpolate linear (-1,1) 0.5+0.0+-}+interpolate :: (Num t, Ord t) => Interpolation_f t -> (t, t) -> t -> t+interpolate f (l, r) x = if x < 0 then l else if x > 1 then r else f l r x++-- | Step function, ignores t and returns x1.+step :: Interpolation_f t+step _ x1 _ = x1++{- | Linear interpolation funtion.++>>> map (linear 1 10) [0,0.25 .. 1]+[1.0,3.25,5.5,7.75,10.0]++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plot_fn_r1_ln (linear (-1) 1) (0,1)+-}+linear :: Num t => Interpolation_f t+linear x0 x1 t = t * (x1 - x0) + x0++{- | Exponential interpolation.+     x0 must not be zero and (x0,x1) must not span zero.++> plot_fn_r1_ln [exponential 0.001 1] (0,1)+> plot_fn_r1_ln [exponential 1 2] (0,1)+> plot_fn_r1_ln [exponential 20 20000] (0,1)+-}+exponential :: Floating t => Interpolation_f t+exponential x0 x1 t = x0 * ((x1 / x0) ** t)++{- | Variant that allows x0 to be zero, though (x0,x1) must not span zero.++> plot_fn_r1_ln [exponential_0 0 1] (0,1)+> plot_fn_r1_ln [exponential_0 0 (-1)] (0,1)+-}+exponential_0 :: (Eq t, Floating t) => Interpolation_f t+exponential_0 x0 x1 =+  let epsilon = 1e-6+      x0' = if x0 == 0 then epsilon * signum x1 else x0+  in exponential x0' x1++{- | 'linear' of 'exponential_0' of (0,1), ie. allows (x0,x1) to span zero.++> plot_fn_r1_ln [exponential_lin (-1) 1] (0,1)+-}+exponential_lin :: (Eq t, Floating t) => Interpolation_f t+exponential_lin x0 x1 t = linear x0 x1 (exponential_0 0 1 t)++{- | 'linear' with t transformed by sine function over (-pi/2,pi/2).++> plot_fn_r1_ln [sine (-1) 1] (0,1)+> plot_fn_r1_ln [sine 1 (-1)] (0,1)+-}+sine :: Floating t => Interpolation_f t+sine x0 x1 t =+  let t' = -cos (pi * t) * 0.5 + 0.5+  in linear x0 x1 t'++{- | If x0 '<' x1 rising sine segment (0,pi/2), else falling segment (pi/2,pi).++> plot_fn_r1_ln [welch (-1) 1] (0,1)+> plot_fn_r1_ln [welch 1 (-1)] (0,1)+-}+welch :: (Ord t, Floating t) => Interpolation_f t+welch x0 x1 t =+  if x0 < x1+    then x0 + (x1 - x0) * sin (Math.half_pi * t)+    else x1 - (x1 - x0) * sin (Math.half_pi - (Math.half_pi * t))++{- | Curvature controlled by single parameter c.+     Zero is 'linear', increasing c approaches 'exponential' and continues past it.+     The value for c at which the curve is close to exponential depends on the range.++> plot_p1_ln (map (\c-> map (curve c (-1) 1) [0,0.01 .. 1]) [-6,-4 .. 6])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 4.4 1 100,exponential 1 100,curve 4.5 1 100])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [exponential 20 20000,curve 7 20 20000])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [fader 0 2,curve 2 0 2])+-}+curve :: (Ord t, Floating t) => t -> Interpolation_f t+curve c x0 x1 t =+  if abs c < 0.0001+    then linear x0 x1 t+    else+      let d = 1 - exp c+          n = 1 - exp (t * c)+      in x0 + (x1 - x0) * (n / d)++{- | Square of 'linear' of 'sqrt' of x0 and x1, therefore neither may be negative.++> plot_fn_r1_ln [squared 0 1] (0,1)+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 2.05 0 1,squared 0 1])+-}+squared :: Floating t => Interpolation_f t+squared x0 x1 t =+  let x0' = sqrt x0+      x1' = sqrt x1+      l = linear x0' x1' t+  in l * l++{- | Cubic variant of 'squared'.++> plot_fn_r1_ln [cubed 0 1] (0,1)+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 3.25 0 1,cubed 0 1])+-}+cubed :: Floating t => Interpolation_f t+cubed x0 x1 t =+  let x0' = x0 ** (1 / 3)+      x1' = x1 ** (1 / 3)+      l = linear x0' x1' t+  in l * l * l++{- | x0 until end, then immediately x1.++> plot_fn_r1_ln [hold 0 1] (0,2)+-}+hold :: (Num t, Ord t) => Interpolation_f t+hold x0 x1 t = if t >= 1 then x1 else x0++{- | Fader curve, equal to 'squared' when x1 > x0.++> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [squared 0 1,fader 0 1])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 2 1 0,fader 1 0])+-}+fader :: (Num t, Ord t) => Interpolation_f t+fader x0 x1 t =+  let rng = x1 - x0+      sqr i = i * i+  in sqr (if rng > 0 then t else 1 - (1 - t)) * rng + x0
+ Sound/Sc3/Common/Math/Noise.hs view
@@ -0,0 +1,51 @@+-- | Noise generating functions.+module Sound.Sc3.Common.Math.Noise where++import Sound.Sc3.Common.Math {- hsc3 -}++-- | x(n+1) = a - b * sqrt(|x(n)|)+cusp_f :: Floating t => t -> t -> t -> t+cusp_f a b x = a - (b * sqrt (abs x))++{- | x(n+1) = sin(im * y(n) + fb * x(n))+  y(n+1) = (a * y(n) + c) % 2pi+-}+fbSine_f :: (Floating t, RealFrac t) => t -> t -> t -> t -> (t, t) -> (t, t)+fbSine_f im fb a c (x, y) = (sin ((im * y) + (fb * x)), ((a * y) + c) `sc3_mod` (2 * pi))++-- | x(n+2) = 1 - a * x(n+1)^2 + b * x(n)+henon_f :: Floating t => t -> t -> (t, t) -> (t, t)+henon_f a b (x1, x0) = (1 - (a * (x1 ** 2)) + (b * x0), x1)++{- | x(n+1) = sin(b * y(n)) + c * sin(b * x(n))+  y(n+1) = sin(a * x(n)) + d * sin(a * y(n))+-}+latoocarfian_f :: Floating t => t -> t -> t -> t -> (t, t) -> (t, t)+latoocarfian_f a b c d (x, y) = (sin (b * y) + (c * sin (b * x)), sin (a * x) + (d * sin (a * y)))++-- | x(n+1) = (a * x(n) + c) % m+linCong_f :: RealFrac t => t -> t -> t -> t -> t+linCong_f a c m x = (a * x + c) `sc3_mod` m++-- | x(n+1) = a * x * (1.0 - x)+logistic_f :: Num t => t -> t -> t+logistic_f a x = a * x * (1 - x)++{- | x' = s * (y - x)+  y' = x * (r - z) - y+  z' = x * y - b * z+-}+lorenz_f :: Num t => t -> t -> t -> (t, t, t) -> (t, t, t)+lorenz_f s r b (x, y, z) = (s * (y - x), x * (r - z) - y, x * y - b * z)++-- | x(n+1) = a * x(n)^2 + b * x(n) + c+quad_f :: Floating t => t -> t -> t -> t -> t+quad_f a b c x = (a * (x ** 2)) + (b * x) + c++{- | x(n+1) = (x(n) + y(n+1)) % 2pi+  y(n+1) = (y(n) + k * sin(x(n))) % 2pi+-}+standard_f :: (RealFrac t, Floating t) => t -> (t, t) -> (t, t)+standard_f k (x, y) =+  let y' = (y + (k * sin x)) `sc3_mod` two_pi+  in ((x + y') `sc3_mod` two_pi, y')
+ Sound/Sc3/Common/Math/Operator.hs view
@@ -0,0 +1,557 @@+{- | Non-standard mathematical enumerations, classes and base instances.++Enumerations of the unary and binary math unit generators.+Names that conflict with existing names have a @_@ suffix.++The Eq and Ord classes in the Prelude require Bool, hence EqE and OrdE.+True is 1.0, False is 0.0++The RealFrac class requires Integral results, hence RealFracE.+-}+module Sound.Sc3.Common.Math.Operator where++import Control.Monad {- base -}+import qualified Data.Fixed as F {- base -}+import Data.Int {- base -}+import Data.Maybe {- base -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}+import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++-- * Unary++{- | Enumeration of @Sc3@ unary operator Ugens.+     The names here are from the enumeration at "server/plugins/UnaryOpUgens.cpp".+     The capitalisation is edited since these names become function names in rsc3.+     Names have a _ suffix if they conflict with Ugen names.++> zip (map show [minBound :: Sc3_Unary_Op .. maxBound]) [0..]+-}+data Sc3_Unary_Op+  = OpNeg -- -+  | OpNot -- !+  | OpIsNil+  | OpNotNil+  | OpBitNot+  | OpAbs -- 5+  | OpAsFloat+  | OpAsInt+  | OpCeil -- 8+  | OpFloor -- 9+  | OpFrac -- 10+  | OpSign -- 11+  | OpSquared -- 12+  | OpCubed -- 13+  | OpSqrt -- 14+  | OpExp -- 15+  | OpRecip -- 16+  | OpMidiCps -- 17+  | OpCpsMidi -- 18+  | OpMidiRatio -- 19+  | OpRatioMidi -- 20+  | OpDbAmp -- 21+  | OpAmpDb -- 22+  | OpOctCps+  | OpCpsOct+  | OpLog -- 25 (natural, base e)+  | OpLog2 -- 26 (base 2)+  | OpLog10 -- 27 (base 10)+  | OpSin -- 28+  | OpCos -- 29+  | OpTan -- 30+  | OpArcSin+  | OpArcCos+  | OpArcTan+  | OpSinh+  | OpCosh -- 35+  | OpTanh -- 36+  | OpRand_ -- 37 ; Ugen+  | OpRand2+  | OpLinRand_ -- 39 ; Ugen+  | OpBiLinRand -- 40+  | OpSum3Rand+  | OpDistort -- 42+  | OpSoftClip -- 43+  | OpCoin+  | OpDigitValue -- 45+  | OpSilence -- 46+  | OpThru -- 47+  | OpRectWindow -- 48+  | OpHanWindow -- 49+  | OpWelchWindow -- 50+  | OpTriWindow+  | OpRamp_ -- 52 ; Ugen+  | OpScurve+  deriving (Eq, Show, Enum, Bounded, Read)++-- | Enum name without Op prefix.+sc3_unary_op_name :: Sc3_Unary_Op -> String+sc3_unary_op_name = drop 2 . show++{- | 'Base.parse_enum' with Op prefix.++>>> Data.Maybe.mapMaybe (parse_unary Base.Cs) (words "Abs Rand")+[OpAbs]+-}+parse_unary :: Base.Case_Rule -> String -> Maybe Sc3_Unary_Op+parse_unary cr = Base.parse_enum cr . (++) "Op"++{- | Table of operator names (non-symbolic) and indices.++> map fst sc3_unary_op_tbl+-}+sc3_unary_op_tbl :: [(String, Int)]+sc3_unary_op_tbl = zip (map sc3_unary_op_name [minBound .. maxBound]) [0 ..]++-- | Table of symbolic names for standard unary operators.+unary_sym_tbl :: [(Sc3_Unary_Op, String)]+unary_sym_tbl = [] -- (Neg,"-"),(Not,"!")++-- | Lookup possibly symbolic name for standard unary operators.+unaryName :: Int -> String+unaryName n =+  let e = toEnum n+  in fromMaybe (sc3_unary_op_name e) (lookup e unary_sym_tbl)++{- | Given name of unary operator derive index.++>>> Data.Maybe.mapMaybe (unaryIndex Base.Ci) (words "abs Cubed midiCps Neg")+[5,13,17,0]++>>> unaryIndex Base.Cs "SinOsc"+Nothing+-}+unaryIndex :: Base.Case_Rule -> String -> Maybe Int+unaryIndex cr nm =+  let ix = Base.rlookup_str cr nm unary_sym_tbl+      ix' = parse_unary cr nm+  in fmap fromEnum (mplus ix' ix)++{- | 'isJust' of 'unaryIndex'.++>>> map (is_unary Base.Ci) (words "Abs MidiCps Neg")+[True,True,True]++>>> map (is_unary Base.Ci) (words "- rand")+[False,False]++>>> map (is_unary Base.Ci) (words "arctan atan")+[True,False]+-}+is_unary :: Base.Case_Rule -> String -> Bool+is_unary cr = isJust . unaryIndex cr++-- * Binary++{- | Enumeration of @Sc3@ unary operator Ugens.+The names here are from the enumeration at "server/plugins/BinaryOpUgens.cpp".++> zip (map show [minBound :: Sc3_Binary_Op .. maxBound]) [0..]+-}+data Sc3_Binary_Op+  = OpAdd -- 0+  | OpSub -- 1+  | OpMul -- 2+  | OpIdiv -- 3+  | OpFdiv -- 4+  | OpMod -- 5+  | OpEq -- 6+  | OpNe -- 7+  | OpLt -- 8+  | OpGt -- 9+  | OpLe -- 10+  | OpGe -- 11+  | OpMin -- 12+  | OpMax -- 13+  | OpBitAnd -- 14+  | OpBitOr -- 15+  | OpBitXor+  | OpLcm -- 17+  | OpGcd -- 18+  | OpRoundTo -- 19 -- i.e. roundTo: (renamed)+  | OpRoundUp -- 20+  | OpTrunc -- 21+  | OpAtan2 -- 22+  | OpHypot -- 23+  | OpHypotx+  | OpPow -- 25+  | OpShiftLeft -- 26+  | OpShiftRight -- 27+  | OpUnsignedShift+  | OpFill+  | OpRing1 -- 30+  | OpRing2+  | OpRing3+  | OpRing4+  | OpDifSqr+  | OpSumSqr -- 35+  | OpSqrSum+  | OpSqrDif+  | OpAbsDif -- 38+  | OpThresh+  | OpAmClip -- 40+  | OpScaleNeg -- 41+  | OpClip2 -- 42+  | OpExcess+  | OpFold2 -- 44+  | OpWrap2 -- 45+  | OpFirstArg -- 46+  | OpRandRange -- 47+  | OpExpRandRange -- 48+  deriving (Eq, Show, Enum, Bounded, Read)++-- | Enum name without Op prefix.+sc3_binary_op_name :: Sc3_Binary_Op -> String+sc3_binary_op_name = drop 2 . show++-- | Table of operator names (non-symbolic) and indices.+sc3_binary_op_tbl :: [(String, Int)]+sc3_binary_op_tbl = zip (map sc3_binary_op_name [minBound .. maxBound]) [0 ..]++{- | 'parse_enum' with Op prefix.++>>> parse_binary Base.Ci "mul"+Just OpMul+-}+parse_binary :: Base.Case_Rule -> String -> Maybe Sc3_Binary_Op+parse_binary cr = Base.parse_enum cr . (++) "Op"++-- | Table of symbolic names for standard binary operators.+binary_sym_tbl :: [(Sc3_Binary_Op, String)]+binary_sym_tbl =+  [ (OpAdd, "+")+  , (OpSub, "-")+  , (OpMul, "*")+  , (OpFdiv, "/")+  , (OpMod, "%")+  , (OpEq, "==")+  , (OpNe, "/=") -- or !=+  , (OpLt, "<")+  , (OpGt, ">")+  , (OpLe, "<=")+  , (OpGe, ">=")+  , (OpBitAnd, ".&.") -- or &+  , (OpBitOr, ".|.") -- or |+  , (OpPow, "**")+  ]++{- | Table of operator names (non-symbolic) and indices.++> map fst sc3_binary_op_sym_tbl+-}+sc3_binary_op_sym_tbl :: [(String, Int)]+sc3_binary_op_sym_tbl =+  let f x = fromMaybe (sc3_binary_op_name x) (lookup x binary_sym_tbl)+  in zip (map f [minBound .. maxBound]) [0 ..]++{- | Lookup possibly symbolic name for standard binary operators.++>>> map binaryName [1,2,8,12]+["-","*","<","Min"]+-}+binaryName :: Int -> String+binaryName n =+  let e = toEnum n+  in fromMaybe (sc3_binary_op_name e) (lookup e binary_sym_tbl)++{- | Given name of binary operator derive index.++>>> Data.Maybe.mapMaybe (binaryIndex Base.Ci) (words "* mul ring1 +")+[2,2,30,0]++>>> binaryIndex Base.Ci "sinosc"+Nothing++>>> map (\x -> (x,binaryIndex Base.Ci x)) (map snd binary_sym_tbl)+[("+",Just 0),("-",Just 1),("*",Just 2),("/",Just 4),("%",Just 5),("==",Just 6),("/=",Just 7),("<",Just 8),(">",Just 9),("<=",Just 10),(">=",Just 11),(".&.",Just 14),(".|.",Just 15),("**",Just 25)]+-}+binaryIndex :: Base.Case_Rule -> String -> Maybe Int+binaryIndex cr nm =+  let ix = Base.rlookup_str cr nm binary_sym_tbl+      ix' = parse_binary cr nm+  in fmap fromEnum (mplus ix' ix)++{- | 'isJust' of 'binaryIndex'.++>>> map (is_binary Base.Ci) (words "== > % Trunc max")+[True,True,True,True,True]+-}+is_binary :: Base.Case_Rule -> String -> Bool+is_binary cr = isJust . binaryIndex cr++-- * Operator++-- | Lookup operator name for operator Ugens, else Ugen name.+ugen_operator_name :: String -> Int -> Maybe String+ugen_operator_name nm n =+  case nm of+    "UnaryOpUGen" -> Just (unaryName n)+    "BinaryOpUGen" -> Just (binaryName n)+    _ -> Nothing++{- | Order of lookup: binary then unary.++>>> map (resolve_operator Base.Ci) (words "+ - sub abs max")+[("BinaryOpUGen",Just 0),("BinaryOpUGen",Just 1),("BinaryOpUGen",Just 1),("UnaryOpUGen",Just 5),("BinaryOpUGen",Just 13)]++>>> map (resolve_operator Base.Cs) (words "Abs Add Neg")+[("UnaryOpUGen",Just 5),("BinaryOpUGen",Just 0),("UnaryOpUGen",Just 0)]+-}+resolve_operator :: Base.Case_Rule -> String -> (String, Maybe Int)+resolve_operator cr nm =+  case binaryIndex cr nm of+    Just sp -> ("BinaryOpUGen", Just sp)+    Nothing -> case unaryIndex cr nm of+      Just sp -> ("UnaryOpUGen", Just sp)+      _ -> (nm, Nothing)++-- | Case-insensitive resolve_operator.+resolve_operator_ci :: String -> (String, Maybe Int)+resolve_operator_ci = resolve_operator Base.Ci++-- * Classes++-- | Variant on 'Eq' class, result is of the same type as the values compared.+class (Eq a, Num a) => EqE a where+  equal_to :: a -> a -> a+  equal_to = Math.sc3_eq+  not_equal_to :: a -> a -> a+  not_equal_to = Math.sc3_neq++instance EqE Int+instance EqE Integer+instance EqE Int32+instance EqE Int64+instance EqE Float+instance EqE Double++-- | Variant on Ord class, result is of the same type as the values compared.+class (Ord a, Num a) => OrdE a where+  less_than :: a -> a -> a+  less_than = Math.sc3_lt+  less_than_or_equal_to :: a -> a -> a+  less_than_or_equal_to = Math.sc3_lte+  greater_than :: a -> a -> a+  greater_than = Math.sc3_gt+  greater_than_or_equal_to :: a -> a -> a+  greater_than_or_equal_to = Math.sc3_gte++instance OrdE Int+instance OrdE Integer+instance OrdE Int32+instance OrdE Int64+instance OrdE Float+instance OrdE Double++-- | Variant of 'RealFrac' with non 'Integral' results.+class RealFrac a => RealFracE a where+  properFractionE :: a -> (a, a)+  properFractionE = Math.sc3_properFraction+  truncateE :: a -> a+  truncateE = Math.sc3_truncate+  roundE :: a -> a+  roundE = Math.sc3_round+  ceilingE :: a -> a+  ceilingE = Math.sc3_ceiling+  floorE :: a -> a+  floorE = Math.sc3_floor++instance RealFracE Float+instance RealFracE Double++{- | Unary operator class.++>>> map (floor . (* 1e4) . dbAmp) [-90,-60,-30,0]+[0,10,316,10000]+-}+class (Floating a, Ord a) => UnaryOp a where+  ampDb :: a -> a+  ampDb = Math.amp_to_db+  asFloat :: a -> a+  asFloat = error "asFloat"+  asInt :: a -> a+  asInt = error "asInt"+  cpsMidi :: a -> a+  cpsMidi = Math.cps_to_midi+  cpsOct :: a -> a+  cpsOct = Math.cps_to_oct+  cubed :: a -> a+  cubed n = n * n * n+  dbAmp :: a -> a+  dbAmp = Math.db_to_amp+  distort :: a -> a+  distort = Math.sc3_distort+  frac :: a -> a+  frac = error "frac"+  isNil :: a -> a+  isNil a = if a == 0.0 then 0.0 else 1.0+  log10 :: a -> a+  log10 = logBase 10+  log2 :: a -> a+  log2 = logBase 2+  midiCps :: a -> a+  midiCps = Math.midi_to_cps+  midiRatio :: a -> a+  midiRatio = Math.midi_to_ratio+  notE :: a -> a+  notE a = if a > 0.0 then 0.0 else 1.0+  notNil :: a -> a+  notNil a = if a /= 0.0 then 0.0 else 1.0+  octCps :: a -> a+  octCps = Math.oct_to_cps+  ramp_ :: a -> a+  ramp_ _ = error "ramp_"+  ratioMidi :: a -> a+  ratioMidi = Math.ratio_to_midi+  softClip :: a -> a+  softClip = Math.sc3_softclip+  squared :: a -> a+  squared = \z -> z * z++instance UnaryOp Float+instance UnaryOp Double++-- | Sc3_Binary_Op operator class.+class (Floating a, RealFrac a, Ord a) => BinaryOp a where+  absDif :: a -> a -> a+  absDif a b = abs (a - b)+  amClip :: a -> a -> a+  amClip a b = if b <= 0 then 0 else a * b+  atan2E :: a -> a -> a+  atan2E a b = atan (b / a)+  clip2 :: a -> a -> a+  clip2 a b = Math.sc3_clip a (-b) b+  difSqr :: a -> a -> a+  difSqr = Math.sc3_dif_sqr+  excess :: a -> a -> a+  excess a b = a - Math.sc3_clip a (-b) b+  exprandRange :: a -> a -> a+  exprandRange = error "exprandRange"+  fill :: a -> a -> a+  fill = error "fill"+  firstArg :: a -> a -> a+  firstArg a _ = a+  fold2 :: a -> a -> a+  fold2 a b = Math.sc3_fold a (-b) b+  gcdE :: a -> a -> a+  gcdE = Math.sc3_gcd+  hypot :: a -> a -> a+  hypot = Math.sc3_hypot+  hypotx :: a -> a -> a+  hypotx = Math.sc3_hypotx+  iDiv :: a -> a -> a+  iDiv = Math.sc3_idiv+  lcmE :: a -> a -> a+  lcmE = Math.sc3_lcm+  modE :: a -> a -> a+  modE = Math.sc3_mod+  randRange :: a -> a -> a+  randRange = error "randRange"+  ring1 :: a -> a -> a+  ring1 a b = a * b + a+  ring2 :: a -> a -> a+  ring2 a b = a * b + a + b+  ring3 :: a -> a -> a+  ring3 a b = a * a * b+  ring4 :: a -> a -> a+  ring4 a b = a * a * b - a * b * b+  roundUp :: a -> a -> a+  roundUp = error "roundUp"+  scaleNeg :: a -> a -> a+  scaleNeg a b = (abs a - a) * b' + a where b' = 0.5 * b + 0.5+  sqrDif :: a -> a -> a+  sqrDif a b = (a - b) * (a - b)+  sqrSum :: a -> a -> a+  sqrSum a b = (a + b) * (a + b)+  sumSqr :: a -> a -> a+  sumSqr a b = (a * a) + (b * b)+  thresh :: a -> a -> a+  thresh a b = if a < b then 0 else a+  trunc :: a -> a -> a+  trunc = error "trunc"+  wrap2 :: a -> a -> a+  wrap2 = error "wrap2"++instance BinaryOp Float where+  fold2 a b = Math.sc3_fold a (-b) b+  modE = F.mod'+  roundUp a b = if b == 0 then a else ceilingE (a / b + 0.5) * b+  wrap2 a b = Math.sc3_wrap_ni (-b) b a++instance BinaryOp Double where+  fold2 a b = Math.sc3_fold a (-b) b+  modE = F.mod'+  roundUp a b = if b == 0 then a else ceilingE (a / b + 0.5) * b+  wrap2 a b = Math.sc3_wrap_ni (-b) b a++-- * Infix++(==**) :: EqE a => a -> a -> a+(==**) = equal_to++(/=**) :: EqE a => a -> a -> a+(/=**) = not_equal_to++(<**) :: OrdE a => a -> a -> a+(<**) = less_than++(<=**) :: OrdE a => a -> a -> a+(<=**) = less_than_or_equal_to++(>**) :: OrdE a => a -> a -> a+(>**) = greater_than++(>=**) :: OrdE a => a -> a -> a+(>=**) = greater_than_or_equal_to++-- * Tables++-- | Association table for 'Sc3_Binary_Op' to haskell function implementing operator.+binop_hs_tbl :: (Real n, Floating n, RealFrac n) => [(Sc3_Binary_Op, n -> n -> n)]+binop_hs_tbl =+  [ (OpAdd, (+))+  , (OpSub, (-))+  , (OpFdiv, (/))+  , (OpIdiv, Math.sc3_idiv)+  , (OpMod, Math.sc3_mod)+  , (OpEq, Math.sc3_eq)+  , (OpNe, Math.sc3_neq)+  , (OpLt, Math.sc3_lt)+  , (OpLe, Math.sc3_lte)+  , (OpGt, Math.sc3_gt)+  , (OpGe, Math.sc3_gte)+  , (OpMin, min)+  , (OpMax, max)+  , (OpMul, (*))+  , (OpPow, (**))+  , (OpMin, min)+  , (OpMax, max)+  , (OpRoundTo, Math.sc3_round_to)+  ]++-- | 'lookup' 'binop_hs_tbl' via 'toEnum'.+binop_special_hs :: (RealFrac n, Floating n) => Int -> Maybe (n -> n -> n)+binop_special_hs z = lookup (toEnum z) binop_hs_tbl++-- | Association table for 'Unary' to haskell function implementing operator.+uop_hs_tbl :: (RealFrac n, Floating n) => [(Sc3_Unary_Op, n -> n)]+uop_hs_tbl =+  [ (OpNeg, negate)+  , (OpNot, \z -> if z > 0 then 0 else 1)+  , (OpAbs, abs)+  , (OpCeil, Math.sc3_ceiling)+  , (OpFloor, Math.sc3_floor)+  , (OpSquared, \z -> z * z)+  , (OpCubed, \z -> z * z * z)+  , (OpSqrt, sqrt)+  , (OpRecip, recip)+  , (OpMidiCps, Math.midi_to_cps)+  , (OpCpsMidi, Math.cps_to_midi)+  , (OpSin, sin)+  , (OpCos, cos)+  , (OpTan, tan)+  ]++-- | 'lookup' 'uop_hs_tbl' via 'toEnum'.+uop_special_hs :: (RealFrac n, Floating n) => Int -> Maybe (n -> n)+uop_special_hs z = lookup (toEnum z) uop_hs_tbl
+ Sound/Sc3/Common/Math/Warp.hs view
@@ -0,0 +1,145 @@+-- | A warp is a mapping from the space @[0,1]@ to a user defined space @[l,r]@.+module Sound.Sc3.Common.Math.Warp where++import Numeric {- base -}++import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++-- | A warp function is lhs -> rhs -> x -> y+type Warp_f t = t -> t -> t -> t++{- | Linear real value map.++>>> map (warp_lin 1 2) [0,1/2,1] == [1,3/2,2]+True++>>> map (warp_lin (-1) 1) [0,1/2,1] == [-1,0,1]+True+-}+warp_lin :: Fractional t => Warp_f t+warp_lin l r n = let z = r - l in n * z + l++{- | Inverse of 'warp_lin'++>>> map (warp_lin_inv 1 2) [1,3/2,2] == [0,1/2,1]+True++>>> map (warp_lin_inv (-1) 1) [-1,0,1] == [0,1/2,1]+True+-}+warp_lin_inv :: Fractional t => Warp_f t+warp_lin_inv l r n = let z = r - l in (n - l) / z++{- | The left and right must both be non zero and have the same sign.++>>> map (warp_exp 1 2) [0,0.5,1] == [1,2 ** 0.5,2]+True++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plot_p1_ln [map (warp_exp 1 2) [0,0.01 .. 1]]+-}+warp_exp :: Floating a => Warp_f a+warp_exp l r n = let z = r / l in (z ** n) * l++warp_exp_inv :: Floating a => Warp_f a+warp_exp_inv l r n = let z = r / l in logBase z (n / l)++{- | Cosine warp++> map (warp_cos 1 2) [0,0.25,0.5,0.75,1]+> plot_p1_ln [map (warp_cos 1 2) [0,0.01 .. 1]]+-}+warp_cos :: Floating t => Warp_f t+warp_cos l r n = warp_lin 0 (r - l) (0.5 - (cos (pi * n) / 2))++warp_cos_inv :: Floating a => Warp_f a+warp_cos_inv l r n = acos (1.0 - (warp_lin_inv 0 (r - l) n * 2)) / pi++{- | Sine warp++> map (warp_sin 1 2) [0,0.25,0.5,0.75,1]+> plot_p1_ln [map (warp_sin 1 2) [0,0.01 .. 1]]+-}+warp_sin :: Floating t => Warp_f t+warp_sin l r n = warp_lin 0 (r - l) (sin (pi * 0.5 * n))++warp_sin_inv :: Floating t => Warp_f t+warp_sin_inv l r n = asin (warp_lin_inv 0 (r - l) n) / (pi / 2)++{- | Fader warp.  Left and right values are ordinarily zero and one.++> map (warp_amp 0 1) [0,0.5,1] == [0,0.25,1]++> plot_p1_ln [map (warp_amp 0 2) [0,0.01 .. 1]]+> plot_p1_ln [map (warp_amp_inv 0 1 . warp_amp 0 1) [0,0.01 .. 1]]+-}+warp_amp :: Num a => Warp_f a+warp_amp l r n = (n * n) * (r - l) + l++warp_amp_inv :: Floating a => Warp_f a+warp_amp_inv l r n = sqrt ((n - l) / (r - l))++{- | DB fader warp. Left and right values are ordinarily negative+infinity and zero.  An input of @0@ gives @-180@.++> map (round . warp_db (-180) 0) [0,0.5,1] == [-180,-12,0]++> plot_p1_ln [map (warp_db (-60) 0) [0,0.01 .. 1]]+> plot_p1_ln [map (warp_db_inv 0 60) [0 .. 60]]+-}+warp_db :: (Eq a, Floating a) => Warp_f a+warp_db l r n =+  let n' = if n == 0 then -180 else Math.amp_to_db (n * n)+  in Math.sc3_linlin n' (-180) 0 l r++warp_db_inv :: Floating a => Warp_f a+warp_db_inv l r n = sqrt (Math.db_to_amp (Math.sc3_linlin n l r (-180) 0))++{- | A curve warp given by a real /n/.++> warp_curve (-3) 1 2 0.25 == 1.5552791692202022+> warp_curve (-3) 1 2 0.50 == 1.8175744761936437++> plot_p1_ln [map (warp_curve (-3) 1 2) [0,0.01 .. 1]]+> plot_p1_ln (map (\c -> map (warp_curve c 1 2) [0,0.01 .. 1]) [0,3,6,9])+> plot_p1_ln [map (warp_curve_inv 7 20 20000 . warp_curve 7 20 20000) [0,0.01 .. 1]]+-}+warp_curve :: (Ord a, Floating a) => a -> Warp_f a+warp_curve k l r n =+  if abs k < 0.001+    then warp_lin l r n+    else+      let e = exp k+          a = (r - l) / (1 - e)+          b = l + a+      in b - ((e ** n) * a)++warp_curve_inv :: (Ord a, Floating a) => a -> Warp_f a+warp_curve_inv k l r n =+  if abs k < 0.001+    then warp_lin l r n+    else+      let e = exp k+          a = (r - l) / (1 - e)+          b = l + a+      in log ((b - n) / a) / k++{- | Select warp functions by name.  Numerical names are interpreted as /curve/ values for 'warpCurve'.++> let Just w = warp_named "lin"+> let Just w = warp_named "-3"+> let Just w = warp_named "6"+> plot_p1_ln [map ((fst w) 1 2) [0,0.01 .. 1]]+-}+warp_named :: (Floating t, RealFrac t) => String -> Maybe (Warp_f t, Warp_f t)+warp_named nm =+  case nm of+    "lin" -> Just (warp_lin, warp_lin_inv)+    "exp" -> Just (warp_exp, warp_exp_inv)+    "sin" -> Just (warp_sin, warp_sin_inv)+    "cos" -> Just (warp_cos, warp_cos_inv)+    "amp" -> Just (warp_amp, warp_amp_inv)+    "db" -> Just (warp_db, warp_db_inv)+    _ -> case readSigned readFloat nm of+      [(c, "")] -> Just (warp_curve c, warp_curve_inv c)+      _ -> Nothing
+ Sound/Sc3/Common/Math/Window.hs view
@@ -0,0 +1,105 @@+-- | Windowing functions.+module Sound.Sc3.Common.Math.Window where++-- * Type and conversion++-- | A function from a (0, 1) normalised input to an output.+type Window x = x -> x++-- | A discrete rendering of a 'Window'.+type Table x = [x]++{- | Format for table.+     Closed indicates the end point should be equal to the start point.+     Open indicates it should be one place short.+     Guarded indicates that an extra place should be added that closes the table, ie. the table has one place more than requested.+     When using a table with an oscillator we want an Open or Guarded table, since the point following the end point is the start point.+-}+data TableFormat = TableClosed | TableOpen | TableGuarded deriving (Eq, Show)++{- | Generate an /n/ element table from a (0, 1) normalised window function /f/.+     The cycle argument decides if the end point should be equal to the start point, or one place short.+     When using a table with an oscillator we want the latter, since the point following the end point is the start point.+-}+window_table :: (Integral n, Fractional a, Enum a) => TableFormat -> n -> Window a -> Table a+window_table fmt n f =+  let k = 1 / (fromIntegral n - (if fmt == TableClosed then 1 else 0))+  in take (fromIntegral (if fmt == TableGuarded then n + 1 else n)) (map f [0, k ..])++-- | window_table of TableClosed.+window_table_closed :: (Integral n, Fractional a, Enum a) => n -> Window a -> Table a+window_table_closed = window_table TableClosed++-- * Math++-- | /n/ ^ 2.+square :: Num a => a -> a+square x = x * x++-- * Window functions++-- | Gaussian window, θ <= 0.5.+gaussian :: Floating a => a -> Window a+gaussian theta i = exp (-(0.5 * square ((i - 0.5) / (theta * 0.5))))++-- | Hann raised cosine window.+hann :: Floating a => Window a+hann i = 0.5 * (1 - cos (2 * pi * i))++-- | Hamming raised cosine window.+hamming :: Floating a => Window a+hamming i = 0.54 - 0.46 * cos (2 * pi * i)++-- | Unit ('id') window, also known as a Dirichlet window.+rectangular :: Window a+rectangular = id++-- | 'sin' window.+sine :: Floating a => Window a+sine i = sin (i * pi)++{- | Triangular window, ie. Bartlett window with zero end-points.++> let n = 2 ^ 7+> Sound.Sc3.Plot.plot_p1_ln (map (\fmt -> window_table fmt n triangular) [TableClosed, TableOpen])+> Sound.Sc3.Plot.plot_p1_ln (map (\fmt -> window_table fmt n triangular) [TableClosed, TableGuarded])+-}+triangular :: Fractional a => Window a+triangular i = 2 * (0.5 - abs (i - 0.5))++-- * Tables++{- | 'window_table_closed' . 'gaussian'.++> Sound.Sc3.Plot.plot_p1_ln [gaussian_table 1024 0.25, gaussian_table 1024 0.5]+-}+gaussian_table :: (Integral n, Floating b, Enum b) => n -> b -> [b]+gaussian_table n = window_table_closed n . gaussian++{- | 'window_table_closed' . 'hamming'.++> Sound.Sc3.Plot.plot_p1_ln [hann_table 128, hamming_table 128]+-}+hamming_table :: Int -> [Double]+hamming_table n = window_table_closed n hamming++{- | 'window_table_closed' . 'hann'.++> Sound.Sc3.Plot.plot_p1_ln [hann_table (2 ^ 7)]+-}+hann_table :: Int -> [Double]+hann_table n = window_table_closed n hann++{- | 'window_table_closed' . 'sine'.++> Sound.Sc3.Plot.plot_p1_ln [sine_table (2 ^ 7)]+-}+sine_table :: (Integral n, Floating b, Enum b) => n -> [b]+sine_table n = window_table_closed n sine++{- | 'window_table_closed' . 'triangular'.++> Sound.Sc3.Plot.plot_p1_ln [triangular_table (2 ^ 8)]+-}+triangular_table :: (Integral n, Fractional b, Enum b) => n -> [b]+triangular_table n = window_table_closed n triangular
+ Sound/Sc3/Common/Mce.hs view
@@ -0,0 +1,174 @@+-- | The Sc3 multiple channel expansion (Mce) rules over an abstract type.+module Sound.Sc3.Common.Mce where++import qualified Sound.Sc3.Common.Base {- hsc3 -}++{- | Multiple channel expansion.+The Mce type is a tree, however in hsc3 Mce_Vector will always hold Mce_Scalar elements.+-}+data Mce t = Mce_Scalar t | Mce_Vector [Mce t]+  deriving (Ord, Eq, Read, Show)++{- | There are two invariants:+1. Mce should not be empty, ie. Mce_Vector should not have a null list.+2. Scalar Mce values should not be written as one-place vectors.++>>> mce_is_well_formed (Mce_Vector [])+False++>>> mce_is_well_formed (Mce_Vector [Mce_Scalar 1])+False+-}+mce_is_well_formed :: Mce t -> Bool+mce_is_well_formed m =+  case m of+    Mce_Scalar _ -> True+    Mce_Vector v -> length v > 1 && all mce_is_well_formed v++-- | Is Mce scalar.+mce_is_scalar :: Mce t -> Bool+mce_is_scalar m =+  case m of+    Mce_Scalar _ -> True+    _ -> False++-- | fromList for Mce, generates well-formed Mce.+mce_from_list :: [t] -> Mce t+mce_from_list l =+  case l of+    [] -> error "mce_from_list: null?"+    [e] -> Mce_Scalar e+    _ -> Mce_Vector (map Mce_Scalar l)++{- | toList for Mce.++>>> let v = Mce_Vector+>>> mce_to_list (v[v[1, 2], 3, v[4, 5]])+[1,2,3,4,5]+-}+mce_to_list :: Mce t -> [t]+mce_to_list m =+  case m of+    Mce_Scalar e -> [e]+    Mce_Vector e -> concatMap mce_to_list e++{- | Pretty printer for Mce.++>>> let v = Mce_Vector+>>> mce_show (v[1, 2, v[3, 4]] * 5 + v[6, 7, 8])+"[11, 17, [23, 28]]"+-}+mce_show :: Show t => Mce t -> String+mce_show m =+  let bracketed (l, r) x = l : x ++ [r]+  in case m of+      Mce_Scalar e -> show e+      Mce_Vector e -> bracketed ('[', ']') (Sound.Sc3.Common.Base.concat_intersperse ", " (map mce_show e))++-- | Read value from Mce_Scalar, error if Mce is Mce_Vector+mce_scalar_value :: Mce t -> t+mce_scalar_value m =+  case m of+    Mce_Scalar x -> x+    Mce_Vector _ -> error "mce_scalar_value: not Mce_Scalar"++{- | Length, or perhaps rather width, of Mce.+Considers only the outermost level, i.e. mce_length is not necessarily the length of mce_to_list.+-}+mce_length :: Mce a -> Int+mce_length m =+  case m of+    Mce_Scalar _ -> 1+    Mce_Vector e -> length e++{- | The depth of an Mce is the longest sequence of nested Mce_Vector nodes.++>>> mce_depth 1+1++>>> mce_depth (Mce_Vector [1, 2])+1++>>> let v = Mce_Vector+>>> mce_depth (v[v[1, 2], 3, v[4, 5]])+2++>>> mce_depth (v[v[1, 2, 3, v[4, 5], 6], 7])+3+-}+mce_depth :: Mce a -> Int+mce_depth m =+  case m of+    Mce_Scalar _ -> 1+    Mce_Vector v -> if all mce_is_scalar v then 1 else 1 + maximum (map mce_depth v)++{- | Extend Mce to specified degree.+Considers only the outermost level.+-}+mce_extend :: Int -> Mce t -> Mce t+mce_extend n m =+  case m of+    Mce_Scalar _ -> Mce_Vector (replicate n m)+    Mce_Vector e -> if length e > n then error "mce_extend?" else Mce_Vector (take n (cycle e))++-- | fmap for Mce, apply /f/ at elements of /m/.+mce_map :: (a -> b) -> Mce a -> Mce b+mce_map f m =+  case m of+    Mce_Scalar e -> Mce_Scalar (f e)+    Mce_Vector e -> Mce_Vector (map (mce_map f) e)++instance Functor Mce where fmap = mce_map++{- | Apply /f/ pairwise at elements of /m1/ and /m2/.+     At each level this extends the shorter of the two operands.+-}+mce_binop :: (a -> b -> c) -> Mce a -> Mce b -> Mce c+mce_binop f m1 m2 =+  case (m1, m2) of+    (Mce_Scalar e1, Mce_Scalar e2) -> Mce_Scalar (f e1 e2)+    (Mce_Scalar _, Mce_Vector e2) -> Mce_Vector (map (mce_binop f m1) e2)+    (Mce_Vector e1, Mce_Scalar _) -> Mce_Vector (map (flip (mce_binop f) m2) e1)+    (Mce_Vector e1, Mce_Vector e2) ->+      let n = max (length e1) (length e2)+          ext = take n . cycle+      in Mce_Vector (zipWith (mce_binop f) (ext e1) (ext e2))++instance Num n => Num (Mce n) where+  (+) = mce_binop (+)+  (-) = mce_binop (-)+  (*) = mce_binop (*)+  abs = mce_map abs+  negate = mce_map negate+  signum = mce_map signum+  fromInteger = Mce_Scalar . fromInteger++instance Fractional n => Fractional (Mce n) where+  (/) = mce_binop (/)+  fromRational = Mce_Scalar . fromRational++instance Floating n => Floating (Mce n) where+  pi = Mce_Scalar pi+  exp = fmap exp+  log = fmap log+  sqrt = fmap sqrt+  (**) = mce_binop (**)+  logBase = mce_binop logBase+  sin = fmap sin+  cos = fmap cos+  asin = fmap asin+  acos = fmap acos+  atan = fmap atan+  sinh = fmap sinh+  cosh = fmap cosh+  asinh = fmap asinh+  acosh = fmap acosh+  atanh = fmap atanh++{-++If Ugen is any of Functor, Foldable, Traversable, then Mce must be as well.++{-# Language DeriveFunctor, DeriveFoldable, DeriveTraversable #-}++-}
+ Sound/Sc3/Common/Monad.hs view
@@ -0,0 +1,32 @@+-- | Common 'Control.Monad' variations.+module Sound.Sc3.Common.Monad where++-- | 'sequence' of 'repeat'+repeatM :: Monad m => m t -> m [t]+repeatM = sequence . repeat++-- | This is the same function as Control.Monad.void, which however hugs does not know of.+mvoid :: Monad m => m a -> m ()+mvoid f = f >> return ()++-- | 'void' of 'repeatM'.+repeatM_ :: Monad m => m t -> m ()+repeatM_ = mvoid . repeatM++{- | Right to left compositon of 'Monad' functions.++>>> composeM [return . (+ 1),return . (* 2)] 3+7++>>> composeM [return . (* 2),return . (+ 1)] 3+8+-}+composeM :: Monad m => [a -> m a] -> a -> m a+composeM = foldr (\f g -> \x -> g x >>= f) return -- foldr (<=<) return except hugs doesn't know of <=<++{- | Feed forward composition of /n/ applications of /f/.++> fmap (== 3) (chainM 3 (return . (+ 1)) 0)+-}+chainM :: Monad m => Int -> (b -> m b) -> b -> m b+chainM n f = composeM (replicate n f)
+ Sound/Sc3/Common/Monad/Operators.hs view
@@ -0,0 +1,133 @@+-- | Functions to make writing 'Applicative' and 'Monad' Ugen graphs less clumsy.+module Sound.Sc3.Common.Monad.Operators where++infixl 7 .*, *., .*.+infixl 6 .+, +., .+.++infixl 7 ./, /., ./.+infixl 6 .-, -., .-.++{- | '+' variant with 'Functor' at left.++>>> fmap (== 5) (return 3 .+ 2)+True++>>> [3,4] .+ 2+[5,6]+-}+(.+) :: (Functor f, Num a) => f a -> a -> f a+m .+ n = fmap (+ n) m++{- | '+' variant with 'Functor' at right.++>>> fmap (== 5) (3 +. return 2)+True++>>> 3 +. [2,3]+[5,6]+-}+(+.) :: (Functor f, Num a) => a -> f a -> f a+m +. n = fmap (+ m) n++{- | '+' variant with 'Applicative' at left and right.++>>> fmap (== 5) (return 3 .+. return 2)+True++>>> [3,4] .+. [2,3]+[5,6,6,7]++>>> import Control.Applicative+>>> getZipList (ZipList [3,4] .+. ZipList [2,3])+[5,7]+-}+(.+.) :: (Applicative m, Num a) => m a -> m a -> m a+(.+.) = liftA2 (+)++{- | '*' variant with 'Functor' at left.++>>> fmap (== 6) (return 3 .* 2)+True+-}+(.*) :: (Functor f, Num a) => f a -> a -> f a+m .* n = fmap (* n) m++{- | '*' variant with 'Functor' at right.++>>> fmap (== 6) (3 *. return 2)+True+-}+(*.) :: (Functor f, Num a) => a -> f a -> f a+m *. n = fmap (* m) n++{- | '*' variant with 'Applicative' at left and right.++>>> fmap (== 6) (return 3 .*. return 2)+True+-}+(.*.) :: (Applicative m, Num a) => m a -> m a -> m a+(.*.) = liftA2 (*)++{- | '-' variant with 'Functor' at left.++>>> fmap (== 1) (return 3 .- 2)+True++>>> [3,4] .- 2+[1,2]+-}+(.-) :: (Functor f, Num a) => f a -> a -> f a+m .- n = fmap (subtract n) m++{- | '-' variant with 'Functor' at right.++>>> fmap (== 1) (3 -. return 2)+True++>>> 3 -. [2,3]+[1,0]+-}+(-.) :: (Functor f, Num a) => a -> f a -> f a+m -. n = fmap (m -) n++{- | '-' variant with 'Applicative' at left and right.++>>> fmap (== 1) (return 3 .-. return 2)+True++>>> [3,4] .-. [2,3]+[1,0,2,1]++>>> import Control.Applicative+>>> getZipList (ZipList [3,4] .-. ZipList [2,3])+[1,1]+-}+(.-.) :: (Applicative m, Num a) => m a -> m a -> m a+(.-.) = liftA2 (-)++{- | '/' variant with 'Functor' at left.++>>> fmap (== 3) (return 6 ./ 2)+True+-}+(./) :: (Functor f, Fractional a) => f a -> a -> f a+m ./ n = fmap (/ n) m++{- | '/' variant with 'Functor' at right.++>>> fmap (== 3) (6 /. return 2)+True+-}+(/.) :: (Functor f, Fractional a) => a -> f a -> f a+m /. n = fmap (m /) n++{- | '/' variant with 'Applicative' at left and right.++>>> fmap (== 3) (return 6 ./. return 2)+True++>>> [5,6] ./. [2,3] == [5/2,5/3,3,2]+True+-}+(./.) :: (Applicative m, Fractional a) => m a -> m a -> m a+(./.) = liftA2 (/)
+ Sound/Sc3/Common/Random.hs view
@@ -0,0 +1,56 @@+-- | Linear congruential generator and related utilities.  Ordinarily use System.Random.+module Sound.Sc3.Common.Random where++import Data.Bits {- base -}+import Data.Int {- base -}+import Data.Word {- base -}+import System.CPUTime {- base -}++{- | Linear congruential generator given modulo function for type.++See <http://en.wikipedia.org/wiki/Linear_congruential_generator> for possible parameters.+-}+lcg :: Num t => (t -> t) -> t -> t -> t -> t+lcg modFunc a c x0 = modFunc (a * x0 + c)++{- | 'lcg' 6364136223846793005 1442695040888963407, so in (0, 18446744073709551615)++> take 5 (iterate lcgWord64Knuth 147092873413)+> (maxBound :: Word64) == (2 ^ 64 - 1)+-}+lcgWord64Knuth :: Word64 -> Word64+lcgWord64Knuth = lcg id 6364136223846793005 1442695040888963407++{- | 'lcg' 1103515245 12345, so in (-2147483648, 2147483647)++> take 5 (iterate lcgInt32Glibc 873413)+> (minBound :: Int32,maxBound :: Int32) == (-2147483648, 2147483647)+-}+lcgInt32Glibc :: Int32 -> Int32+lcgInt32Glibc = lcg id 1103515245 12345++-- | Run getCPUTime and convert to Word64+cpuTimeSeedWord64 :: IO Word64+cpuTimeSeedWord64 = fmap (fromIntegral . flip div cpuTimePrecision) getCPUTime++-- | Run getCPUTime and convert to Int32+cpuTimeSeedInt32 :: IO Int32+cpuTimeSeedInt32 = fmap (fromIntegral . flip div cpuTimePrecision) getCPUTime++-- | Iterate lcgWord64Knuth using cpuTimeSeedWord64.+lcgWord64KnuthCpuTime :: IO [Word64]+lcgWord64KnuthCpuTime = fmap (iterate lcgWord64Knuth) cpuTimeSeedWord64++{- | Convert Word64 to Double in range (0, 1).+     Shifts input right 11 places (ie. discards 11 least significant bits) then divide by 2^53.+-}+word64ToUnitDouble :: Word64 -> Double+word64ToUnitDouble n = realToFrac (shiftR n 11) / realToFrac (shiftL (1 :: Word64) 53)++{- | word64ToUnitDouble of lcgWord64KnuthCpuTime++> x <- fmap (take 256) lcgDoubleKnuthCpuTime+> Sound.Sc3.Plot.plot_p1_ln [x]+-}+lcgDoubleKnuthCpuTime :: IO [Double]+lcgDoubleKnuthCpuTime = fmap (map word64ToUnitDouble) lcgWord64KnuthCpuTime
+ Sound/Sc3/Common/Rate.hs view
@@ -0,0 +1,92 @@+-- | Operating rate definitions and utilities.+module Sound.Sc3.Common.Rate where++import Data.Char {- base -}+import Data.Maybe {- base -}++-- | Enumeration of operating rates of unit generators.+data Rate = InitialisationRate | ControlRate | AudioRate | DemandRate+  deriving (Eq, Ord, Enum, Bounded, Show, Read)++{- | Standard abbreviations of Rate values.+ir = initialisation, kr = control, ar = audio, dr = demand.+dr sorts to the right of the fixed clock rates.++> Data.List.sort [dr,ar,kr,ir] == [ir,kr,ar,dr]+-}+ir, kr, ar, dr :: Rate+ir = InitialisationRate+kr = ControlRate+ar = AudioRate+dr = DemandRate++{- | Standard SuperCollider rate abbreviations.++> map rateAbbrev [minBound .. maxBound] == ["ir","kr","ar","dr"]+-}+rateAbbrev :: Rate -> String+rateAbbrev rt =+  fromMaybe+    (error "rateAbbrev?")+    (lookup (fromEnum rt) (zip [0 ..] (words "ir kr ar dr")))++{- | Standard SuperCollider rate abbreviations.++> map rateName [minBound .. maxBound] == ["scalar","control","audio","demand"]+-}+rateName :: Rate -> String+rateName rt =+  fromMaybe+    (error "rateName?")+    (lookup (fromEnum rt) (zip [0 ..] (words "scalar control audio demand")))++-- | Integer rate identifier, as required for scsynth bytecode.+rateId :: Rate -> Int+rateId = fromEnum++-- | Color identifiers for each 'Rate'.+rate_color :: Rate -> String+rate_color r =+  case r of+    AudioRate -> "black"+    ControlRate -> "blue"+    InitialisationRate -> "yellow"+    DemandRate -> "red"++-- | Set of all 'Rate' values.+all_rates :: [Rate]+all_rates = [minBound .. maxBound]++{- | Case insensitive parser for rate.++> Data.Maybe.mapMaybe rate_parse (words "ar kR IR Dr") == [AudioRate,ControlRate,InitialisationRate,DemandRate]+-}+rate_parse :: String -> Maybe Rate+rate_parse r =+  case map toUpper r of+    "AR" -> Just AudioRate+    "KR" -> Just ControlRate+    "IR" -> Just InitialisationRate+    "DR" -> Just DemandRate+    _ -> Nothing++-- * Control rates++{- | Enumeration of the four operating rates for controls.+I = initialisation, K = control, T = trigger, A = audio.+-}+data K_Type = K_InitialisationRate | K_ControlRate | K_TriggerRate | K_AudioRate+  deriving (Eq, Show, Ord)++-- | Determine class of control given 'Rate' and /trigger/ status.+ktype :: Rate -> Bool -> K_Type+ktype r tr =+  if tr+    then case r of+      ControlRate -> K_TriggerRate+      _ -> error "ktype: non ControlRate trigger control"+    else case r of+      InitialisationRate -> K_InitialisationRate+      ControlRate -> K_ControlRate+      AudioRate -> K_AudioRate+      DemandRate -> error "ktype: DemandRate control"
+ Sound/Sc3/Common/SoundFile.hs view
@@ -0,0 +1,133 @@+-- | Sound file functions.+module Sound.Sc3.Common.SoundFile where++import System.Environment {- base -}+import System.IO.Unsafe {- base -}+import System.Process {- process -}++import System.Directory {- directory -}+import System.FilePath {- filepath -}++import qualified Sound.Sc3.Common.Base {- hsc3 -}++{- | Find the file fn (case-sensitively) starting from dir.+Runs the system command "find" (so UNIX only).+Note that fn must be a file name not a relative path name.++> findFileFromDirectory "/home/rohan/data/audio" "metal.wav"+-}+findFileFromDirectory :: String -> String -> IO (Maybe String)+findFileFromDirectory dir fn = do+  r <- System.Process.readProcess "find" [dir, "-name", fn] ""+  case lines r of+    [] -> return Nothing+    [r0] -> return (Just r0)+    _ -> error "findFileFromDirectory: multiple files?"++{- | Find the file fn starting from dir.+If dir/fn names a file return that file, else call findFileFromDirectory.+Note this will not find dir/p/q/r given q/r, the query must be either p/q/r or r.++> findFileAtOrFromDirectory "/home/rohan/data/audio" "instr/bosendorfer/072/C5.aif"+-}+findFileAtOrFromDirectory :: String -> String -> IO (Maybe String)+findFileAtOrFromDirectory dir fn = do+  isAtDir <- doesFileExist (dir </> fn)+  if isAtDir then return (Just (dir </> fn)) else findFileFromDirectory dir fn++{- | Run findFileAtOrFromDirectory for each entry in path until the file is found, or not.++> findFileAtOrFromPath ["/home/rohan/rd/data/"] "20.2-LW+RD.flac"+-}+findFileAtOrFromPath :: [FilePath] -> FilePath -> IO (Maybe FilePath)+findFileAtOrFromPath path fn =+  case path of+    [] -> return Nothing+    dir : path' -> do+      m <- findFileAtOrFromDirectory dir fn+      case m of+        Just r -> return (Just r)+        Nothing -> findFileAtOrFromPath path' fn++-- | SFDIR environment variable.+sfDir :: IO FilePath+sfDir = getEnv "SFDIR"++-- | SFPATH environment variable.+sfPath :: IO FilePath+sfPath = getEnv "SFPATH"++{- | Find file fn at 'sfDir' directly or along 'sfPath'.+If fn is either absolute or names a relative file and if that file exists it is returned.+If sdDir/fn exists it is returned.+Else each directory at sfPath is searched (recursively) in turn.+Despite the name this will find any file type along the SFDIR and SFPATH, i.e. .sfz files &etc.++> mapM sfFindFile ["/home/rohan/data/audio/metal.wav", "pf-c5.aif", "20.2-LW+RD.flac"]+-}+sfFindFile :: FilePath -> IO (Maybe FilePath)+sfFindFile fn = do+  dir <- sfDir+  path <- fmap (Sound.Sc3.Common.Base.string_split_at_char ':') sfPath+  isFn <- doesFileExist fn+  isDir <- doesFileExist (dir </> fn)+  if isFn then return (Just fn) else if isDir then return (Just (dir </> fn)) else findFileAtOrFromPath path fn++-- | sfFindFile or error.+sfResolveFile :: FilePath -> IO FilePath+sfResolveFile fn = do+  m <- sfFindFile fn+  case m of+    Nothing -> error ("sfResolveFile: " ++ fn)+    Just r -> return r++{- | Unsafe sfResolveFile.+For resolving sound file names at read only sound file archives this is quite safe.+-}+sfResolve :: FilePath -> FilePath+sfResolve = unsafePerformIO . sfResolveFile++{- | Return the number of channels at fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfNumChannels >>= print+-}+sfNumChannels :: FilePath -> IO Int+sfNumChannels fn = fmap read (System.Process.readProcess "soxi" ["-c", fn] "")++{- | Return the sample rate of fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfSampleRate >>= print+-}+sfSampleRate :: FilePath -> IO Int+sfSampleRate fn = fmap read (System.Process.readProcess "soxi" ["-r", fn] "")++{- | Return the number of frames at fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfFrameCount >>= print+-}+sfFrameCount :: FilePath -> IO Int+sfFrameCount fn = fmap read (System.Process.readProcess "soxi" ["-s", fn] "")++{- | Return the number of channels, sample-rate and number of frames at fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfMetadata >>= print+-}+sfMetadata :: FilePath -> IO (Int, Int, Int)+sfMetadata fn = do+  nc <- sfNumChannels fn+  sr <- sfSampleRate fn+  nf <- sfFrameCount fn+  return (nc, sr, nf)++{- | Unsafe sfMetadata.+For fetching sound file information from read only sound file archives this is quite safe.++> sfInfo (sfResolve "metal.wav") == (1,44100,1029664)+> sfInfo (sfResolve "pf-c5.aif") == (2,44100,576377)+-}+sfInfo :: FilePath -> (Int, Int, Int)+sfInfo = unsafePerformIO . sfMetadata
+ Sound/Sc3/Common/Uid.hs view
@@ -0,0 +1,143 @@+{-# LANGUAGE FlexibleInstances #-}++{- | Unique identifier types and classes.+Used by non-deterministic (noise) and non-sharable (demand) unit generators.+-}+module Sound.Sc3.Common.Uid where++import Data.Functor.Identity {- base -}+import Data.List {- base -}+import qualified Data.Unique as Unique {- base -}++import qualified Control.Monad.Trans.Reader as Reader {- transformers -}+import qualified Control.Monad.Trans.State as State {- transformers -}++import qualified Data.Digest.Murmur32 as Murmur32 {- murmur-hash -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}++-- * Id & Uid++-- | Identifiers are integers.+type Id = Int++-- | A class indicating a monad (and functor and applicative) that will generate a sequence of unique integer identifiers.+class (Functor m, Applicative m, Monad m) => Uid m where+  generateUid :: m Int++-- | Requires FlexibleInstances.+instance Uid (State.StateT Int Identity) where+  generateUid = State.get >>= \n -> State.put (n + 1) >> return n++instance Uid IO where+  generateUid = fmap Unique.hashUnique Unique.newUnique++instance Uid m => Uid (Reader.ReaderT t m) where+  generateUid = Reader.ReaderT (const generateUid)++-- * Uid_St++-- | 'State.State' Uid.+type Uid_St = State.State Int++-- | Alias for 'runIdentity'.+uid_id_eval :: Identity t -> t+uid_id_eval = runIdentity++{- | 'State.evalState' with initial state of zero.++> uid_st_eval (replicateM 3 generateUid) == [0, 1, 2]+-}+uid_st_eval :: Uid_St t -> t+uid_st_eval x = State.evalState x 0++-- | Thread state through sequence of 'State.runState'.+uid_st_seq :: [Uid_St t] -> ([t], Int)+uid_st_seq =+  let swap (p, q) = (q, p)+      step_f n x = swap (State.runState x n)+  in swap . mapAccumL step_f 0++{- | 'fst' of 'uid_st_seq'.++> uid_st_seq_ (replicate 3 generateUid) == [0, 1, 2]+-}+uid_st_seq_ :: [Uid_St t] -> [t]+uid_st_seq_ = fst . uid_st_seq++-- * Lift++-- | Unary Uid lift.+liftUid1 :: Uid m => (Int -> Base.Fn1 a b) -> Base.Fn1 a (m b)+liftUid1 fn a = do+  z <- generateUid+  return (fn z a)++-- | Binary Uid lift.+liftUid2 :: Uid m => (Int -> Base.Fn2 a b c) -> Base.Fn2 a b (m c)+liftUid2 fn a b = do+  z <- generateUid+  return (fn z a b)++-- | Ternary Uid lift.+liftUid3 :: Uid m => (Int -> Base.Fn3 a b c d) -> Base.Fn3 a b c (m d)+liftUid3 fn a b c = do+  z <- generateUid+  return (fn z a b c)++-- | Quaternary Uid lift.+liftUid4 :: Uid m => (Int -> Base.Fn4 a b c d e) -> Base.Fn4 a b c d (m e)+liftUid4 fn a b c d = do+  z <- generateUid+  return (fn z a b c d)++-- | 5-parameter Uid lift.+liftUid5 :: Uid m => (Int -> Base.Fn5 a b c d e f) -> Base.Fn5 a b c d e (m f)+liftUid5 fn a b c d e = do+  z <- generateUid+  return (fn z a b c d e)++-- | 6-parameter Uid lift.+liftUid6 :: Uid m => (Int -> Base.Fn6 a b c d e f g) -> Base.Fn6 a b c d e f (m g)+liftUid6 fn a b c d e f = do+  z <- generateUid+  return (fn z a b c d e f)++-- | 10-parameter Uid lift.+liftUid10 :: Uid m => (Int -> Base.Fn10 a b c d e f g h i j k) -> Base.Fn10 a b c d e f g h i j (m k)+liftUid10 fn a b c d e f g h i j = do+  z <- generateUid+  return (fn z a b c d e f g h i j)++-- | 11-parameter Uid lift.+liftUid11 :: Uid m => (Int -> Base.Fn11 a b c d e f g h i j k l) -> Base.Fn11 a b c d e f g h i j k (m l)+liftUid11 fn a b c d e f g h i j k = do+  z <- generateUid+  return (fn z a b c d e f g h i j k)++-- * ID++{- | Typeclass to constrain Ugen identifiers.+Char inputs are hashed to generate longer seeds for when ir (constant) random Ugens are optimised.++> map resolveID [0::Int,1] == [0, 1]+> map resolveID ['α', 'β'] == [1439603815, 4131151318]+> map resolveID [('α', 'β'),('β', 'α')] == [3538183581, 3750624898]+> map resolveID [('α',('α', 'β')),('β',('α', 'β'))] == [0020082907, 2688286317]+> map resolveID [('α', 'α', 'β'),('β', 'α', 'β')] == [0020082907, 2688286317]+-}+class Murmur32.Hashable32 a => ID a where+  resolveID :: a -> Id+  resolveID = fromIntegral . Murmur32.asWord32 . Murmur32.hash32++instance ID Char+instance ID Int where resolveID = id+instance (ID p, ID q) => ID (p, q)+instance (ID p, ID q, ID r) => ID (p, q, r)++{- | /n/ identifiers from /x/.++> id_seq 10 'α' == [1439603815 .. 1439603824]+-}+id_seq :: ID a => Int -> a -> [Id]+id_seq n x = take n [resolveID x ..]
+ Sound/Sc3/Common/Unsafe.hs view
@@ -0,0 +1,58 @@+-- | Unsafe variants of monadic functions.+module Sound.Sc3.Common.Unsafe where++import System.IO.Unsafe {- base -}++-- * Lift++-- | Lift monadic r to unsafe form.+liftUnsafe0 :: (IO r) -> (x -> r)+liftUnsafe0 fn _ = unsafePerformIO fn++-- | Lift monadic r to unsafe form.+liftUnsafe1 :: (a -> IO r) -> (a -> r)+liftUnsafe1 fn = unsafePerformIO . fn++-- | Lift monadic r to unsafe form.+liftUnsafe2 :: (a -> b -> IO r) -> (a -> b -> r)+liftUnsafe2 fn a = unsafePerformIO . fn a++-- | Lift monadic r to unsafe form.+liftUnsafe3 :: (a -> b -> c -> IO r) -> (a -> b -> c -> r)+liftUnsafe3 fn a b = unsafePerformIO . fn a b++-- | Lift monadic r to unsafe form.+liftUnsafe4 :: (a -> b -> c -> d -> IO r) -> (a -> b -> c -> d -> r)+liftUnsafe4 fn a b c = unsafePerformIO . fn a b c++-- | Lift monadic r to unsafe form.+liftUnsafe5 :: (a -> b -> c -> d -> e -> IO r) -> (a -> b -> c -> d -> e -> r)+liftUnsafe5 fn a b c d = unsafePerformIO . fn a b c d++-- | Lift monadic r to unsafe form.+liftUnsafe6 :: (a -> b -> c -> d -> e -> f -> IO r) -> (a -> b -> c -> d -> e -> f -> r)+liftUnsafe6 fn a b c d e = unsafePerformIO . fn a b c d e++-- | Lift monadic r to unsafe form.+liftUnsafe7 :: (a -> b -> c -> d -> e -> f -> g -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> r)+liftUnsafe7 fn a b c d e f = unsafePerformIO . fn a b c d e f++-- | Lift monadic r to unsafe form.+liftUnsafe8 :: (a -> b -> c -> d -> e -> f -> g -> h -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> r)+liftUnsafe8 fn a b c d e f g = unsafePerformIO . fn a b c d e f g++-- | Lift monadic r to unsafe form.+liftUnsafe9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> r)+liftUnsafe9 fn a b c d e f g h = unsafePerformIO . fn a b c d e f g h++-- | Lift monadic r to unsafe form.+liftUnsafe10 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> r)+liftUnsafe10 fn a b c d e f g h i = unsafePerformIO . fn a b c d e f g h i++-- | Lift monadic r to unsafe form.+liftUnsafe11 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> r)+liftUnsafe11 fn a b c d e f g h i j = unsafePerformIO . fn a b c d e f g h i j++-- | Lift monadic r to unsafe form.+liftUnsafe12 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> r)+liftUnsafe12 fn a b c d e f g h i j k = unsafePerformIO . fn a b c d e f g h i j k
+ Sound/Sc3/Fd.hs view
@@ -0,0 +1,9 @@+{- | Composite of "Sound.Sc3.Common", "Sound.Sc3.Server.Fd",+  "Sound.Sc3.Ugen" and "Sound.Sc3.Ugen.Bindings".+-}+module Sound.Sc3.Fd (module M) where++import Sound.Sc3.Common as M+import Sound.Sc3.Server.Fd as M+import Sound.Sc3.Ugen as M+import Sound.Sc3.Ugen.Bindings as M
+ Sound/Sc3/Server.hs view
@@ -0,0 +1,16 @@+{- | Collection of modules for communicating with the SuperCollider+synthesis server, see also "Sound.Sc3.Server.FD" and+"Sound.Sc3.Server.Monad".+-}+module Sound.Sc3.Server (module S) where++import Sound.Sc3.Server.Command as S+import Sound.Sc3.Server.Enum as S+import Sound.Sc3.Server.Nrt as S+import Sound.Sc3.Server.Nrt.Edit as S+import Sound.Sc3.Server.Nrt.Render as S+import Sound.Sc3.Server.Param as S+import Sound.Sc3.Server.Recorder as S+import Sound.Sc3.Server.Scsynth as S+import Sound.Sc3.Server.Status as S+import Sound.Sc3.Server.Synthdef as S
+ Sound/Sc3/Server/Command.hs view
@@ -0,0 +1,6 @@+-- | Collection of standard /command/ modules.+module Sound.Sc3.Server.Command (module S) where++import Sound.Sc3.Server.Command.Completion as S+import Sound.Sc3.Server.Command.Enum as S+import Sound.Sc3.Server.Command.Plain as S
+ Sound/Sc3/Server/Command/Completion.hs view
@@ -0,0 +1,26 @@+-- | Modify existing message to include completion message+module Sound.Sc3.Server.Command.Completion where++import Sound.Osc.Core {- hosc -}++import qualified Sound.Sc3.Server.Command.Enum as Server.Command.Enum {- hsc3 -}++-- | Add a completion packet to an existing asynchronous command.+with_completion_packet :: Message -> PacketOf Message -> Message+with_completion_packet (Message c xs) cm =+  if c `elem` Server.Command.Enum.async_cmds+    then+      let xs' = xs ++ [Blob (encodePacket cm)]+      in Message c xs'+    else error ("with_completion_packet: not async: " ++ c)++{- | Add a completion message to an existing asynchronous command.++>>> import Sound.Sc3.Server.Command.Plain+>>> let m = n_set1 0 "0" 0+>>> let e = encodeMessage m+>>> withCm (b_close 0) m == Message "/b_close" [Int32 0,Blob e]+True+-}+withCm :: Message -> Message -> Message+withCm m cm = with_completion_packet m (Packet_Message cm)
+ Sound/Sc3/Server/Command/Enum.hs view
@@ -0,0 +1,165 @@+-- | Enumeration of SC3 server commands.+module Sound.Sc3.Server.Command.Enum where++import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Sound.Osc.Packet as Osc {- hosc -}++-- | SC3 server commands are strings.+type SC3_Command = String++-- | Enumerate server command numbers.+sc3_cmd_enumeration :: [(SC3_Command, Int)]+sc3_cmd_enumeration =+  [ ("/notify", 1)+  , ("/status", 2)+  , ("/quit", 3)+  , ("/cmd", 4)+  , -- /d = synthdef+    ("/d_recv", 5)+  , ("/d_load", 6)+  , ("/d_loadDir", 7)+  , ("/d_freeAll", 8)+  , -- /s = synth+    ("/s_new", 9)+  , -- /n = node+    ("/n_trace", 10)+  , ("/n_free", 11)+  , ("/n_run", 12)+  , ("/n_cmd", 13)+  , ("/n_map", 14)+  , ("/n_set", 15)+  , ("/n_setn", 16)+  , ("/n_fill", 17)+  , ("/n_before", 18)+  , ("/n_after", 19)+  , -- /u = ugen+    ("/u_cmd", 20)+  , -- /g = group+    ("/g_new", 21)+  , ("/g_head", 22)+  , ("/g_tail", 23)+  , ("/g_freeAll", 24)+  , -- /c = control+    ("/c_set", 25)+  , ("/c_setn", 26)+  , ("/c_fill", 27)+  , -- /b = buffer+    ("/b_alloc", 28)+  , ("/b_allocRead", 29)+  , ("/b_read", 30)+  , ("/b_write", 31)+  , ("/b_free", 32)+  , ("/b_close", 33)+  , ("/b_zero", 34)+  , ("/b_set", 35)+  , ("/b_setn", 36)+  , ("/b_fill", 37)+  , ("/b_gen", 38)+  , --+    ("/dumpOSC", 39)+  , -- _get+    ("/c_get", 40)+  , ("/c_getn", 41)+  , ("/b_get", 42)+  , ("/b_getn", 43)+  , ("/s_get", 44)+  , ("/s_getn", 45)+  , -- _query+    ("/n_query", 46)+  , ("/b_query", 47)+  , --+    ("/n_mapn", 48)+  , ("/s_noid", 49)+  , --+    ("/g_deepFree", 50)+  , ("/clearSched", 51)+  , --+    ("/sync", 52)+  , --+    ("/d_free", 53)+  , -- _channel+    ("/b_allocReadChannel", 54)+  , ("/b_readChannel", 55)+  , -- _tree+    ("/g_dumpTree", 56)+  , ("/g_queryTree", 57)+  , -- error+    ("/error", 58)+  , -- _args+    ("/s_newargs", 59)+  , --+    ("/n_mapa", 60)+  , ("/n_mapan", 61)+  , ("/n_order", 62)+  ]++{- | Lookup command number in 'sc3_cmd_enumeration'.++>>> map sc3_cmd_number ["/b_alloc","/s_new"]+[Just 28,Just 9]+-}+sc3_cmd_number :: SC3_Command -> Maybe Int+sc3_cmd_number = flip lookup sc3_cmd_enumeration++-- | 'isJust' of 'sc3_cmd_number'.+known_sc3_cmd :: SC3_Command -> Bool+known_sc3_cmd = isJust . sc3_cmd_number++-- | List of asynchronous server commands, ie. commands that reply with @/done@.+async_cmds :: [SC3_Command]+async_cmds =+  [ "/b_alloc"+  , "/b_allocRead"+  , "/b_allocReadChannel"+  , "/b_close"+  , "/b_free"+  , "/b_read"+  , "/b_readChannel"+  , "/b_write"+  , "/b_zero"+  , "/d_load"+  , "/d_loadDir"+  , "/d_recv"+  , "/notify"+  , "/quit"+  , "/sync"+  ]++{- | 'True' if 'Message' is an asynchronous 'Message'.++> import Sound.Sc3.Server.Command.Plain+> map isAsync [b_close 0,n_set1 0 "0" 0,status] == [True,False,False]+-}+isAsync :: Osc.Message -> Bool+isAsync (Osc.Message a _) = a `elem` async_cmds++{- | Asynchronous commands are at the left.+This function should preserve the ordering of both branches.++> partition_async [b_close 0,n_set1 0 "0" 0]+-}+partition_async :: [Osc.Message] -> ([Osc.Message], [Osc.Message])+partition_async = partition isAsync++-- | Types & names for @b_info@ message fields.+b_info_fields :: [(String, String)]+b_info_fields =+  [ ("int", "buffer-id")+  , ("int", "frame-count")+  , ("int", "channels-count")+  , ("float", "sample-rate")+  ]++-- | Type, name and value descriptors for fields of @n_info@ message.+n_info_fields :: [(String, String, String)]+n_info_fields =+  [ ("int", "node-id", "")+  , ("int", "parent group-id", "-1 = nil")+  , ("int", "previous node-id", "-1 = nil")+  , ("int", "next node-id", "-1 = nil")+  , ("int", "node-type", "0 = synth,1 = group")+  , ("int", "head node-id", "-1 = nil")+  , ("int", "tail node-id", "-1 = nil")+  ]
+ Sound/Sc3/Server/Command/Generic.hs view
@@ -0,0 +1,560 @@+-- | Generic constructors for the command set implemented by the SuperCollider synthesis server.+module Sound.Sc3.Server.Command.Generic where++import Data.List {- base -}+import Data.Maybe {- base -}++import Sound.Osc.Core {- hosc -}++import qualified Sound.Sc3.Common.Base as Common.Base+import qualified Sound.Sc3.Server.Command.Completion as Server.Command.Completion+import qualified Sound.Sc3.Server.Enum as Server.Enum+import qualified Sound.Sc3.Server.Graphdef as Server.Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Server.Graphdef+import qualified Sound.Sc3.Server.Synthdef as Server.Synthdef++cmd_check_arg :: String -> (t -> Bool) -> t -> t+cmd_check_arg e f x = if not (f x) then error e else x++-- * Buffer commands (b_)++-- | Buf-Num must be >= 0+b_bufnum :: Integral t => t -> Datum+b_bufnum = int32 . cmd_check_arg "buffer-number < 0?" (>= 0)++-- | Buf-Frame-Ix must be >= 0+b_ix :: Integral t => t -> Datum+b_ix = int32 . cmd_check_arg "buffer-ix < 0?" (>= 0)++-- | Buf-Channel must be >= 0+b_ch :: Integral t => t -> Datum+b_ch = int32 . cmd_check_arg "buffer-channel < 0?" (>= 0)++-- | Buf-Frame-Cnt must be >= 0+b_size :: Integral t => t -> Datum+b_size = int32 . cmd_check_arg "buffer-size < 0?" (>= 0)++-- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)+b_alloc :: Integral i => i -> i -> i -> Message+b_alloc b frames channels = message "/b_alloc" [b_bufnum b, b_size frames, int32 channels]++-- | Allocate buffer space and read a sound file. (Asynchronous)+b_allocRead :: Integral i => i -> String -> i -> i -> Message+b_allocRead bufferNumber fileName startFrame frameCount =+  message+    "/b_allocRead"+    [ b_bufnum bufferNumber+    , string fileName+    , b_ix startFrame+    , b_ix frameCount+    ]++-- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)+b_allocReadChannel :: Integral i => i -> String -> i -> i -> [i] -> Message+b_allocReadChannel bufferNumber fileName startFrame frameCount channels =+  message+    "/b_allocReadChannel"+    ( [ b_bufnum bufferNumber+      , string fileName+      , b_ix startFrame+      , b_ix frameCount+      ]+        ++ map b_ch channels+    )++-- | Close attached soundfile and write header information. (Asynchronous)+b_close :: Integral i => i -> Message+b_close b = message "/b_close" [b_bufnum b]++-- | Fill ranges of sample values.+b_fill :: (Integral i, Real n) => i -> [(i, i, n)] -> Message+b_fill b l = message "/b_fill" (b_bufnum b : Common.Base.mk_triples int32 int32 float l)++-- | Free buffer data. (Asynchronous)+b_free :: Integral i => i -> Message+b_free b = message "/b_free" [b_bufnum b]++-- | Call a command to fill a buffer.  (Asynchronous)+b_gen :: Integral i => i -> String -> [Datum] -> Message+b_gen b name arg = message "/b_gen" (b_bufnum b : string name : arg)++-- | Call @sine1@ 'b_gen' command.+b_gen_sine1 :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [n] -> Message+b_gen_sine1 z f n = b_gen z "sine1" (int32 (Server.Enum.b_gen_flag f) : map float n)++-- | Call @sine2@ 'b_gen' command.+b_gen_sine2 :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [(n, n)] -> Message+b_gen_sine2 z f n = b_gen z "sine2" (int32 (Server.Enum.b_gen_flag f) : Common.Base.mk_duples float float n)++-- | Call @sine3@ 'b_gen' command.+b_gen_sine3 :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [(n, n, n)] -> Message+b_gen_sine3 z f n = b_gen z "sine3" (int32 (Server.Enum.b_gen_flag f) : Common.Base.mk_triples float float float n)++-- | Call @cheby@ 'b_gen' command.+b_gen_cheby :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [n] -> Message+b_gen_cheby z f n = b_gen z "cheby" (int32 (Server.Enum.b_gen_flag f) : map float n)++-- | Call @copy@ 'b_gen' command.+b_gen_copy :: Integral i => i -> i -> i -> i -> Maybe i -> Message+b_gen_copy dst_b dst_ix src_b src_ix nf =+  let nf' = fromMaybe (-1) nf+  in b_gen dst_b "copy" (map int32 [dst_ix, src_b, src_ix, nf'])++-- | Get sample values.+b_get :: Integral i => i -> [i] -> Message+b_get b i = message "/b_get" (b_bufnum b : map int32 i)++-- | Get ranges of sample values.+b_getn :: Integral i => i -> [(i, i)] -> Message+b_getn b l = message "/b_getn" (b_bufnum b : Common.Base.mk_duples b_ix b_size l)++-- | Request \/b_info messages.+b_query :: Integral i => [i] -> Message+b_query = message "/b_query" . map int32++{- | Read sound file data into an existing buffer. (Asynchronous)+     Param: bufId pathName startFrame numFrames bufFrame leaveOpen+-}+b_read :: Integral i => i -> String -> i -> i -> i -> Bool -> Message+b_read bufId pathName startFrame numFrames bufFrame leaveOpen =+  message "/b_read" [b_bufnum bufId, string pathName, int32 startFrame, int32 numFrames, int32 bufFrame, int32 (fromEnum leaveOpen)]++-- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)+b_readChannel :: Integral i => i -> String -> i -> i -> i -> Bool -> [i] -> Message+b_readChannel b p f n f' z cs = message "/b_readChannel" ([b_bufnum b, string p, int32 f, int32 n, int32 f', int32 (fromEnum z)] ++ map int32 cs)++-- | Set sample values.+b_set :: (Integral i, Real n) => i -> [(i, n)] -> Message+b_set b l = message "/b_set" (b_bufnum b : Common.Base.mk_duples int32 float l)++-- | Set ranges of sample values.+b_setn :: (Integral i, Real n) => i -> [(i, [n])] -> Message+b_setn b l =+  let f (i, d) = int32 i : int32 (length d) : map float d+  in message "/b_setn" (b_bufnum b : concatMap f l)++-- | Write sound file data. (Asynchronous)+b_write :: Integral i => i -> String -> Server.Enum.SoundFileFormat -> Server.Enum.SampleFormat -> i -> i -> Bool -> Message+b_write b p h t f s z =+  let h' = string (Server.Enum.soundFileFormatString h)+      t' = string (Server.Enum.sampleFormatString t)+  in message "/b_write" [b_bufnum b, string p, h', t', int32 f, int32 s, int32 (fromEnum z)]++-- | Zero sample data. (Asynchronous)+b_zero :: Integral i => i -> Message+b_zero b = message "/b_zero" [b_bufnum b]++-- * Control bus commands (c_)++-- |  Fill ranges of bus values.+c_fill :: (Integral i, Real n) => [(i, i, n)] -> Message+c_fill = message "/c_fill" . Common.Base.mk_triples int32 int32 float++-- | Get bus values.+c_get :: Integral i => [i] -> Message+c_get = message "/c_get" . map int32++-- | Get ranges of bus values.+c_getn :: Integral i => [(i, i)] -> Message+c_getn = message "/c_getn" . Common.Base.mk_duples int32 int32++-- | Set bus values.+c_set :: (Integral i, Real n) => [(i, n)] -> Message+c_set = message "/c_set" . Common.Base.mk_duples int32 float++-- | Set ranges of bus values.+c_setn :: (Integral i, Real n) => [(i, [n])] -> Message+c_setn l =+  let f (i, d) = int32 i : int32 (length d) : map float d+  in message "/c_setn" (concatMap f l)++-- * Instrument definition commands (d_)++-- | Install a bytecode instrument definition. (Asynchronous)+d_recv_bytes :: Blob -> Message+d_recv_bytes b = message "/d_recv" [Blob b]++-- | Graphdef encoding variant.+d_recv_gr :: Server.Graphdef.Graphdef -> Message+d_recv_gr = d_recv_bytes . Server.Graphdef.encode_graphdef++-- | Synthdef encoding variant.+d_recv :: Server.Synthdef.Synthdef -> Message+d_recv = d_recv_bytes . Server.Synthdef.synthdefData++-- | Load an instrument definition from a named file. (Asynchronous)+d_load :: String -> Message+d_load p = message "/d_load" [string p]++-- | Load a directory of instrument definitions files. (Asynchronous)+d_loadDir :: String -> Message+d_loadDir p = message "/d_loadDir" [string p]++-- | Remove definition once all nodes using it have ended.+d_free :: [String] -> Message+d_free = message "/d_free" . map string++-- * Group node commands (g_)++-- | Free all synths in this group and all its sub-groups.+g_deepFree :: Integral i => [i] -> Message+g_deepFree = message "/g_deepFree" . map int32++-- | Delete all nodes in a group.+g_freeAll :: Integral i => [i] -> Message+g_freeAll = message "/g_freeAll" . map int32++-- | Add node to head of group.+g_head :: Integral i => [(i, i)] -> Message+g_head = message "/g_head" . Common.Base.mk_duples int32 int32++-- | Create a new group.+g_new :: Integral i => [(i, Server.Enum.AddAction, i)] -> Message+g_new = message "/g_new" . Common.Base.mk_triples int32 (int32 . fromEnum) int32++-- | Add node to tail of group.+g_tail :: Integral i => [(i, i)] -> Message+g_tail = message "/g_tail" . Common.Base.mk_duples int32 int32++-- | Post a representation of a group's node subtree, optionally including the current control values for synths.+g_dumpTree :: Integral i => [(i, Bool)] -> Message+g_dumpTree = message "/g_dumpTree" . Common.Base.mk_duples int32 (int32 . fromEnum)++{- | Request a representation of a group's node subtree, optionally including the current control values for synths.++Replies to the sender with a @/g_queryTree.reply@ message listing all of the nodes contained within the group in the following format:++@+int32 - if synth control values are included 1, else 0+int32 - node ID of the requested group+int32 - number of child nodes contained within the requested group++For each node in the subtree:+[+  int32 - node ID+  int32 - number of child nodes contained within this node. If -1 this is a synth, if >= 0 it's a group.++  If this node is a synth:+    symbol - the SynthDef name for this node.++  If flag (see above) is true:+    int32 - numControls for this synth (M)+    [+      symbol or int: control name or index+      float or symbol: value or control bus mapping symbol (e.g. 'c1')+    ] * M+] * the number of nodes in the subtree+@+N.b. The order of nodes corresponds to their execution order on the server. Thus child nodes (those contained within a group) are listed immediately following their parent.+-}+g_queryTree :: Integral i => [(i, Bool)] -> Message+g_queryTree = message "/g_queryTree" . Common.Base.mk_duples int32 (int32 . fromEnum)++-- * Node commands (n_)++-- | Node-Id must be >= -1+n_id :: Integral t => t -> Datum+n_id = int32 . cmd_check_arg "node-id < -1?" (>= (-1))++-- | Place a node after another.+n_after :: Integral i => [(i, i)] -> Message+n_after = message "/n_after" . Common.Base.mk_duples n_id n_id++-- | Place a node before another.+n_before :: Integral i => [(i, i)] -> Message+n_before = message "/n_before" . Common.Base.mk_duples int32 int32++-- | Fill ranges of a node's control values.+n_fill :: (Integral i, Real f) => i -> [(String, i, f)] -> Message+n_fill n l = message "/n_fill" (n_id n : Common.Base.mk_triples string int32 float l)++-- | Delete a node.+n_free :: Integral i => [i] -> Message+n_free = message "/n_free" . map n_id++n_map :: Integral i => i -> [(String, i)] -> Message+n_map n l = message "/n_map" (n_id n : Common.Base.mk_duples string int32 l)++{- | Map a node's controls to read from buses.+  n_mapn only works if the control is given as an index and not as a name (3.8.0).+-}+n_mapn :: Integral i => i -> [(i, i, i)] -> Message+n_mapn n l = message "/n_mapn" (n_id n : Common.Base.mk_triples int32 int32 int32 l)++-- | Map a node's controls to read from an audio bus.+n_mapa :: Integral i => i -> [(String, i)] -> Message+n_mapa n l = message "/n_mapa" (n_id n : Common.Base.mk_duples string int32 l)++-- | Map a node's controls to read from audio buses.+n_mapan :: Integral i => i -> [(String, i, i)] -> Message+n_mapan n l = message "/n_mapan" (n_id n : Common.Base.mk_triples string int32 int32 l)++-- | Get info about a node.+n_query :: Integral i => [i] -> Message+n_query = message "/n_query" . map n_id++-- | Turn node on or off.+n_run :: Integral i => [(i, Bool)] -> Message+n_run = message "/n_run" . Common.Base.mk_duples n_id (int32 . fromEnum)++-- | Set a node's control values.+n_set :: (Integral i, Real n) => i -> [(String, n)] -> Message+n_set n c = message "/n_set" (n_id n : Common.Base.mk_duples string float c)++{- | Set ranges of a node's control values.+n_mapn and n_setn only work if the control is given as an index and not as a name.+-}+n_setn :: (Integral i, Real n) => i -> [(i, [n])] -> Message+n_setn n l =+  let f (s, d) = int32 s : int32 (length d) : map float d+  in message "/n_setn" (n_id n : concatMap f l)++-- | Trace a node.+n_trace :: Integral i => [i] -> Message+n_trace = message "/n_trace" . map int32++-- | Move an ordered sequence of nodes.+n_order :: Integral i => Server.Enum.AddAction -> i -> [i] -> Message+n_order a n ns = message "/n_order" (int32 (fromEnum a) : int32 n : map int32 ns)++-- * Par commands (p_)++-- | Create a new parallel group (supernova specific).+p_new :: Integral i => [(i, Server.Enum.AddAction, i)] -> Message+p_new = message "/p_new" . Common.Base.mk_triples int32 (int32 . fromEnum) int32++-- * Synthesis node commands (s_)++-- | Get control values.+s_get :: Integral i => i -> [String] -> Message+s_get n i = message "/s_get" (n_id n : map string i)++-- | Get ranges of control values.+s_getn :: Integral i => i -> [(String, i)] -> Message+s_getn n l = message "/s_getn" (n_id n : Common.Base.mk_duples string int32 l)++-- | Create a new synth.+s_new :: (Integral i, Real n) => String -> i -> Server.Enum.AddAction -> i -> [(String, n)] -> Message+s_new synthdefName nodeId addAction targetId controlValues =+  message+    "/s_new"+    ( string synthdefName+        : int32 nodeId+        : int32 (fromEnum addAction)+        : int32 targetId+        : Common.Base.mk_duples string float controlValues+    )++-- | Auto-reassign synth's ID to a reserved value.+s_noid :: Integral i => [i] -> Message+s_noid = message "/s_noid" . map int32++-- * Ugen commands (u_)++-- | Send a command to a unit generator.+u_cmd :: Integral i => i -> i -> String -> [Datum] -> Message+u_cmd n uid name arg = message "/u_cmd" ([n_id n, int32 uid, string name] ++ arg)++-- * Server operation commands++-- | Send a plugin command.+cmd :: String -> [Datum] -> Message+cmd name = message "/cmd" . (string name :)++-- | Remove all bundles from the scheduling queue.+clearSched :: Message+clearSched = message "/clearSched" []++-- | Select printing of incoming Open Sound Control messages.+dumpOsc :: Server.Enum.PrintLevel -> Message+dumpOsc c = message "/dumpOSC" [int32 (fromEnum c)]++-- | Set error posting scope and mode.+errorMode :: Server.Enum.ErrorScope -> Server.Enum.ErrorMode -> Message+errorMode scope mode =+  let e = case scope of+        Server.Enum.Globally -> fromEnum mode+        Server.Enum.Locally -> -1 - fromEnum mode+  in message "/error" [int32 e]++-- | Select reception of notification messages. (Asynchronous)+notify :: Bool -> Message+notify c = message "/notify" [int32 (fromEnum c)]++-- | End real time mode, close file (un-implemented).+nrt_end :: Message+nrt_end = message "/nrt_end" []++-- | Stop synthesis server.+quit :: Message+quit = message "/quit" []++-- | Request \/status.reply message.+status :: Message+status = message "/status" []++-- | Request \/synced message when all current asynchronous commands complete.+sync :: Integral i => i -> Message+sync sid = message "/sync" [int32 sid]++-- * Variants to simplify common cases++-- | Pre-allocate for b_setn1, values preceding offset are zeroed.+b_alloc_setn1 :: (Integral i, Real n) => i -> i -> [n] -> Message+b_alloc_setn1 b i xs =+  let k = i + genericLength xs+      xs' = genericReplicate i 0 ++ xs+  in Server.Command.Completion.withCm (b_alloc b k 1) (b_setn1 b 0 xs')++-- | Get ranges of sample values.+b_getn1 :: Integral i => i -> (i, i) -> Message+b_getn1 b = b_getn b . return++-- | Variant on 'b_query'.+b_query1 :: Integral i => i -> Message+b_query1 = b_query . return++-- | Set single sample value.+b_set1 :: (Integral i, Real n) => i -> i -> n -> Message+b_set1 b i x = b_set b [(i, x)]++-- | Set a range of sample values.+b_setn1 :: (Integral i, Real n) => i -> i -> [n] -> Message+b_setn1 b i xs = b_setn b [(i, xs)]++-- | Segmented variant of 'b_setn1'.+b_setn1_segmented :: (Integral i, Real n) => i -> i -> i -> [n] -> [Message]+b_setn1_segmented k b i d =+  if genericLength d < k+    then [b_setn1 b i d]+    else b_setn1 b i (genericTake k d) : b_setn1_segmented k b (i + k) (genericDrop k d)++-- | Get ranges of sample values.+c_getn1 :: Integral i => (i, i) -> Message+c_getn1 = c_getn . return++-- | Set single bus values.+c_set1 :: (Integral i, Real n) => i -> n -> Message+c_set1 i x = c_set [(i, x)]++-- | Set single range of bus values.+c_setn1 :: (Integral i, Real n) => (i, [n]) -> Message+c_setn1 = c_setn . return++-- | Turn a single node on or off.+n_run1 :: Integral i => i -> Bool -> Message+n_run1 n k = n_run [(n, k)]++-- | Set a single node control value.+n_set1 :: (Integral i, Real n) => i -> String -> n -> Message+n_set1 n k v = n_set n [(k, v)]++-- | @s_new@ with no parameters.+s_new0 :: Integral i => String -> i -> Server.Enum.AddAction -> i -> Message+s_new0 n i a t = s_new n i a t ([] :: [(String, Double)])++-- * Buffer segmentation and indices++{- | Segment a request for /m/ places into sets of at most /n/.++>>> b_segment 1024 2056+[8,1024,1024]++>>> b_segment 1 5 == replicate 5 1+True+-}+b_segment :: Integral i => i -> i -> [i]+b_segment n m =+  let (q, r) = m `quotRem` n+      s = genericReplicate q n+  in if r == 0 then s else r : s++{- | Variant of 'b_segment' that takes a starting index and returns /(index,size)/ duples.++>>> b_indices 1 5 0 == zip [0..4] (replicate 5 1)+True++>>> b_indices 1024 2056 16+[(16,8),(24,1024),(1048,1024)]+-}+b_indices :: Integral i => i -> i -> i -> [(i, i)]+b_indices n m k =+  let s = b_segment n m+      i = 0 : Common.Base.dx_d s+  in zip (map (+ k) i) s++-- * Ugen commands.++-- | Generate accumulation buffer given time-domain IR buffer and FFT size.+partConv_preparePartConv :: Integral i => i -> i -> i -> Message+partConv_preparePartConv b irb fft_size = b_gen b "PreparePartConv" (map int32 [irb, fft_size])++-- * Unpack++-- | Result is null for non-conforming data, or has five or seven elements.+unpack_n_info_datum_plain :: Num i => [Datum] -> [i]+unpack_n_info_datum_plain m =+  let to_i = fromIntegral+  in case m of+      [Int32 i1, Int32 i2, Int32 i3, Int32 i4, Int32 i5] -> [to_i i1, to_i i2, to_i i3, to_i i4, to_i i5]+      [Int32 i1, Int32 i2, Int32 i3, Int32 i4, Int32 i5, Int32 i6, Int32 i7] -> [to_i i1, to_i i2, to_i i3, to_i i4, to_i i5, to_i i6, to_i i7]+      _ -> []++unpack_n_info_plain :: Num i => Message -> [i]+unpack_n_info_plain m =+  case m of+    Message "/n_info" dat -> unpack_n_info_datum_plain dat+    _ -> []++-- | Unpack @n_info@ message.+unpack_n_info :: Num i => Message -> Maybe (i, i, i, i, i, Maybe (i, i))+unpack_n_info m =+  case unpack_n_info_plain m of+    [i1, i2, i3, i4, i5] -> Just (i1, i2, i3, i4, i5, Nothing)+    [i1, i2, i3, i4, i5, i6, i7] -> Just (i1, i2, i3, i4, i5, Just (i6, i7))+    _ -> Nothing++unpack_n_info_err :: Num i => Message -> (i, i, i, i, i, Maybe (i, i))+unpack_n_info_err = fromMaybe (error "unpack_n_info") . unpack_n_info++-- | Unpack the '/tr' messages sent by 'sendTrig'.+unpack_tr :: (Num i, Fractional f) => Message -> Maybe (i, i, f)+unpack_tr m =+  let to_i = fromIntegral+      to_f = realToFrac+  in case m of+      Message "/tr" [Int32 p, Int32 q, Float r] -> Just (to_i p, to_i q, to_f r)+      _ -> Nothing++unpack_tr_err :: (Num i, Fractional f) => Message -> (i, i, f)+unpack_tr_err = fromMaybe (error "unpack_tr") . unpack_tr++unpack_b_setn :: (Num i, Fractional f) => Message -> Maybe (i, i, i, [f])+unpack_b_setn m =+  let to_i = fromIntegral+      to_f d = case d of+        Float n -> realToFrac n+        _ -> error "unpack_b_setn: non-float data"+  in case m of+      Message "/b_setn" (Int32 p : Int32 q : Int32 r : z) -> Just (to_i p, to_i q, to_i r, map to_f z)+      _ -> Nothing++unpack_b_setn_err :: (Num i, Fractional f) => Message -> (i, i, i, [f])+unpack_b_setn_err = fromMaybe (error "unpack_b_setn") . unpack_b_setn++-- | Unpack b_info message, fields are (id,frames,channels,sample-rate).+unpack_b_info :: (Num i, Fractional f) => Message -> Maybe (i, i, i, f)+unpack_b_info m =+  let to_i = fromIntegral+      to_f = realToFrac+  in case m of+      Message "/b_info" [Int32 p, Int32 q, Int32 r, Float s] -> Just (to_i p, to_i q, to_i r, to_f s)+      _ -> Nothing++-- | Variant generating 'error'.+unpack_b_info_err :: (Num i, Fractional f) => Message -> (i, i, i, f)+unpack_b_info_err = fromMaybe (error "unpack_b_info") . unpack_b_info++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Server/Command/Plain.hs view
@@ -0,0 +1,437 @@+-- | Functions from "Sound.Sc3.Server.Command.Generic" specialised to 'Int' and 'Double'.+module Sound.Sc3.Server.Command.Plain where++import Sound.Osc.Datum (Blob, Datum {- hosc3 -})+import Sound.Osc.Packet (Message {- hosc -})++import qualified Sound.Sc3.Server.Command.Generic as G+import qualified Sound.Sc3.Server.Enum as E+import Sound.Sc3.Server.Graphdef (Graphdef)+import Sound.Sc3.Server.Synthdef (Synthdef)++-- * Types++-- | Buffer identifier (buffer number).+type Buffer_Id = Int++-- | Buffer index (frame index).+type Buffer_Ix = Int++-- | File connection flag.+type Buffer_Leave_File_Open = Bool++-- | Audio/control bus identifier (number).+type Bus_Id = Int++-- | Node identifier (number).+type Node_Id = Int++-- | Group-node identifier (number).+type Group_Id = Int++-- | Synth-node identifier (number).+type Synth_Id = Int++-- * Buffer commands (b_)++-- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)+b_alloc :: Buffer_Id -> Int -> Int -> Message+b_alloc = G.b_alloc++-- | Allocate buffer space and read a sound file. (Asynchronous)+b_allocRead :: Buffer_Id -> String -> Int -> Int -> Message+b_allocRead = G.b_allocRead++-- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)+b_allocReadChannel :: Buffer_Id -> String -> Int -> Int -> [Int] -> Message+b_allocReadChannel = G.b_allocReadChannel++-- | Close attached soundfile and write header information. (Asynchronous)+b_close :: Buffer_Id -> Message+b_close = G.b_close++-- | Fill ranges of sample values.+b_fill :: Buffer_Id -> [(Buffer_Ix, Int, Double)] -> Message+b_fill = G.b_fill++-- | Free buffer data. (Asynchronous)+b_free :: Buffer_Id -> Message+b_free = G.b_free++-- | Call a command to fill a buffer.  (Asynchronous)+b_gen :: Buffer_Id -> String -> [Datum] -> Message+b_gen = G.b_gen++-- | Get sample values.+b_get :: Buffer_Id -> [Buffer_Ix] -> Message+b_get = G.b_get++-- | Get ranges of sample values.+b_getn :: Buffer_Id -> [(Buffer_Ix, Int)] -> Message+b_getn = G.b_getn++-- | Request \/b_info messages.+b_query :: [Buffer_Id] -> Message+b_query = G.b_query++-- | Read sound file data into an existing buffer. (Asynchronous)+b_read :: Buffer_Id -> String -> Int -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> Message+b_read = G.b_read++-- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)+b_readChannel :: Buffer_Id -> String -> Int -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> [Int] -> Message+b_readChannel = G.b_readChannel++-- | Set sample values.+b_set :: Buffer_Id -> [(Buffer_Ix, Double)] -> Message+b_set = G.b_set++-- | Set ranges of sample values.+b_setn :: Buffer_Id -> [(Buffer_Ix, [Double])] -> Message+b_setn = G.b_setn++-- | Write sound file data. (Asynchronous)+b_write :: Buffer_Id -> String -> E.SoundFileFormat -> E.SampleFormat -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> Message+b_write = G.b_write++-- | Zero sample data. (Asynchronous)+b_zero :: Buffer_Id -> Message+b_zero = G.b_zero++-- * Control bus commands++-- |  Fill ranges of bus values.+c_fill :: [(Bus_Id, Int, Double)] -> Message+c_fill = G.c_fill++-- | Get bus values.+c_get :: [Bus_Id] -> Message+c_get = G.c_get++-- | Get ranges of bus values.+c_getn :: [(Bus_Id, Int)] -> Message+c_getn = G.c_getn++-- | Set bus values.+c_set :: [(Bus_Id, Double)] -> Message+c_set = G.c_set++-- | Set ranges of bus values.+c_setn :: [(Bus_Id, [Double])] -> Message+c_setn = G.c_setn++-- * Instrument definition commands (d_)++-- | Install a bytecode instrument definition. (Asynchronous)+d_recv_bytes :: Blob -> Message+d_recv_bytes = G.d_recv_bytes++-- | 'Graphdef' encoding variant.+d_recv_gr :: Graphdef -> Message+d_recv_gr = G.d_recv_gr++-- | 'Synthdef' encoding variant.+d_recv :: Synthdef -> Message+d_recv = G.d_recv++-- | Load an instrument definition from a named file. (Asynchronous)+d_load :: String -> Message+d_load = G.d_load++-- | Load a directory of instrument definitions files. (Asynchronous)+d_loadDir :: String -> Message+d_loadDir = G.d_loadDir++-- | Remove definition once all nodes using it have ended.+d_free :: [String] -> Message+d_free = G.d_free++-- * Group node commands (g_)++-- | Free all synths in this group and all its sub-groups.+g_deepFree :: [Group_Id] -> Message+g_deepFree = G.g_deepFree++-- | Delete all nodes in a set of groups.+g_freeAll :: [Group_Id] -> Message+g_freeAll = G.g_freeAll++-- | Add node to head of group.+g_head :: [(Group_Id, Node_Id)] -> Message+g_head = G.g_head++-- | Create a new group.+g_new :: [(Group_Id, E.AddAction, Node_Id)] -> Message+g_new = G.g_new++-- | Add node to tail of group.+g_tail :: [(Group_Id, Node_Id)] -> Message+g_tail = G.g_tail++-- | Post a representation of a group's node subtree, optionally including the current control values for synths.+g_dumpTree :: [(Group_Id, Bool)] -> Message+g_dumpTree = G.g_dumpTree++-- | Request a representation of a group's node subtree, optionally including the current control values for synths.+g_queryTree :: [(Group_Id, Bool)] -> Message+g_queryTree = G.g_queryTree++-- * Node commands (n_)++-- | Place a node after another.+n_after :: [(Node_Id, Node_Id)] -> Message+n_after = G.n_after++-- | Place a node before another.+n_before :: [(Node_Id, Node_Id)] -> Message+n_before = G.n_before++-- | Fill ranges of a node's control values.+n_fill :: Node_Id -> [(String, Int, Double)] -> Message+n_fill = G.n_fill++-- | Delete a node.+n_free :: [Node_Id] -> Message+n_free = G.n_free++n_map :: Node_Id -> [(String, Bus_Id)] -> Message+n_map = G.n_map++{- | Map a node's controls to read from buses.+  n_mapn only works if the control is given as an index and not as a name (3.8.0).+-}+n_mapn :: Node_Id -> [(Int, Bus_Id, Int)] -> Message+n_mapn = G.n_mapn++-- | Map a node's controls to read from an audio bus.+n_mapa :: Node_Id -> [(String, Bus_Id)] -> Message+n_mapa = G.n_mapa++-- | Map a node's controls to read from audio buses.+n_mapan :: Node_Id -> [(String, Bus_Id, Int)] -> Message+n_mapan = G.n_mapan++-- | Get info about a node.+n_query :: [Node_Id] -> Message+n_query = G.n_query++-- | Turn node on or off.+n_run :: [(Node_Id, Bool)] -> Message+n_run = G.n_run++-- | Set a node's control values.+n_set :: Node_Id -> [(String, Double)] -> Message+n_set = G.n_set++-- | Set ranges of a node's control values.+n_setn :: Node_Id -> [(Int, [Double])] -> Message+n_setn = G.n_setn++-- | Trace a node.+n_trace :: [Node_Id] -> Message+n_trace = G.n_trace++-- | Move and order a sequence of nodes.+n_order :: E.AddAction -> Node_Id -> [Node_Id] -> Message+n_order = G.n_order++-- * Par commands (p_)++-- | Create a new parallel group (supernova specific).+p_new :: [(Group_Id, E.AddAction, Node_Id)] -> Message+p_new = G.p_new++-- * Synthesis node commands (s_)++-- | Get control values.+s_get :: Synth_Id -> [String] -> Message+s_get = G.s_get++-- | Get ranges of control values.+s_getn :: Synth_Id -> [(String, Int)] -> Message+s_getn = G.s_getn++-- | Create a new synth.+s_new :: String -> Synth_Id -> E.AddAction -> Node_Id -> [(String, Double)] -> Message+s_new = G.s_new++-- | Auto-reassign synth's ID to a reserved value.+s_noid :: [Synth_Id] -> Message+s_noid = G.s_noid++-- * Unit Generator commands (u_)++-- | Send a command to a unit generator.+u_cmd :: Int -> Int -> String -> [Datum] -> Message+u_cmd = G.u_cmd++-- * Server operation commands++-- | Send a plugin command.+cmd :: String -> [Datum] -> Message+cmd = G.cmd++-- | Remove all bundles from the scheduling queue.+clearSched :: Message+clearSched = G.clearSched++-- | Select printing of incoming Open Sound Control messages.+dumpOsc :: E.PrintLevel -> Message+dumpOsc = G.dumpOsc++-- | Set error posting scope and mode.+errorMode :: E.ErrorScope -> E.ErrorMode -> Message+errorMode = G.errorMode++-- | Select reception of notification messages. (Asynchronous)+notify :: Bool -> Message+notify = G.notify++-- | End real time mode, close file (un-implemented).+nrt_end :: Message+nrt_end = G.nrt_end++-- | Stop synthesis server.+quit :: Message+quit = G.quit++-- | Request \/status.reply message.+status :: Message+status = G.status++-- | Request \/synced message when all current asynchronous commands complete.+sync :: Int -> Message+sync = G.sync++-- * Variants to simplify common cases++-- | Get ranges of sample values.+b_getn1 :: Buffer_Id -> (Buffer_Ix, Int) -> Message+b_getn1 = G.b_getn1++-- | Variant on 'b_query'.+b_query1 :: Buffer_Id -> Message+b_query1 = b_query . return++-- | Get ranges of sample values.+c_getn1 :: (Bus_Id, Int) -> Message+c_getn1 = G.c_getn1++-- | Set single bus values.+c_set1 :: Bus_Id -> Double -> Message+c_set1 = G.c_set1++-- | Set single range of bus values.+c_setn1 :: (Bus_Id, [Double]) -> Message+c_setn1 = G.c_setn1++-- | Turn a single node on or off.+n_run1 :: Node_Id -> Bool -> Message+n_run1 = G.n_run1++-- | Set a single node control value.+n_set1 :: Node_Id -> String -> Double -> Message+n_set1 = G.n_set1++-- | @s_new@ with no parameters.+s_new0 :: String -> Synth_Id -> E.AddAction -> Node_Id -> Message+s_new0 = G.s_new0++-- * Buffer segmentation and indices++{- | Segment a request for /m/ places into sets of at most /n/.++>>> b_segment 1024 2056+[8,1024,1024]++>>> b_segment 1 5 == replicate 5 1+True+-}+b_segment :: Int -> Int -> [Int]+b_segment = G.b_segment++{- | Variant of 'b_segment' that takes a starting index and returns /(index,size)/ duples.++>>> b_indices 1 5 0 == zip [0..4] (replicate 5 1)+True++>>> b_indices 1024 2056 16+[(16,8),(24,1024),(1048,1024)]+-}+b_indices :: Int -> Int -> Int -> [(Int, Int)]+b_indices = G.b_indices++-- | Call @copy@ 'b_gen' command.+b_gen_copy :: Buffer_Id -> Int -> Buffer_Id -> Int -> Maybe Int -> Message+b_gen_copy = G.b_gen_copy++-- | Call @sine1@ 'b_gen' command.+b_gen_sine1 :: Buffer_Id -> [E.B_Gen] -> [Double] -> Message+b_gen_sine1 = G.b_gen_sine1++-- | Call @sine2@ 'b_gen' command.+b_gen_sine2 :: Buffer_Id -> [E.B_Gen] -> [(Double, Double)] -> Message+b_gen_sine2 = G.b_gen_sine2++-- | Call @sine3@ 'b_gen' command.+b_gen_sine3 :: Buffer_Id -> [E.B_Gen] -> [(Double, Double, Double)] -> Message+b_gen_sine3 = G.b_gen_sine3++-- | Call @cheby@ 'b_gen' command.+b_gen_cheby :: Buffer_Id -> [E.B_Gen] -> [Double] -> Message+b_gen_cheby = G.b_gen_cheby++-- | Pre-allocate for b_setn1, values preceding offset are zeroed.+b_alloc_setn1 :: Buffer_Id -> Buffer_Ix -> [Double] -> Message+b_alloc_setn1 = G.b_alloc_setn1++-- | Set single sample value.+b_set1 :: Buffer_Id -> Buffer_Ix -> Double -> Message+b_set1 = G.b_set1++-- | Set a range of sample values.+b_setn1 :: Buffer_Id -> Buffer_Ix -> [Double] -> Message+b_setn1 = G.b_setn1++-- | Segmented variant of 'b_setn1'.+b_setn1_segmented :: Int -> Buffer_Id -> Buffer_Ix -> [Double] -> [Message]+b_setn1_segmented = G.b_setn1_segmented++-- * Ugen commands.++-- | Generate accumulation buffer given time-domain IR buffer and FFT size.+partConv_preparePartConv :: Int -> Int -> Int -> Message+partConv_preparePartConv = G.partConv_preparePartConv++-- * Unpack++unpack_n_info_plain :: Message -> [Int]+unpack_n_info_plain = G.unpack_n_info_plain++unpack_n_info :: Message -> Maybe (Int, Int, Int, Int, Int, Maybe (Int, Int))+unpack_n_info = G.unpack_n_info++unpack_n_info_err :: Message -> (Int, Int, Int, Int, Int, Maybe (Int, Int))+unpack_n_info_err = G.unpack_n_info_err++unpack_tr :: Message -> Maybe (Int, Int, Double)+unpack_tr = G.unpack_tr++unpack_tr_err :: Message -> (Int, Int, Double)+unpack_tr_err = G.unpack_tr_err++unpack_b_setn :: Message -> Maybe (Int, Int, Int, [Double])+unpack_b_setn = G.unpack_b_setn++unpack_b_setn_err :: Message -> (Int, Int, Int, [Double])+unpack_b_setn_err = G.unpack_b_setn_err++unpack_b_info :: Message -> Maybe (Int, Int, Int, Double)+unpack_b_info = G.unpack_b_info++unpack_b_info_err :: Message -> (Int, Int, Int, Double)+unpack_b_info_err = G.unpack_b_info_err++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Server/Command/Plain/Completion.hs view
@@ -0,0 +1,69 @@+{- | This module provides variations of the asynchronous server commands that+expect a /completion packet/ as the first argument. The completion packet+is executed by the server when the asynchronous command has finished. Note+that this mechanism is for synchronizing server side processes only, for+client side synchronization use @\/done@ message notification or the+@\/sync@ barrier.+-}+module Sound.Sc3.Server.Command.Plain.Completion where++import Sound.Osc.Core {- hosc -}++import Sound.Sc3.Server.Enum+import Sound.Sc3.Server.Synthdef++-- | Encode an Osc packet as an Osc blob.+encode_blob :: PacketOf Message -> Datum+encode_blob = Blob . encodePacket++-- | Install a bytecode instrument definition. (Asynchronous)+d_recv :: PacketOf Message -> Synthdef -> Message+d_recv pkt d = Message "/d_recv" [Blob (synthdefData d), encode_blob pkt]++-- | Load an instrument definition from a named file. (Asynchronous)+d_load :: PacketOf Message -> String -> Message+d_load pkt p = Message "/d_load" [string p, encode_blob pkt]++-- | Load a directory of instrument definitions files. (Asynchronous)+d_loadDir :: PacketOf Message -> String -> Message+d_loadDir pkt p = Message "/d_loadDir" [string p, encode_blob pkt]++-- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)+b_alloc :: PacketOf Message -> Int -> Int -> Int -> Message+b_alloc pkt nid frames channels = Message "/b_alloc" [int32 nid, int32 frames, int32 channels, encode_blob pkt]++-- | Allocate buffer space and read a sound file. (Asynchronous)+b_allocRead :: PacketOf Message -> Int -> String -> Int -> Int -> Message+b_allocRead pkt nid p f n = Message "/b_allocRead" [int32 nid, string p, int32 f, int32 n, encode_blob pkt]++-- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)+b_allocReadChannel :: PacketOf Message -> Int -> String -> Int -> Int -> [Int] -> Message+b_allocReadChannel pkt nid p f n cs = Message "/b_allocReadChannel" ([int32 nid, string p, int32 f, int32 n] ++ map int32 cs ++ [encode_blob pkt])++-- | Free buffer data. (Asynchronous)+b_free :: PacketOf Message -> Int -> Message+b_free pkt nid = Message "/b_free" [int32 nid, encode_blob pkt]++-- | Close attached soundfile and write header information. (Asynchronous)+b_close :: PacketOf Message -> Int -> Message+b_close pkt nid = Message "/b_close" [int32 nid, encode_blob pkt]++-- | Read sound file data into an existing buffer. (Asynchronous)+b_read :: PacketOf Message -> Int -> String -> Int -> Int -> Int -> Bool -> Message+b_read pkt nid p f n f' z = Message "/b_read" [int32 nid, string p, int32 f, int32 n, int32 f', int32 (fromEnum z), encode_blob pkt]++-- | Read sound file data into an existing buffer. (Asynchronous)+b_readChannel :: PacketOf Message -> Int -> String -> Int -> Int -> Int -> Bool -> [Int] -> Message+b_readChannel pkt nid p f n f' z cs = Message "/b_readChannel" ([int32 nid, string p, int32 f, int32 n, int32 f', int32 (fromEnum z)] ++ map int32 cs ++ [encode_blob pkt])++-- | Write sound file data. (Asynchronous)+b_write :: PacketOf Message -> Int -> String -> SoundFileFormat -> SampleFormat -> Int -> Int -> Bool -> Message+b_write pkt nid p h t f s z = Message "/b_write" [int32 nid, string p, string (soundFileFormatString h), string (sampleFormatString t), int32 f, int32 s, int32 (fromEnum z), encode_blob pkt]++-- | Zero sample data. (Asynchronous)+b_zero :: PacketOf Message -> Int -> Message+b_zero pkt nid = Message "/b_zero" [int32 nid, encode_blob pkt]++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Server/Enum.hs view
@@ -0,0 +1,121 @@+-- | Server input enumerations.+module Sound.Sc3.Server.Enum where++import Data.Maybe {- base -}++{- | Enumeration of possible locations to add new nodes (s_new and g_new).++>>> fromEnum AddToTail+1+-}+data AddAction+  = AddToHead+  | AddToTail+  | AddBefore+  | AddAfter+  | AddReplace+  deriving (Eq, Show, Enum)++-- | Enumeration of flags for '/b_gen' command.+data B_Gen = Normalise | Wavetable | Clear+  deriving (Eq, Enum, Bounded, Show)++{- | 'B_Gen' to bit number.++>>> map b_gen_bit [minBound .. maxBound]+[0,1,2]+-}+b_gen_bit :: B_Gen -> Int+b_gen_bit = fromEnum++{- | Set of 'B_Gen' to flag.++>>> b_gen_flag [minBound .. maxBound]+7+-}+b_gen_flag :: [B_Gen] -> Int+b_gen_flag = sum . map ((2 ^) . b_gen_bit)++-- | Error posting scope.+data ErrorScope+  = -- | Global scope+    Globally+  | -- | Bundle scope+    Locally+  deriving (Eq, Show, Enum)++-- | Error posting mode.+data ErrorMode+  = -- | Turn error posting off+    ErrorsOff+  | -- | Turn error posting on+    ErrorsOn+  deriving (Eq, Show, Enum)++-- | Enumeration of Message printer types.+data PrintLevel+  = NoPrinter+  | TextPrinter+  | HexPrinter+  | AllPrinter+  deriving (Eq, Show, Enum)++-- | Sound file format.+data SoundFileFormat = Aiff | Flac | Ircam | Next | Raw | Wave+  deriving (Enum, Eq, Read, Show)++-- | Sample format.+data SampleFormat+  = PcmInt8+  | PcmInt16+  | PcmInt24+  | PcmInt32+  | PcmFloat+  | PcmDouble+  | PcmMulaw+  | PcmAlaw+  deriving (Enum, Eq, Read, Show)++-- | Sample format to standard file extension name.+soundFileFormatString :: SoundFileFormat -> String+soundFileFormatString f =+  case f of+    Aiff -> "aiff"+    Flac -> "flac"+    Ircam -> "ircam"+    Next -> "next"+    Raw -> "raw"+    Wave -> "wav"++-- | Infer sample format from file extension name.+soundFileFormat_from_extension :: String -> Maybe SoundFileFormat+soundFileFormat_from_extension =+  let tbl =+        [ ("aif", Aiff)+        , ("aiff", Aiff)+        , ("flac", Flac)+        , ("ircam", Ircam)+        , ("next", Next)+        , ("raw", Raw)+        , ("wav", Wave)+        ]+  in flip lookup tbl++-- | Erroring variant.+soundFileFormat_from_extension_err :: String -> SoundFileFormat+soundFileFormat_from_extension_err =+  fromMaybe (error "soundFileFormat_from_extension: unknown sf extension")+    . soundFileFormat_from_extension++-- | 'SampleFormat' string as recognised by scsynth NRT mode.+sampleFormatString :: SampleFormat -> String+sampleFormatString f =+  case f of+    PcmInt8 -> "int8"+    PcmInt16 -> "int16"+    PcmInt24 -> "int24"+    PcmInt32 -> "int32"+    PcmFloat -> "float"+    PcmDouble -> "double"+    PcmMulaw -> "mulaw"+    PcmAlaw -> "alaw"
+ Sound/Sc3/Server/Fd.hs view
@@ -0,0 +1,5 @@+-- | Composite of "Sound.Sc3.Server" and /Fd/ transport.+module Sound.Sc3.Server.Fd (module M) where++import Sound.Sc3.Server as M+import Sound.Sc3.Server.Transport.Fd as M
+ Sound/Sc3/Server/Graphdef.hs view
@@ -0,0 +1,316 @@+{- | Binary 'Graph Definition' as understood by @scsynth@.+     There are both binary and text encoders and decoders.+-}+module Sound.Sc3.Server.Graphdef where++import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import Text.Printf {- base -}++import qualified Safe {- safe -}++import qualified Sound.Osc.Datum as Datum {- hosc -}++import qualified Sound.Sc3.Common.Math.Operator as Operator {- hsc3 -}+import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}++-- * Type++-- | Names are Ascii strings (ie. ByteString.Char8)+type Name = Datum.Ascii++-- | Controls are a name and a ugen-index.+type Control = (Name, Int)++-- | Constants are floating point.+type Sample = Double++-- | Ugen indices are Int.+type Ugen_Index = Int++-- | Port indices are Int.+type Port_Index = Int++{- | Index used to indicate constants at Ugen inputs.+  Ie. if the ugen-index is this value (-1) it indicates a constant.+-}+constant_index :: Ugen_Index+constant_index = -1++-- | Inputs are a ugen-index and a port-index.+data Input = Input Ugen_Index Port_Index deriving (Eq, Show)++-- | Rates are encoded as integers (IR = 0, KR = 1, AR = 2, DR = 3).+type Rate = Int++-- | Outputs each indicate a Rate.+type Output = Rate++-- | Secondary (special) index, used by operator Ugens to select operation.+type Special = Int++-- | Unit generator type.+type Ugen = (Name, Rate, [Input], [Output], Special)++-- | 'Ugen' name.+ugen_name_str :: Ugen -> String+ugen_name_str (nm, _, _, _, _) = Datum.ascii_to_string nm++-- | 'Ugen' name, using operator name if appropriate.+ugen_name_op :: Ugen -> String+ugen_name_op (nm, _, _, _, k) =+  let s = Datum.ascii_to_string nm+  in fromMaybe s (Operator.ugen_operator_name s k)++-- | 'Ugen' 'Rate'.+ugen_rate :: Ugen -> Rate+ugen_rate (_, r, _, _, _) = r++ugen_rate_enum :: Ugen -> Rate.Rate+ugen_rate_enum = toEnum . ugen_rate++-- | 'Ugen' 'Input's.+ugen_inputs :: Ugen -> [Input]+ugen_inputs (_, _, i, _, _) = i++-- | 'Ugen' 'Output's.+ugen_outputs :: Ugen -> [Output]+ugen_outputs (_, _, _, o, _) = o++-- | Predicate to examine Ugen name and decide if it is a control.+ugen_is_control :: Ugen -> Bool+ugen_is_control =+  (`elem` ["Control", "LagControl", "TrigControl"])+    . ugen_name_str++-- | Input is a Ugen (ie. not a constant, indicated by a ugen-index of -1) and the Ugen is a control.+input_is_control :: Graphdef -> Input -> Bool+input_is_control g (Input u _) = (u /= constant_index) && ugen_is_control (graphdef_ugen g u)++-- | Graph definition type.+data Graphdef = Graphdef+  { graphdef_name :: Name+  , graphdef_constants :: [Sample]+  , graphdef_controls :: [(Control, Sample)]+  , graphdef_ugens :: [Ugen]+  }+  deriving (Eq, Show)++-- | Lookup Ugen by index.+graphdef_ugen :: Graphdef -> Ugen_Index -> Ugen+graphdef_ugen g = Safe.atNote "graphdef_ugen" (graphdef_ugens g)++-- | Lookup Control and default value by index.+graphdef_control :: Graphdef -> Int -> (Control, Sample)+graphdef_control g = Safe.atNote "graphdef_controls" (graphdef_controls g)++-- | nid of constant.+graphdef_constant_nid :: Graphdef -> Int -> Int+graphdef_constant_nid _ = id++-- | nid of control.+graphdef_control_nid :: Graphdef -> Int -> Int+graphdef_control_nid g = (+) (length (graphdef_constants g))++-- | nid of Ugen.+graphdef_ugen_nid :: Graphdef -> Int -> Int+graphdef_ugen_nid g n = graphdef_control_nid g 0 + length (graphdef_controls g) + n++{- | "SCgf" encoded as 32-bit unsigned integer.++>> map fromEnum "SCgf"+[83, 67, 103, 102]++>>> import Sound.Osc.Coding.Byte+>>> decode_i32 (encode_ascii (Datum.ascii "SCgf")) == scgf_i32+True+-}+scgf_i32 :: Num n => n+scgf_i32 = 1396926310++-- * Get++-- | Get functions for Graphdef types, (str_f,i8_f,i16_f,i32_f,f32_f)+type Get_Functions m = (m Name, m Int, m Int, m Int, m Double)++-- | Get a 'Control'.+get_control :: Monad m => (Get_Functions m, m Int) -> m Control+get_control ((get_str, _, _, _, _), get_i) = do+  nm <- get_str+  ix <- get_i+  return (nm, ix)++-- | Get an 'Input'.+get_input :: Monad m => m Int -> m Input+get_input get_i = liftM2 Input get_i get_i++-- | Get a 'Ugen'+get_ugen :: Monad m => (Get_Functions m, m Int) -> m Ugen+get_ugen ((get_str, get_i8, get_i16, _, _), get_i) = do+  name <- get_str+  rate <- get_i8+  number_of_inputs <- get_i+  number_of_outputs <- get_i+  special <- get_i16+  inputs <- replicateM number_of_inputs (get_input get_i)+  outputs <- replicateM number_of_outputs get_i8+  return+    ( name+    , rate+    , inputs+    , outputs+    , special+    )++-- | Get a 'Graphdef'. Supports version 0|1 and version 2 files.  Ignores variants.+get_graphdef :: Monad m => Get_Functions m -> m Graphdef+get_graphdef c@(get_str, _, get_i16, get_i32, get_f32) = do+  magic <- get_i32+  version <- get_i32+  let get_i =+        case version of+          0 -> get_i16+          1 -> get_i16 -- version one allows variants, which are not allowed by hsc3+          2 -> get_i32+          _ -> error ("get_graphdef: version not at {zero | one | two}: " ++ show version)+  number_of_definitions <- get_i16+  when+    (magic /= scgf_i32)+    (error "get_graphdef: illegal magic string")+  when+    (number_of_definitions /= 1)+    (error "get_graphdef: non unary graphdef file")+  name <- get_str+  number_of_constants <- get_i+  constants <- replicateM number_of_constants get_f32+  number_of_control_defaults <- get_i+  control_defaults <- replicateM number_of_control_defaults get_f32+  number_of_controls <- get_i+  controls <- replicateM number_of_controls (get_control (c, get_i))+  number_of_ugens <- get_i+  ugens <- replicateM number_of_ugens (get_ugen (c, get_i))+  return+    ( Graphdef+        name+        constants+        (zip controls control_defaults)+        ugens+    )++-- * Encode (version zero)++-- | Encode functions for Graphdef types (join_f,str_f,i8_f,i16_f,i32_f,f32_f,com_f)+type Encode_Functions t = ([t] -> t, Name -> t, Int -> t, Int -> t, Int -> t, Double -> t, String -> t)++encode_input_f :: Encode_Functions t -> Input -> t+encode_input_f (join_f, _, _, i16_f, _, _, _) (Input u p) = join_f (map i16_f [u, p])++encode_control_f :: Encode_Functions t -> Control -> t+encode_control_f (join_f, str_f, _, i16_f, _, _, _) (nm, k) = join_f [str_f nm, i16_f k]++encode_ugen_f :: Encode_Functions t -> Ugen -> t+encode_ugen_f enc (nm, r, i, o, s) =+  let (join_f, str_f, i8_f, i16_f, _, _, com_f) = enc+  in join_f+      [ com_f "ugen-name"+      , str_f nm+      , com_f "ugen-rate"+      , i8_f r+      , com_f "ugen-number-of-inputs"+      , i16_f (length i)+      , com_f "ugen-number-of-outputs"+      , i16_f (length o)+      , com_f "ugen-special"+      , i16_f s+      , com_f "ugen-inputs (ugen-index,port-index)"+      , join_f (map (encode_input_f enc) i)+      , com_f "ugen-output-rates"+      , join_f (map i8_f o)+      ]++encode_graphdef_f :: Encode_Functions t -> Graphdef -> t+encode_graphdef_f enc (Graphdef nm cs ks us) =+  let (join_f, str_f, _, i16_f, i32_f, f32_f, com_f) = enc+      (ks_ctl, ks_def) = unzip ks+  in join_f+      [ com_f "SCgf"+      , i32_f scgf_i32+      , com_f "version"+      , i32_f 0+      , com_f "number of graphs"+      , i16_f 1+      , com_f "name"+      , str_f nm+      , com_f "number-of-constants"+      , i16_f (length cs)+      , com_f "constant-values"+      , join_f (map f32_f cs)+      , com_f "number-of-controls"+      , i16_f (length ks_def)+      , com_f "control-default-values"+      , join_f (map f32_f ks_def)+      , com_f "number-of-controls"+      , i16_f (length ks_ctl)+      , com_f "controls"+      , join_f (map (encode_control_f enc) ks_ctl)+      , com_f "number-of-ugens"+      , i16_f (length us)+      , join_f (map (encode_ugen_f enc) us)+      ]++-- * Stat++-- | Simple statistics printer for 'Graphdef'.+graphdef_stat :: Graphdef -> String+graphdef_stat (Graphdef nm cs ks us) =+  let f g =+        let h (x : xs) = (x, length (x : xs))+            h [] = error "graphdef_stat"+        in show . map h . group . sort . map g+      sq pp_f = intercalate "," (pp_f (map ugen_name_op us))+  in unlines+      [ "name                      : " ++ show nm+      , "number of constants       : " ++ show (length cs)+      , "number of controls        : " ++ show (length ks)+      , "number of unit generators : " ++ show (length us)+      , "unit generator rates      : " ++ f ugen_rate us+      , "unit generator set        : " ++ sq (nub . sort)+      , "unit generator sequence   : " ++ sq id+      ]++-- * Dump Ugens++-- | Pretty print Ugen in the manner of SynthDef>>dumpUgens.+ugen_dump_ugen_str :: [Sample] -> [Ugen] -> Ugen_Index -> Ugen -> String+ugen_dump_ugen_str c_sq u_sq ix u =+  let in_brackets :: String -> String+      in_brackets x = printf "[%s]" x+      input_pp (Input i j) =+        let ui = u_sq !! i+        in if i >= 0+            then+              if length (ugen_outputs ui) > 1+                then printf "%d_%s:%d" i (ugen_name_op ui) j+                else printf "%d_%s" i (ugen_name_op ui)+            else printf "%f" (c_sq !! j)+      inputs_pp = in_brackets . intercalate "," . map input_pp+  in printf "%d_%s, %s, %s" ix (ugen_name_op u) (show (ugen_rate_enum u)) (inputs_pp (ugen_inputs u))++-- | Print graphdef in format equivalent to SynthDef>>dumpUgens in SuperCollider+graphdef_dump_ugens_str :: Graphdef -> [String]+graphdef_dump_ugens_str (Graphdef _nm cs _ks us) = zipWith (ugen_dump_ugen_str cs us) [0 ..] us++{- | 'putStrLn' of 'unlines' of 'graphdef_dump_ugens_str'++> import Sound.Sc3.Server.Graphdef+> import Sound.Sc3.Server.Graphdef.Io+> dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/"+> pp nm = read_graphdef_file (dir ++ nm) >>= graphdef_dump_ugens+> pp "simple.scsyndef"+> pp "with-ctl.scsyndef"+> pp "mce.scsyndef"+> pp "mrg.scsyndef"+-}+graphdef_dump_ugens :: Graphdef -> IO ()+graphdef_dump_ugens = putStrLn . unlines . graphdef_dump_ugens_str
+ Sound/Sc3/Server/Graphdef/Binary.hs view
@@ -0,0 +1,111 @@+-- | Binary encoders and decoders.+module Sound.Sc3.Server.Graphdef.Binary where++import System.FilePath {- filepath -}++import qualified Data.Binary.Get as Get {- binary -}+import qualified Data.Binary.IEEE754 as IEEE754 {- data-binary-ieee754 -}+import qualified Data.ByteString.Lazy as ByteString {- bytestring -}++import qualified Sound.Osc.Coding.Byte as Byte {- hosc -}+import qualified Sound.Osc.Coding.Cast as Cast {- hosc -}+import qualified Sound.Osc.Datum as Datum {- hosc -}++import Sound.Sc3.Server.Graphdef {- hsc3 -}++-- * Binary Get (version 0|1 or 2)++-- | Get a 'Name' (Pascal string).+get_pstr :: Get.Get Name+get_pstr = do+  n <- fmap fromIntegral Get.getWord8+  fmap Byte.decode_ascii (Get.getLazyByteString n)++-- | Get_Functions for binary .scsyndef files.+binary_get_f :: Get_Functions Get.Get+binary_get_f =+  ( get_pstr+  , fmap fromIntegral Get.getInt8+  , fmap fromIntegral Get.getInt16be+  , fmap fromIntegral Get.getInt32be+  , fmap realToFrac IEEE754.getFloat32be+  )++-- * Read++{- | Read Graphdef from .scsyndef file.++> dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/"+> pp nm = read_graphdef_file (dir ++ nm) >>= putStrLn . graphdef_stat+> pp "simple.scsyndef"+> pp "with-ctl.scsyndef"+> pp "mce.scsyndef"+> pp "mrg.scsyndef"+-}+read_graphdef_file :: FilePath -> IO Graphdef+read_graphdef_file nm = do+  b <- ByteString.readFile nm+  return (Get.runGet (get_graphdef binary_get_f) b)++-- * Stat++-- | 'read_graphdef_file' and run 'graphdef_stat'.+scsyndef_stat :: FilePath -> IO String+scsyndef_stat fn = do+  g <- read_graphdef_file fn+  return (graphdef_stat g)++-- * Encode (version zero)++-- | 'Encode_Functions' for 'ByteString.ByteString'+enc_bytestring :: Encode_Functions ByteString.ByteString+enc_bytestring =+  ( ByteString.concat+  , encode_pstr+  , Byte.encode_i8+  , Byte.encode_i16+  , Byte.encode_i32+  , encode_sample+  , const ByteString.empty+  )++{- | Pascal (length prefixed) encoding of 'Name'.++> ByteString.unpack (encode_pstr (ascii "string")) ==  [6, 115, 116, 114, 105, 110, 103]+-}+encode_pstr :: Name -> ByteString.ByteString+encode_pstr = ByteString.pack . Cast.str_pstr . Datum.ascii_to_string++-- | Byte-encode 'Input'.+encode_input :: Input -> ByteString.ByteString+encode_input = encode_input_f enc_bytestring++-- | Byte-encode 'Control'.+encode_control :: Control -> ByteString.ByteString+encode_control = encode_control_f enc_bytestring++-- | Byte-encode 'Ugen'.+encode_ugen :: Ugen -> ByteString.ByteString+encode_ugen = encode_ugen_f enc_bytestring++-- | Encode 'Sample' as 32-bit IEEE float.+encode_sample :: Sample -> ByteString.ByteString+encode_sample = Byte.encode_f32 . realToFrac++-- | Encode 'Graphdef'.+encode_graphdef :: Graphdef -> ByteString.ByteString+encode_graphdef = encode_graphdef_f enc_bytestring++-- * IO++-- | Write 'Graphdef' to indicated file.+graphdefWrite :: FilePath -> Graphdef -> IO ()+graphdefWrite fn = ByteString.writeFile fn . encode_graphdef++{- | Write 'Graphdef' to indicated directory.  The filename is the+'graphdef_name' with the appropriate extension (@scsyndef@).+-}+graphdefWrite_dir :: FilePath -> Graphdef -> IO ()+graphdefWrite_dir dir s =+  let fn = dir </> Datum.ascii_to_string (graphdef_name s) <.> "scsyndef"+  in graphdefWrite fn s
+ Sound/Sc3/Server/Graphdef/Graph.hs view
@@ -0,0 +1,81 @@+-- | Transform 'Graph.U_Graph' to 'Graphdef.Graphdef'.+module Sound.Sc3.Server.Graphdef.Graph where++import Data.Maybe {- base -}++import qualified Data.IntMap as M {- containers -}++import qualified Sound.Osc.Datum as Datum {- hosc -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Ugen.Graph as Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Types as Types {- hsc3 -}++-- * Maps++-- | (Int,Int) map.+type Int_Map = M.IntMap Int++-- | (constants-map,controls,controls-map,ugen-map,ktype-map)+type Encoding_Maps = (Int_Map, [Graph.U_Node], Int_Map, Int_Map, [(Rate.K_Type, Int)])++-- | Generate 'Encoding_Maps' translating node identifiers to synthdef indexes.+mk_encoding_maps :: Graph.U_Graph -> Encoding_Maps+mk_encoding_maps (Graph.U_Graph _ cs ks us) =+  ( M.fromList (zip (map Graph.u_node_id cs) [0 ..])+  , ks+  , M.fromList (zip (map Graph.u_node_id ks) [0 ..])+  , M.fromList (zip (map Graph.u_node_id us) [0 ..])+  , Graph.u_node_mk_ktype_map us+  )++-- | Locate index in map given node identifer 'UID_t'.+uid_lookup :: Uid.Id -> Int_Map -> Int+uid_lookup = M.findWithDefault (error "uid_lookup")++-- | Lookup 'K_Type' index from map (erroring variant of 'lookup').+ktype_map_lookup :: Rate.K_Type -> [(Rate.K_Type, Int)] -> Int+ktype_map_lookup k m =+  let e = error (show ("ktype_map_lookup", k, m))+  in fromMaybe e (lookup k m)++-- * Encoding++-- | Byte-encode 'Graph.From_Port' primitive node.+make_input :: Encoding_Maps -> Graph.From_Port -> Graphdef.Input+make_input (cs, ks, _, us, kt) fp =+  case fp of+    Graph.From_Port_C n -> Graphdef.Input (-1) (uid_lookup n cs)+    Graph.From_Port_K n t ->+      let i = ktype_map_lookup t kt+      in Graphdef.Input i (Graph.u_node_fetch_k n t ks)+    Graph.From_Port_U n p -> Graphdef.Input (uid_lookup n us) (fromMaybe 0 p)++-- | Byte-encode 'Graph.U_Node_K' primitive node.+make_control :: Encoding_Maps -> Graph.U_Node -> Graphdef.Control+make_control (_, _, ks, _, _) nd =+  case nd of+    Graph.U_Node_K n _ _ nm _ _ _ -> (Datum.ascii nm, uid_lookup n ks)+    _ -> error "make_control"++-- | Byte-encode 'Graph.U_Node_U' primitive node.+make_ugen :: Encoding_Maps -> Graph.U_Node -> Graphdef.Ugen+make_ugen m n =+  case n of+    Graph.U_Node_U _ r nm i o (Types.Special s) _ ->+      let i' = map (make_input m) i+      in (Datum.ascii nm, Rate.rateId r, i', map Rate.rateId o, s)+    _ -> error "encode_node_u: illegal input"++-- | Construct instrument definition bytecode.+graph_to_graphdef :: String -> Graph.U_Graph -> Graphdef.Graphdef+graph_to_graphdef nm g =+  let Graph.U_Graph _ cs ks us = g+      cs' = map Graph.u_node_c_value cs+      mm = mk_encoding_maps g+      ks_def = map Graph.u_node_k_default ks+      ks_ctl = map (make_control mm) ks+      us' = map (make_ugen mm) us+  in Graphdef.Graphdef (Datum.ascii nm) cs' (zip ks_ctl ks_def) us'
+ Sound/Sc3/Server/Graphdef/Io.hs view
@@ -0,0 +1,19 @@+-- | Encoding agnostic i/o.+module Sound.Sc3.Server.Graphdef.Io where++import Data.List {- base -}++import Sound.Sc3.Server.Graphdef {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Binary as Binary {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Text as Text {- hsc3 -}++{- | Encoding agnostic file reader.+If the file has a .scsyndef.text extension it's read as a text file, else as a binary file.++read_graphdef_file "/tmp/stsc3.scsyndef.text"+-}+read_graphdef_file :: FilePath -> IO Graphdef+read_graphdef_file fn =+  if ".scsyndef.text" `isSuffixOf` fn+    then Text.read_graphdef_file fn+    else Binary.read_graphdef_file fn
+ Sound/Sc3/Server/Graphdef/Read.hs view
@@ -0,0 +1,66 @@+-- | Decode (read) a 'Graphdef' into a 'Graph'.+module Sound.Sc3.Server.Graphdef.Read where++import qualified Sound.Osc.Datum as Datum {- hosc -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Ugen.Graph as Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Types as Types {- hsc3 -}++control_to_node :: Graphdef.Graphdef -> Uid.Id -> (Graphdef.Control, Types.Sample) -> Graph.U_Node+control_to_node g z ((nm, ix), v) =+  let z' = Graphdef.graphdef_control_nid g z+      nm' = Datum.ascii_to_string nm+  in Graph.U_Node_K z' Rate.ControlRate (Just ix) nm' v Rate.K_ControlRate Nothing++-- | Note: Graphs with multiple Control Ugens are not accounted for.+input_to_from_port :: Graphdef.Graphdef -> Graphdef.Input -> Graph.From_Port+input_to_from_port g (Graphdef.Input u p) =+  if u == -1+    then Graph.From_Port_C (Graphdef.graphdef_constant_nid g p)+    else+      if Graphdef.input_is_control g (Graphdef.Input u p)+        then Graph.From_Port_K (Graphdef.graphdef_control_nid g p) Rate.K_ControlRate+        else+          let ugen = Graphdef.graphdef_ugens g !! u+              port =+                if length (Graphdef.ugen_outputs ugen) > 1+                  then Just p+                  else Nothing+          in Graph.From_Port_U (Graphdef.graphdef_ugen_nid g u) port++ugen_to_node :: Graphdef.Graphdef -> Uid.Id -> Graphdef.Ugen -> Graph.U_Node+ugen_to_node g z u =+  let (name, rate, inputs, outputs, special) = u+      z' = Graphdef.graphdef_ugen_nid g z+      rate' = toEnum rate+      name' = Datum.ascii_to_string name+      inputs' = map (input_to_from_port g) inputs+      outputs' = map toEnum outputs+      special' = Types.Special special+  in Graph.U_Node_U z' rate' name' inputs' outputs' special' (Types.Uid z')++graphdef_to_graph :: Graphdef.Graphdef -> (String, Graph.U_Graph)+graphdef_to_graph g =+  let constants_nd = zipWith Graph.U_Node_C [0 ..] (Graphdef.graphdef_constants g)+      controls_nd = zipWith (control_to_node g) [0 ..] (Graphdef.graphdef_controls g)+      ugens_nd = zipWith (ugen_to_node g) [0 ..] (Graphdef.graphdef_ugens g)+      nm = Datum.ascii_to_string (Graphdef.graphdef_name g)+      gr = Graph.U_Graph (-1) constants_nd controls_nd ugens_nd+  in (nm, gr) -- S.Synthdef nm gr++-- | Read graphdef file and translate to graph.+read_graph :: FilePath -> IO Graph.U_Graph+read_graph sy_nm = do+  d <- Graphdef.read_graphdef_file sy_nm+  let (_, g) = graphdef_to_graph d+  return g++-- | Read graphdef file, translate to graph, and run 'ug_stat_ln'.+scsyndef_ug_stat :: FilePath -> IO String+scsyndef_ug_stat sy_nm = do+  g <- read_graph sy_nm+  return (unlines (Graph.ug_stat_ln g))
+ Sound/Sc3/Server/Graphdef/Text.hs view
@@ -0,0 +1,91 @@+{- | .scsyndef file encoded in plain text.+There are reader and writer functions.+-}+module Sound.Sc3.Server.Graphdef.Text where++import Data.Char {- base -}+import Data.Functor.Identity {- base -}+import Data.List {- base -}++import qualified Numeric {- base -}++import qualified Control.Monad.State as S {- mtl -}++import qualified Sound.Osc.Datum as Datum {- hosc -}++import Sound.Sc3.Server.Graphdef {- hsc3 -}++-- | * Printer++-- | Print string.  Strings must not have internal whitespace or semi-colons.  A quoting system could allow these if required.+print_string :: Datum.Ascii -> String+print_string a =+  let s = Datum.ascii_to_string a+  in if any isSpace s || ';' `elem` s then error "print_string" else s++-- | 'Encode_Functions' for plain text output.+enc_text :: (String -> String) -> Encode_Functions String+enc_text com_f =+  ( unwords . filter (not . null)+  , print_string+  , show+  , show+  , show+  , \n -> Numeric.showFFloat Nothing n ""+  , com_f+  )++{- | 'encode_graphdef_f' of 'enc_text' with optional semi-colon delimited comments.++> dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/"+> pp nm = Sound.Sc3.Server.Graphdef.Io.read_graphdef_file (dir ++ nm) >>= putStrLn . print_graphdef True+> pp "simple.scsyndef"+> pp "with-ctl.scsyndef"+> pp "mce.scsyndef"+> pp "mrg.scsyndef"+-}+print_graphdef :: Bool -> Graphdef -> String+print_graphdef with_com =+  let com_f = if with_com then \c -> concat ["\n; ", c, "\n"] else const ""+  in encode_graphdef_f (enc_text com_f)++-- * List Input++-- | Read the next value from a list.+list_read_f :: (t -> u) -> S.State [t] u+list_read_f f = do+  l <- S.get+  case uncons l of+    Nothing -> error "list_read_f"+    Just (h, t) -> S.put t >> return (f h)++-- | Read function for floating point that admits inf and infinity.+read_float :: (Fractional p, Read p) => String -> p+read_float txt =+  case map toLower txt of+    "inf" -> 1 / 0+    "infinity" -> 1 / 0+    _ -> read txt++-- | Get_Functions for text representation of Graphdef.+text_get_f :: Get_Functions (S.StateT [String] Identity)+text_get_f = (list_read_f Datum.ascii, list_read_f read, list_read_f read, list_read_f read, list_read_f read_float)++-- | Is line empty or starts with ';'+is_nil_or_comment :: String -> Bool+is_nil_or_comment txt =+  case uncons txt of+    Nothing -> True+    Just (h, _) -> h == ';'++{- | Read text representation of Graphdef, as written by 'print_graphdef'.++> read_graphdef "1396926310 0 1 simple 2 0.0 440.0 0 0 2 SinOsc 2 2 1 0 -1 1 -1 0 2 Out 2 2 0 0 -1 0 0 0"+-}+read_graphdef :: String -> Graphdef+read_graphdef txt =+  let delete_comments = filter (not . is_nil_or_comment)+  in S.evalState (get_graphdef text_get_f) (concatMap words (delete_comments (lines txt)))++read_graphdef_file :: FilePath -> IO Graphdef+read_graphdef_file = fmap read_graphdef . readFile
+ Sound/Sc3/Server/Monad.hs view
@@ -0,0 +1,5 @@+-- | Composite of "Sound.Sc3.Server" and 'Monad' transport.+module Sound.Sc3.Server.Monad (module S) where++import Sound.Sc3.Server as S+import Sound.Sc3.Server.Transport.Monad as S
+ Sound/Sc3/Server/Nrt.hs view
@@ -0,0 +1,87 @@+-- | Non-realtime score generation.+module Sound.Sc3.Server.Nrt where++import Data.List {- base -}+import Data.Maybe {- base -}+import System.IO {- base -}++import qualified Data.ByteString.Lazy as B {- bytestring -}++import qualified Sound.Osc.Coding.Byte as Byte {- hosc -}+import qualified Sound.Osc.Coding.Decode.Binary as Decode {- hosc3 -}+import qualified Sound.Osc.Coding.Encode.Builder as Encode {- hosc3 -}+import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Packet {- hosc -}++-- | Encode Bundle and prefix with encoded length.+oscWithSize :: BundleOf Message -> B.ByteString+oscWithSize o =+  let b = Encode.encodeBundle o+      l = Byte.encode_i32 (fromIntegral (B.length b))+  in B.append l b++-- | An 'Nrt' score is a sequence of 'Bundle's.+newtype Nrt = Nrt {nrt_bundles :: [BundleOf Message]} deriving (Show)++{- | 'span' of 'f' of 'bundleTime'.+     Can be used to separate the /initialisation/ and /remainder/ parts of a score.+-}+nrt_span :: (Time -> Bool) -> Nrt -> ([BundleOf Message], [BundleOf Message])+nrt_span f = span (f . bundleTime) . nrt_bundles++-- | Encode an 'Nrt' score.+encodeNrt :: Nrt -> B.ByteString+encodeNrt = B.concat . map oscWithSize . nrt_bundles++{- | Write an 'Nrt' score.++> import Sound.Osc {\- hosc -\}+> import Sound.Sc3 {\- hsc3 -\}+> m1 = g_new [(1, AddToTail, 0)]+> m2 = d_recv (synthdef "sin" (out 0 (sinOsc ar 660 0 * 0.15)))+> m3 = s_new "sin" 100 AddToTail 1 []+> m4 = n_free [100]+> m5 = nrt_end+> sc = Nrt [bundle 0 [m1,m2],bundle 1 [m3],bundle 10 [m4],bundle 15 [m5]]+> writeNrt "/tmp/t.osc" sc+-}+writeNrt :: FilePath -> Nrt -> IO ()+writeNrt fn = B.writeFile fn . encodeNrt++-- | Write an 'Nrt' score to a file handle.+putNrt :: Handle -> Nrt -> IO ()+putNrt h = B.hPut h . encodeNrt++-- | Decode an 'Nrt' 'B.ByteString' to a list of 'Bundle's.+decode_nrt_bundles :: B.ByteString -> [BundleOf Message]+decode_nrt_bundles s =+  let (p, q) = B.splitAt 4 s+      n = fromIntegral (Byte.decode_i32 p)+      (r, s') = B.splitAt n q+      r' = Decode.decodeBundle r+  in if B.null s'+      then [r']+      else r' : decode_nrt_bundles s'++-- | Decode an 'Nrt' 'B.ByteString'.+decodeNrt :: B.ByteString -> Nrt+decodeNrt = Nrt . decode_nrt_bundles++{- | 'decodeNrt' of 'B.readFile'.++> readNrt "/tmp/t.osc"+-}+readNrt :: FilePath -> IO Nrt+readNrt = fmap decodeNrt . B.readFile++-- * Query++-- | Find any non-ascending sequences.+nrt_non_ascending :: Nrt -> [(BundleOf Message, BundleOf Message)]+nrt_non_ascending (Nrt b) =+  case uncons b of+    Nothing -> error "nrt_non_ascending: empty nrt"+    Just (_, t) ->+      let p = zip b t+          f (i, j) = if bundleTime i > bundleTime j then Just (i, j) else Nothing+      in mapMaybe f p
+ Sound/Sc3/Server/Nrt/Edit.hs view
@@ -0,0 +1,55 @@+-- | Nrt editing+module Sound.Sc3.Server.Nrt.Edit where++import Data.List {- base -}++import qualified Data.List.Ordered {- data-ordlist -}++import qualified Sound.Osc.Datum as Osc {- hosc -}+import qualified Sound.Osc.Packet as Osc {- hosc -}++import qualified Sound.Sc3.Common.Base {- hsc3 -}+import qualified Sound.Sc3.Server.Command {- hsc3 -}+import Sound.Sc3.Server.Nrt {- hsc3 -}++-- | Merge two Nrt scores.  Retains internal nrt_end messages.+nrt_merge :: Nrt -> Nrt -> Nrt+nrt_merge (Nrt p) (Nrt q) = Nrt (Data.List.Ordered.merge p q)++-- | Merge a set of Nrt.  Retains internal 'nrt_end' messages.+nrt_merge_set :: [Nrt] -> Nrt+nrt_merge_set = foldr nrt_merge nrt_empty++-- | The empty Nrt.+nrt_empty :: Nrt+nrt_empty = Nrt []++-- | Add bundle at first permissable location of Nrt.+nrt_insert_pre :: Osc.BundleOf Osc.Message -> Nrt -> Nrt+nrt_insert_pre p (Nrt q) = Nrt (insert p q)++-- | Add bundle at last permissable location of Nrt.+nrt_insert_post :: Osc.BundleOf Osc.Message -> Nrt -> Nrt+nrt_insert_post p (Nrt q) = Nrt (Sound.Sc3.Common.Base.insert_post p q)++-- | bundleTime of last of nrt_bundles.+nrt_end_time :: Nrt -> Osc.Time+nrt_end_time = Osc.bundleTime . last . nrt_bundles++-- | Delete any internal nrt_end messages, and require one at the final bundle.+nrt_close :: Nrt -> Nrt+nrt_close (Nrt l) =+  let is_nrt_end_msg = (== "/nrt_end") . Osc.messageAddress+      bundle_map t_f m_f (Osc.Bundle t m) = Osc.Bundle (t_f t) (m_f m) -- apply temporal and message functions to bundle+      rem_end_msg = bundle_map id (filter (not . is_nrt_end_msg))+      req_end_msg =+        let f m =+              if any is_nrt_end_msg m+                then m+                else m ++ [Sound.Sc3.Server.Command.nrt_end]+        in bundle_map id f+  in Nrt (Sound.Sc3.Common.Base.at_last rem_end_msg req_end_msg l)++-- | Append /q/ to /p/, assumes last timestamp at /p/ precedes first at /q/.+nrt_append :: Nrt -> Nrt -> Nrt+nrt_append (Nrt p) (Nrt q) = Nrt (p ++ q)
+ Sound/Sc3/Server/Nrt/Render.hs view
@@ -0,0 +1,83 @@+-- | Non-realtime score rendering.+module Sound.Sc3.Server.Nrt.Render where++import System.FilePath {- filepath -}+import System.Process {- process -}++import Sound.Sc3.Server.Enum+import Sound.Sc3.Server.Nrt++{- | Minimal Nrt rendering parameters.++The sound file type is inferred from the file name extension.+Structure is:+Osc file name,+input audio file name and input number of channels (use ("_",0) for no input file),+output audio file name and output number of channels,+sample rate (int),+sample format,+further parameters (ie. ["-m","32768"]) to be inserted before the Nrt -N option.+-}+type Nrt_Param_Plain = (FilePath, (FilePath, Int), (FilePath, Int), Int, SampleFormat, [String])++{- | Compile argument list from Nrt_Param_Plain.++>>> let opt = ("/tmp/t.osc",("_",0),("/tmp/t.wav",1),48000,PcmInt16,[])+>>> nrt_param_plain_to_arg opt+["-i","0","-o","1","-N","/tmp/t.osc","_","/tmp/t.wav","48000","wav","int16"]+-}+nrt_param_plain_to_arg :: Nrt_Param_Plain -> [String]+nrt_param_plain_to_arg (osc_nm, (in_sf, in_nc), (out_sf, out_nc), sr, sf, param) =+  let sf_ty = case takeExtension out_sf of+        '.' : ext -> soundFileFormat_from_extension_err ext+        _ -> error "nrt_exec_plain: invalid sf extension"+  in concat+      [+        [ "-i"+        , show in_nc+        , "-o"+        , show out_nc+        ]+      , param+      ,+        [ "-N"+        , osc_nm+        , in_sf+        , out_sf+        , show sr+        , soundFileFormatString sf_ty+        , sampleFormatString sf+        ]+      ]++{- | Compile argument list from Nrt_Param_Plain and run scynth.++> nrt_exec_plain opt+-}+nrt_exec_plain :: Nrt_Param_Plain -> IO ()+nrt_exec_plain opt = callProcess "scsynth" (nrt_param_plain_to_arg opt)++{- | Minimal Nrt rendering, for more control see Stefan Kersten's+/hsc3-process/ package at:+<https://github.com/kaoskorobase/hsc3-process>.+-}+nrt_proc_plain :: Nrt_Param_Plain -> Nrt -> IO ()+nrt_proc_plain opt sc = do+  let (osc_nm, _, _, _, _, _) = opt+  writeNrt osc_nm sc+  nrt_exec_plain opt++{- | Variant for no input case.++(osc-file-name, audio-file-name, number-of-channels, sample-rate, sample-format, param)+-}+type Nrt_Render_Plain = (FilePath, FilePath, Int, Int, SampleFormat, [String])++{- | Add ("-",0) as input parameters and run 'nrt_proc_plain'.++> nrt_render_plain opt sc+-}+nrt_render_plain :: Nrt_Render_Plain -> Nrt -> IO ()+nrt_render_plain (osc_nm, sf_nm, nc, sr, sf, param) sc =+  let opt = (osc_nm, ("_", 0), (sf_nm, nc), sr, sf, param)+  in nrt_proc_plain opt sc
+ Sound/Sc3/Server/Nrt/Stat.hs view
@@ -0,0 +1,32 @@+-- | Nrt statistics.+module Sound.Sc3.Server.Nrt.Stat where++import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Packet {- hosc -}++import Sound.Sc3.Common.Base {- hsc3 -}+import Sound.Sc3.Server.Nrt {- hsc3 -}++-- | Nrt statistics, see nrt_stat_param for meanings.+type Nrt_Stat =+  ( (String, Time)+  , (String, Int)+  , (String, Int)+  , (String, [(String, Int)])+  )++-- | Nrt_Stat names.+nrt_stat_param :: (String, String, String, String)+nrt_stat_param = ("duration", "# bundles", "# messages", "command set")++-- | Trivial Nrt statistics.+nrt_stat :: Nrt -> Nrt_Stat+nrt_stat (Nrt b_seq) =+  let b_msg = map bundleMessages b_seq+  in p4_zip+      nrt_stat_param+      ( bundleTime (last b_seq)+      , length b_seq+      , sum (map length b_msg)+      , histogram (concatMap (map messageAddress) b_msg)+      )
+ Sound/Sc3/Server/Nrt/Ugen.hs view
@@ -0,0 +1,62 @@+-- | Nrt from Ugen+module Sound.Sc3.Server.Nrt.Ugen where++import qualified Sound.Osc.Datum as Osc {- hosc -}+import qualified Sound.Osc.Packet as Osc {- hosc -}++import qualified Sound.Sc3.Common.Rate as Rate+import qualified Sound.Sc3.Server.Command.Plain as Server.Command+import qualified Sound.Sc3.Server.Enum as Server.Enum+import qualified Sound.Sc3.Server.Graphdef as Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef.Binary+import qualified Sound.Sc3.Server.Nrt as Nrt+import qualified Sound.Sc3.Server.Nrt.Render as Nrt.Render+import qualified Sound.Sc3.Server.Synthdef as Synthdef+import qualified Sound.Sc3.Ugen.Bindings.Db as Ugen.Binding+import qualified Sound.Sc3.Ugen.Ugen as Ugen++nrt_encoded_graphdef_rec :: Osc.Time -> Osc.Blob -> Nrt.Nrt+nrt_encoded_graphdef_rec dur graphdef =+  let m0 = Server.Command.d_recv_bytes graphdef+      m1 = Server.Command.s_new0 "Anonymous" 1 Server.Enum.AddToHead 0+  in Nrt.Nrt [Osc.bundle 0 [m0, m1], Osc.bundle dur [Server.Command.nrt_end]]++nrt_graphdef_rec :: Osc.Time -> Graphdef.Graphdef -> Nrt.Nrt+nrt_graphdef_rec dur graphdef = nrt_encoded_graphdef_rec dur (Graphdef.Binary.encode_graphdef graphdef)++nrt_syndef_rec :: Osc.Time -> Synthdef.Synthdef -> Nrt.Nrt+nrt_syndef_rec dur syndef = nrt_graphdef_rec dur (Synthdef.synthdef_to_graphdef syndef)++{- | Make Nrt score that runs Ugen for Time seconds to output bus zero.+If Ugen is at ControlRate insert 'k2a' Ugen.+-}+nrt_ugen_rec :: Osc.Time -> Ugen.Ugen -> Nrt.Nrt+nrt_ugen_rec dur ugen =+  let ugen' =+        case Ugen.rateOf ugen of+          Rate.AudioRate -> ugen+          Rate.ControlRate -> Ugen.Binding.k2a ugen+          _ -> error "nrt_ugen_rec: rate?"+  in nrt_syndef_rec dur (Synthdef.synthdef "Anonymous" (Ugen.Binding.out 0 ugen'))++-- | (osc-file, sound-file, sample-rate, sample-format, scsynth-options)+type Nrt_Opt = (FilePath, FilePath, Int, Server.Enum.SampleFormat, [String])++nrt_encoded_graphdef_render :: Nrt_Opt -> Osc.Time -> Int -> Osc.Blob -> IO ()+nrt_encoded_graphdef_render (osc_fn, sf_fn, sample_rate, fmt, opt) dur nc syndef = do+  let sc = nrt_encoded_graphdef_rec dur syndef+  Nrt.Render.nrt_render_plain (osc_fn, sf_fn, nc, sample_rate, fmt, opt) sc++nrt_syndef_render :: Nrt_Opt -> Osc.Time -> Int -> Synthdef.Synthdef -> IO ()+nrt_syndef_render (osc_fn, sf_fn, sample_rate, fmt, opt) dur nc syndef = do+  let sc = nrt_syndef_rec dur syndef+  Nrt.Render.nrt_render_plain (osc_fn, sf_fn, nc, sample_rate, fmt, opt) sc++{- | 'nrt_render_plain' of 'ugen_rec_nrt'.+The number of channels is equal to the degree of the Ugen.+-}+nrt_ugen_render :: Nrt_Opt -> Osc.Time -> Ugen.Ugen -> IO ()+nrt_ugen_render (osc_fn, sf_fn, sample_rate, fmt, opt) dur u = do+  let sc = nrt_ugen_rec dur u+      nc = length (Ugen.mceChannels u)+  Nrt.Render.nrt_render_plain (osc_fn, sf_fn, nc, sample_rate, fmt, opt) sc
+ Sound/Sc3/Server/Options.hs view
@@ -0,0 +1,113 @@+-- | scsynth server command-line options.+module Sound.Sc3.Server.Options where++import Data.List {- base -}++-- | (short-option, long-option, default-value)+type Sc3_Opt i = (Char, String, i)++-- | Get value from option.+sc3_opt_value :: Sc3_Opt i -> i+sc3_opt_value (_, _, v) = v++-- | Default host name string.+sc3_host_name_def :: String+sc3_host_name_def = "127.0.0.1"++-- | Default port number, either a 'u' or a 't' option is required.+sc3_port_def :: Num i => i+sc3_port_def = 57110++-- | Protocol is either Udp or Tcp.+data Sc3_Protocol = Sc3_Udp | Sc3_Tcp++sc3_protocol_def :: Sc3_Protocol+sc3_protocol_def = Sc3_Tcp++-- | Default port option.+sc3_opt_port_def :: Num i => Sc3_Protocol -> Sc3_Opt i+sc3_opt_port_def p =+  case p of+    Sc3_Udp -> ('u', "udp-port-number", sc3_port_def)+    Sc3_Tcp -> ('t', "tcp-port-number", sc3_port_def)++-- | Sc3 default options.+sc3_opt_def :: Num i => Sc3_Protocol -> [Sc3_Opt i]+sc3_opt_def p =+  sc3_opt_port_def p+    : [ ('a', "number-of-audio-bus-channels", 1024)+      , ('b', "number-of-sample-buffers", 1024)+      , -- ,('B',"bind-to-address","127.0.0.1")+        ('c', "number-of-control-bus-channels", 16384)+      , ('D', "load-synthdefs?", 1)+      , ('d', "max-number-of-synth-defs", 1024)+      , ('i', "number-of-input-bus-channels", 8)+      , ('l', "max-logins", 64)+      , ('m', "real-time-memory-size", 8192)+      , ('n', "max-number-of-nodes", 1024)+      , ('o', "number-of-output-bus-channels", 8)+      , ('r', "number-of-random-seeds", 64)+      , ('R', "publish-to-rendezvous?", 1)+      , ('S', "hardware-sample-rate", 0)+      , ('V', "verbosity", 0)+      , ('w', "number-of-wire-buffers", 64)+      , ('z', "block-size", 64)+      , ('Z', "hardware-buffer-size", 0)+      ]++-- | SC3 default options for Udp.+sc3_opt_def_udp :: Num i => [Sc3_Opt i]+sc3_opt_def_udp = sc3_opt_def Sc3_Udp++{- | Is option boolean, ie. 0=False and 1=True.++>>> filter sc3_opt_bool sc3_opt_def_udp+[('D',"load-synthdefs?",1),('R',"publish-to-rendezvous?",1)]+-}+sc3_opt_bool :: Sc3_Opt i -> Bool+sc3_opt_bool (_, s, _) = last s == '?'++-- | Lookup option given either short or long name.+sc3_opt_get :: [Sc3_Opt i] -> Either Char String -> Maybe i+sc3_opt_get opt k =+  case k of+    Left c -> fmap sc3_opt_value (find (\(o, _, _) -> o == c) opt)+    Right s -> fmap sc3_opt_value (find (\(_, o, _) -> o == s) opt)++{- | Set option given either short or long name.++>>> sc3_opt_get (sc3_opt_set sc3_opt_def_udp (Left 'w',256)) (Right "number-of-wire-buffers")+Just 256+-}+sc3_opt_set :: [Sc3_Opt i] -> (Either Char String, i) -> [Sc3_Opt i]+sc3_opt_set opt (k, v) =+  case k of+    Left x -> map (\(c, s, y) -> if c == x then (c, s, v) else (c, s, y)) opt+    Right x -> map (\(c, s, y) -> if s == x then (c, s, v) else (c, s, y)) opt++{- | Apply set of edits to options.++>>> unwords (sc3_opt_arg (sc3_opt_edit sc3_opt_def_udp [(Left 'w',256),(Left 'm',2 ^ 16)]))+"-u 57110 -a 1024 -b 1024 -c 16384 -D 1 -d 1024 -i 8 -l 64 -m 65536 -n 1024 -o 8 -r 64 -R 1 -S 0 -V 0 -w 256 -z 64 -Z 0"+-}+sc3_opt_edit :: [Sc3_Opt i] -> [(Either Char String, i)] -> [Sc3_Opt i]+sc3_opt_edit opt edt =+  case edt of+    [] -> opt+    x : rst -> sc3_opt_edit (sc3_opt_set opt x) rst++{- | Generate scsynth argument list.++>>> unwords (sc3_opt_arg sc3_opt_def_udp)+"-u 57110 -a 1024 -b 1024 -c 16384 -D 1 -d 1024 -i 8 -l 64 -m 8192 -n 1024 -o 8 -r 64 -R 1 -S 0 -V 0 -w 64 -z 64 -Z 0"+-}+sc3_opt_arg :: Show i => [Sc3_Opt i] -> [String]+sc3_opt_arg = concatMap (\(c, _, v) -> [['-', c], show v])++{- | Generate arguments for 'System.Process.callProcess' or related functions.++>>> let o = sc3_opt_def_udp in sc3_opt_cmd o == ("scsynth", sc3_opt_arg o)+True+-}+sc3_opt_cmd :: Show i => [Sc3_Opt i] -> (FilePath, [String])+sc3_opt_cmd opt = ("scsynth", sc3_opt_arg opt)
+ Sound/Sc3/Server/Param.hs view
@@ -0,0 +1,77 @@+-- | Synthesis parameters+module Sound.Sc3.Server.Param where++import Data.Function {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import Data.List.Split {- split -}++import Sound.Sc3.Common.Math {- hsc3 -}++-- | An Sc3 synthesis parameter, ie. (controlName, controlValue).+type Param1 = (String, Double)++-- | Set of Sc3 synthesiser parameters.+type Param = [Param1]++-- | Add new, or overwrite existing, parameter.+param_insert :: Param -> Param1 -> Param+param_insert p z = z : deleteBy ((==) `on` fst) z p++{- | Merge, require keys be unique.++>>> param_merge_uniq [("a",1),("b",2)] [("c",3),("d",4)]+[("a",1.0),("b",2.0),("c",3.0),("d",4.0)]++> param_merge_uniq [("a",1)] [("a",2)] -- error+-}+param_merge_uniq :: Param -> Param -> Param+param_merge_uniq p1 p2 =+  case map fst p1 `intersect` map fst p2 of+    [] -> p1 ++ p2+    _ -> error "param_merge_uniq?"++{- | Merge, right biased.++>>> param_merge_r [("a",1),("b",2)] [("c",3),("a",4)]+[("b",2.0),("c",3.0),("a",4.0)]+-}+param_merge_r :: Param -> Param -> Param+param_merge_r p1 p2 =+  let p3 = let k2 = map fst p2 in filter (\(x, _) -> x `notElem` k2) p1+  in p3 ++ p2++{- | Right-fold (right-biased) of 'param_merge'++>>> param_merge_r_seq [[("a",1),("b",2)],[("c",3),("a",4)],[("b",5)]]+[("c",3.0),("a",4.0),("b",5.0)]+-}+param_merge_r_seq :: [Param] -> Param+param_merge_r_seq = foldr1 param_merge_r++-- | Lookup parameter value, with default.+param_get :: Param -> String -> Double -> Double+param_get p k v = fromMaybe v (lookup k p)++{- | Given (param-separator,key-value-separator) parse paramter string.++>>> param_parse (';','=') "a=1;b=2"+[("a",1.0),("b",2.0)]+-}+param_parse :: (Char, Char) -> String -> Param+param_parse (c1, c2) str =+  let f x = case splitOn [c2] x of+        [lhs, rhs] -> (lhs, read rhs)+        _ -> error ("param_parse: " ++ x)+  in if null str then [] else map f (splitOn [c1] str)++{- | Inverse of 'param_parse', /k/ is the precision to print values to.++>>> param_pp (';','=') 4 [("a",1),("b",2)]+"a=1.0;b=2.0"+-}+param_pp :: (Char, Char) -> Int -> Param -> String+param_pp (c1, c2) k =+  let f (lhs, rhs) = concat [lhs, [c2], double_pp k rhs]+  in concat . intersperse [c1] . map f
+ Sound/Sc3/Server/Recorder.hs view
@@ -0,0 +1,122 @@+-- | Recording scsynth.+module Sound.Sc3.Server.Recorder where++import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Packet {- hosc -}++import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Bindings+import Sound.Sc3.Ugen.Util++import Sound.Sc3.Server.Command+import Sound.Sc3.Server.Enum+import Sound.Sc3.Server.Nrt+import Sound.Sc3.Server.Synthdef++-- | Parameters for recording scsynth.+data SC3_Recorder = SC3_Recorder+  { rec_sftype :: SoundFileFormat+  -- ^ Sound file format.+  , rec_coding :: SampleFormat+  -- ^ Sample format.+  , rec_fname :: FilePath+  -- ^ File name.+  , rec_nc :: Int+  -- ^ Number of channels.+  , rec_bus :: Int+  -- ^ Bus number.+  , rec_buf_id :: Int+  -- ^ ID of buffer to allocate.+  , rec_buf_frames :: Int+  -- ^ Number of frames at buffer.+  , rec_node_id :: Int+  -- ^ ID to allocate for node.+  , rec_group_id :: Int+  -- ^ Group to allocate node within.+  , rec_dur :: Maybe Time+  -- ^ Recoring duration if fixed.+  }++-- | Default recording structure.+default_SC3_Recorder :: SC3_Recorder+default_SC3_Recorder =+  SC3_Recorder+    { rec_sftype = Wave+    , rec_coding = PcmFloat+    , rec_fname = "/tmp/sc3-recorder.wav"+    , rec_nc = 2+    , rec_bus = 0+    , rec_buf_id = 10+    , rec_buf_frames = 65536+    , rec_node_id = 2001+    , rec_group_id = 0+    , rec_dur = Just 60+    }++-- | The name indicates the number of channels.+rec_synthdef_nm :: Int -> String+rec_synthdef_nm nc = "sc3-recorder-" ++ show nc++{- | Generate 'Synthdef' with required number of channels.++> Sound.Sc3.Ugen.Dot.draw (rec_synthdef 2)+-}+rec_synthdef :: Int -> Synthdef+rec_synthdef nc =+  let bufnum = control kr "bufnum" 0+      bus = control kr "bus" 0+  in synthdef (rec_synthdef_nm nc) (diskOut bufnum (in' nc ar bus))++{- | Asyncronous initialisation 'Message's ('d_recv', 'b_alloc' and 'b_write').++> withSc3 (sendBundle (bundle immediately (rec_init_m def)))+-}+rec_init_m :: SC3_Recorder -> [Message]+rec_init_m r =+  let buf = rec_buf_id r+  in [ d_recv (rec_synthdef (rec_nc r))+     , b_alloc buf (rec_buf_frames r) (rec_nc r)+     , b_write buf (rec_fname r) (rec_sftype r) (rec_coding r) (-1) 0 True+     ]++{- | Begin recording 'Message' ('s_new').++> withSc3 (sendMessage (rec_begin_m def))+-}+rec_begin_m :: SC3_Recorder -> Message+rec_begin_m r =+  s_new+    (rec_synthdef_nm (rec_nc r))+    (rec_node_id r)+    AddToTail+    (rec_group_id r)+    [ ("bus", fromIntegral (rec_bus r))+    , ("bufnum", fromIntegral (rec_buf_id r))+    ]++{- | End recording 'Message's ('n_free', 'b_close' and 'b_free').++> withSc3 (sendBundle (bundle immediately (rec_end_m def)))+-}+rec_end_m :: SC3_Recorder -> [Message]+rec_end_m r =+  [ n_free [rec_node_id r]+  , b_close (rec_buf_id r)+  , b_free (rec_buf_id r)+  ]++{- | 'Nrt' score for recorder, if 'rec_dur' is given schedule 'rec_end_m'.++> import Sound.Sc3+> withSc3 (Sound.Osc.sendMessage (dumpOSC TextPrinter))+> audition (out 0 (sinOsc ar (mce2 440 441) 0 * 0.1))+> let rc = default_SC3_Recorder {rec_dur = Just 5.0}+> nrt_audition (sc3_recorder rc)+-}+sc3_recorder :: SC3_Recorder -> Nrt+sc3_recorder r =+  let b0 = bundle 0 (rec_init_m r ++ [rec_begin_m r])+  in case rec_dur r of+      Nothing -> Nrt [b0]+      Just d -> Nrt [b0, bundle d (rec_end_m r)]
+ Sound/Sc3/Server/Scsynth.hs view
@@ -0,0 +1,64 @@+{- | Module to provide a stateful connection to scsynth.++The purpose is to store Osc Messages that should be sent when resetting the synthesiser.++This should, but does not:++- allow for Scsynth to be at a non-standard address+- allow for multiple Scsynth instances+-}+module Sound.Sc3.Server.Scsynth where++import Data.IORef {- base -}++import qualified Sound.Osc.Packet as Osc {- hosc -}++import Sound.Sc3.Ugen.Ugen {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++import Sound.Sc3.Server.Transport.Monad {- hsc3 -}++-- | Scsynth state.+data Scsynth = Scsynth {scsynthResetMessages :: IORef [Osc.Message]}++-- | Scsynth with no messages or allocated buffers.+newScsynth :: IO Scsynth+newScsynth = fmap Scsynth (newIORef [])++-- | Print onReset messages.+scsynthPrint :: Scsynth -> IO ()+scsynthPrint (Scsynth mRef) = do+  m <- readIORef mRef+  print m++{- | Add a sequence of messages to be sent on scsynth reset.++> scsynth <- newScsynth+> scsynthOnReset scsynth [b_free 100]+> scsynthPrint scsynth+-}+scsynthOnReset :: Scsynth -> [Osc.Message] -> IO ()+scsynthOnReset (Scsynth mRef) messages =+  if not (null messages)+    then modifyIORef' mRef (++ messages)+    else return ()++-- | reset scsynth, send all stored onReset messages, clear the onReset message store.+scsynthReset :: Scsynth -> IO ()+scsynthReset (Scsynth mRef) = do+  onResetMessages <- readIORef mRef+  writeIORef mRef []+  withSc3 (reset >> mapM_ maybe_async onResetMessages)++{- | Play Ugen at Scsynth.+Send any required initialisation messages and stores and onReset messages.+-}+scsynthPlayAt :: Scsynth -> Play_Opt -> Ugen -> IO ()+scsynthPlayAt scsynth opt ugen = do+  let (pre, post) = ugenCollectBrackets ugen+  if not (null post) then scsynthOnReset scsynth post else return ()+  withSc3 (mapM_ maybe_async pre >> playAt opt ugen)++-- | scsynthPlayAt with default options.+scsynthPlay :: Scsynth -> Ugen -> IO ()+scsynthPlay scsynth = scsynthPlayAt scsynth def_play_opt
+ Sound/Sc3/Server/Status.hs view
@@ -0,0 +1,180 @@+{- | Request and display status information from the synthesis server.++\/status messages receive \/status.reply messages.++\/g_queryTree messages recieve \/g_queryTree.reply messages.+-}+module Sound.Sc3.Server.Status where++import Data.List {- base -}+import Data.Maybe {- base -}+import Text.Printf {- base -}++import qualified Data.ByteString.Char8 as C {- bytestring -}+import qualified Data.Tree as T {- containers -}+import qualified Safe {- safe -}++import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Text {- hosc -}++import Sound.Sc3.Server.Command.Plain++-- * Status++-- | Get /n/th field of /status.reply message as 'Floating'.+extractStatusField :: Floating n => Int -> [Datum] -> n+extractStatusField n =+  fromMaybe (error "extractStatusField")+    . datum_floating+    . flip (Safe.atNote "extractStatusField") n++-- | Names of /status.reply fields sent in reply to /status request.+statusFields :: [String]+statusFields =+  [ "Unused                      "+  , "# Ugens                     "+  , "# Synths                    "+  , "# Groups                    "+  , "# Synthdefs                 "+  , "% CPU (Average)             "+  , "% CPU (Peak)                "+  , "Sample Rate (Nominal)       "+  , "Sample Rate (Actual)        "+  ]++-- | Status pretty printer.+statusFormat :: [Datum] -> [String]+statusFormat d =+  let s = "***** SuperCollider Server Status *****"+      t = Safe.tailNote "statusFormat"+  in s : zipWith (++) (t statusFields) (map (showDatum (Just 5)) (t d))++-- | Concise pretty printer, one line, omits Peak-Cpu and Nominal-Sr.+status_format_concise :: [Datum] -> String+status_format_concise d =+  case d of+    [Int32 _, Int32 ugn, Int32 grp, Int32 syn, Int32 ins, Float cpu1, Float _cpu2, Double _sr1, Double sr2] ->+      printf+        "UGN=%-5d GRP=%-5d SYN=%-5d INS=%-5d CPU=%-5.1f SR=%-7.1f"+        ugn+        grp+        syn+        ins+        cpu1+        sr2+    _ -> error "status_format_concise?"++-- * Query Group++-- | Name or index and value or bus mapping.+type Query_Ctl = (Either String Int, Either Double Int)++-- | Nodes are either groups of synths.+data Query_Node+  = Query_Group Group_Id [Query_Node]+  | Query_Synth Synth_Id String (Maybe [Query_Ctl])+  deriving (Eq, Show)++-- | Pretty-print 'Query_Ctl'+query_ctl_pp :: Query_Ctl -> String+query_ctl_pp (p, q) = either id show p ++ ":" ++ either show show q++-- | Pretty-print 'Query_Node'+query_node_pp :: Query_Node -> String+query_node_pp n =+  case n of+    Query_Group k _ -> show k+    Query_Synth k nm c ->+      let c' = unwords (maybe [] (map query_ctl_pp) c)+      in show (k, nm, c')++{- | Control (parameter) data may be given as names or indices and as+values or bus mappings.++> queryTree_ctl (string "freq",float 440) == (Left "freq",Left 440.0)+> queryTree_ctl (int32 1,string "c0") == (Right 1,Right 0)+-}+queryTree_ctl :: (Datum, Datum) -> Query_Ctl+queryTree_ctl (p, q) =+  let err msg val = error (show ("queryTree_ctl", msg, val))+      f d = case d of+        AsciiString nm -> Left (C.unpack nm)+        Int32 ix -> Right (fromIntegral ix)+        _ -> err "string/int32" d+      g d = case d of+        Float k -> Left (realToFrac k)+        AsciiString b -> case C.unpack b of+          'c' : n -> Right (read n)+          _ -> err "c:_" d+        _ -> err "float/string" d+  in (f p, g q)++{- | If /rc/ is 'True' then 'Query_Ctl' data is expected (ie. flag was set at @\/g_queryTree@).+/k/ is the synth-id, and /nm/ the name.++> let d = [int32 1,string "freq",float 440]+> in queryTree_synth True 1000 "saw" d+-}+queryTree_synth :: Bool -> Synth_Id -> String -> [Datum] -> (Query_Node, [Datum])+queryTree_synth rc k nm d =+  let pairs l = case l of+        e0 : e1 : l' -> (e0, e1) : pairs l'+        _ -> []+      f r = case r of+        Int32 n : r' ->+          let (p, r'') = genericSplitAt (n * 2) r'+          in (map queryTree_ctl (pairs p), r'')+        _ -> error "queryTree_synth"+  in if rc+      then+        let (p, d') = f d+        in (Query_Synth k nm (Just p), d')+      else (Query_Synth k nm Nothing, d)++-- | Generate 'Query_Node' for indicated 'Group_Id'.+queryTree_group :: Bool -> Group_Id -> Int -> [Datum] -> (Query_Node, [Datum])+queryTree_group rc gid nc =+  let recur n r d =+        if n == 0+          then (Query_Group gid (reverse r), d)+          else+            let (c, d') = queryTree_child rc d+            in recur (n - 1) (c : r) d'+  in recur nc []++-- | Either 'queryTree_synth' or 'queryTree_group'.+queryTree_child :: Bool -> [Datum] -> (Query_Node, [Datum])+queryTree_child rc d =+  case d of+    Int32 nid : Int32 (-1) : AsciiString nm : d' ->+      queryTree_synth rc (fromIntegral nid) (C.unpack nm) d'+    Int32 gid : Int32 nc : d' ->+      queryTree_group rc (fromIntegral gid) (fromIntegral nc) d'+    _ -> error "queryTree_child"++-- | Parse result of ' g_queryTree '.+queryTree :: [Datum] -> Query_Node+queryTree d =+  case d of+    Int32 rc : Int32 gid : Int32 nc : d' ->+      let rc' = rc /= 0+          gid' = fromIntegral gid+          nc' = fromIntegral nc+      in case queryTree_group rc' gid' nc' d' of+          (r, []) -> r+          _ -> error "queryTree"+    _ -> error "queryTree"++-- | Extact sequence of 'Group_Id's from 'Query_Node'.+queryNode_to_group_seq :: Query_Node -> [Group_Id]+queryNode_to_group_seq nd =+  case nd of+    Query_Group k ch -> k : concatMap queryNode_to_group_seq ch+    Query_Synth _ _ _ -> []++-- | Transform 'Query_Node' to 'T.Tree'.+queryTree_rt :: Query_Node -> T.Tree Query_Node+queryTree_rt n =+  case n of+    Query_Synth _ _ _ -> T.Node n []+    Query_Group _ c -> T.Node n (map queryTree_rt c)
+ Sound/Sc3/Server/Synthdef.hs view
@@ -0,0 +1,108 @@+-- | The unit-generator graph structure implemented by the SuperCollider synthesis server.+module Sound.Sc3.Server.Synthdef where++import qualified Data.ByteString.Lazy as L {- bytestring -}++import qualified Sound.Sc3.Ugen.Graph as Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Help.Graph as Help.Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Ugen as Ugen {- hsc3 -}++import qualified Sound.Sc3.Server.Graphdef as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef.Binary {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Graph as Graphdef.Graph {- hsc3 -}+import qualified Sound.Sc3.Server.Param as Param {- hsc3 -}++-- | A named unit generator graph.+data Synthdef = Synthdef+  { synthdefName :: String+  , synthdefUgen :: Ugen.Ugen+  }+  deriving (Eq, Show)++-- | Alias for 'Synthdef'.+synthdef :: String -> Ugen.Ugen -> Synthdef+synthdef = Synthdef++{- | The Sc3 /default/ instrument 'Synthdef', see 'default_ugen_graph'.++> import Sound.Osc {\- hosc -\}+> import Sound.Sc3 {\- hsc3 -\}+> withSc3 (sendMessage (d_recv defaultSynthdef))+> audition defaultSynthdef+-}+defaultSynthdef :: Synthdef+defaultSynthdef = synthdef "default" Help.Graph.default_ugen_graph++{- | The Sc3 /default/ sample (buffer) playback instrument 'Synthdef',+see 'default_sampler_ugen_graph'.++> withSc3 (sendMessage (d_recv (defaultSampler False)))+> audition (defaultSampler False)+-}+defaultSampler :: Bool -> Synthdef+defaultSampler use_gate =+  let nm = "default-sampler-" ++ if use_gate then "gate" else "fixed"+  in synthdef nm (Help.Graph.default_sampler_ugen_graph use_gate)++-- | 'ugen_to_graph' of 'synthdefUgen'.+synthdefGraph :: Synthdef -> Graph.U_Graph+synthdefGraph = Graph.ugen_to_graph . synthdefUgen++{- | Parameter names at 'Synthdef'.++>>> synthdefParam defaultSynthdef+[("amp",0.1),("pan",0.0),("gate",1.0),("freq",440.0),("out",0.0)]+-}+synthdefParam :: Synthdef -> Param.Param+synthdefParam =+  map (\n -> (Graph.u_node_k_name n, Graph.u_node_k_default n))+    . Graph.ug_controls+    . synthdefGraph++-- | 'graph_to_graphdef' at 'Synthdef'.+synthdef_to_graphdef :: Synthdef -> Graphdef.Graphdef+synthdef_to_graphdef (Synthdef nm u) = Graphdef.Graph.graph_to_graphdef nm (Graph.ugen_to_graph u)++-- | 'graph_to_graphdef' at 'Synthdef'.+ugen_to_graphdef :: Ugen.Ugen -> Graphdef.Graphdef+ugen_to_graphdef = synthdef_to_graphdef . Synthdef "anonymous"++-- | Encode 'Synthdef' as a binary data stream.+synthdefData :: Synthdef -> L.ByteString+synthdefData = Graphdef.Binary.encode_graphdef . synthdef_to_graphdef++-- | Write 'Synthdef' to indicated file.+synthdefWrite :: FilePath -> Synthdef -> IO ()+synthdefWrite fn = Graphdef.Binary.graphdefWrite fn . synthdef_to_graphdef++{- | Write 'Synthdef' to indicated directory.  The filename is the+'synthdefName' with the appropriate extension (@scsyndef@).+-}+synthdefWrite_dir :: FilePath -> Synthdef -> IO ()+synthdefWrite_dir dir = Graphdef.Binary.graphdefWrite_dir dir . synthdef_to_graphdef++-- | 'graph_stat_ln' of 'synth'.+synthstat_ln :: Ugen.Ugen -> [String]+synthstat_ln = Graph.ug_stat_ln . Graph.ugen_to_graph++-- | 'unlines' of 'synthstat_ln'.+synthstat :: Ugen.Ugen -> String+synthstat = unlines . synthstat_ln++{- | 'putStrLn' of 'synthstat'.++> synthstat_wr Sound.Sc3.Ugen.Help.Graph.default_ugen_graph+-}+synthstat_wr :: Ugen.Ugen -> IO ()+synthstat_wr = putStrLn . synthstat++{- | Variant without Ugen sequence.++> putStrLn $ synthstat_concise (default_sampler_ugen_graph True)+-}+synthstat_concise :: Ugen.Ugen -> String+synthstat_concise = unlines . reverse . drop 1 . reverse . synthstat_ln++-- | 'graphdef_dump_ugens' of 'ugen_to_graphdef'+ugen_dump_ugens :: Ugen.Ugen -> IO ()+ugen_dump_ugens = Graphdef.graphdef_dump_ugens . ugen_to_graphdef
+ Sound/Sc3/Server/Transport/Fd.hs view
@@ -0,0 +1,210 @@+{- | /Fd/ variant of interaction with the scsynth server.++This duplicates functions at 'Sound.Sc3.Server.Transport.Monad' and+at some point at least part of the duplication will be removed.+-}+module Sound.Sc3.Server.Transport.Fd where++import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import System.Environment {- base -}+import System.FilePath {- filepath -}++import qualified Data.ByteString.Lazy as L {- bytestring -}+import qualified Data.List.Split as Split {- split -}+import qualified Safe {- safe -}++import Sound.Osc.Fd {- hosc -}++import Sound.Sc3.Server.Command+import Sound.Sc3.Server.Enum+import qualified Sound.Sc3.Server.Graphdef as Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef+import qualified Sound.Sc3.Server.Nrt as Nrt+import qualified Sound.Sc3.Server.Status as Status+import Sound.Sc3.Server.Synthdef+import Sound.Sc3.Ugen.Ugen++-- * hosc variants++-- | Send a 'Message' and 'waitReply' for a @\/done@ reply.+async :: Transport t => t -> Message -> IO Message+async fd m = sendMessage fd m >> waitReply fd "/done"++-- | If 'isAsync' then 'void' 'async' else 'sendMessage'.+maybe_async :: (Transport t) => t -> Message -> IO ()+maybe_async fd m = if isAsync m then void (async fd m) else sendMessage fd m++-- | Variant that timestamps synchronous messages.+maybe_async_at :: (Transport t) => t -> Time -> Message -> IO ()+maybe_async_at fd t m =+  if isAsync m+    then void (async fd m)+    else sendBundle fd (bundle t [m])++{- | Read ScTransport, ScHostname and ScPort environment variables.+Default values are: Tcp, 127.0.0.1 and 57110.+-}+defaultSc3OscSocketAddress :: IO OscSocketAddress+defaultSc3OscSocketAddress = do+  let f key defaultValue = fmap (fromMaybe defaultValue) (lookupEnv key)+  protocol <- f "ScTransport" "Tcp"+  hostname <- f "ScHostname" "127.0.0.1"+  port <- f "ScPort" "57110"+  return (read protocol, hostname, read port)++-- | Bracket @Sc3@ communication.+withSc3 :: (OscSocket -> IO a) -> IO a+withSc3 process = do+  address <- defaultSc3OscSocketAddress+  withTransport (openOscSocket address) process++-- * Server control++-- | Free all nodes ('g_freeAll') at group @1@.+stop :: Transport t => t -> IO ()+stop fd = sendMessage fd (g_freeAll [1])++-- | Free all nodes ('g_freeAll') at and re-create groups @1@ and @2@.+reset :: Transport t => t -> IO ()+reset fd = do+  sendMessage fd (g_freeAll [1, 2])+  sendMessage fd (g_new [(1, AddToTail, 0), (2, AddToTail, 0)])++-- | Send 'd_recv' and 's_new' messages to scsynth.+playGraphdef :: Transport t => Int -> t -> Graphdef.Graphdef -> IO ()+playGraphdef k fd g = do+  let nm = ascii_to_string (Graphdef.graphdef_name g)+      fn = "/tmp" </> nm <.> "scsyndef"+      by = Graphdef.encode_graphdef g+      sz = L.length by+  if sz < 65507+    then void (async fd (d_recv_bytes by))+    else Graphdef.graphdefWrite fn g >> async fd (d_load fn) >> sendMessage fd (s_new0 nm k AddToTail 1)++-- | 'playGraphdef' of 'synthdef_to_graphdef'.+playSynthdef :: Transport t => Int -> t -> Synthdef -> IO ()+playSynthdef k fd = playGraphdef k fd . synthdef_to_graphdef++-- | Send an /anonymous/ instrument definition using 'playSynthdef'.+playUgen :: Transport t => Int -> t -> Ugen -> IO ()+playUgen k fd = playSynthdef k fd . synthdef "Anonymous"++-- * Non-real time++{- | Wait ('pauseThreadUntil') until bundle is due to be sent relative+to initial 'Time', then send each message, asynchronously if+required.+-}+run_bundle :: Transport t => t -> Time -> BundleOf Message -> IO ()+run_bundle fd t0 b = do+  let t = t0 + bundleTime b+      latency = 0.1+  pauseThreadUntil (t - latency)+  mapM_ (maybe_async_at fd t) (bundleMessages b)++{- | Perform an 'Nrt' score (as would be rendered by 'writeNrt').  In+particular note that all timestamps /must/ be in 'NTPr' form.+-}+nrt_play :: Transport t => t -> Nrt.Nrt -> IO ()+nrt_play fd sc = time >>= \t0 -> mapM_ (run_bundle fd t0) (Nrt.nrt_bundles sc)++-- | 'withSc3' of 'nrt_play'+nrt_audition :: Nrt.Nrt -> IO ()+nrt_audition sc = withSc3 (`nrt_play` sc)++-- * Audible++-- | Class for values that can be encoded and sent to @scsynth@ for audition.+class Audible e where+  play_id :: Transport t => Int -> t -> e -> IO ()+  play :: Transport t => t -> e -> IO ()+  play = play_id (-1)++instance Audible Graphdef.Graphdef where+  play_id = playGraphdef++instance Audible Synthdef where+  play_id = playSynthdef++instance Audible Ugen where+  play_id = playUgen++-- | 'withSc3' of 'play_id'+audition_id :: Audible e => Int -> e -> IO ()+audition_id k e = withSc3 (\fd -> play_id k fd e)++-- | 'audition_id' of @-1@.+audition :: Audible e => e -> IO ()+audition = audition_id (-1)++-- * Notifications++{- | Turn on notifications, run /f/, turn off notifications, return+result.+-}+withNotifications :: Transport t => t -> (t -> IO a) -> IO a+withNotifications fd f = do+  _ <- async fd (notify True)+  r <- f fd+  _ <- async fd (notify False)+  return r++-- * Buffer++{- | Variant of 'b_getn1' that waits for return message and unpacks it.++> withSc3 (\fd -> b_getn1_data fd 0 (0,5))+-}+b_getn1_data :: Transport t => t -> Int -> (Int, Int) -> IO [Double]+b_getn1_data fd b s = do+  let f m = let (_, _, _, r) = unpack_b_setn_err m in r+  sendMessage fd (b_getn1 b s)+  fmap f (waitReply fd "/b_setn")++{- | Variant of 'b_getn1_data' that segments individual 'b_getn'+messages to /n/ elements.++> withSc3 (\fd -> b_getn1_data_segment fd 1 0 (0,5))+-}+b_getn1_data_segment :: Transport t => t -> Int -> Int -> (Int, Int) -> IO [Double]+b_getn1_data_segment fd n b (i, j) = do+  let ix = b_indices n j i+  d <- mapM (b_getn1_data fd b) ix+  return (concat d)++-- | Variant of 'b_getn1_data_segment' that gets the entire buffer.+b_fetch :: Transport t => t -> Int -> Int -> IO [[Double]]+b_fetch fd n b = do+  let f m =+        let (_, nf, nc, _) = unpack_b_info_err m+            ix = (0, nf * nc)+            deinterleave = transpose . Split.chunksOf nc+        in fmap deinterleave (b_getn1_data_segment fd n b ix)+  sendMessage fd (b_query1 b)+  waitReply fd "/b_info" >>= f++-- | 'head' of 'b_fetch'.+b_fetch1 :: Transport t => t -> Int -> Int -> IO [Double]+b_fetch1 fd n b = fmap (Safe.headNote "b_fetch1") (b_fetch fd n b)++-- * Status++-- | Collect server status information.+serverStatus :: Transport t => t -> IO [String]+serverStatus = fmap Status.statusFormat . serverStatusData++-- | Read nominal sample rate of server.+serverSampleRateNominal :: Transport t => t -> IO Double+serverSampleRateNominal = fmap (Status.extractStatusField 7) . serverStatusData++-- | Read actual sample rate of server.+serverSampleRateActual :: Transport t => t -> IO Double+serverSampleRateActual = fmap (Status.extractStatusField 8) . serverStatusData++-- | Retrieve status data from server.+serverStatusData :: Transport t => t -> IO [Datum]+serverStatusData fd = do+  sendMessage fd status+  waitDatum fd "/status.reply"
+ Sound/Sc3/Server/Transport/Monad.hs view
@@ -0,0 +1,433 @@+-- | /Monad/ variant of interaction with the scsynth server.+module Sound.Sc3.Server.Transport.Monad where++import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import System.Directory {- directory -}+import System.FilePath {- filepath -}++import qualified Data.ByteString.Lazy as L {- bytestring -}+import qualified Data.List.Split as Split {- split -}+import qualified Data.Tree as Tree {- containers -}+import qualified Safe {- safe -}++import Sound.Osc {- hosc -}+import qualified Sound.Osc.Time.Timeout {- hosc -}++import qualified Sound.Sc3.Common.Base.System as System+import qualified Sound.Sc3.Server.Command as Command+import qualified Sound.Sc3.Server.Command.Generic as Generic+import qualified Sound.Sc3.Server.Enum as Enum+import qualified Sound.Sc3.Server.Graphdef as Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef+import qualified Sound.Sc3.Server.Nrt as Nrt+import qualified Sound.Sc3.Server.Status as Status+import qualified Sound.Sc3.Server.Synthdef as Synthdef+import qualified Sound.Sc3.Ugen.Bindings.Composite as Composite+import qualified Sound.Sc3.Ugen.Ugen as Ugen++{-+import qualified Control.Monad.IO.Class as M {- transformers -}+import qualified Control.Monad.Trans.Reader as R {- transformers -}+import qualified Sound.Sc3.Server.Transport.FD as FD+-}++-- * hosc variants++-- | 'sendMessage' and 'waitReply' for a @\/done@ reply.+async :: DuplexOsc m => Message -> m Message+async m = sendMessage m >> waitReply "/done"++-- | 'void' of 'async'.+async_ :: DuplexOsc m => Message -> m ()+async_ = void . async++-- | If 'isAsync' then 'async_' else 'sendMessage'.+maybe_async :: DuplexOsc m => Message -> m ()+maybe_async m = if Command.isAsync m then async_ m else sendMessage m++-- | Variant that timestamps synchronous messages.+maybe_async_at :: DuplexOsc m => Time -> Message -> m ()+maybe_async_at t m =+  if Command.isAsync m+    then async_ m+    else sendBundle (bundle t [m])++{- | Hostname and port number.+By default Tcp, 127.0.0.1 and 57110.+-}+type Sc3_Address = OscSocketAddress++{- | Sc3 default address.++>>> sc3_default_address+(Tcp,"127.0.0.1",57110)+-}+sc3_default_address :: Sc3_Address+sc3_default_address = (Tcp, "127.0.0.1", 57110)++{- | Lookup ScSynth address at ScHostname and ScPort.+If either is no set default values are used.++>>> import System.Environment+>>> setEnv "ScHostname" "192.168.1.53"+>>> sc3_env_or_default_address+(Udp,"192.168.1.53",57110)+-}+sc3_env_or_default_address :: IO Sc3_Address+sc3_env_or_default_address = do+  protocol <- System.lookup_env_default "ScProtocol" "Tcp"+  hostname <- System.lookup_env_default "ScHostname" "127.0.0.1"+  port <- System.lookup_env_default "ScPort" "57110"+  return (read protocol, hostname, read port)++{- | Maximum packet size, in bytes, that can be sent over Udp.+However, see also <https://tools.ietf.org/html/rfc2675>.+Tcp is now the default transport mechanism for Hsc3.+-}+sc3_udp_limit :: Num n => n+sc3_udp_limit = 65507++-- | Bracket @Sc3@ communication at indicated host and port.+withSc3At :: Sc3_Address -> Connection OscSocket a -> IO a+withSc3At address = withTransport (openOscSocket address)++{- | Bracket @Sc3@ communication, ie. 'withSc3At' 'sc3_env_or_default_address'.++> import Sound.Sc3.Server.Command++> withSc3 (sendMessage status >> waitReply "/status.reply")+-}+withSc3 :: Connection OscSocket a -> IO a+withSc3 f = do+  addr <- sc3_env_or_default_address+  withSc3At addr f++-- | 'void' of 'withSc3'.+withSc3_ :: Connection OscSocket a -> IO ()+withSc3_ = void . withSc3++-- | 'timeout_r' of 'withSc3'+withSc3_tm :: Double -> Connection OscSocket a -> IO (Maybe a)+withSc3_tm tm = Sound.Osc.Time.Timeout.timeout_r tm . withSc3++{- | Run /f/ at /k/ scsynth servers with sequential port numbers starting at 'Options.sc3_port_def'.++> withSc3AtSeq sc3_default_address 2 (sendMessage status >> waitReply "/status.reply")+-}+withSc3AtSeq :: Sc3_Address -> Int -> Connection OscSocket a -> IO [a]+withSc3AtSeq (protocol, hostname, port) k f = do+  let mk_socket i = openOscSocket (protocol, hostname, port + i)+  mapM (\i -> withTransport (mk_socket i) f) [0 .. k - 1]++-- | 'void' of 'withSc3AtSeq'.+withSc3AtSeq_ :: Sc3_Address -> Int -> Connection OscSocket a -> IO ()+withSc3AtSeq_ loc k = void . withSc3AtSeq loc k++-- * Server control++-- | Free all nodes ('g_freeAll') at group @1@.+stop :: SendOsc m => m ()+stop = sendMessage (Command.g_freeAll [1])++-- * Composite++-- | Runs 'clearSched' and then frees and re-creates groups @1@ and @2@.+reset :: SendOsc m => m ()+reset =+  let m =+        [ Command.clearSched+        , Command.n_free [1, 2]+        , Command.g_new [(1, Enum.AddToHead, 0), (2, Enum.AddToTail, 0)]+        ]+  in sendBundle (bundle immediately m)++-- | (node-id,add-action,group-id,parameters)+type Play_Opt = (Command.Node_Id, Enum.AddAction, Command.Group_Id, [(String, Double)])++-- | Make 's_new' message to play 'Graphdef.Graphdef'.+play_graphdef_msg :: Play_Opt -> Graphdef.Graphdef -> Message+play_graphdef_msg (nid, act, gid, param) g =+  let nm = ascii_to_string (Graphdef.graphdef_name g)+  in Command.s_new nm nid act gid param++{- | If the graph size is less than 'sc3_udp_limit' encode and send+using 'd_recv_bytes', else write to temporary directory and read+using 'd_load'.+-}+recv_or_load_graphdef :: Transport m => Graphdef.Graphdef -> m Message+recv_or_load_graphdef g = do+  tmp <- liftIO getTemporaryDirectory+  let nm = ascii_to_string (Graphdef.graphdef_name g)+      fn = tmp </> nm <.> "scsyndef"+      by = Graphdef.encode_graphdef g+      sz = L.length by+  if sz < sc3_udp_limit+    then async (Command.d_recv_bytes by)+    else liftIO (Graphdef.graphdefWrite fn g) >> async (Command.d_load fn)++-- | Send 'd_recv' and 's_new' messages to scsynth.+playGraphdef :: Transport m => Play_Opt -> Graphdef.Graphdef -> m ()+playGraphdef opt g = recv_or_load_graphdef g >> sendMessage (play_graphdef_msg opt g)++-- | Send 'd_recv' and 's_new' messages to scsynth.+playSynthdef :: Transport m => Play_Opt -> Synthdef.Synthdef -> m ()+playSynthdef opt = playGraphdef opt . Synthdef.synthdef_to_graphdef++-- | Send an /anonymous/ instrument definition using 'playSynthdef'.+playUgen :: Transport m => Play_Opt -> Ugen.Ugen -> m ()+playUgen loc =+  playSynthdef loc+    . Synthdef.synthdef "Anonymous"+    . Composite.wrapOut Nothing++-- * Nrt++-- | Read latency from environment, defaulting to 0.1 seconds.+sc_latency :: IO Double+sc_latency = fmap read (System.lookup_env_default "ScLatency" "0.1")++{- | Wait ('pauseThreadUntil') until bundle is due to be sent relative+to the initial 'Time', then send each message, asynchronously if+required.+-}+run_bundle :: Transport m => Double -> Time -> BundleOf Message -> m ()+run_bundle latency t0 b = do+  let t = t0 + bundleTime b+  liftIO (pauseThreadUntil (t - latency))+  mapM_ (maybe_async_at t) (bundleMessages b)++{- | Play an 'Nrt' score (as would be rendered by 'writeNrt').++> let sc = Nrt [bundle 1 [s_new0 "default" (-1) AddToHead 1]+>              ,bundle 2 [n_set1 (-1) "gate" 0]]+> in withSc3 (nrt_play sc)+-}+nrt_play :: Transport m => Nrt.Nrt -> m ()+nrt_play sc = do+  t0 <- liftIO time+  latency <- liftIO sc_latency+  mapM_ (run_bundle latency t0) (Nrt.nrt_bundles sc)++{- | Variant where asynchronous commands at time @0@ are separated out and run before+the initial time-stamp is taken.  This re-orders synchronous+commands in relation to asynchronous at time @0@.+-}+nrt_play_reorder :: Transport m => Nrt.Nrt -> m ()+nrt_play_reorder s = do+  let (i, r) = Nrt.nrt_span (<= 0) s+      i' = concatMap bundleMessages i+      (a, b) = Command.partition_async i'+  mapM_ async a+  t0 <- liftIO time+  latency <- liftIO sc_latency+  mapM_ (run_bundle latency t0) (Bundle 0 b : r)++-- | 'withSc3' of 'nrt_play'.+nrt_audition :: Nrt.Nrt -> IO ()+nrt_audition = withSc3 . nrt_play++-- * Audible++-- | Class for values that can be encoded and send to @scsynth@ for audition.+class Audible e where+  playAt :: Transport m => Play_Opt -> e -> m ()++  -- | Variant where /id/ is @-1@.+  play :: Transport m => e -> m ()+  play = playAt (-1, Enum.AddToHead, 1, [])++instance Audible Graphdef.Graphdef where+  playAt = playGraphdef++instance Audible Synthdef.Synthdef where+  playAt = playSynthdef++instance Audible Ugen.Ugen where+  playAt = playUgen++-- | 'withSc3At' of 'playAt'.+auditionAt :: Audible e => Sc3_Address -> Play_Opt -> e -> IO ()+auditionAt loc opt = withSc3At loc . playAt opt++-- | 'withSc3AtSeq' of 'playAt'.+auditionAtSeq :: Audible e => Sc3_Address -> Play_Opt -> Int -> e -> IO ()+auditionAtSeq loc opt k = withSc3AtSeq_ loc k . playAt opt++-- | Default 'Play_Opt', ie. (-1,addToHead,1,[])+def_play_opt :: Play_Opt+def_play_opt = (-1, Enum.AddToHead, 1, [])++-- | 'auditionAt' 'sc3_env_or_default_address'+auditionOpt :: Audible e => Play_Opt -> e -> IO ()+auditionOpt o e = do+  addr <- sc3_env_or_default_address+  auditionAt addr o e++-- | 'auditionOpt' 'def_play_opt'+audition :: Audible e => e -> IO ()+audition = auditionOpt def_play_opt++-- | 'auditionAtSeq' 'def_play_opt'+auditionSeq :: Audible e => Int -> e -> IO ()+auditionSeq k x = do+  addr <- sc3_env_or_default_address+  auditionAtSeq addr def_play_opt k x++-- * Notifications++-- | Turn on notifications, run /f/, turn off notifications, return result.+withNotifications :: DuplexOsc m => m a -> m a+withNotifications f = do+  async_ (Command.notify True)+  r <- f+  async_ (Command.notify False)+  return r++-- * Buffer & control & node variants.++{- | Variant of 'b_getn1' that waits for return message and unpacks it.++> withSc3_tm 1.0 (b_getn1_data 0 (0,5))+-}+b_getn1_data :: DuplexOsc m => Int -> (Int, Int) -> m [Double]+b_getn1_data b s = do+  let f m = let (_, _, _, r) = Command.unpack_b_setn_err m in r+  sendMessage (Command.b_getn1 b s)+  fmap f (waitReply "/b_setn")++{- | Variant of 'b_getn1_data' that segments individual 'b_getn'+messages to /n/ elements.++> withSc3_tm 1.0 (b_getn1_data_segment 1 0 (0,5))+-}+b_getn1_data_segment ::+  DuplexOsc m =>+  Int ->+  Int ->+  (Int, Int) ->+  m [Double]+b_getn1_data_segment n b (i, j) = do+  let ix = Command.b_indices n j i+  d <- mapM (b_getn1_data b) ix+  return (concat d)++-- | Variant of 'b_getn1_data_segment' that gets the entire buffer.+b_fetch :: DuplexOsc m => Int -> Int -> m [[Double]]+b_fetch n b = do+  let f m =+        let (_, nf, nc, _) = Command.unpack_b_info_err m+            ix = (0, nf * nc)+            deinterleave = transpose . Split.chunksOf nc+        in fmap deinterleave (b_getn1_data_segment n b ix)+  sendMessage (Command.b_query1 b)+  waitReply "/b_info" >>= f++{- | First channel of 'b_fetch', errors if there is no data.++> withSc3 (b_fetch1 512 123456789)+-}+b_fetch1 :: DuplexOsc m => Int -> Int -> m [Double]+b_fetch1 n b = fmap (Safe.headNote "b_fetch1: no data") (b_fetch n b)++-- | Combination of 'b_query1_unpack' and 'b_fetch'.+b_fetch_hdr :: Transport m => Int -> Int -> m ((Int, Int, Int, Double), [[Double]])+b_fetch_hdr k b = do+  q <- b_query1_unpack b+  d <- b_fetch k b+  return (q, d)++-- | 'b_info_unpack_err' of 'b_query1'.+b_query1_unpack_generic :: (DuplexOsc m, Num n, Fractional r) => Int -> m (n, n, n, r)+b_query1_unpack_generic n = do+  sendMessage (Command.b_query1 n)+  q <- waitReply "/b_info"+  return (Generic.unpack_b_info_err q)++{- | Type specialised 'b_query1_unpack_generic'.++> withSc3 (b_query1_unpack 0)+-}+b_query1_unpack :: DuplexOsc m => Command.Buffer_Id -> m (Int, Int, Int, Double)+b_query1_unpack = b_query1_unpack_generic++-- | Variant of 'c_getn1' that waits for the reply and unpacks the data.+c_getn1_data :: (DuplexOsc m, Floating t) => (Int, Int) -> m [t]+c_getn1_data s = do+  let f d = case d of+        Int32 _ : Int32 _ : x -> mapMaybe datum_floating x+        _ -> error "c_getn1_data"+  sendMessage (Command.c_getn1 s)+  fmap f (waitDatum "/c_setn")++-- | Apply /f/ to result of 'n_query'.+n_query1_unpack_f :: DuplexOsc m => (Message -> t) -> Command.Node_Id -> m t+n_query1_unpack_f f n = do+  sendMessage (Command.n_query [n])+  r <- waitReply "/n_info"+  return (f r)++-- | Variant of 'n_query' that waits for and unpacks the reply.+n_query1_unpack :: DuplexOsc m => Command.Node_Id -> m (Maybe (Int, Int, Int, Int, Int, Maybe (Int, Int)))+n_query1_unpack = n_query1_unpack_f Command.unpack_n_info++-- | Variant of 'n_query1_unpack' that returns plain (un-lifted) result.+n_query1_unpack_plain :: DuplexOsc m => Command.Node_Id -> m [Int]+n_query1_unpack_plain = n_query1_unpack_f Command.unpack_n_info_plain++-- | Variant of 'g_queryTree' that waits for and unpacks the reply.+g_queryTree1_unpack :: DuplexOsc m => Command.Group_Id -> m Status.Query_Node+g_queryTree1_unpack n = do+  sendMessage (Command.g_queryTree [(n, True)])+  r <- waitReply "/g_queryTree.reply"+  return (Status.queryTree (messageDatum r))++-- * Status++{- | Collect server status information.++> withSc3 serverStatus >>= mapM putStrLn+-}+serverStatus :: DuplexOsc m => m [String]+serverStatus = fmap Status.statusFormat serverStatusData++{- | Collect server status information.++> withSc3 server_status_concise >>= putStrLn+-}+server_status_concise :: DuplexOsc m => m String+server_status_concise = fmap Status.status_format_concise serverStatusData++{- | Read nominal sample rate of server.++> withSc3 serverSampleRateNominal+-}+serverSampleRateNominal :: DuplexOsc m => m Double+serverSampleRateNominal = fmap (Status.extractStatusField 7) serverStatusData++{- | Read actual sample rate of server.++> withSc3 serverSampleRateActual+-}+serverSampleRateActual :: DuplexOsc m => m Double+serverSampleRateActual = fmap (Status.extractStatusField 8) serverStatusData++-- | Retrieve status data from server.+serverStatusData :: DuplexOsc m => m [Datum]+serverStatusData = do+  sendMessage Command.status+  waitDatum "/status.reply"++-- * Tree++{- | Collect server node tree information.++> withSc3 serverTree >>= mapM_ putStrLn+-}+serverTree :: DuplexOsc m => m [String]+serverTree = do+  qt <- g_queryTree1_unpack 0+  let tr = Status.queryTree_rt qt+  return ["***** SuperCollider Server Tree *****", Tree.drawTree (fmap Status.query_node_pp tr)]
+ Sound/Sc3/Ugen.hs view
@@ -0,0 +1,24 @@+-- | Collection of modules for writing unit-generator graphs.+module Sound.Sc3.Ugen (module M) where++import Sound.Sc3.Ugen.Analysis as M+import Sound.Sc3.Ugen.Bracketed as M+import Sound.Sc3.Ugen.Brackets as M+import Sound.Sc3.Ugen.Constant as M+import Sound.Sc3.Ugen.Control as M+import Sound.Sc3.Ugen.Enum as M+import Sound.Sc3.Ugen.Envelope as M+import Sound.Sc3.Ugen.Event as M+import Sound.Sc3.Ugen.Help.Graph as M+import Sound.Sc3.Ugen.Label as M+import Sound.Sc3.Ugen.Math as M+import Sound.Sc3.Ugen.Math.Composite as M+import Sound.Sc3.Ugen.Mce as M+import Sound.Sc3.Ugen.Mrg as M+import Sound.Sc3.Ugen.Name as M+import Sound.Sc3.Ugen.Optimise as M+import Sound.Sc3.Ugen.Pp as M+import Sound.Sc3.Ugen.Primitive as M+import Sound.Sc3.Ugen.Proxy as M+import Sound.Sc3.Ugen.Ugen as M+import Sound.Sc3.Ugen.Util as M
+ Sound/Sc3/Ugen/Analysis.hs view
@@ -0,0 +1,86 @@+-- | Ugen analysis+module Sound.Sc3.Ugen.Analysis where++import Data.List {- base -}++import qualified Sound.Sc3.Common.Mce as Mce {- hsc3 -}+import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Db as Db {- hsc3 -}++import Sound.Sc3.Ugen.Types++{- | Ugen primitive set.+Sees through Proxy and Mrg, possible multiple primitives for Mce.+-}+ugen_primitive_set :: Ugen -> [Primitive Ugen]+ugen_primitive_set u =+  case u of+    Constant_U _ -> []+    Control_U _ -> []+    Label_U _ -> []+    Primitive_U p -> [p]+    Proxy_U p -> [proxySource p]+    Mce_U m -> concatMap ugen_primitive_set (Mce.mce_to_list m)+    Mrg_U m -> ugen_primitive_set (mrgLeft m)++{- | Heuristic based on primitive name (FFT, PV_...).+Note that IFFT is at /control/ rate, not PV_... rate.+-}+primitive_is_pv_rate :: String -> Bool+primitive_is_pv_rate nm = nm == "FFT" || "PV_" `isPrefixOf` nm++-- | Variant on primitive_is_pv_rate.+ugen_is_pv_rate :: Ugen -> Bool+ugen_is_pv_rate = any (primitive_is_pv_rate . ugenName) . ugen_primitive_set++{- | 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)+-}+pv_track_buffer :: Ugen -> Either String Ugen+pv_track_buffer u =+  case ugen_primitive_set u of+    [] -> Left "pv_track_buffer: not located"+    p : _ -> case ugenName p of+      "FFT" -> Right (ugenInputs p !! 0)+      "PV_Split" -> Right (ugenInputs p !! 1)+      _ -> pv_track_buffer (ugenInputs p !! 0)++{- | 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+-}+buffer_nframes :: Ugen -> Ugen+buffer_nframes u =+  case ugen_primitive_set u of+    [] -> Db.bufFrames (rateOf u) u+    p : _ -> case ugenName p of+      "LocalBuf" -> ugenInputs p !! 1+      _ -> Db.bufFrames (rateOf u) u++-- | 'pv_track_buffer' then 'buffer_nframes'.+pv_track_nframes :: Ugen -> Either String Ugen+pv_track_nframes u = pv_track_buffer u >>= Right . buffer_nframes++{- | Ugen is required to be the root node of complete graph.+This function returns the name of the output Ugen (ie. "Out" or an allowed variant) and the input to that Ugen.+It allows multiple-root graphs.+It is in some sense the inverse of 'wrapOut'.+-}+ugen_remove_out_node :: Ugen -> (String, Ugen)+ugen_remove_out_node u =+  let err = error "ugen_remove_out_node?"+      assert_is_output x = if x `elem` ["Out", "ReplaceOut", "OffsetOut"] then x else err+  in case u of+      Primitive_U (Primitive Rate.AudioRate nm (_bus : inputs) [] _special _uid _brk) -> (assert_is_output nm, mce inputs)+      Mrg_U (Mrg lhs rhs) -> let (nm, res) = ugen_remove_out_node lhs in (nm, Mrg_U (Mrg res rhs))+      _ -> err
+ Sound/Sc3/Ugen/Bindings.hs view
@@ -0,0 +1,9 @@+-- | SC3 Ugen bindings (composite module).+module Sound.Sc3.Ugen.Bindings (module B) where++import Sound.Sc3.Ugen.Bindings.Composite as B+import Sound.Sc3.Ugen.Bindings.Db as B+import Sound.Sc3.Ugen.Bindings.Hw as B++-- import Sound.Sc3.Ugen.Bindings.Hw.External as B+-- import Sound.Sc3.Ugen.Bindings.Monad as B
+ Sound/Sc3/Ugen/Bindings/Composite.hs view
@@ -0,0 +1,603 @@+-- | Common unit generator graphs.+module Sound.Sc3.Ugen.Bindings.Composite where++import Data.List {- base -}+import Data.Maybe {- base -}++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Math+import Sound.Sc3.Common.Math.Filter.Beq+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import Sound.Sc3.Ugen.Bindings.Db+import Sound.Sc3.Ugen.Bindings.Hw+import Sound.Sc3.Ugen.Math+import Sound.Sc3.Ugen.Mce+import Sound.Sc3.Ugen.Types+import Sound.Sc3.Ugen.Util++-- | Generate a localBuf and use setBuf to initialise it.+asLocalBufId :: ID i => i -> [Ugen] -> Ugen+asLocalBufId z xs =+  let b = localBufId z 1 (fromIntegral (length xs))+      s = setBuf' b xs 0+  in mrg2 b s++asLocalBufM :: Uid m => [Ugen] -> m Ugen+asLocalBufM = liftUid1 asLocalBufId++asLocalBuf :: [Ugen] -> Ugen+asLocalBuf = liftUnsafe1 asLocalBufM++-- | balance2 with Mce input.+balanceStereo :: Ugen -> Ugen -> Ugen -> Ugen+balanceStereo sig pos level = let (x, y) = unmce2 sig in balance2 x y pos level++-- | 24db/oct rolloff - 4th order resonant Low Pass Filter+bLowPass4 :: Ugen -> Ugen -> Ugen -> Ugen+bLowPass4 i f rq =+  let (a0, a1, a2, b1, b2) = bLowPassCoef sampleRate f rq+      flt z = sos z a0 a1 a2 b1 b2+  in flt (flt i)++-- | 24db/oct rolloff - 4th order resonant Hi Pass Filter+bHiPass4 :: Ugen -> Ugen -> Ugen -> Ugen+bHiPass4 i f rq =+  let (a0, a1, a2, b1, b2) = bHiPassCoef sampleRate f rq+      flt z = sos z a0 a1 a2 b1 b2+  in flt (flt i)++-- | Buffer reader (no interpolation).+bufRdN :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Ugen+bufRdN n r b p l = bufRd n r b p l NoInterpolation++-- | Buffer reader (linear interpolation).+bufRdL :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Ugen+bufRdL n r b p l = bufRd n r b p l LinearInterpolation++-- | Buffer reader (cubic interpolation).+bufRdC :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Ugen+bufRdC n r b p l = bufRd n r b p l CubicInterpolation++-- | Triggers when a value changes+changed :: Ugen -> Ugen -> Ugen+changed input threshold = abs (hpz1 input) `greater_than` threshold++-- | 'mce' variant of 'lchoose'.+chooseId :: ID m => m -> Ugen -> Ugen+chooseId z = lchooseId z . mceChannels++-- | 'liftUid' of 'choose'.+chooseM :: Uid m => Ugen -> m Ugen+chooseM = liftUid1 chooseId++choose :: Ugen -> Ugen+choose = liftUnsafe1 chooseM++-- | 'clearBuf' of 'localBuf'.+clearLocalBufId :: ID a => a -> Ugen -> Ugen -> Ugen+clearLocalBufId z nc nf = clearBuf (localBufId z nc nf)++clearLocalBufM :: Uid m => Ugen -> Ugen -> m Ugen+clearLocalBufM = liftUid2 clearLocalBufId++clearLocalBuf :: Ugen -> Ugen -> Ugen+clearLocalBuf = liftUnsafe2 clearLocalBufM++-- | Demand rate (:) function.+dconsId :: ID m => (m, m, m) -> Ugen -> Ugen -> Ugen+dconsId (z0, z1, z2) x xs =+  let i = dseqId z0 1 (mce2 0 1)+      a = dseqId z1 1 (mce2 x xs)+  in dswitchId z2 i a++-- | Demand rate (:) function.+dconsM :: (Uid m) => Ugen -> Ugen -> m Ugen+dconsM x xs = do+  i <- dseqM 1 (mce2 0 1)+  a <- dseqM 1 (mce2 x xs)+  dswitchM i a++dcons :: Ugen -> Ugen -> Ugen+dcons = liftUnsafe2 dconsM++-- | Dynamic klang, dynamic sine oscillator bank+dynKlang :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+dynKlang r fs fo s =+  let gen (f : a : ph : xs) = sinOsc r (f * fs + fo) ph * a + gen xs+      gen _ = 0+  in gen (mceChannels s)++-- | Dynamic klank, set of non-fixed resonating filters.+dynKlank :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dynKlank i fs fo ds s =+  let gen (f : a : d : xs) = ringz i (f * fs + fo) (d * ds) * a + gen xs+      gen _ = 0+  in gen (mceChannels s)++-- | Pan2 without (k-rate only) level input+eqPan2 :: Ugen -> Ugen -> Ugen+eqPan2 input pos = pan2 input pos 1++-- | 'linExp' with input range of (-1,1).+exprange :: Ugen -> Ugen -> Ugen -> Ugen+exprange l r s = linExp s (-1) 1 l r++-- | Variant of `exprange` with arguments to make writing post-fix nicer.+in_exprange :: Ugen -> (Ugen, Ugen) -> Ugen+in_exprange s (l, r) = exprange l r s++{- | Variant FFT constructor with default values for hop size (0.5),+window type (0), active status (1) and window size (0).+-}+fft' :: Ugen -> Ugen -> Ugen+fft' buf i = fft buf i 0.5 0 1 0++{- | 'fft' variant that allocates 'localBuf'.++> let c = ffta 'α' 2048 (soundIn 0) 0.5 0 1 0+> in audition (out 0 (ifft c 0 0))+-}+fftAllocId :: ID i => i -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fftAllocId z nf i h wt a ws =+  let b = localBufId z 1 nf+  in fft b i h wt a ws++fftAllocM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+fftAllocM = liftUid6 fftAllocId++fftAlloc :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fftAlloc = liftUnsafe6 fftAllocM++-- | Sum of 'numInputBuses' and 'numOutputBuses'.+firstPrivateBus :: Ugen+firstPrivateBus = numInputBuses + numOutputBuses++-- | Frequency shifter, in terms of 'hilbert' (see also 'freqShift').+freqShift_hilbert :: Ugen -> Ugen -> Ugen -> Ugen+freqShift_hilbert i f p =+  let o = sinOsc ar f (mce [p + 0.5 * pi, p])+      h = hilbert i+  in mix (h * o)++{- | Ugen function to re-trigger an EnvGen envelope.+     Inputs are /gate/ (as set at EnvGen) and /reset/.+     The four state logic is: (1,0)->1 (1,1)->-1 (0,1)->0 (0,0)->0.+     If the gate input to EnvGen.kr is -1 the envelope ramps to zero in one control period.+     The reset input sequence 0,1,0 when the gate is open produces (1,-1,1), which resets the envelope.++>>> map (uncurry gateReset) [(1,0),(1,1),(0,1),(0,0)]+[1,-1,0,0]+-}+gateReset :: Num a => a -> a -> a+gateReset gt tr = gt - (gt * tr * 2)++{- | Variant of 'hilbert' using FFT (with a delay) for better results.+Buffer should be 2048 or 1024.+2048 = better results, more delay.+1024 = less delay, little choppier results.+-}+hilbertFIR :: Ugen -> Ugen -> Ugen+hilbertFIR s b =+  let c0 = fft' b s+      c1 = pv_PhaseShift90 c0+      delay = bufDur kr b+  in mce2 (delayN s delay delay) (ifft' c1)++-- | Variant ifft with default value for window type.+ifft' :: Ugen -> Ugen+ifft' buf = ifft buf 0 0++{-+-- | Linear interpolating variant on index.+indexL :: Ugen -> Ugen -> Ugen+indexL b i =+    let x = index b i+        y = index b (i + 1)+    in linLin (frac i) 0 1 x y+-}++{- | Generalised Klan(k/g) specification rule.  /f/ unwraps inputs, /g/ wraps output.++> let r = [220,0.2,0,219,0.1,1,221,0.1,2]+> in klanx_spec_f id id [220,219,221] [0.2,0.1,0.1] [0,1,2] == r+-}+klanx_spec_f :: (a -> [b]) -> ([b] -> c) -> a -> a -> a -> c+klanx_spec_f f g fr am z = g ((concat . transpose) [f fr, f am, f z])++-- | Format frequency, amplitude and decay time data as required for klank.+klangSpec :: [Ugen] -> [Ugen] -> [Ugen] -> Ugen+klangSpec = klanx_spec_f id mce++-- | Variant of 'klangSpec' for non-Ugen inputs.+klangSpec_k :: Real n => [n] -> [n] -> [n] -> Ugen+klangSpec_k = klanx_spec_f (map constant) mce++-- | Variant of 'klangSpec' for 'Mce' inputs.+klangSpec_mce :: Ugen -> Ugen -> Ugen -> Ugen+klangSpec_mce = klanx_spec_f mceChannels mce++-- | Format frequency, amplitude and decay time data as required for klank.+klankSpec :: [Ugen] -> [Ugen] -> [Ugen] -> Ugen+klankSpec = klanx_spec_f id mce++-- | Variant for non-Ugen inputs.+klankSpec_k :: Real n => [n] -> [n] -> [n] -> Ugen+klankSpec_k = klanx_spec_f (map constant) mce++-- | Variant of 'klankSpec' for 'Mce' inputs.+klankSpec_mce :: Ugen -> Ugen -> Ugen -> Ugen+klankSpec_mce = klanx_spec_f mceChannels mce++-- | Randomly select one of a list of Ugens (initialisation rate).+lchooseId :: ID m => m -> [Ugen] -> Ugen+lchooseId z a = select (iRandId z 0 (fromIntegral (length a))) (mce a)++-- | 'liftUid' of 'lchoose'.+lchooseM :: Uid m => [Ugen] -> m Ugen+lchooseM = liftUid1 lchooseId++lchoose :: [Ugen] -> Ugen+lchoose = liftUnsafe1 lchooseM++-- | 'linExp' of (-1,1).+linExp_b :: Ugen -> Ugen -> Ugen -> Ugen+linExp_b i = linExp i (-1) 1++-- | 'linExp' of (0,1).+linExp_u :: Ugen -> Ugen -> Ugen -> Ugen+linExp_u i = linExp i 0 1++-- | Map from one linear range to another linear range.+linLin :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linLin = linlin_ma mulAdd++-- | 'linLin' where source is (0,1).+linLin_u :: Ugen -> Ugen -> Ugen -> Ugen+linLin_u i = linLin i 0 1++-- | 'linLin' where source is (-1,1).+linLin_b :: Ugen -> Ugen -> Ugen -> Ugen+linLin_b i = linLin i (-1) 1++-- | Variant with defaults of zero.+localIn' :: Int -> Rate -> Ugen+localIn' nc r = localIn nc r (mce (replicate nc 0))++{- | Generate an 'envGen' Ugen with @fadeTime@ and @gate@ controls.++> import Sound.Sc3+> audition (out 0 (makeFadeEnv 1 * sinOsc ar 440 0 * 0.1))+> withSc3 (send (n_set1 (-1) "gate" 0))+-}+makeFadeEnv :: Double -> Ugen+makeFadeEnv fadeTime =+  let dt = control kr "fadeTime" (realToFrac fadeTime)+      gate_ = control kr "gate" 1+      startVal = dt `less_than_or_equal_to` 0+      env = Envelope [startVal, 1, 0] [1, 1] [EnvLin, EnvLin] (Just 1) Nothing 0+  in envGen kr gate_ 1 0 dt RemoveSynth env++-- | Variant that is randomly pressed.+mouseButtonRand :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+mouseButtonRand rt l r tm =+  let o = lfClipNoiseId 'z' rt 1+  in lag (linLin o (-1) 1 l r) tm++-- | Randomised mouse Ugen (see also 'mouseX'' and 'mouseY'').+mouseRandId :: ID a => a -> Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseRandId z rt l r ty tm =+  let f = case ty of+        Linear -> linLin+        Exponential -> linExp+        _ -> undefined+  in lag (f (lfNoise1Id z rt 1) (-1) 1 l r) tm++mouseRandM :: Uid m => Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> m Ugen+mouseRandM = liftUid5 mouseRandId++mouseRand :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseRand = liftUnsafe5 mouseRandM++-- | Variant that randomly traverses the mouseX space.+mouseXRand :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseXRand = mouseRandId 'x'++-- | Variant that randomly traverses the mouseY space.+mouseYRand :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseYRand = mouseRandId 'y'++-- | Translate onset type string to constant Ugen value.+onsetType :: Num a => String -> a+onsetType s =+  let t = ["power", "magsum", "complex", "rcomplex", "phase", "wphase", "mkl"]+  in fromIntegral (fromMaybe 3 (elemIndex s t))++-- | Onset detector with default values for minor parameters.+onsetsDefault :: Ugen -> Ugen -> Ugen -> Ugen+onsetsDefault c t o = onsets c t o 1 0.1 10 11 1 0++-- | Format magnitude and phase data data as required for packFFT.+packFFTSpec :: [Ugen] -> [Ugen] -> Ugen+packFFTSpec m p =+  let interleave x = concat . zipWith (\a b -> [a, b]) x+  in mce (interleave m p)++-- | Calculate size of accumulation buffer given FFT and IR sizes.+partConv_calcAccumSize :: Int -> Int -> Int+partConv_calcAccumSize fft_size ir_length =+  let partition_size = fft_size `div` 2+      num_partitions = (ir_length `div` partition_size) + 1+  in fft_size * num_partitions++{- | PM oscillator.+cf = carrier frequency, mf = modulation frequency, pm = pm-index = 0.0, mp = mod-phase = 0.0+-}+pmOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pmOsc r cf mf pm mp = sinOsc r cf (sinOsc r mf mp * pm)++{- | Variant of 'poll' that generates an 'mrg' value with the input+signal at left, and that allows a constant /frequency/ input in+place of a trigger.+-}+pollExt :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pollExt optTrig in_ label_ trigId =+  let tr = if isConstant optTrig then impulse kr optTrig 0 else optTrig+  in mrg [in_, poll tr in_ label_ trigId]++-- | Variant of 'in'' offset so zero if the first private bus.+privateIn :: Int -> Rate -> Ugen -> Ugen+privateIn nc rt k = in' nc rt (k + firstPrivateBus)++-- | Variant of 'out' offset so zero if the first private bus.+privateOut :: Ugen -> Ugen -> Ugen+privateOut k = out (k + firstPrivateBus)++{- | Apply function /f/ to each bin of an @FFT@ chain, /f/ receives+magnitude, phase and index and returns a (magnitude,phase).+-}+pvcollect :: Ugen -> Int -> (Ugen -> Ugen -> Int -> (Ugen, Ugen)) -> Int -> Int -> Ugen -> Ugen+pvcollect c nf f from to z =+  let m = unpackFFT c nf from to 0+      p = unpackFFT c nf from to 1+      i = [from .. to]+      e = zipWith3 f m p i+      mp = uncurry packFFTSpec (unzip e)+  in packFFT c nf from to z mp++{- | /dur/ and /hop/ are in seconds, /frameSize/ and /sampleRate/ in+frames, though the latter maybe fractional.++> pv_calcPVRecSize 4.2832879818594 1024 0.25 48000.0 == 823299+-}+pv_calcPVRecSize :: Double -> Int -> Double -> Double -> Int+pv_calcPVRecSize dur frame_size hop sample_rate =+  let frame_size' = fromIntegral frame_size+      raw_size = ceiling ((dur * sample_rate) / frame_size') * frame_size+  in ceiling (fromIntegral raw_size * recip hop + 3)++-- | 'rand' with left edge set to zero.+rand0Id :: ID a => a -> Ugen -> Ugen+rand0Id z = randId z 0++-- | 'Uid' form of 'rand0'.+rand0M :: Uid m => Ugen -> m Ugen+rand0M = randM 0++rand0 :: Ugen -> Ugen+rand0 = liftUnsafe1 rand0M++{- | 'rand' with left edge set to negative /n/.+     Note rand2 is also a UnaryOp Ugen, however hsc3 does not store Ids for operators.+-}+rand2Id :: ID a => a -> Ugen -> Ugen+rand2Id z n = randId z (negate n) n++-- | 'Uid' form of 'rand2'.+rand2M :: Uid m => Ugen -> m Ugen+rand2M n = randM (negate n) n++rand2 :: Ugen -> Ugen+rand2 = liftUnsafe1 rand2M++-- | rotate2 with Mce input.+rotateStereo :: Ugen -> Ugen -> Ugen+rotateStereo sig pos = let (x, y) = unmce2 sig in rotate2 x y pos++-- | RMS variant of 'runningSum'.+runningSumRMS :: Ugen -> Ugen -> Ugen+runningSumRMS z n = sqrt (runningSum (z * z) n * recip n)++-- | Mix one output from many sources+selectX :: Ugen -> Ugen -> Ugen+selectX ix xs =+  let s0 = select (roundTo ix 2) xs+      s1 = select (trunc ix 2 + 1) xs+  in xFade2 s0 s1 (fold2 (ix * 2 - 1) 1) 1++-- | Set local buffer values.+setBuf' :: Ugen -> [Ugen] -> Ugen -> Ugen+setBuf' b xs o = Sound.Sc3.Ugen.Bindings.Db.setBuf b o (fromIntegral (length xs)) (mce xs)++-- | Silence.+silent :: Int -> Ugen+silent n = let s = dc ar 0 in mce (replicate n s)++{- | Zero indexed audio input buses.+     Optimises case of consecutive Ugens.++>>> soundIn (mce2 0 1) == in' 2 ar numOutputBuses+True++>>> soundIn (mce2 0 2) == in' 1 ar (numOutputBuses + mce2 0 2)+True+-}+soundIn :: Ugen -> Ugen+soundIn u =+  let r = in' 1 ar (numOutputBuses + u)+  in case u of+      Mce_U m ->+        let n = mceProxies m+        in case uncons n of+            Nothing -> error "soundIn"+            Just (h, t) ->+              if all (== 1) (zipWith (-) t n)+                then in' (length n) ar (numOutputBuses + h)+                else r+      _ -> r++{- | Pan a set of channels across the stereo field.++input, spread:1, level:1, center:0, levelComp:true+-}+splay :: Ugen -> Ugen -> Ugen -> Ugen -> Bool -> Ugen+splay i s l c lc =+  let n = max 2 (fromIntegral (fromMaybe 1 (mceDegree i)))+      m = n - 1+      p = map ((+ (-1.0)) . (* (2 / m))) [0 .. m]+      a = if lc then sqrt (1 / n) else 1+  in mix (pan2 i (s * mce p + c) 1) * l * a++-- | Single tap into a delayline.  ar only.+tap :: Int -> Rate -> Ugen -> Ugen -> Ugen+tap numChannels rt bufnum delaytime =+  let n = delaytime * negate sampleRate+  in playBuf numChannels rt bufnum 1 0 n Loop DoNothing++-- | Randomly select one of several inputs on trigger.+tChooseId :: ID m => m -> Ugen -> Ugen -> Ugen+tChooseId z t a = select (tiRandId z 0 (mceSize a - 1) t) a++-- | Randomly select one of several inputs.+tChooseM :: (Uid m) => Ugen -> Ugen -> m Ugen+tChooseM t a = do+  r <- tiRandM 0 (constant (length (mceChannels a) - 1)) t+  return (select r a)++tChoose :: Ugen -> Ugen -> Ugen+tChoose = liftUnsafe2 tChooseM++-- | Triggered Line, implemented in terms of EnvGen.+tLine :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tLine rt start end dur trig_ =+  let p = envCoord [(0, 0), (0, start), (dur, end)] 1 1 EnvLin+  in envGen rt trig_ 1 0 1 DoNothing p++-- | Triggered xLine, implemented in terms of EnvGen.+tXLine :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tXLine rt start end dur trig_ =+  let p = envCoord [(0, 0), (0, start), (dur, end)] 1 1 EnvExp+  in envGen rt trig_ 1 0 1 DoNothing p++{- | Triangle wave as sum of /n/ sines.+For partial n, amplitude is (1 / square n) and phase is pi at every other odd partial.+-}+triAS :: Int -> Ugen -> Ugen+triAS n f0 =+  let mk_freq i = f0 * fromIntegral i+      mk_amp i = if even i then 0 else 1 / fromIntegral (i * i)+      mk_ph i = if i + 1 `mod` 4 == 0 then pi else 0+      m = [1, 3 .. n]+      param = zip3 (map mk_freq m) (map mk_ph m) (map mk_amp m)+  in sum_opt (map (\(fr, ph, am) -> sinOsc ar fr ph * am) param)++-- | Randomly select one of several inputs on trigger (weighted).+tWChooseId :: ID m => m -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tWChooseId z t a w n =+  let i = tWindexId z t n w+  in select i a++-- | Randomly select one of several inputs (weighted).+tWChooseM :: (Uid m) => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tWChooseM t a w n = do+  i <- tWindexM t n w+  return (select i a)++tWChoose :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tWChoose = liftUnsafe4 tWChooseM++-- | Unpack an FFT chain into separate demand-rate FFT bin streams.+unpackFFT :: Ugen -> Int -> Int -> Int -> Ugen -> [Ugen]+unpackFFT c nf from to w = map (\i -> unpack1FFT c (constant nf) (constant i) w) [from .. to]++-- | VarLag in terms of envGen.  Note: in SC3 curvature and warp are separate arguments.+varLag_env :: Ugen -> Ugen -> Envelope_Curve Ugen -> Maybe Ugen -> Ugen+varLag_env in_ time warp start =+  let rt = rateOf in_+      start_ = fromMaybe in_ start+      e = Envelope [start_, in_] [time] [warp] Nothing Nothing 0+      -- e[6] = curve; e[7] = curvature;+      time_ch = if rateOf time == InitialisationRate then 0 else changed time 0+      tr = changed in_ 0 + time_ch + impulse rt 0 0+  in envGen rt tr 1 0 1 DoNothing e++{- | k channel white noise.++> whiteNoiseN 2 ar * 0.1+-}+whiteNoiseMN :: Uid m => Int -> Rate -> m Ugen+whiteNoiseMN k r = fmap mce (mapM (\_ -> whiteNoiseM r) [1 .. k])++whiteNoiseN :: Int -> Rate -> Ugen+whiteNoiseN k = liftUnsafe1 (whiteNoiseMN k)++{- | If @z@ isn't a sink node route to an @out@ node writing to @bus@.+     If @fadeTime@ is given multiply by 'makeFadeEnv'.++> import Sound.Sc3 {\- hsc3 -\}+> audition (wrapOut (Just 1) (sinOsc ar 440 0 * 0.1))++> import Sound.Osc {\- hosc -\}+> withSc3 (sendMessage (n_set1 (-1) "gate" 0))+-}+wrapOut :: Maybe Double -> Ugen -> Ugen+wrapOut fadeTime z =+  if isSink z+    then z+    else out (control kr "out" 0) (maybe z ((* z) . makeFadeEnv) fadeTime)++-- * wslib++-- | Cross-fading version of 'playBuf'.+playBufCF :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen -> Int -> Ugen+playBufCF nc bufnum rate trigger startPos loop lag' n =+  let trigger' =+        if rateOf trigger == DemandRate+          then tDuty ar trigger 0 DoNothing 1 0+          else trigger+      index' = stepper trigger' 0 0 (constant n - 1) 1 0+      on =+        map+          (\i -> inRange index' (i - 0.5) (i + 0.5))+          [0 .. constant n - 1]+      rate' = case rateOf rate of+        DemandRate -> map (\on' -> demand on' 0 rate) on+        ControlRate -> map (gate rate) on+        AudioRate -> map (gate rate) on+        InitialisationRate -> map (const rate) on+      startPos' =+        if rateOf startPos == DemandRate+          then demand trigger' 0 startPos+          else startPos+      lag'' = 1 / lag'+      s =+        zipWith+          ( \on' r ->+              let p = playBuf nc ar bufnum r on' startPos' loop DoNothing+              in p * sqrt (slew on' lag'' lag'')+          )+          on+          rate'+  in sum_opt s++-- * adc++-- | An oscillator that reads through a table once.+osc1 :: Rate -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+osc1 rt buf dur doneAction =+  let ph = line rt 0 (bufFrames ir buf - 1) dur doneAction+  in bufRd 1 rt buf ph NoLoop LinearInterpolation
+ Sound/Sc3/Ugen/Bindings/Composite/External.hs view
@@ -0,0 +1,196 @@+-- | Common unit generator graphs.+module Sound.Sc3.Ugen.Bindings.Composite.External where++import Data.List {- base -}+import Data.Maybe {- base -}++import Sound.Sc3.Common.Math {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Common.Uid {- hsc3 -}+import Sound.Sc3.Common.Unsafe {- hsc3 -}++import Sound.Sc3.Ugen.Analysis {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++import qualified Sound.Sc3.Ugen.Bindings.Db as Db {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Db.External as External {- hsc3 -}++-- | FM7 variant where input matrices are not in Mce form.+fm7_mx :: [[Ugen]] -> [[Ugen]] -> Ugen+fm7_mx ctlMatrix modMatrix = External.fm7 ar (mce (concat ctlMatrix)) (mce (concat modMatrix))++{- | greyhole re-orders parameters as well as unpacking the input signal.++in1=0.0 in2=0.0 damping=0.0 delayTime=2.0 diffusion=0.5 feedback=0.9 moddepth=0.1 modfreq=2.0 size=1.0+in              delayTime=2.0 damping=0.0 size=1.0 diffusion=0.7 feedback=0.9 modDepth=0.1 modFreq=2.0+-}+greyhole :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+greyhole i delayTime damping size diffusion feedback modDepth modFreq =+  let (i1, i2) = unmce2 i+  in External.greyholeRaw i1 i2 damping delayTime diffusion feedback modDepth modFreq size++-- | Association list giving names for MiBraids modes.+miBraids_mode_dict :: Num n => [(n, String)]+miBraids_mode_dict =+  [ (0, "CSAW")+  , (1, "MORPH")+  , (2, "SAW_SQUARE")+  , (3, "SINE_TRIANGLE")+  , (4, "BUZZ")+  , (5, "SQUARE_SUB")+  , (6, "SAW_SUB")+  , (7, "SQUARE_SYNC")+  , (8, "SAW_SYNC")+  , (9, "TRIPLE_SAW")+  , (10, "TRIPLE_SQUARE")+  , (11, "TRIPLE_TRIANGLE")+  , (12, "TRIPLE_SINE")+  , (13, "TRIPLE_RING_MOD")+  , (14, "SAW_SWARM")+  , (15, "SAW_COMB")+  , (16, "TOY")+  , (17, "DIGITAL_FILTER_LP")+  , (18, "DIGITAL_FILTER_PK")+  , (19, "DIGITAL_FILTER_BP")+  , (20, "DIGITAL_FILTER_HP")+  , (21, "VOSIM")+  , (22, "VOWEL")+  , (23, "VOWEL_FOF")+  , (24, "HARMONICS")+  , (25, "FM")+  , (26, "FEEDbACK_FM")+  , (27, "CHAOTIC_FEEDbACK_FM")+  , (28, "PLUCKED")+  , (29, "BOWED")+  , (30, "BLOWN")+  , (31, "FLUTED")+  , (32, "STRUCK_BELL")+  , (33, "STRUCK_DRUM")+  , (34, "KICK")+  , (35, "CYMBAL")+  , (36, "SNARE")+  , (37, "WAVETABLES")+  , (38, "WAVE_MAP")+  , (39, "WAVE_LINE")+  , (40, "WAVE_PARAPHONIC")+  , (41, "FILTERED_NOISE")+  , (42, "TWIN_PEAKS_NOISE")+  , (43, "CLOCKED_NOISE")+  , (44, "GRANULAR_CLOUD")+  , (45, "PARTICLE_NOISE")+  , (46, "DIGITAL_MODULATION")+  , (47, "QUESTION_MARK")+  ]++-- | Reverse lookup of 'miBraids_mode_dict'.+miBraids_mode_maybe :: Num n => String -> Maybe n+miBraids_mode_maybe x = fmap fst (find ((== x) . snd) miBraids_mode_dict)++-- | 'error' of 'miBraids_mode_maybe'+miBraids_mode :: Num n => String -> n+miBraids_mode = fromMaybe (error "miBraids_mode?") . miBraids_mode_maybe++-- | Association list giving names for MiClouds modes.+miClouds_mode_dict :: Num n => [(n, String)]+miClouds_mode_dict =+  [ (0, "GRANULAR")+  , (1, "STRETCH")+  , (2, "LOOPING_DELAY")+  , (3, "SPECTRAL")+  ]++-- | Reverse lookup of 'miClouds_mode_dict'.+miClouds_mode_maybe :: Num n => String -> Maybe n+miClouds_mode_maybe x = fmap fst (find ((== x) . snd) miClouds_mode_dict)++-- | 'error' of 'miClouds_mode_maybe'+miClouds_mode :: Num n => String -> n+miClouds_mode = fromMaybe (error "miClouds_mode?") . miClouds_mode_maybe++-- | Association list giving names for MiPlaits modes.+miPlaits_mode_dict :: Num n => [(n, String)]+miPlaits_mode_dict =+  [ (0, "virtual_analog")+  , (1, "waveshaping")+  , (2, "fm")+  , (3, "grain")+  , (4, "additive")+  , (5, "wavetable")+  , (6, "chord")+  , (7, "speech")+  , (8, "swarm")+  , (9, "noise")+  , (10, "particle")+  , (11, "string")+  , (12, "modal")+  , (13, "bass_drum")+  , (14, "snare_drum")+  , (15, "hi_hat")+  ]++-- | Reverse lookup of 'miPlaits_mode_dict'.+miPlaits_mode_maybe :: Num n => String -> Maybe n+miPlaits_mode_maybe x = fmap fst (find ((== x) . snd) miPlaits_mode_dict)++-- | 'error' of 'miPlaits_mode_maybe'+miPlaits_mode :: Num n => String -> n+miPlaits_mode = fromMaybe (error "miPlaits_mode?") . miPlaits_mode_maybe++-- | Association list giving names for MiPlaits modes.+miRings_mode_dict :: Num n => [(n, String)]+miRings_mode_dict =+  [ (0, "MODAL_RESONATOR")+  , (1, "SYMPATHETIC_STRING")+  , (2, "MODULATED/INHARMONIC_STRING")+  , (3, "2-OP_FM_VOICE")+  , (4, "SYMPATHETIC_STRING_QUANTIZED")+  , (5, "STRING_AND_REVERB")+  ]++-- | Reverse lookup of 'miRings_mode_dict'.+miRings_mode_maybe :: Num n => String -> Maybe n+miRings_mode_maybe x = fmap fst (find ((== x) . snd) miRings_mode_dict)++-- | 'error' of 'miRings_mode_maybe'+miRings_mode :: Num n => String -> n+miRings_mode = fromMaybe (error "miRings_mode?") . miRings_mode_maybe++-- | pulse signal as difference of two 'sawDPW' signals.+pulseDPW :: Rate -> Ugen -> Ugen -> Ugen+pulseDPW rt freq width =+  let o1 = External.sawDPW rt freq 0+      o2 = External.sawDPW rt freq (wrap_hs (-1, 1) (width + width))+  in o1 - o2++-- * rdu++-- | Variant that unpacks the output /mce/ node.+pv_SplitUnpack :: Ugen -> Ugen -> (Ugen, Ugen)+pv_SplitUnpack a b =+  case mceChannels (External.pv_Split a b) of+    [p, q] -> (p, q)+    _ -> error "pv_SplitUnpack"++{- | A 'pv_Split' variant, like 'ffta', that allocates a 'localBuf' by+tracing the input graph to locate the parent @FFT@ or @PV_Split@+node.+-}+pv_SplitAllocId :: ID i => i -> Ugen -> Ugen+pv_SplitAllocId z u =+  case pv_track_nframes u of+    Left err -> error err+    Right nf -> let b = Db.localBufId z nf 1 in External.pv_Split u b++pv_SplitAllocM :: Uid m => Ugen -> m Ugen+pv_SplitAllocM = liftUid1 pv_SplitAllocId++pv_SplitAlloc :: Ugen -> Ugen+pv_SplitAlloc = liftUnsafe1 pv_SplitAllocM++-- | Variant that unpacks the output /mce/ node.+pv_SplitAllocUnpackId :: ID i => i -> Ugen -> (Ugen, Ugen)+pv_SplitAllocUnpackId z u =+  case mceChannels (pv_SplitAllocId z u) of+    [p, q] -> (p, q)+    _ -> error "pv_SplitAllocUnpackId"
+ Sound/Sc3/Ugen/Bindings/Db.hs view
@@ -0,0 +1,3052 @@+-- | Sc3 Ugen bindings (auto-generated).+module Sound.Sc3.Ugen.Bindings.Db where++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import Sound.Sc3.Ugen.Primitive+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++{- | Apply a binary operation to the values of an input Ugen++ BinaryOpUgen [InitialisationRate,ControlRate,AudioRate,DemandRate] a=0 b=0;    FILTER: TRUE+-}+binaryOpUgen :: Ugen -> Ugen -> Ugen+binaryOpUgen a b = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0, 1]) "BinaryOpUGen" [a, b] Nothing 1 (Special 0) NoId++{- | Apply a unary operation to the values of an input ugen++ UnaryOpUgen [InitialisationRate,ControlRate,AudioRate,DemandRate] a=0;    FILTER: TRUE+-}+unaryOpUgen :: Ugen -> Ugen+unaryOpUgen a = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0]) "UnaryOpUGen" [a] Nothing 1 (Special 0) NoId++{- | Audio to control rate converter.++ A2K [ControlRate] in=0+-}+a2k :: Ugen -> Ugen+a2k in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "A2K" [in_] Nothing 1 (Special 0) NoId++{- | FIXME: APF purpose.++ APF [ControlRate,AudioRate] in=0 freq=440 radius=0.8;    FILTER: TRUE+-}+apf :: Ugen -> Ugen -> Ugen -> Ugen+apf in_ freq radius = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "APF" [in_, freq, radius] Nothing 1 (Special 0) NoId++{- | Schroeder allpass delay line with cubic interpolation.++ AllpassC [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+allpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+allpassC in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AllpassC" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Schroeder allpass delay line with linear interpolation.++ AllpassL [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+allpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+allpassL in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AllpassL" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Schroeder allpass delay line with no interpolation.++ AllpassN [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+allpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+allpassN in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AllpassN" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Basic psychoacoustic amplitude compensation.++ AmpComp [InitialisationRate,ControlRate,AudioRate] freq=0 root=0 exp=0.3333+-}+ampComp :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+ampComp rate freq root exp_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Left rate) "AmpComp" [freq, root, exp_] Nothing 1 (Special 0) NoId++{- | Basic psychoacoustic amplitude compensation (ANSI A-weighting curve).++ AmpCompA [InitialisationRate,ControlRate,AudioRate] freq=1000 root=0 minAmp=0.32 rootAmp=1+-}+ampCompA :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ampCompA rate freq root minAmp rootAmp = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Left rate) "AmpCompA" [freq, root, minAmp, rootAmp] Nothing 1 (Special 0) NoId++{- | Amplitude follower++ Amplitude [ControlRate,AudioRate] in=0 attackTime=0.01 releaseTime=0.01+-}+amplitude :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+amplitude rate in_ attackTime releaseTime = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Amplitude" [in_, attackTime, releaseTime] Nothing 1 (Special 0) NoId++{- | All Pass Filter++ BAllPass [AudioRate] in=0 freq=1200 rq=1;    FILTER: TRUE+-}+bAllPass :: Ugen -> Ugen -> Ugen -> Ugen+bAllPass in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "BAllPass" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Band Pass Filter++ BBandPass [AudioRate] in=0 freq=1200 bw=1;    FILTER: TRUE+-}+bBandPass :: Ugen -> Ugen -> Ugen -> Ugen+bBandPass in_ freq bw = mkUgen Nothing [AudioRate] (Right [0]) "BBandPass" [in_, freq, bw] Nothing 1 (Special 0) NoId++{- | Band reject filter++ BBandStop [AudioRate] in=0 freq=1200 bw=1;    FILTER: TRUE+-}+bBandStop :: Ugen -> Ugen -> Ugen -> Ugen+bBandStop in_ freq bw = mkUgen Nothing [AudioRate] (Right [0]) "BBandStop" [in_, freq, bw] Nothing 1 (Special 0) NoId++{- | 12db/oct rolloff - 2nd order resonant  Hi Pass Filter++ BHiPass [AudioRate] in=0 freq=1200 rq=1;    FILTER: TRUE+-}+bHiPass :: Ugen -> Ugen -> Ugen -> Ugen+bHiPass in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "BHiPass" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Hi Shelf++ BHiShelf [AudioRate] in=0 freq=1200 rs=1 db=0;    FILTER: TRUE+-}+bHiShelf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bHiShelf in_ freq rs db = mkUgen Nothing [AudioRate] (Right [0]) "BHiShelf" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | 12db/oct rolloff - 2nd order resonant Low Pass Filter++ BLowPass [AudioRate] in=0 freq=1200 rq=1;    FILTER: TRUE+-}+bLowPass :: Ugen -> Ugen -> Ugen -> Ugen+bLowPass in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "BLowPass" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Low Shelf++ BLowShelf [AudioRate] in=0 freq=1200 rs=1 db=0;    FILTER: TRUE+-}+bLowShelf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bLowShelf in_ freq rs db = mkUgen Nothing [AudioRate] (Right [0]) "BLowShelf" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | 2nd order Butterworth bandpass filter.++ BPF [ControlRate,AudioRate] in=0 freq=440 rq=1;    FILTER: TRUE+-}+bpf :: Ugen -> Ugen -> Ugen -> Ugen+bpf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Two zero fixed midpass.++ BPZ2 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+bpz2 :: Ugen -> Ugen+bpz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BPZ2" [in_] Nothing 1 (Special 0) NoId++{- | Parametric equalizer++ BPeakEQ [AudioRate] in=0 freq=1200 rq=1 db=0;    FILTER: TRUE+-}+bPeakEQ :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bPeakEQ in_ freq rq db = mkUgen Nothing [AudioRate] (Right [0]) "BPeakEQ" [in_, freq, rq, db] Nothing 1 (Special 0) NoId++{- | 2nd order Butterworth band reject filter.++ BRF [ControlRate,AudioRate] in=0 freq=440 rq=1;    FILTER: TRUE+-}+brf :: Ugen -> Ugen -> Ugen -> Ugen+brf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BRF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Two zero fixed midcut.++ BRZ2 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+brz2 :: Ugen -> Ugen+brz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BRZ2" [in_] Nothing 1 (Special 0) NoId++{- | Stereo signal balancer++ Balance2 [ControlRate,AudioRate] left=0 right=0 pos=0 level=1;    FILTER: TRUE+-}+balance2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+balance2 left right pos level = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "Balance2" [left, right, pos, level] Nothing 2 (Special 0) NoId++{- | physical model of bouncing object++ Ball [ControlRate,AudioRate] in=0 g=1 damp=0 friction=0.01+-}+ball :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ball rate in_ g damp friction_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Ball" [in_, g, damp, friction_] Nothing 1 (Special 0) NoId++{- | Autocorrelation beat tracker++ BeatTrack [ControlRate] chain=0 lock=0+-}+beatTrack :: Rate -> Ugen -> Ugen -> Ugen+beatTrack rate chain lock = mkUgen Nothing [ControlRate] (Left rate) "BeatTrack" [chain, lock] Nothing 4 (Special 0) NoId++{- | Template matching beat tracker++ BeatTrack2 [ControlRate] busindex=0 numfeatures=0 windowsize=2 phaseaccuracy=0.02 lock=0 weightingscheme=0+-}+beatTrack2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+beatTrack2 rate busindex numfeatures windowsize phaseaccuracy lock weightingscheme = mkUgen Nothing [ControlRate] (Left rate) "BeatTrack2" [busindex, numfeatures, windowsize, phaseaccuracy, lock, weightingscheme] Nothing 6 (Special 0) NoId++{- | 2D Ambisonic B-format panner.++ BiPanB2 [ControlRate,AudioRate] inA=0 inB=0 azimuth=0 gain=1+-}+biPanB2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+biPanB2 rate inA inB azimuth gain = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BiPanB2" [inA, inB, azimuth, gain] Nothing 3 (Special 0) NoId++{- | Band limited impulse oscillator.++ Blip [ControlRate,AudioRate] freq=440 numharm=200+-}+blip :: Rate -> Ugen -> Ugen -> Ugen+blip rate freq numharm = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Blip" [freq, numharm] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BlockSize [InitialisationRate]+-}+blockSize :: Ugen+blockSize = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "BlockSize" [] Nothing 1 (Special 0) NoId++{- | Brown Noise.++ BrownNoise [ControlRate,AudioRate] ;    NONDET+-}+brownNoiseId :: ID a => a -> Rate -> Ugen+brownNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BrownNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of BrownNoise.+brownNoiseM :: Uid m => Rate -> m Ugen+brownNoiseM = liftUid1 brownNoiseId++-- | Unsafe variant of BrownNoise.+brownNoise :: Rate -> Ugen+brownNoise = liftUnsafe1 brownNoiseM++{- | Buffer based all pass delay line with cubic interpolation.++ BufAllpassC [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+bufAllpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufAllpassC buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufAllpassC" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based all pass delay line with linear interpolation.++ BufAllpassL [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+bufAllpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufAllpassL buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufAllpassL" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based all pass delay line with no interpolation.++ BufAllpassN [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+bufAllpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufAllpassN buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufAllpassN" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Current number of channels of soundfile in buffer.++ BufChannels [InitialisationRate,ControlRate] bufnum=0+-}+bufChannels :: Rate -> Ugen -> Ugen+bufChannels rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufChannels" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer based comb delay line with cubic interpolation.++ BufCombC [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+bufCombC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufCombC buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufCombC" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based comb delay line with linear interpolation.++ BufCombL [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+bufCombL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufCombL buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufCombL" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based comb delay line with no interpolation.++ BufCombN [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+bufCombN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufCombN buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufCombN" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based simple delay line with cubic interpolation.++ BufDelayC [ControlRate,AudioRate] buf=0 in=0 delaytime=0.2;    FILTER: TRUE+-}+bufDelayC :: Ugen -> Ugen -> Ugen -> Ugen+bufDelayC buf in_ delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "BufDelayC" [buf, in_, delaytime] Nothing 1 (Special 0) NoId++{- | Buffer based simple delay line with linear interpolation.++ BufDelayL [ControlRate,AudioRate] buf=0 in=0 delaytime=0.2;    FILTER: TRUE+-}+bufDelayL :: Ugen -> Ugen -> Ugen -> Ugen+bufDelayL buf in_ delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "BufDelayL" [buf, in_, delaytime] Nothing 1 (Special 0) NoId++{- | Buffer based simple delay line with no interpolation.++ BufDelayN [ControlRate,AudioRate] buf=0 in=0 delaytime=0.2;    FILTER: TRUE+-}+bufDelayN :: Ugen -> Ugen -> Ugen -> Ugen+bufDelayN buf in_ delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "BufDelayN" [buf, in_, delaytime] Nothing 1 (Special 0) NoId++{- | Current duration of soundfile in buffer.++ BufDur [InitialisationRate,ControlRate] bufnum=0+-}+bufDur :: Rate -> Ugen -> Ugen+bufDur rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufDur" [bufnum] Nothing 1 (Special 0) NoId++{- | Current number of frames allocated in the buffer.++ BufFrames [InitialisationRate,ControlRate] bufnum=0+-}+bufFrames :: Rate -> Ugen -> Ugen+bufFrames rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufFrames" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer rate scaling in respect to server samplerate.++ BufRateScale [InitialisationRate,ControlRate] bufnum=0+-}+bufRateScale :: Rate -> Ugen -> Ugen+bufRateScale rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufRateScale" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer reading oscillator.++ BufRd [ControlRate,AudioRate] bufnum=0 phase=0 loop=1 interpolation=2;    NC INPUT: True, ENUMERATION INPUTS: 2=Loop, 3=Interpolation+-}+bufRd :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Interpolation Ugen -> Ugen+bufRd numChannels rate bufnum phase loop interpolation = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BufRd" [bufnum, phase, (from_loop loop), (from_interpolation interpolation)] Nothing numChannels (Special 0) NoId++{- | Buffer sample rate.++ BufSampleRate [InitialisationRate,ControlRate] bufnum=0+-}+bufSampleRate :: Rate -> Ugen -> Ugen+bufSampleRate rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufSampleRate" [bufnum] Nothing 1 (Special 0) NoId++{- | Current number of samples in buffer.++ BufSamples [InitialisationRate,ControlRate] bufnum=0+-}+bufSamples :: Rate -> Ugen -> Ugen+bufSamples rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufSamples" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer writing oscillator.++ BufWr [ControlRate,AudioRate] bufnum=0 phase=0 loop=1 *inputArray=0;    MCE=1, FILTER: TRUE, REORDERS INPUTS: [3,0,1,2], ENUMERATION INPUTS: 2=Loop+-}+bufWr :: Ugen -> Ugen -> Loop Ugen -> Ugen -> Ugen+bufWr bufnum phase loop inputArray = mkUgen Nothing [ControlRate, AudioRate] (Right [3]) "BufWr" [bufnum, phase, (from_loop loop)] (Just [inputArray]) 1 (Special 0) NoId++{- | Chorusing wavetable oscillator.++ COsc [ControlRate,AudioRate] bufnum=0 freq=440 beats=0.5+-}+cOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+cOsc rate bufnum freq beats = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "COsc" [bufnum, freq, beats] Nothing 1 (Special 0) NoId++{- | Test for infinity, not-a-number, and denormals++ CheckBadValues [ControlRate,AudioRate] in=0 id=0 post=2;    FILTER: TRUE+-}+checkBadValues :: Ugen -> Ugen -> Ugen -> Ugen+checkBadValues in_ id_ post = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CheckBadValues" [in_, id_, post] Nothing 1 (Special 0) NoId++{- | Clip a signal outside given thresholds.++ Clip [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1;    FILTER: TRUE+-}+clip :: Ugen -> Ugen -> Ugen -> Ugen+clip in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Clip" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Clip Noise.++ ClipNoise [ControlRate,AudioRate] ;    NONDET+-}+clipNoiseId :: ID a => a -> Rate -> Ugen+clipNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "ClipNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of ClipNoise.+clipNoiseM :: Uid m => Rate -> m Ugen+clipNoiseM = liftUid1 clipNoiseId++-- | Unsafe variant of ClipNoise.+clipNoise :: Rate -> Ugen+clipNoise = liftUnsafe1 clipNoiseM++{- | Statistical gate.++ CoinGate [ControlRate,AudioRate] prob=0 in=0;    FILTER: TRUE, NONDET+-}+coinGateId :: ID a => a -> Ugen -> Ugen -> Ugen+coinGateId z prob in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "CoinGate" [prob, in_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of CoinGate.+coinGateM :: Uid m => Ugen -> Ugen -> m Ugen+coinGateM = liftUid2 coinGateId++-- | Unsafe variant of CoinGate.+coinGate :: Ugen -> Ugen -> Ugen+coinGate = liftUnsafe2 coinGateM++{- | Comb delay line with cubic interpolation.++ CombC [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+combC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combC in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CombC" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Comb delay line with linear interpolation.++ CombL [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+combL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combL in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CombL" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Comb delay line with no interpolation.++ CombN [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1;    FILTER: TRUE+-}+combN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combN in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CombN" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Compressor, expander, limiter, gate, ducker++ Compander [AudioRate] in=0 control=0 thresh=0.5 slopeBelow=1 slopeAbove=1 clampTime=0.01 relaxTime=0.1;    FILTER: TRUE+-}+compander :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+compander in_ control_ thresh slopeBelow slopeAbove clampTime relaxTime = mkUgen Nothing [AudioRate] (Right [0]) "Compander" [in_, control_, thresh, slopeBelow, slopeAbove, clampTime, relaxTime] Nothing 1 (Special 0) NoId++{- | Compressor, expander, limiter, gate, ducker.++ CompanderD [AudioRate] in=0 thresh=0.5 slopeBelow=1 slopeAbove=1 clampTime=0.01 relaxTime=0.01+-}+companderD :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+companderD rate in_ thresh slopeBelow slopeAbove clampTime relaxTime = mkUgen Nothing [AudioRate] (Left rate) "CompanderD" [in_, thresh, slopeBelow, slopeAbove, clampTime, relaxTime] Nothing 1 (Special 0) NoId++{- | Duration of one block++ ControlDur [InitialisationRate]+-}+controlDur :: Ugen+controlDur = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ControlDur" [] Nothing 1 (Special 0) NoId++{- | Server control rate.++ ControlRate [InitialisationRate]+-}+controlRate :: Ugen+controlRate = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ControlRate" [] Nothing 1 (Special 0) NoId++{- | Real-time convolver.++ Convolution [AudioRate] in=0 kernel=0 framesize=512+-}+convolution :: Ugen -> Ugen -> Ugen -> Ugen+convolution in_ kernel framesize = mkUgen Nothing [AudioRate] (Left AudioRate) "Convolution" [in_, kernel, framesize] Nothing 1 (Special 0) NoId++{- | Real-time fixed kernel convolver.++ Convolution2 [AudioRate] in=0 kernel=0 trigger=0 framesize=2048+-}+convolution2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+convolution2 in_ kernel trigger framesize = mkUgen Nothing [AudioRate] (Left AudioRate) "Convolution2" [in_, kernel, trigger, framesize] Nothing 1 (Special 0) NoId++{- | Real-time convolver with linear interpolation++ Convolution2L [AudioRate] in=0 kernel=0 trigger=0 framesize=2048 crossfade=1+-}+convolution2L :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+convolution2L rate in_ kernel trigger framesize crossfade = mkUgen Nothing [AudioRate] (Left rate) "Convolution2L" [in_, kernel, trigger, framesize, crossfade] Nothing 1 (Special 0) NoId++{- | Time based convolver.++ Convolution3 [ControlRate,AudioRate] in=0 kernel=0 trigger=0 framesize=2048+-}+convolution3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+convolution3 rate in_ kernel trigger framesize = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Convolution3" [in_, kernel, trigger, framesize] Nothing 1 (Special 0) NoId++{- | Chaotic noise function.++ Crackle [ControlRate,AudioRate] chaosParam=1.5+-}+crackle :: Rate -> Ugen -> Ugen+crackle rate chaosParam = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Crackle" [chaosParam] Nothing 1 (Special 0) NoId++{- | Cusp map chaotic generator++ CuspL [AudioRate] freq=22050 a=1 b=1.9 xi=0+-}+cuspL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+cuspL rate freq a b xi = mkUgen Nothing [AudioRate] (Left rate) "CuspL" [freq, a, b, xi] Nothing 1 (Special 0) NoId++{- | Cusp map chaotic generator++ CuspN [AudioRate] freq=22050 a=1 b=1.9 xi=0+-}+cuspN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+cuspN rate freq a b xi = mkUgen Nothing [AudioRate] (Left rate) "CuspN" [freq, a, b, xi] Nothing 1 (Special 0) NoId++{- | Create a constant amplitude signal++ DC [ControlRate,AudioRate] in=0+-}+dc :: Rate -> Ugen -> Ugen+dc rate in_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "DC" [in_] Nothing 1 (Special 0) NoId++{- | Demand rate brownian movement generator.++ Dbrown [DemandRate] length=100000000 lo=0 hi=1 step=0.01;    REORDERS INPUTS: [1,2,3,0], DEMAND/NONDET+-}+dbrownId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbrownId z length_ lo hi step = mkUgen Nothing [DemandRate] (Left DemandRate) "Dbrown" [length_, lo, hi, step] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dbrown.+dbrownM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dbrownM = liftUid4 dbrownId++-- | Unsafe variant of Dbrown.+dbrown :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbrown = liftUnsafe4 dbrownM++{- | Buffer read demand ugen++ Dbufrd [DemandRate] bufnum=0 phase=0 loop=1;    ENUMERATION INPUTS: 2=Loop, DEMAND/NONDET+-}+dbufrdId :: ID a => a -> Ugen -> Ugen -> Loop Ugen -> Ugen+dbufrdId z bufnum phase loop = mkUgen Nothing [DemandRate] (Left DemandRate) "Dbufrd" [bufnum, phase, (from_loop loop)] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dbufrd.+dbufrdM :: Uid m => Ugen -> Ugen -> Loop Ugen -> m Ugen+dbufrdM = liftUid3 dbufrdId++-- | Unsafe variant of Dbufrd.+dbufrd :: Ugen -> Ugen -> Loop Ugen -> Ugen+dbufrd = liftUnsafe3 dbufrdM++{- | Buffer write demand ugen++ Dbufwr [DemandRate] bufnum=0 phase=0 input=0 loop=1;    REORDERS INPUTS: [2,0,1,3], ENUMERATION INPUTS: 3=Loop, DEMAND/NONDET+-}+dbufwrId :: ID a => a -> Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen+dbufwrId z bufnum phase input loop = mkUgen Nothing [DemandRate] (Left DemandRate) "Dbufwr" [bufnum, phase, input, (from_loop loop)] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dbufwr.+dbufwrM :: Uid m => Ugen -> Ugen -> Ugen -> Loop Ugen -> m Ugen+dbufwrM = liftUid4 dbufwrId++-- | Unsafe variant of Dbufwr.+dbufwr :: Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen+dbufwr = liftUnsafe4 dbufwrM++{- | Constrain a demand-rate stream to a given sum++ Dconst [DemandRate] sum=0 in=0 tolerance=0.001;    DEMAND/NONDET+-}+dconstId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dconstId z sum_ in_ tolerance = mkUgen Nothing [DemandRate] (Left DemandRate) "Dconst" [sum_, in_, tolerance] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dconst.+dconstM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dconstM = liftUid3 dconstId++-- | Unsafe variant of Dconst.+dconst :: Ugen -> Ugen -> Ugen -> Ugen+dconst = liftUnsafe3 dconstM++{- | Exponential decay++ Decay [ControlRate,AudioRate] in=0 decayTime=1;    FILTER: TRUE+-}+decay :: Ugen -> Ugen -> Ugen+decay in_ decayTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Decay" [in_, decayTime] Nothing 1 (Special 0) NoId++{- | Exponential decay++ Decay2 [ControlRate,AudioRate] in=0 attackTime=0.01 decayTime=1;    FILTER: TRUE+-}+decay2 :: Ugen -> Ugen -> Ugen -> Ugen+decay2 in_ attackTime decayTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Decay2" [in_, attackTime, decayTime] Nothing 1 (Special 0) NoId++{- | 2D Ambisonic B-format decoder.++ DecodeB2 [ControlRate,AudioRate] w=0 x=0 y=0 orientation=0.5;    NC INPUT: True, FILTER: TRUE+-}+decodeB2 :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+decodeB2 numChannels w x y orientation = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1, 2]) "DecodeB2" [w, x, y, orientation] Nothing numChannels (Special 0) NoId++{- | Convert signal to modal pitch.++ DegreeToKey [ControlRate,AudioRate] bufnum=0 in=0 octave=12;    FILTER: TRUE+-}+degreeToKey :: Ugen -> Ugen -> Ugen -> Ugen+degreeToKey bufnum in_ octave = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DegreeToKey" [bufnum, in_, octave] Nothing 1 (Special 0) NoId++{- | Tap a delay line from a DelTapWr Ugen++ DelTapRd [ControlRate,AudioRate] buffer=0 phase=0 delTime=0 interp=1;    FILTER: TRUE+-}+delTapRd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+delTapRd buffer phase delTime interp = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DelTapRd" [buffer, phase, delTime, interp] Nothing 1 (Special 0) NoId++{- | Write to a buffer for a DelTapRd Ugen++ DelTapWr [ControlRate,AudioRate] buffer=0 in=0;    FILTER: TRUE+-}+delTapWr :: Ugen -> Ugen -> Ugen+delTapWr buffer in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DelTapWr" [buffer, in_] Nothing 1 (Special 0) NoId++{- | Single sample delay.++ Delay1 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+delay1 :: Ugen -> Ugen+delay1 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Delay1" [in_] Nothing 1 (Special 0) NoId++{- | Two sample delay.++ Delay2 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+delay2 :: Ugen -> Ugen+delay2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Delay2" [in_] Nothing 1 (Special 0) NoId++{- | Simple delay line with cubic interpolation.++ DelayC [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2;    FILTER: TRUE+-}+delayC :: Ugen -> Ugen -> Ugen -> Ugen+delayC in_ maxdelaytime delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DelayC" [in_, maxdelaytime, delaytime] Nothing 1 (Special 0) NoId++{- | Simple delay line with linear interpolation.++ DelayL [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2;    FILTER: TRUE+-}+delayL :: Ugen -> Ugen -> Ugen -> Ugen+delayL in_ maxdelaytime delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DelayL" [in_, maxdelaytime, delaytime] Nothing 1 (Special 0) NoId++{- | Simple delay line with no interpolation.++ DelayN [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2;    FILTER: TRUE+-}+delayN :: Ugen -> Ugen -> Ugen -> Ugen+delayN in_ maxdelaytime delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DelayN" [in_, maxdelaytime, delaytime] Nothing 1 (Special 0) NoId++{- | Demand results from demand rate Ugens.++ Demand [ControlRate,AudioRate] trig=0 reset=0 *demandUgens=0;    MCE=1, FILTER: TRUE+-}+demand :: Ugen -> Ugen -> Ugen -> Ugen+demand trig_ reset demandUgens = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Demand" [trig_, reset] (Just [demandUgens]) (length (mceChannels demandUgens) + 0) (Special 0) NoId++{- | Demand rate envelope generator++ DemandEnvGen [ControlRate,AudioRate] level=0 dur=0 shape=1 curve=0 gate=1 reset=1 levelScale=1 levelBias=0 timeScale=1 doneAction=0;    ENUMERATION INPUTS: 9=DoneAction+-}+demandEnvGen :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+demandEnvGen rate level dur shape curve gate_ reset levelScale levelBias timeScale doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "DemandEnvGen" [level, dur, shape, curve, gate_, reset, levelScale, levelBias, timeScale, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Search a buffer for a value++ DetectIndex [ControlRate,AudioRate] bufnum=0 in=0;    FILTER: TRUE+-}+detectIndex :: Ugen -> Ugen -> Ugen+detectIndex bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DetectIndex" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Detect when input falls below an amplitude threshold++ DetectSilence [ControlRate,AudioRate] in=0 amp=0.0001 time=0.1 doneAction=0;    FILTER: TRUE, ENUMERATION INPUTS: 3=DoneAction+-}+detectSilence :: Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+detectSilence in_ amp time doneAction = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DetectSilence" [in_, amp, time, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Demand rate geometric series Ugen.++ Dgeom [DemandRate] length=100000000 start=1 grow=2;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+dgeomId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dgeomId z length_ start grow = mkUgen Nothing [DemandRate] (Left DemandRate) "Dgeom" [length_, start, grow] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dgeom.+dgeomM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dgeomM = liftUid3 dgeomId++-- | Unsafe variant of Dgeom.+dgeom :: Ugen -> Ugen -> Ugen -> Ugen+dgeom = liftUnsafe3 dgeomM++{- | Demand rate brownian movement generator.++ Dibrown [DemandRate] length=100000000 lo=0 hi=1 step=0.01;    REORDERS INPUTS: [1,2,3,0], DEMAND/NONDET+-}+dibrownId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dibrownId z length_ lo hi step = mkUgen Nothing [DemandRate] (Left DemandRate) "Dibrown" [length_, lo, hi, step] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dibrown.+dibrownM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dibrownM = liftUid4 dibrownId++-- | Unsafe variant of Dibrown.+dibrown :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dibrown = liftUnsafe4 dibrownM++{- | Stream in audio from a file.++ DiskIn [AudioRate] bufnum=0 loop=0;    NC INPUT: True, ENUMERATION INPUTS: 1=Loop+-}+diskIn :: Int -> Ugen -> Loop Ugen -> Ugen+diskIn numChannels bufnum loop = mkUgen Nothing [AudioRate] (Left AudioRate) "DiskIn" [bufnum, (from_loop loop)] Nothing numChannels (Special 0) NoId++{- | Record to a soundfile to disk.++ DiskOut [AudioRate] bufnum=0 *channelsArray=0;    MCE=1+-}+diskOut :: Ugen -> Ugen -> Ugen+diskOut bufnum input = mkUgen Nothing [AudioRate] (Left AudioRate) "DiskOut" [bufnum] (Just [input]) 1 (Special 0) NoId++{- | Demand rate white noise random generator.++ Diwhite [DemandRate] length=100000000 lo=0 hi=1;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+diwhiteId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+diwhiteId z length_ lo hi = mkUgen Nothing [DemandRate] (Left DemandRate) "Diwhite" [length_, lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Diwhite.+diwhiteM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+diwhiteM = liftUid3 diwhiteId++-- | Unsafe variant of Diwhite.+diwhite :: Ugen -> Ugen -> Ugen -> Ugen+diwhite = liftUnsafe3 diwhiteM++{- | Monitors another Ugen to see when it is finished++ Done [ControlRate] src=0+-}+done :: Ugen -> Ugen+done src = mkUgen Nothing [ControlRate] (Left ControlRate) "Done" [src] Nothing 1 (Special 0) NoId++{- | Print the current output value of a demand rate Ugen++ Dpoll [DemandRate] in=0 label=0 run=1 trigid=-1;    DEMAND/NONDET+-}+dpollId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dpollId z in_ label_ run trigid = mkUgen Nothing [DemandRate] (Left DemandRate) "Dpoll" [in_, label_, run, trigid] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dpoll.+dpollM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dpollM = liftUid4 dpollId++-- | Unsafe variant of Dpoll.+dpoll :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dpoll = liftUnsafe4 dpollM++{- | Demand rate random sequence generator.++ Drand [DemandRate] repeats=1 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+drandId :: ID a => a -> Ugen -> Ugen -> Ugen+drandId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Drand" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Drand.+drandM :: Uid m => Ugen -> Ugen -> m Ugen+drandM = liftUid2 drandId++-- | Unsafe variant of Drand.+drand :: Ugen -> Ugen -> Ugen+drand = liftUnsafe2 drandM++{- | demand rate reset++ Dreset [DemandRate] in=0 reset=0;    DEMAND/NONDET+-}+dresetId :: ID a => a -> Ugen -> Ugen -> Ugen+dresetId z in_ reset = mkUgen Nothing [DemandRate] (Left DemandRate) "Dreset" [in_, reset] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dreset.+dresetM :: Uid m => Ugen -> Ugen -> m Ugen+dresetM = liftUid2 dresetId++-- | Unsafe variant of Dreset.+dreset :: Ugen -> Ugen -> Ugen+dreset = liftUnsafe2 dresetM++{- | Demand rate sequence generator.++ Dseq [DemandRate] repeats=1 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dseqId :: ID a => a -> Ugen -> Ugen -> Ugen+dseqId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dseq" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dseq.+dseqM :: Uid m => Ugen -> Ugen -> m Ugen+dseqM = liftUid2 dseqId++-- | Unsafe variant of Dseq.+dseq :: Ugen -> Ugen -> Ugen+dseq = liftUnsafe2 dseqM++{- | Demand rate sequence generator.++ Dser [DemandRate] repeats=1 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dserId :: ID a => a -> Ugen -> Ugen -> Ugen+dserId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dser" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dser.+dserM :: Uid m => Ugen -> Ugen -> m Ugen+dserM = liftUid2 dserId++-- | Unsafe variant of Dser.+dser :: Ugen -> Ugen -> Ugen+dser = liftUnsafe2 dserM++{- | Demand rate arithmetic series Ugen.++ Dseries [DemandRate] length=100000000 start=1 step=1;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+dseriesId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dseriesId z length_ start step = mkUgen Nothing [DemandRate] (Left DemandRate) "Dseries" [length_, start, step] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dseries.+dseriesM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dseriesM = liftUid3 dseriesId++-- | Unsafe variant of Dseries.+dseries :: Ugen -> Ugen -> Ugen -> Ugen+dseries = liftUnsafe3 dseriesM++{- | Demand rate random sequence generator++ Dshuf [DemandRate] repeats=1 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dshufId :: ID a => a -> Ugen -> Ugen -> Ugen+dshufId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dshuf" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dshuf.+dshufM :: Uid m => Ugen -> Ugen -> m Ugen+dshufM = liftUid2 dshufId++-- | Unsafe variant of Dshuf.+dshuf :: Ugen -> Ugen -> Ugen+dshuf = liftUnsafe2 dshufM++{- | Demand rate input replicator++ Dstutter [DemandRate] n=0 in=0;    DEMAND/NONDET+-}+dstutterId :: ID a => a -> Ugen -> Ugen -> Ugen+dstutterId z n in_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dstutter" [n, in_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dstutter.+dstutterM :: Uid m => Ugen -> Ugen -> m Ugen+dstutterM = liftUid2 dstutterId++-- | Unsafe variant of Dstutter.+dstutter :: Ugen -> Ugen -> Ugen+dstutter = liftUnsafe2 dstutterM++{- | Demand rate generator for embedding different inputs++ Dswitch [DemandRate] index=0 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dswitchId :: ID a => a -> Ugen -> Ugen -> Ugen+dswitchId z index_ list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dswitch" [index_] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dswitch.+dswitchM :: Uid m => Ugen -> Ugen -> m Ugen+dswitchM = liftUid2 dswitchId++-- | Unsafe variant of Dswitch.+dswitch :: Ugen -> Ugen -> Ugen+dswitch = liftUnsafe2 dswitchM++{- | Demand rate generator for switching between inputs.++ Dswitch1 [DemandRate] index=0 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dswitch1Id :: ID a => a -> Ugen -> Ugen -> Ugen+dswitch1Id z index_ list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dswitch1" [index_] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dswitch1.+dswitch1M :: Uid m => Ugen -> Ugen -> m Ugen+dswitch1M = liftUid2 dswitch1Id++-- | Unsafe variant of Dswitch1.+dswitch1 :: Ugen -> Ugen -> Ugen+dswitch1 = liftUnsafe2 dswitch1M++{- | Return the same unique series of values for several demand streams++ Dunique [DemandRate] source=0 maxBufferSize=1024 protected=1;    DEMAND/NONDET+-}+duniqueId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+duniqueId z source maxBufferSize protected = mkUgen Nothing [DemandRate] (Left DemandRate) "Dunique" [source, maxBufferSize, protected] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dunique.+duniqueM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+duniqueM = liftUid3 duniqueId++-- | Unsafe variant of Dunique.+dunique :: Ugen -> Ugen -> Ugen -> Ugen+dunique = liftUnsafe3 duniqueM++{- | Random impulses.++ Dust [ControlRate,AudioRate] density=0;    NONDET+-}+dustId :: ID a => a -> Rate -> Ugen -> Ugen+dustId z rate density = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Dust" [density] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dust.+dustM :: Uid m => Rate -> Ugen -> m Ugen+dustM = liftUid2 dustId++-- | Unsafe variant of Dust.+dust :: Rate -> Ugen -> Ugen+dust = liftUnsafe2 dustM++{- | Random impulses.++ Dust2 [ControlRate,AudioRate] density=0;    NONDET+-}+dust2Id :: ID a => a -> Rate -> Ugen -> Ugen+dust2Id z rate density = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Dust2" [density] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dust2.+dust2M :: Uid m => Rate -> Ugen -> m Ugen+dust2M = liftUid2 dust2Id++-- | Unsafe variant of Dust2.+dust2 :: Rate -> Ugen -> Ugen+dust2 = liftUnsafe2 dust2M++{- | Demand results from demand rate Ugens.++ Duty [ControlRate,AudioRate] dur=1 reset=0 doneAction=0 level=1;    REORDERS INPUTS: [0,1,3,2], ENUMERATION INPUTS: 2=DoneAction+-}+duty :: Rate -> Ugen -> Ugen -> DoneAction Ugen -> Ugen -> Ugen+duty rate dur reset doneAction level = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Duty" [dur, reset, (from_done_action doneAction), level] Nothing 1 (Special 0) NoId++{- | Demand rate white noise random generator.++ Dwhite [DemandRate] length=100000000 lo=0 hi=1;    REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+dwhiteId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dwhiteId z length_ lo hi = mkUgen Nothing [DemandRate] (Left DemandRate) "Dwhite" [length_, lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dwhite.+dwhiteM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dwhiteM = liftUid3 dwhiteId++-- | Unsafe variant of Dwhite.+dwhite :: Ugen -> Ugen -> Ugen -> Ugen+dwhite = liftUnsafe3 dwhiteM++{-+-- | Demand rate weighted random sequence generator+--+--  Dwrand [DemandRate] repeats=1 weights=0 *list=0;    MCE=1, REORDERS INPUTS: [2,1,0], DEMAND/NONDET+dwrandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dwrandId z repeats weights list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dwrand" [repeats,weights] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dwrand.+dwrandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dwrandM = liftUid3 dwrandId++-- | Unsafe variant of Dwrand.+dwrand ::  Ugen -> Ugen -> Ugen -> Ugen+dwrand = liftUnsafe3 dwrandM+-}++{- | Demand rate random sequence generator.++ Dxrand [DemandRate] repeats=1 *list=0;    MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dxrandId :: ID a => a -> Ugen -> Ugen -> Ugen+dxrandId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dxrand" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dxrand.+dxrandM :: Uid m => Ugen -> Ugen -> m Ugen+dxrandM = liftUid2 dxrandId++-- | Unsafe variant of Dxrand.+dxrand :: Ugen -> Ugen -> Ugen+dxrand = liftUnsafe2 dxrandM++{- | Envelope generator++ EnvGen [ControlRate,AudioRate] gate=1 levelScale=1 levelBias=0 timeScale=1 doneAction=0 *envelope=0;    MCE=1, REORDERS INPUTS: [5,0,1,2,3,4], ENUMERATION INPUTS: 4=DoneAction, 5=Envelope+-}+envGen :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Envelope Ugen -> Ugen+envGen rate gate_ levelScale levelBias timeScale doneAction envelope_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "EnvGen" [gate_, levelScale, levelBias, timeScale, (from_done_action doneAction)] (Just [(envelope_to_ugen envelope_)]) 1 (Special 0) NoId++{- | Exponential single random number generator.++ ExpRand [InitialisationRate] lo=0.01 hi=1;    NONDET+-}+expRandId :: ID a => a -> Ugen -> Ugen -> Ugen+expRandId z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ExpRand" [lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of ExpRand.+expRandM :: Uid m => Ugen -> Ugen -> m Ugen+expRandM = liftUid2 expRandId++-- | Unsafe variant of ExpRand.+expRand :: Ugen -> Ugen -> Ugen+expRand = liftUnsafe2 expRandM++{- | Feedback sine with chaotic phase indexing++ FBSineC [AudioRate] freq=22050 im=1 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1+-}+fbSineC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fbSineC rate freq im fb a c xi yi = mkUgen Nothing [AudioRate] (Left rate) "FBSineC" [freq, im, fb, a, c, xi, yi] Nothing 1 (Special 0) NoId++{- | Feedback sine with chaotic phase indexing++ FBSineL [AudioRate] freq=22050 im=1 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1+-}+fbSineL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fbSineL rate freq im fb a c xi yi = mkUgen Nothing [AudioRate] (Left rate) "FBSineL" [freq, im, fb, a, c, xi, yi] Nothing 1 (Special 0) NoId++{- | Feedback sine with chaotic phase indexing++ FBSineN [AudioRate] freq=22050 im=1 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1+-}+fbSineN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fbSineN rate freq im fb a c xi yi = mkUgen Nothing [AudioRate] (Left rate) "FBSineN" [freq, im, fb, a, c, xi, yi] Nothing 1 (Special 0) NoId++{- | Fast Fourier Transform++ FFT [ControlRate] buffer=0 in=0 hop=0.5 wintype=0 active=1 winsize=0+-}+fft :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fft buffer in_ hop wintype active winsize = mkUgen Nothing [ControlRate] (Left ControlRate) "FFT" [buffer, in_, hop, wintype, active, winsize] Nothing 1 (Special 0) NoId++{- | First order filter section.++ FOS [ControlRate,AudioRate] in=0 a0=0 a1=0 b1=0;    FILTER: TRUE+-}+fos :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fos in_ a0 a1 b1 = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "FOS" [in_, a0, a1, b1] Nothing 1 (Special 0) NoId++{- | Fast sine oscillator.++ FSinOsc [ControlRate,AudioRate] freq=440 iphase=0+-}+fSinOsc :: Rate -> Ugen -> Ugen -> Ugen+fSinOsc rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "FSinOsc" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Fold a signal outside given thresholds.++ Fold [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1;    FILTER: TRUE+-}+fold :: Ugen -> Ugen -> Ugen -> Ugen+fold in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Fold" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Formant oscillator++ Formant [AudioRate] fundfreq=440 formfreq=1760 bwfreq=880+-}+formant :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+formant rate fundfreq formfreq bwfreq = mkUgen Nothing [AudioRate] (Left rate) "Formant" [fundfreq, formfreq, bwfreq] Nothing 1 (Special 0) NoId++{- | FOF-like filter.++ Formlet [ControlRate,AudioRate] in=0 freq=440 attacktime=1 decaytime=1;    FILTER: TRUE+-}+formlet :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+formlet in_ freq attacktime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Formlet" [in_, freq, attacktime, decaytime] Nothing 1 (Special 0) NoId++{- | When triggered, frees a node.++ Free [ControlRate] trig=0 id=0;    FILTER: TRUE+-}+free :: Ugen -> Ugen -> Ugen+free trig_ id_ = mkUgen Nothing [ControlRate] (Right [0]) "Free" [trig_, id_] Nothing 1 (Special 0) NoId++{- | When triggered, free enclosing synth.++ FreeSelf [ControlRate] in=0+-}+freeSelf :: Ugen -> Ugen+freeSelf in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "FreeSelf" [in_] Nothing 1 (Special 0) NoId++{- | Free the enclosing synth when a Ugen is finished++ FreeSelfWhenDone [ControlRate] src=0+-}+freeSelfWhenDone :: Ugen -> Ugen+freeSelfWhenDone src = mkUgen Nothing [ControlRate] (Left ControlRate) "FreeSelfWhenDone" [src] Nothing 1 (Special 0) NoId++{- | A reverb++ FreeVerb [AudioRate] in=0 mix=0.33 room=0.5 damp=0.5;    FILTER: TRUE+-}+freeVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+freeVerb in_ mix room damp = mkUgen Nothing [AudioRate] (Right [0]) "FreeVerb" [in_, mix, room, damp] Nothing 1 (Special 0) NoId++{- | A two-channel reverb++ FreeVerb2 [AudioRate] in=0 in2=0 mix=0.33 room=0.5 damp=0.5;    FILTER: TRUE+-}+freeVerb2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+freeVerb2 in_ in2 mix room damp = mkUgen Nothing [AudioRate] (Right [0]) "FreeVerb2" [in_, in2, mix, room, damp] Nothing 2 (Special 0) NoId++{- | Frequency Shifter.++ FreqShift [AudioRate] in=0 freq=0 phase=0+-}+freqShift :: Ugen -> Ugen -> Ugen -> Ugen+freqShift in_ freq phase = mkUgen Nothing [AudioRate] (Left AudioRate) "FreqShift" [in_, freq, phase] Nothing 1 (Special 0) NoId++{- | A two-channel reverb++ GVerb [AudioRate] in=0 roomsize=10 revtime=3 damping=0.5 inputbw=0.5 spread=15 drylevel=1 earlyreflevel=0.7 taillevel=0.5 maxroomsize=300;    FILTER: TRUE+-}+gVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gVerb in_ roomsize revtime damping inputbw spread drylevel earlyreflevel taillevel maxroomsize = mkUgen Nothing [AudioRate] (Right [0]) "GVerb" [in_, roomsize, revtime, damping, inputbw, spread, drylevel, earlyreflevel, taillevel, maxroomsize] Nothing 2 (Special 0) NoId++{- | Gate or hold.++ Gate [ControlRate,AudioRate] in=0 trig=0;    FILTER: TRUE+-}+gate :: Ugen -> Ugen -> Ugen+gate in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Gate" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Gingerbreadman map chaotic generator++ GbmanL [AudioRate] freq=22050 xi=1.2 yi=2.1+-}+gbmanL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+gbmanL rate freq xi yi = mkUgen Nothing [AudioRate] (Left rate) "GbmanL" [freq, xi, yi] Nothing 1 (Special 0) NoId++{- | Gingerbreadman map chaotic generator++ GbmanN [AudioRate] freq=22050 xi=1.2 yi=2.1+-}+gbmanN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+gbmanN rate freq xi yi = mkUgen Nothing [AudioRate] (Left rate) "GbmanN" [freq, xi, yi] Nothing 1 (Special 0) NoId++{- | Dynamic stochastic synthesis generator.++ Gendy1 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0;    NONDET+-}+gendy1Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy1Id z rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy1" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Gendy1.+gendy1M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+gendy1M = liftUid11 gendy1Id++-- | Unsafe variant of Gendy1.+gendy1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy1 = liftUnsafe11 gendy1M++{- | Dynamic stochastic synthesis generator.++ Gendy2 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0 a=1.17 c=0.31;    NONDET+-}+gendy2Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy2Id z rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum a c = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy2" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum, a, c] Nothing 1 (Special 0) (toUid z)++{-+-- | Monad variant of Gendy2.+gendy2M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+gendy2M = liftUid13 gendy2Id++-- | Unsafe variant of Gendy2.+gendy2 ::  Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy2 = liftUnsafe13 gendy2M+-}++{- | Dynamic stochastic synthesis generator.++ Gendy3 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 freq=440 ampscale=0.5 durscale=0.5 initCPs=12 knum=0;    NONDET+-}+gendy3Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy3Id z rate ampdist durdist adparam ddparam freq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy3" [ampdist, durdist, adparam, ddparam, freq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Gendy3.+gendy3M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+gendy3M = liftUid10 gendy3Id++-- | Unsafe variant of Gendy3.+gendy3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy3 = liftUnsafe10 gendy3M++{- | Granular synthesis with sound stored in a buffer++ GrainBuf [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 interp=2 pan=0 envbufnum=-1 maxGrains=512;    NC INPUT: True+-}+grainBuf :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainBuf numChannels trigger dur sndbuf rate_ pos interp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainBuf" [trigger, dur, sndbuf, rate_, pos, interp, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Granular synthesis with frequency modulated sine tones++ GrainFM [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 pan=0 envbufnum=-1 maxGrains=512;    NC INPUT: True+-}+grainFM :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainFM numChannels trigger dur carfreq modfreq index_ pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainFM" [trigger, dur, carfreq, modfreq, index_, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Granulate an input signal++ GrainIn [AudioRate] trigger=0 dur=1 in=0 pan=0 envbufnum=-1 maxGrains=512;    NC INPUT: True+-}+grainIn :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainIn numChannels trigger dur in_ pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainIn" [trigger, dur, in_, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Granular synthesis with sine tones++ GrainSin [AudioRate] trigger=0 dur=1 freq=440 pan=0 envbufnum=-1 maxGrains=512;    NC INPUT: True+-}+grainSin :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainSin numChannels trigger dur freq pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainSin" [trigger, dur, freq, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Gray Noise.++ GrayNoise [ControlRate,AudioRate] ;    NONDET+-}+grayNoiseId :: ID a => a -> Rate -> Ugen+grayNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GrayNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of GrayNoise.+grayNoiseM :: Uid m => Rate -> m Ugen+grayNoiseM = liftUid1 grayNoiseId++-- | Unsafe variant of GrayNoise.+grayNoise :: Rate -> Ugen+grayNoise = liftUnsafe1 grayNoiseM++{- | 2nd order Butterworth highpass filter.++ HPF [ControlRate,AudioRate] in=0 freq=440;    FILTER: TRUE+-}+hpf :: Ugen -> Ugen -> Ugen+hpf in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HPF" [in_, freq] Nothing 1 (Special 0) NoId++{- | Two point difference filter++ HPZ1 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+hpz1 :: Ugen -> Ugen+hpz1 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HPZ1" [in_] Nothing 1 (Special 0) NoId++{- | Two zero fixed midcut.++ HPZ2 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+hpz2 :: Ugen -> Ugen+hpz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HPZ2" [in_] Nothing 1 (Special 0) NoId++{- | Scrambled value with a hash function.++ Hasher [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+hasher :: Ugen -> Ugen+hasher in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Hasher" [in_] Nothing 1 (Special 0) NoId++{- | Henon map chaotic generator++ HenonC [AudioRate] freq=22050 a=1.4 b=0.3 x0=0 x1=0+-}+henonC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonC rate freq a b x0 x1 = mkUgen Nothing [AudioRate] (Left rate) "HenonC" [freq, a, b, x0, x1] Nothing 1 (Special 0) NoId++{- | Henon map chaotic generator++ HenonL [AudioRate] freq=22050 a=1.4 b=0.3 x0=0 x1=0+-}+henonL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonL rate freq a b x0 x1 = mkUgen Nothing [AudioRate] (Left rate) "HenonL" [freq, a, b, x0, x1] Nothing 1 (Special 0) NoId++{- | Henon map chaotic generator++ HenonN [AudioRate] freq=22050 a=1.4 b=0.3 x0=0 x1=0+-}+henonN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonN rate freq a b x0 x1 = mkUgen Nothing [AudioRate] (Left rate) "HenonN" [freq, a, b, x0, x1] Nothing 1 (Special 0) NoId++{- | Applies the Hilbert transform to an input signal.++ Hilbert [AudioRate] in=0;    FILTER: TRUE+-}+hilbert :: Ugen -> Ugen+hilbert in_ = mkUgen Nothing [AudioRate] (Right [0]) "Hilbert" [in_] Nothing 2 (Special 0) NoId++{- | Envelope generator for polling values from an Env++ IEnvGen [ControlRate,AudioRate] index=0 *envelope=0;    MCE=1, REORDERS INPUTS: [1,0], ENUMERATION INPUTS: 1=IEnvelope+-}+iEnvGen :: Rate -> Ugen -> Envelope Ugen -> Ugen+iEnvGen rate index_ envelope_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "IEnvGen" [index_] (Just [(envelope_to_ienvgen_ugen envelope_)]) 1 (Special 0) NoId++{- | Inverse Fast Fourier Transform++ IFFT [ControlRate,AudioRate] buffer=0 wintype=0 winsize=0+-}+ifft :: Ugen -> Ugen -> Ugen -> Ugen+ifft buffer wintype winsize = mkUgen Nothing [ControlRate, AudioRate] (Left AudioRate) "IFFT" [buffer, wintype, winsize] Nothing 1 (Special 0) NoId++{- | Single integer random number generator.++ iRand [InitialisationRate] lo=0 hi=127;    NONDET+-}+iRandId :: ID a => a -> Ugen -> Ugen -> Ugen+iRandId z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "IRand" [lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of irand.+iRandM :: Uid m => Ugen -> Ugen -> m Ugen+iRandM = liftUid2 iRandId++-- | Unsafe variant of irand.+iRand :: Ugen -> Ugen -> Ugen+iRand = liftUnsafe2 iRandM++{- | Impulse oscillator.++ Impulse [ControlRate,AudioRate] freq=440 phase=0+-}+impulse :: Rate -> Ugen -> Ugen -> Ugen+impulse rate freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Impulse" [freq, phase] Nothing 1 (Special 0) NoId++{- | Read a signal from a bus.++ In [ControlRate,AudioRate] bus=0;    NC INPUT: True+-}+in' :: Int -> Rate -> Ugen -> Ugen+in' numChannels rate bus = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "In" [bus] Nothing numChannels (Special 0) NoId++{- | Read signal from a bus with a current or one cycle old timestamp.++ InFeedback [AudioRate] bus=0;    NC INPUT: True+-}+inFeedback :: Int -> Ugen -> Ugen+inFeedback numChannels bus = mkUgen Nothing [AudioRate] (Left AudioRate) "InFeedback" [bus] Nothing numChannels (Special 0) NoId++{- | Tests if a signal is within a given range.++ InRange [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1;    FILTER: TRUE+-}+inRange :: Ugen -> Ugen -> Ugen -> Ugen+inRange in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "InRange" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Test if a point is within a given rectangle.++ InRect [ControlRate,AudioRate] x=0 y=0 rect=0+-}+inRect :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+inRect rate x y rect = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "InRect" [x, y, rect] Nothing 1 (Special 0) NoId++{- | Generate a trigger anytime a bus is set.++ InTrig [ControlRate] bus=0;    NC INPUT: True+-}+inTrig :: Int -> Ugen -> Ugen+inTrig numChannels bus = mkUgen Nothing [ControlRate] (Left ControlRate) "InTrig" [bus] Nothing numChannels (Special 0) NoId++{- | Index into a table with a signal++ Index [ControlRate,AudioRate] bufnum=0 in=0;    FILTER: TRUE+-}+index :: Ugen -> Ugen -> Ugen+index bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Index" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values++ IndexInBetween [ControlRate,AudioRate] bufnum=0 in=0;    FILTER: TRUE+-}+indexInBetween :: Ugen -> Ugen -> Ugen+indexInBetween bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "IndexInBetween" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Index into a table with a signal, linear interpolated++ IndexL [ControlRate,AudioRate] bufnum=0 in=0;    FILTER: TRUE+-}+indexL :: Ugen -> Ugen -> Ugen+indexL bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "IndexL" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Base class for info ugens++ InfoUgenBase [InitialisationRate]+-}+infoUgenBase :: Rate -> Ugen+infoUgenBase rate = mkUgen Nothing [InitialisationRate] (Left rate) "InfoUgenBase" [] Nothing 1 (Special 0) NoId++{- | A leaky integrator.++ Integrator [ControlRate,AudioRate] in=0 coef=1;    FILTER: TRUE+-}+integrator :: Ugen -> Ugen -> Ugen+integrator in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Integrator" [in_, coef] Nothing 1 (Special 0) NoId++{- | Control to audio rate converter.++ K2A [AudioRate] in=0+-}+k2a :: Ugen -> Ugen+k2a in_ = mkUgen Nothing [AudioRate] (Left AudioRate) "K2A" [in_] Nothing 1 (Special 0) NoId++{- | Respond to the state of a key++ KeyState [ControlRate] keycode=0 minval=0 maxval=1 lag=0.2+-}+keyState :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+keyState rate keycode minval maxval lag_ = mkUgen Nothing [ControlRate] (Left rate) "KeyState" [keycode, minval, maxval, lag_] Nothing 1 (Special 0) NoId++{- | Key tracker++ KeyTrack [ControlRate] chain=0 keydecay=2 chromaleak=0.5+-}+keyTrack :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+keyTrack rate chain keydecay chromaleak = mkUgen Nothing [ControlRate] (Left rate) "KeyTrack" [chain, keydecay, chromaleak] Nothing 1 (Special 0) NoId++{- | Sine oscillator bank++ Klang [AudioRate] freqscale=1 freqoffset=0 *specificationsArrayRef=0;    MCE=1, REORDERS INPUTS: [2,0,1]+-}+klang :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+klang rate freqscale freqoffset specificationsArrayRef = mkUgen Nothing [AudioRate] (Left rate) "Klang" [freqscale, freqoffset] (Just [specificationsArrayRef]) 1 (Special 0) NoId++{- | Bank of resonators++ Klank [AudioRate] input=0 freqscale=1 freqoffset=0 decayscale=1 *specificationsArrayRef=0;    MCE=1, FILTER: TRUE, REORDERS INPUTS: [4,0,1,2,3]+-}+klank :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+klank input freqscale freqoffset decayscale specificationsArrayRef = mkUgen Nothing [AudioRate] (Right [0]) "Klank" [input, freqscale, freqoffset, decayscale] (Just [specificationsArrayRef]) 1 (Special 0) NoId++{- | Clipped noise++ LFClipNoise [ControlRate,AudioRate] freq=500;    NONDET+-}+lfClipNoiseId :: ID a => a -> Rate -> Ugen -> Ugen+lfClipNoiseId z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFClipNoise" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFClipNoise.+lfClipNoiseM :: Uid m => Rate -> Ugen -> m Ugen+lfClipNoiseM = liftUid2 lfClipNoiseId++-- | Unsafe variant of LFClipNoise.+lfClipNoise :: Rate -> Ugen -> Ugen+lfClipNoise = liftUnsafe2 lfClipNoiseM++{- | A sine like shape made of two cubic pieces++ LFCub [ControlRate,AudioRate] freq=440 iphase=0+-}+lfCub :: Rate -> Ugen -> Ugen -> Ugen+lfCub rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFCub" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Dynamic clipped noise++ LFDClipNoise [ControlRate,AudioRate] freq=500;    NONDET+-}+lfdClipNoiseId :: ID a => a -> Rate -> Ugen -> Ugen+lfdClipNoiseId z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDClipNoise" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDClipNoise.+lfdClipNoiseM :: Uid m => Rate -> Ugen -> m Ugen+lfdClipNoiseM = liftUid2 lfdClipNoiseId++-- | Unsafe variant of LFDClipNoise.+lfdClipNoise :: Rate -> Ugen -> Ugen+lfdClipNoise = liftUnsafe2 lfdClipNoiseM++{- | Dynamic step noise++ LFDNoise0 [ControlRate,AudioRate] freq=500;    NONDET+-}+lfdNoise0Id :: ID a => a -> Rate -> Ugen -> Ugen+lfdNoise0Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDNoise0" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDNoise0.+lfdNoise0M :: Uid m => Rate -> Ugen -> m Ugen+lfdNoise0M = liftUid2 lfdNoise0Id++-- | Unsafe variant of LFDNoise0.+lfdNoise0 :: Rate -> Ugen -> Ugen+lfdNoise0 = liftUnsafe2 lfdNoise0M++{- | Dynamic ramp noise++ LFDNoise1 [ControlRate,AudioRate] freq=500;    NONDET+-}+lfdNoise1Id :: ID a => a -> Rate -> Ugen -> Ugen+lfdNoise1Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDNoise1" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDNoise1.+lfdNoise1M :: Uid m => Rate -> Ugen -> m Ugen+lfdNoise1M = liftUid2 lfdNoise1Id++-- | Unsafe variant of LFDNoise1.+lfdNoise1 :: Rate -> Ugen -> Ugen+lfdNoise1 = liftUnsafe2 lfdNoise1M++{- | Dynamic cubic noise++ LFDNoise3 [ControlRate,AudioRate] freq=500;    NONDET+-}+lfdNoise3Id :: ID a => a -> Rate -> Ugen -> Ugen+lfdNoise3Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDNoise3" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDNoise3.+lfdNoise3M :: Uid m => Rate -> Ugen -> m Ugen+lfdNoise3M = liftUid2 lfdNoise3Id++-- | Unsafe variant of LFDNoise3.+lfdNoise3 :: Rate -> Ugen -> Ugen+lfdNoise3 = liftUnsafe2 lfdNoise3M++{- | Gaussian function oscillator++ LFGauss [ControlRate,AudioRate] duration=1 width=0.1 iphase=0 loop=1 doneAction=0;    ENUMERATION INPUTS: 3=Loop, 4=DoneAction+-}+lfGauss :: Rate -> Ugen -> Ugen -> Ugen -> Loop Ugen -> DoneAction Ugen -> Ugen+lfGauss rate duration width iphase loop doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFGauss" [duration, width, iphase, (from_loop loop), (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Step noise++ LFNoise0 [ControlRate,AudioRate] freq=500;    NONDET+-}+lfNoise0Id :: ID a => a -> Rate -> Ugen -> Ugen+lfNoise0Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFNoise0" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFNoise0.+lfNoise0M :: Uid m => Rate -> Ugen -> m Ugen+lfNoise0M = liftUid2 lfNoise0Id++-- | Unsafe variant of LFNoise0.+lfNoise0 :: Rate -> Ugen -> Ugen+lfNoise0 = liftUnsafe2 lfNoise0M++{- | Ramp noise++ LFNoise1 [ControlRate,AudioRate] freq=500;    NONDET+-}+lfNoise1Id :: ID a => a -> Rate -> Ugen -> Ugen+lfNoise1Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFNoise1" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFNoise1.+lfNoise1M :: Uid m => Rate -> Ugen -> m Ugen+lfNoise1M = liftUid2 lfNoise1Id++-- | Unsafe variant of LFNoise1.+lfNoise1 :: Rate -> Ugen -> Ugen+lfNoise1 = liftUnsafe2 lfNoise1M++{- | Quadratic noise.++ LFNoise2 [ControlRate,AudioRate] freq=500;    NONDET+-}+lfNoise2Id :: ID a => a -> Rate -> Ugen -> Ugen+lfNoise2Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFNoise2" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFNoise2.+lfNoise2M :: Uid m => Rate -> Ugen -> m Ugen+lfNoise2M = liftUid2 lfNoise2Id++-- | Unsafe variant of LFNoise2.+lfNoise2 :: Rate -> Ugen -> Ugen+lfNoise2 = liftUnsafe2 lfNoise2M++{- | Parabolic oscillator++ LFPar [ControlRate,AudioRate] freq=440 iphase=0+-}+lfPar :: Rate -> Ugen -> Ugen -> Ugen+lfPar rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFPar" [freq, iphase] Nothing 1 (Special 0) NoId++{- | pulse oscillator++ LFPulse [ControlRate,AudioRate] freq=440 iphase=0 width=0.5+-}+lfPulse :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfPulse rate freq iphase width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFPulse" [freq, iphase, width] Nothing 1 (Special 0) NoId++{- | Sawtooth oscillator++ LFSaw [ControlRate,AudioRate] freq=440 iphase=0+-}+lfSaw :: Rate -> Ugen -> Ugen -> Ugen+lfSaw rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFSaw" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Triangle oscillator++ LFTri [ControlRate,AudioRate] freq=440 iphase=0+-}+lfTri :: Rate -> Ugen -> Ugen -> Ugen+lfTri rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFTri" [freq, iphase] Nothing 1 (Special 0) NoId++{- | 2nd order Butterworth lowpass filter++ LPF [ControlRate,AudioRate] in=0 freq=440;    FILTER: TRUE+-}+lpf :: Ugen -> Ugen -> Ugen+lpf in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LPF" [in_, freq] Nothing 1 (Special 0) NoId++{- | Two point average filter++ LPZ1 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+lpz1 :: Ugen -> Ugen+lpz1 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LPZ1" [in_] Nothing 1 (Special 0) NoId++{- | Two zero fixed lowpass++ LPZ2 [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+lpz2 :: Ugen -> Ugen+lpz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LPZ2" [in_] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag [ControlRate,AudioRate] in=0 lagTime=0.1;    FILTER: TRUE+-}+lag :: Ugen -> Ugen -> Ugen+lag in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag2 [ControlRate,AudioRate] in=0 lagTime=0.1;    FILTER: TRUE+-}+lag2 :: Ugen -> Ugen -> Ugen+lag2 in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag2" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag2UD [ControlRate,AudioRate] in=0 lagTimeU=0.1 lagTimeD=0.1;    FILTER: TRUE+-}+lag2UD :: Ugen -> Ugen -> Ugen -> Ugen+lag2UD in_ lagTimeU lagTimeD = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag2UD" [in_, lagTimeU, lagTimeD] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag3 [ControlRate,AudioRate] in=0 lagTime=0.1;    FILTER: TRUE+-}+lag3 :: Ugen -> Ugen -> Ugen+lag3 in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag3" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag3UD [ControlRate,AudioRate] in=0 lagTimeU=0.1 lagTimeD=0.1;    FILTER: TRUE+-}+lag3UD :: Ugen -> Ugen -> Ugen -> Ugen+lag3UD in_ lagTimeU lagTimeD = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag3UD" [in_, lagTimeU, lagTimeD] Nothing 1 (Special 0) NoId++{- | Read a control signal from a bus with a lag++ LagIn [ControlRate] bus=0 lag=0.1;    NC INPUT: True+-}+lagIn :: Int -> Ugen -> Ugen -> Ugen+lagIn numChannels bus lag_ = mkUgen Nothing [ControlRate] (Left ControlRate) "LagIn" [bus, lag_] Nothing numChannels (Special 0) NoId++{- | Exponential lag++ LagUD [ControlRate,AudioRate] in=0 lagTimeU=0.1 lagTimeD=0.1;    FILTER: TRUE+-}+lagUD :: Ugen -> Ugen -> Ugen -> Ugen+lagUD in_ lagTimeU lagTimeD = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LagUD" [in_, lagTimeU, lagTimeD] Nothing 1 (Special 0) NoId++{- | Output the last value before the input changed++ LastValue [ControlRate,AudioRate] in=0 diff=0.01;    FILTER: TRUE+-}+lastValue :: Ugen -> Ugen -> Ugen+lastValue in_ diff = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LastValue" [in_, diff] Nothing 1 (Special 0) NoId++{- | Sample and hold++ Latch [ControlRate,AudioRate] in=0 trig=0;    FILTER: TRUE+-}+latch :: Ugen -> Ugen -> Ugen+latch in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "Latch" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Latoocarfian chaotic generator++ LatoocarfianC [AudioRate] freq=22050 a=1 b=3 c=0.5 d=0.5 xi=0.5 yi=0.5+-}+latoocarfianC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianC rate freq a b c d xi yi = mkUgen Nothing [AudioRate] (Left rate) "LatoocarfianC" [freq, a, b, c, d, xi, yi] Nothing 1 (Special 0) NoId++{- | Latoocarfian chaotic generator++ LatoocarfianL [AudioRate] freq=22050 a=1 b=3 c=0.5 d=0.5 xi=0.5 yi=0.5+-}+latoocarfianL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianL rate freq a b c d xi yi = mkUgen Nothing [AudioRate] (Left rate) "LatoocarfianL" [freq, a, b, c, d, xi, yi] Nothing 1 (Special 0) NoId++{- | Latoocarfian chaotic generator++ LatoocarfianN [AudioRate] freq=22050 a=1 b=3 c=0.5 d=0.5 xi=0.5 yi=0.5+-}+latoocarfianN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianN rate freq a b c d xi yi = mkUgen Nothing [AudioRate] (Left rate) "LatoocarfianN" [freq, a, b, c, d, xi, yi] Nothing 1 (Special 0) NoId++{- | Remove DC++ LeakDC [ControlRate,AudioRate] in=0 coef=0.995;    FILTER: TRUE+-}+leakDC :: Ugen -> Ugen -> Ugen+leakDC in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LeakDC" [in_, coef] Nothing 1 (Special 0) NoId++{- | Output least changed++ LeastChange [ControlRate,AudioRate] a=0 b=0+-}+leastChange :: Rate -> Ugen -> Ugen -> Ugen+leastChange rate a b = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LeastChange" [a, b] Nothing 1 (Special 0) NoId++{- | Peak limiter++ Limiter [AudioRate] in=0 level=1 dur=0.01;    FILTER: TRUE+-}+limiter :: Ugen -> Ugen -> Ugen -> Ugen+limiter in_ level dur = mkUgen Nothing [AudioRate] (Right [0]) "Limiter" [in_, level, dur] Nothing 1 (Special 0) NoId++{- | Linear congruential chaotic generator++ LinCongC [AudioRate] freq=22050 a=1.1 c=0.13 m=1 xi=0+-}+linCongC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linCongC rate freq a c m xi = mkUgen Nothing [AudioRate] (Left rate) "LinCongC" [freq, a, c, m, xi] Nothing 1 (Special 0) NoId++{- | Linear congruential chaotic generator++ LinCongL [AudioRate] freq=22050 a=1.1 c=0.13 m=1 xi=0+-}+linCongL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linCongL rate freq a c m xi = mkUgen Nothing [AudioRate] (Left rate) "LinCongL" [freq, a, c, m, xi] Nothing 1 (Special 0) NoId++{- | Linear congruential chaotic generator++ LinCongN [AudioRate] freq=22050 a=1.1 c=0.13 m=1 xi=0+-}+linCongN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linCongN rate freq a c m xi = mkUgen Nothing [AudioRate] (Left rate) "LinCongN" [freq, a, c, m, xi] Nothing 1 (Special 0) NoId++{- | Map a linear range to an exponential range++ LinExp [InitialisationRate,ControlRate,AudioRate] in=0 srclo=0 srchi=1 dstlo=1 dsthi=2;    FILTER: TRUE+-}+linExp :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linExp in_ srclo srchi dstlo dsthi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "LinExp" [in_, srclo, srchi, dstlo, dsthi] Nothing 1 (Special 0) NoId++{- | Two channel linear pan.++ LinPan2 [ControlRate,AudioRate] in=0 pos=0 level=1;    FILTER: TRUE+-}+linPan2 :: Ugen -> Ugen -> Ugen -> Ugen+linPan2 in_ pos level = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LinPan2" [in_, pos, level] Nothing 2 (Special 0) NoId++{- | Skewed random number generator.++ LinRand [InitialisationRate] lo=0 hi=1 minmax=0;    NONDET+-}+linRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+linRandId z lo hi minmax = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "LinRand" [lo, hi, minmax] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LinRand.+linRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+linRandM = liftUid3 linRandId++-- | Unsafe variant of LinRand.+linRand :: Ugen -> Ugen -> Ugen -> Ugen+linRand = liftUnsafe3 linRandM++{- | Two channel linear crossfade.++ LinXFade2 [ControlRate,AudioRate] inA=0 inB=0 pan=0 level=1;    FILTER: TRUE, PSUEDO INPUTS: [3]+-}+linXFade2 :: Ugen -> Ugen -> Ugen -> Ugen+linXFade2 inA inB pan = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "LinXFade2" [inA, inB, pan] Nothing 1 (Special 0) NoId++{- | Line generator.++ Line [ControlRate,AudioRate] start=0 end=1 dur=1 doneAction=0;    ENUMERATION INPUTS: 3=DoneAction+-}+line :: Rate -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+line rate start end dur doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Line" [start, end, dur, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Simple linear envelope generator.++ Linen [ControlRate] gate=1 attackTime=0.01 susLevel=1 releaseTime=1 doneAction=0;    ENUMERATION INPUTS: 4=DoneAction+-}+linen :: Ugen -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+linen gate_ attackTime susLevel releaseTime doneAction = mkUgen Nothing [ControlRate] (Left ControlRate) "Linen" [gate_, attackTime, susLevel, releaseTime, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Allocate a buffer local to the synth++ LocalBuf [InitialisationRate] numChannels=1 numFrames=1;    REORDERS INPUTS: [1,0], NONDET+-}+localBufId :: ID a => a -> Ugen -> Ugen -> Ugen+localBufId z numChannels numFrames = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "LocalBuf" [numChannels, numFrames] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LocalBuf.+localBufM :: Uid m => Ugen -> Ugen -> m Ugen+localBufM = liftUid2 localBufId++-- | Unsafe variant of LocalBuf.+localBuf :: Ugen -> Ugen -> Ugen+localBuf = liftUnsafe2 localBufM++{- | Define and read from buses local to a synth.++ LocalIn [ControlRate,AudioRate] *default=0;    MCE=1, NC INPUT: True+-}+localIn :: Int -> Rate -> Ugen -> Ugen+localIn numChannels rate default_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LocalIn" [] (Just [default_]) numChannels (Special 0) NoId++{- | Write to buses local to a synth.++ LocalOut [ControlRate,AudioRate] *channelsArray=0;    MCE=1, FILTER: TRUE+-}+localOut :: Ugen -> Ugen+localOut input = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LocalOut" [] (Just [input]) 0 (Special 0) NoId++{- | Chaotic noise function++ Logistic [ControlRate,AudioRate] chaosParam=3 freq=1000 init=0.5+-}+logistic :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+logistic rate chaosParam freq init_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Logistic" [chaosParam, freq, init_] Nothing 1 (Special 0) NoId++{- | Lorenz chaotic generator++ LorenzL [AudioRate] freq=22050 s=10 r=28 b=2.667 h=0.05 xi=0.1 yi=0 zi=0+-}+lorenzL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenzL rate freq s r b h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "LorenzL" [freq, s, r, b, h, xi, yi, zi] Nothing 1 (Special 0) NoId++{- | Extraction of instantaneous loudness in sones++ Loudness [ControlRate] chain=0 smask=0.25 tmask=1+-}+loudness :: Ugen -> Ugen -> Ugen -> Ugen+loudness chain smask tmask = mkUgen Nothing [ControlRate] (Left ControlRate) "Loudness" [chain, smask, tmask] Nothing 1 (Special 0) NoId++{- | Mel frequency cepstral coefficients++ MFCC [ControlRate] chain=0 numcoeff=13+-}+mfcc :: Rate -> Ugen -> Ugen -> Ugen+mfcc rate chain numcoeff = mkUgen Nothing [ControlRate] (Left rate) "MFCC" [chain, numcoeff] Nothing 13 (Special 0) NoId++{- | Reduce precision.++ MantissaMask [ControlRate,AudioRate] in=0 bits=3;    FILTER: TRUE+-}+mantissaMask :: Ugen -> Ugen -> Ugen+mantissaMask in_ bits = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MantissaMask" [in_, bits] Nothing 1 (Special 0) NoId++{- | Median filter.++ Median [ControlRate,AudioRate] length=3 in=0;    FILTER: TRUE+-}+median :: Ugen -> Ugen -> Ugen+median length_ in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Median" [length_, in_] Nothing 1 (Special 0) NoId++{- | Parametric filter.++ MidEQ [ControlRate,AudioRate] in=0 freq=440 rq=1 db=0;    FILTER: TRUE+-}+midEQ :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+midEQ in_ freq rq db = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MidEQ" [in_, freq, rq, db] Nothing 1 (Special 0) NoId++{- | Minimum difference of two values in modulo arithmetics++ ModDif [InitialisationRate,ControlRate,AudioRate] x=0 y=0 mod=1;    FILTER: TRUE+-}+modDif :: Ugen -> Ugen -> Ugen -> Ugen+modDif x y mod_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "ModDif" [x, y, mod_] Nothing 1 (Special 0) NoId++{- | Moog VCF implementation, designed by Federico Fontana++ MoogFF [ControlRate,AudioRate] in=0 freq=100 gain=2 reset=0;    FILTER: TRUE+-}+moogFF :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+moogFF in_ freq gain reset = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MoogFF" [in_, freq, gain, reset] Nothing 1 (Special 0) NoId++{- | Output most changed.++ MostChange [ControlRate,AudioRate] a=0 b=0;    FILTER: TRUE+-}+mostChange :: Ugen -> Ugen -> Ugen+mostChange a b = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "MostChange" [a, b] Nothing 1 (Special 0) NoId++{- | Mouse button Ugen.++ MouseButton [ControlRate] minval=0 maxval=1 lag=0.2+-}+mouseButton :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+mouseButton rate minval maxval lag_ = mkUgen Nothing [ControlRate] (Left rate) "MouseButton" [minval, maxval, lag_] Nothing 1 (Special 0) NoId++{- | Cursor tracking Ugen.++ MouseX [ControlRate] minval=0 maxval=1 warp=0 lag=0.2;    ENUMERATION INPUTS: 2=Warp+-}+mouseX :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseX rate minval maxval warp lag_ = mkUgen Nothing [ControlRate] (Left rate) "MouseX" [minval, maxval, (from_warp warp), lag_] Nothing 1 (Special 0) NoId++{- | Cursor tracking Ugen.++ MouseY [ControlRate] minval=0 maxval=1 warp=0 lag=0.2;    ENUMERATION INPUTS: 2=Warp+-}+mouseY :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseY rate minval maxval warp lag_ = mkUgen Nothing [ControlRate] (Left rate) "MouseY" [minval, maxval, (from_warp warp), lag_] Nothing 1 (Special 0) NoId++{- | Sum of uniform distributions.++ NRand [InitialisationRate] lo=0 hi=1 n=0;    NONDET+-}+nRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+nRandId z lo hi n = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NRand" [lo, hi, n] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of NRand.+nRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+nRandM = liftUid3 nRandId++-- | Unsafe variant of NRand.+nRand :: Ugen -> Ugen -> Ugen -> Ugen+nRand = liftUnsafe3 nRandM++{- | (Undocumented class)++ NodeID [InitialisationRate]+-}+nodeID :: Rate -> Ugen+nodeID rate = mkUgen Nothing [InitialisationRate] (Left rate) "NodeID" [] Nothing 1 (Special 0) NoId++{- | Flattens dynamics.++ Normalizer [AudioRate] in=0 level=1 dur=0.01;    FILTER: TRUE+-}+normalizer :: Ugen -> Ugen -> Ugen -> Ugen+normalizer in_ level dur = mkUgen Nothing [AudioRate] (Right [0]) "Normalizer" [in_, level, dur] Nothing 1 (Special 0) NoId++{- | Number of audio busses.++ NumAudioBuses [InitialisationRate]+-}+numAudioBuses :: Ugen+numAudioBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumAudioBuses" [] Nothing 1 (Special 0) NoId++{- | Number of open buffers.++ NumBuffers [InitialisationRate]+-}+numBuffers :: Ugen+numBuffers = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumBuffers" [] Nothing 1 (Special 0) NoId++{- | Number of control busses.++ NumControlBuses [InitialisationRate]+-}+numControlBuses :: Ugen+numControlBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumControlBuses" [] Nothing 1 (Special 0) NoId++{- | Number of input busses.++ NumInputBuses [InitialisationRate]+-}+numInputBuses :: Ugen+numInputBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumInputBuses" [] Nothing 1 (Special 0) NoId++{- | Number of output busses.++ NumOutputBuses [InitialisationRate]+-}+numOutputBuses :: Ugen+numOutputBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumOutputBuses" [] Nothing 1 (Special 0) NoId++{- | Number of currently running synths.++ NumRunningSynths [InitialisationRate,ControlRate]+-}+numRunningSynths :: Ugen+numRunningSynths = mkUgen Nothing [InitialisationRate, ControlRate] (Left InitialisationRate) "NumRunningSynths" [] Nothing 1 (Special 0) NoId++{- | Write a signal to a bus with sample accurate timing.++ OffsetOut [ControlRate,AudioRate] bus=0 *channelsArray=0;    MCE=1, FILTER: TRUE+-}+offsetOut :: Ugen -> Ugen -> Ugen+offsetOut bus input = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "OffsetOut" [bus] (Just [input]) 0 (Special 0) NoId++{- | One pole filter.++ OnePole [ControlRate,AudioRate] in=0 coef=0.5;    FILTER: TRUE+-}+onePole :: Ugen -> Ugen -> Ugen+onePole in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "OnePole" [in_, coef] Nothing 1 (Special 0) NoId++{- | One zero filter.++ OneZero [ControlRate,AudioRate] in=0 coef=0.5;    FILTER: TRUE+-}+oneZero :: Ugen -> Ugen -> Ugen+oneZero in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "OneZero" [in_, coef] Nothing 1 (Special 0) NoId++{- | Onset detector++ Onsets [ControlRate] chain=0 threshold=0.5 odftype=3 relaxtime=1 floor=0.1 mingap=10 medianspan=11 whtype=1 rawodf=0+-}+onsets :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+onsets chain threshold odftype relaxtime floor_ mingap medianspan whtype rawodf = mkUgen Nothing [ControlRate] (Left ControlRate) "Onsets" [chain, threshold, odftype, relaxtime, floor_, mingap, medianspan, whtype, rawodf] Nothing 1 (Special 0) NoId++{- | Interpolating wavetable oscillator.++ Osc [ControlRate,AudioRate] bufnum=0 freq=440 phase=0+-}+osc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osc rate bufnum freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Osc" [bufnum, freq, phase] Nothing 1 (Special 0) NoId++{- | Noninterpolating wavetable oscillator.++ OscN [ControlRate,AudioRate] bufnum=0 freq=440 phase=0+-}+oscN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+oscN rate bufnum freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "OscN" [bufnum, freq, phase] Nothing 1 (Special 0) NoId++{- | Write a signal to a bus.++ Out [ControlRate,AudioRate] bus=0 *channelsArray=0;    MCE=1, FILTER: TRUE+-}+out :: Ugen -> Ugen -> Ugen+out bus input = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Out" [bus] (Just [input]) 0 (Special 0) NoId++{- | Very fast sine grain with a parabolic envelope++ PSinGrain [AudioRate] freq=440 dur=0.2 amp=0.1+-}+pSinGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+pSinGrain rate freq dur amp = mkUgen Nothing [AudioRate] (Left rate) "PSinGrain" [freq, dur, amp] Nothing 1 (Special 0) NoId++{- | Complex addition.++ PV_Add [ControlRate] bufferA=0 bufferB=0+-}+pv_Add :: Ugen -> Ugen -> Ugen+pv_Add bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Add" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Scramble bins.++ PV_BinScramble [ControlRate] buffer=0 wipe=0 width=0.2 trig=0;    NONDET+-}+pv_BinScrambleId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinScrambleId z buffer wipe width trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinScramble" [buffer, wipe, width, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PV_BinScramble.+pv_BinScrambleM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+pv_BinScrambleM = liftUid4 pv_BinScrambleId++-- | Unsafe variant of PV_BinScramble.+pv_BinScramble :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinScramble = liftUnsafe4 pv_BinScrambleM++{- | Shift and stretch bin position.++ PV_BinShift [ControlRate] buffer=0 stretch=1 shift=0 interp=0+-}+pv_BinShift :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinShift buffer stretch shift interp = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinShift" [buffer, stretch, shift, interp] Nothing 1 (Special 0) NoId++{- | Combine low and high bins from two inputs.++ PV_BinWipe [ControlRate] bufferA=0 bufferB=0 wipe=0+-}+pv_BinWipe :: Ugen -> Ugen -> Ugen -> Ugen+pv_BinWipe bufferA bufferB wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinWipe" [bufferA, bufferB, wipe] Nothing 1 (Special 0) NoId++{- | Zero bins.++ PV_BrickWall [ControlRate] buffer=0 wipe=0+-}+pv_BrickWall :: Ugen -> Ugen -> Ugen+pv_BrickWall buffer wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BrickWall" [buffer, wipe] Nothing 1 (Special 0) NoId++{- | Complex plane attack.++ PV_ConformalMap [ControlRate] buffer=0 areal=0 aimag=0+-}+pv_ConformalMap :: Ugen -> Ugen -> Ugen -> Ugen+pv_ConformalMap buffer areal aimag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_ConformalMap" [buffer, areal, aimag] Nothing 1 (Special 0) NoId++{- | Complex conjugate++ PV_Conj [ControlRate] buffer=0+-}+pv_Conj :: Ugen -> Ugen+pv_Conj buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Conj" [buffer] Nothing 1 (Special 0) NoId++{- | Copy an FFT buffer++ PV_Copy [ControlRate] bufferA=0 bufferB=0+-}+pv_Copy :: Ugen -> Ugen -> Ugen+pv_Copy bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Copy" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Copy magnitudes and phases.++ PV_CopyPhase [ControlRate] bufferA=0 bufferB=0+-}+pv_CopyPhase :: Ugen -> Ugen -> Ugen+pv_CopyPhase bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_CopyPhase" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Random phase shifting.++ PV_Diffuser [ControlRate] buffer=0 trig=0+-}+pv_Diffuser :: Ugen -> Ugen -> Ugen+pv_Diffuser buffer trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Diffuser" [buffer, trig_] Nothing 1 (Special 0) NoId++{- | Complex division++ PV_Div [ControlRate] bufferA=0 bufferB=0+-}+pv_Div :: Ugen -> Ugen -> Ugen+pv_Div bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Div" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{-+-- | FFT onset detector.+--+--  PV_HainsworthFoote [ControlRate,AudioRate] maxSize=0+pv_HainsworthFoote :: Ugen -> Ugen+pv_HainsworthFoote maxSize = mkUgen Nothing [ControlRate,AudioRate] (Left ControlRate) "PV_HainsworthFoote" [maxSize] Nothing 1 (Special 0) NoId++-- | FFT feature detector for onset detection.+--+--  PV_JensenAndersen [ControlRate,AudioRate] maxSize=0+pv_JensenAndersen :: Ugen -> Ugen+pv_JensenAndersen maxSize = mkUgen Nothing [ControlRate,AudioRate] (Left ControlRate) "PV_JensenAndersen" [maxSize] Nothing 1 (Special 0) NoId+-}++{- | Pass bins which are a local maximum.++ PV_LocalMax [ControlRate] buffer=0 threshold=0+-}+pv_LocalMax :: Ugen -> Ugen -> Ugen+pv_LocalMax buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_LocalMax" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Pass bins above a threshold.++ PV_MagAbove [ControlRate] buffer=0 threshold=0+-}+pv_MagAbove :: Ugen -> Ugen -> Ugen+pv_MagAbove buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagAbove" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Pass bins below a threshold.++ PV_MagBelow [ControlRate] buffer=0 threshold=0+-}+pv_MagBelow :: Ugen -> Ugen -> Ugen+pv_MagBelow buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagBelow" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Clip bins to a threshold.++ PV_MagClip [ControlRate] buffer=0 threshold=0+-}+pv_MagClip :: Ugen -> Ugen -> Ugen+pv_MagClip buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagClip" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Division of magnitudes++ PV_MagDiv [ControlRate] bufferA=0 bufferB=0 zeroed=0.0001+-}+pv_MagDiv :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagDiv bufferA bufferB zeroed = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagDiv" [bufferA, bufferB, zeroed] Nothing 1 (Special 0) NoId++{- | Freeze magnitudes.++ PV_MagFreeze [ControlRate] buffer=0 freeze=0+-}+pv_MagFreeze :: Ugen -> Ugen -> Ugen+pv_MagFreeze buffer freeze = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagFreeze" [buffer, freeze] Nothing 1 (Special 0) NoId++{- | Multiply magnitudes.++ PV_MagMul [ControlRate] bufferA=0 bufferB=0+-}+pv_MagMul :: Ugen -> Ugen -> Ugen+pv_MagMul bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMul" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Multiply magnitudes by noise.++ PV_MagNoise [ControlRate] buffer=0+-}+pv_MagNoise :: Ugen -> Ugen+pv_MagNoise buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagNoise" [buffer] Nothing 1 (Special 0) NoId++{- | shift and stretch magnitude bin position.++ PV_MagShift [ControlRate] buffer=0 stretch=1 shift=0+-}+pv_MagShift :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagShift buffer stretch shift = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagShift" [buffer, stretch, shift] Nothing 1 (Special 0) NoId++{- | Average magnitudes across bins.++ PV_MagSmear [ControlRate] buffer=0 bins=0+-}+pv_MagSmear :: Ugen -> Ugen -> Ugen+pv_MagSmear buffer bins = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSmear" [buffer, bins] Nothing 1 (Special 0) NoId++{- | Square magnitudes.++ PV_MagSquared [ControlRate] buffer=0+-}+pv_MagSquared :: Ugen -> Ugen+pv_MagSquared buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSquared" [buffer] Nothing 1 (Special 0) NoId++{- | Maximum magnitude.++ PV_Max [ControlRate] bufferA=0 bufferB=0+-}+pv_Max :: Ugen -> Ugen -> Ugen+pv_Max bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Max" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Minimum magnitude.++ PV_Min [ControlRate] bufferA=0 bufferB=0+-}+pv_Min :: Ugen -> Ugen -> Ugen+pv_Min bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Min" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Complex multiply.++ PV_Mul [ControlRate] bufferA=0 bufferB=0+-}+pv_Mul :: Ugen -> Ugen -> Ugen+pv_Mul bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Mul" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Shift phase.++ PV_PhaseShift [ControlRate] buffer=0 shift=0 integrate=0+-}+pv_PhaseShift :: Ugen -> Ugen -> Ugen -> Ugen+pv_PhaseShift buffer shift integrate = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PhaseShift" [buffer, shift, integrate] Nothing 1 (Special 0) NoId++{- | Shift phase by 270 degrees.++ PV_PhaseShift270 [ControlRate] buffer=0+-}+pv_PhaseShift270 :: Ugen -> Ugen+pv_PhaseShift270 buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PhaseShift270" [buffer] Nothing 1 (Special 0) NoId++{- | Shift phase by 90 degrees.++ PV_PhaseShift90 [ControlRate] buffer=0+-}+pv_PhaseShift90 :: Ugen -> Ugen+pv_PhaseShift90 buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PhaseShift90" [buffer] Nothing 1 (Special 0) NoId++{- | Pass random bins.++ PV_RandComb [ControlRate] buffer=0 wipe=0 trig=0;    NONDET+-}+pv_RandCombId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+pv_RandCombId z buffer wipe trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RandComb" [buffer, wipe, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PV_RandComb.+pv_RandCombM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+pv_RandCombM = liftUid3 pv_RandCombId++-- | Unsafe variant of PV_RandComb.+pv_RandComb :: Ugen -> Ugen -> Ugen -> Ugen+pv_RandComb = liftUnsafe3 pv_RandCombM++{- | Crossfade in random bin order.++ PV_RandWipe [ControlRate] bufferA=0 bufferB=0 wipe=0 trig=0;    NONDET+-}+pv_RandWipeId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RandWipeId z bufferA bufferB wipe trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RandWipe" [bufferA, bufferB, wipe, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PV_RandWipe.+pv_RandWipeM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+pv_RandWipeM = liftUid4 pv_RandWipeId++-- | Unsafe variant of PV_RandWipe.+pv_RandWipe :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RandWipe = liftUnsafe4 pv_RandWipeM++{- | Make gaps in spectrum.++ PV_RectComb [ControlRate] buffer=0 numTeeth=0 phase=0 width=0.5+-}+pv_RectComb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RectComb buffer numTeeth phase width = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RectComb" [buffer, numTeeth, phase, width] Nothing 1 (Special 0) NoId++{- | Make gaps in spectrum.++ PV_RectComb2 [ControlRate] bufferA=0 bufferB=0 numTeeth=0 phase=0 width=0.5+-}+pv_RectComb2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RectComb2 bufferA bufferB numTeeth phase width = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RectComb2" [bufferA, bufferB, numTeeth, phase, width] Nothing 1 (Special 0) NoId++{- | Two channel equal power pan.++ Pan2 [ControlRate,AudioRate] in=0 pos=0 level=1;    FILTER: TRUE+-}+pan2 :: Ugen -> Ugen -> Ugen -> Ugen+pan2 in_ pos level = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Pan2" [in_, pos, level] Nothing 2 (Special 0) NoId++{- | Four channel equal power pan.++ Pan4 [ControlRate,AudioRate] in=0 xpos=0 ypos=0 level=1+-}+pan4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pan4 rate in_ xpos ypos level = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Pan4" [in_, xpos, ypos, level] Nothing 4 (Special 0) NoId++{- | Azimuth panner++ PanAz [ControlRate,AudioRate] in=0 pos=0 level=1 width=2 orientation=0.5;    NC INPUT: True, FILTER: TRUE+-}+panAz :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panAz numChannels in_ pos level width orientation = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PanAz" [in_, pos, level, width, orientation] Nothing numChannels (Special 0) NoId++{- | Ambisonic B-format panner.++ PanB [ControlRate,AudioRate] in=0 azimuth=0 elevation=0 gain=1+-}+panB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panB rate in_ azimuth elevation gain = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PanB" [in_, azimuth, elevation, gain] Nothing 4 (Special 0) NoId++{- | 2D Ambisonic B-format panner.++ PanB2 [ControlRate,AudioRate] in=0 azimuth=0 gain=1;    FILTER: TRUE+-}+panB2 :: Ugen -> Ugen -> Ugen -> Ugen+panB2 in_ azimuth gain = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PanB2" [in_, azimuth, gain] Nothing 3 (Special 0) NoId++{- | Real-time partitioned convolution++ PartConv [AudioRate] in=0 fftsize=0 irbufnum=0+-}+partConv :: Ugen -> Ugen -> Ugen -> Ugen+partConv in_ fftsize irbufnum = mkUgen Nothing [AudioRate] (Left AudioRate) "PartConv" [in_, fftsize, irbufnum] Nothing 1 (Special 0) NoId++{- | When triggered, pauses a node.++ Pause [ControlRate] gate=0 id=0+-}+pause :: Ugen -> Ugen -> Ugen+pause gate_ id_ = mkUgen Nothing [ControlRate] (Left ControlRate) "Pause" [gate_, id_] Nothing 1 (Special 0) NoId++{- | When triggered, pause enclosing synth.++ PauseSelf [ControlRate] in=0+-}+pauseSelf :: Ugen -> Ugen+pauseSelf in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PauseSelf" [in_] Nothing 1 (Special 0) NoId++{- | FIXME: PauseSelfWhenDone purpose.++ PauseSelfWhenDone [ControlRate] src=0+-}+pauseSelfWhenDone :: Ugen -> Ugen+pauseSelfWhenDone src = mkUgen Nothing [ControlRate] (Left ControlRate) "PauseSelfWhenDone" [src] Nothing 1 (Special 0) NoId++{- | Track peak signal amplitude.++ Peak [ControlRate,AudioRate] in=0 trig=0;    FILTER: TRUE+-}+peak :: Ugen -> Ugen -> Ugen+peak in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Peak" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Track peak signal amplitude.++ PeakFollower [ControlRate,AudioRate] in=0 decay=0.999;    FILTER: TRUE+-}+peakFollower :: Ugen -> Ugen -> Ugen+peakFollower in_ decay_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PeakFollower" [in_, decay_] Nothing 1 (Special 0) NoId++{- | A resettable linear ramp between two levels.++ Phasor [ControlRate,AudioRate] trig=0 rate=1 start=0 end=1 resetPos=0+-}+phasor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+phasor rate trig_ rate_ start end resetPos = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Phasor" [trig_, rate_, start, end, resetPos] Nothing 1 (Special 0) NoId++{- | Pink Noise.++ PinkNoise [ControlRate,AudioRate] ;    NONDET+-}+pinkNoiseId :: ID a => a -> Rate -> Ugen+pinkNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PinkNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PinkNoise.+pinkNoiseM :: Uid m => Rate -> m Ugen+pinkNoiseM = liftUid1 pinkNoiseId++-- | Unsafe variant of PinkNoise.+pinkNoise :: Rate -> Ugen+pinkNoise = liftUnsafe1 pinkNoiseM++{- | Autocorrelation pitch follower++ Pitch [ControlRate] in=0 initFreq=440 minFreq=60 maxFreq=4000 execFreq=100 maxBinsPerOctave=16 median=1 ampThreshold=0.01 peakThreshold=0.5 downSample=1 clar=0+-}+pitch :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pitch in_ initFreq minFreq maxFreq execFreq maxBinsPerOctave median_ ampThreshold peakThreshold downSample clar = mkUgen Nothing [ControlRate] (Left ControlRate) "Pitch" [in_, initFreq, minFreq, maxFreq, execFreq, maxBinsPerOctave, median_, ampThreshold, peakThreshold, downSample, clar] Nothing 2 (Special 0) NoId++{- | Time domain pitch shifter.++ PitchShift [AudioRate] in=0 windowSize=0.2 pitchRatio=1 pitchDispersion=0 timeDispersion=0;    FILTER: TRUE+-}+pitchShift :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pitchShift in_ windowSize pitchRatio pitchDispersion timeDispersion = mkUgen Nothing [AudioRate] (Right [0]) "PitchShift" [in_, windowSize, pitchRatio, pitchDispersion, timeDispersion] Nothing 1 (Special 0) NoId++{- | Sample playback oscillator.++ PlayBuf [ControlRate,AudioRate] bufnum=0 rate=1 trigger=1 startPos=0 loop=0 doneAction=0;    NC INPUT: True, ENUMERATION INPUTS: 4=Loop, 5=DoneAction+-}+playBuf :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Loop Ugen -> DoneAction Ugen -> Ugen+playBuf numChannels rate bufnum rate_ trigger startPos loop doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PlayBuf" [bufnum, rate_, trigger, startPos, (from_loop loop), (from_done_action doneAction)] Nothing numChannels (Special 0) NoId++{- | A Karplus-Strong Ugen++ Pluck [AudioRate] in=0 trig=1 maxdelaytime=0.2 delaytime=0.2 decaytime=1 coef=0.5;    FILTER: TRUE+-}+pluck :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pluck in_ trig_ maxdelaytime delaytime decaytime coef = mkUgen Nothing [AudioRate] (Right [0]) "Pluck" [in_, trig_, maxdelaytime, delaytime, decaytime, coef] Nothing 1 (Special 0) NoId++{-+-- | Print the current output value of a Ugen+--+--  Poll [ControlRate,AudioRate] trig=0 in=0 trigid=-1 label=0;    FILTER: TRUE, REORDERS INPUTS: [0,1,3,2]+poll :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+poll trig_ in_ trigid label_ = mkUgen Nothing [ControlRate,AudioRate] (Right [1]) "Poll" [trig_,in_,trigid,label_] Nothing 1 (Special 0) NoId+-}++{- | Band limited pulse wave.++ Pulse [ControlRate,AudioRate] freq=440 width=0.5+-}+pulse :: Rate -> Ugen -> Ugen -> Ugen+pulse rate freq width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Pulse" [freq, width] Nothing 1 (Special 0) NoId++{- | Pulse counter.++ PulseCount [ControlRate,AudioRate] trig=0 reset=0;    FILTER: TRUE+-}+pulseCount :: Ugen -> Ugen -> Ugen+pulseCount trig_ reset = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PulseCount" [trig_, reset] Nothing 1 (Special 0) NoId++{- | Pulse divider.++ PulseDivider [ControlRate,AudioRate] trig=0 div=2 start=0;    FILTER: TRUE+-}+pulseDivider :: Ugen -> Ugen -> Ugen -> Ugen+pulseDivider trig_ div_ start = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PulseDivider" [trig_, div_, start] Nothing 1 (Special 0) NoId++{- | General quadratic map chaotic generator++ QuadC [AudioRate] freq=22050 a=1 b=-1 c=-0.75 xi=0+-}+quadC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+quadC rate freq a b c xi = mkUgen Nothing [AudioRate] (Left rate) "QuadC" [freq, a, b, c, xi] Nothing 1 (Special 0) NoId++{- | General quadratic map chaotic generator++ QuadL [AudioRate] freq=22050 a=1 b=-1 c=-0.75 xi=0+-}+quadL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+quadL rate freq a b c xi = mkUgen Nothing [AudioRate] (Left rate) "QuadL" [freq, a, b, c, xi] Nothing 1 (Special 0) NoId++{- | General quadratic map chaotic generator++ QuadN [AudioRate] freq=22050 a=1 b=-1 c=-0.75 xi=0+-}+quadN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+quadN rate freq a b c xi = mkUgen Nothing [AudioRate] (Left rate) "QuadN" [freq, a, b, c, xi] Nothing 1 (Special 0) NoId++{- | A resonant high pass filter.++ RHPF [ControlRate,AudioRate] in=0 freq=440 rq=1;    FILTER: TRUE+-}+rhpf :: Ugen -> Ugen -> Ugen -> Ugen+rhpf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RHPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | A resonant low pass filter.++ RLPF [ControlRate,AudioRate] in=0 freq=440 rq=1;    FILTER: TRUE+-}+rlpf :: Ugen -> Ugen -> Ugen -> Ugen+rlpf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RLPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Number of radians per sample.++ RadiansPerSample [InitialisationRate]+-}+radiansPerSample :: Ugen+radiansPerSample = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "RadiansPerSample" [] Nothing 1 (Special 0) NoId++{- | Break a continuous signal into line segments++ Ramp [ControlRate,AudioRate] in=0 lagTime=0.1;    FILTER: TRUE+-}+ramp :: Ugen -> Ugen -> Ugen+ramp in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Ramp" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Single random number generator.++ Rand [InitialisationRate] lo=0 hi=1;    NONDET+-}+randId :: ID a => a -> Ugen -> Ugen -> Ugen+randId z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "Rand" [lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Rand.+randM :: Uid m => Ugen -> Ugen -> m Ugen+randM = liftUid2 randId++-- | Unsafe variant of Rand.+rand :: Ugen -> Ugen -> Ugen+rand = liftUnsafe2 randM++{- | Set the synth's random generator ID.++ RandID [InitialisationRate,ControlRate] id=0+-}+randID :: Rate -> Ugen -> Ugen+randID rate id_ = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "RandID" [id_] Nothing 0 (Special 0) NoId++{- | Sets the synth's random generator seed.++ RandSeed [InitialisationRate,ControlRate,AudioRate] trig=0 seed=56789+-}+randSeed :: Rate -> Ugen -> Ugen -> Ugen+randSeed rate trig_ seed = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Left rate) "RandSeed" [trig_, seed] Nothing 0 (Special 0) NoId++{- | Record or overdub into a Buffer.++ RecordBuf [ControlRate,AudioRate] bufnum=0 offset=0 recLevel=1 preLevel=0 run=1 loop=1 trigger=1 doneAction=0 *inputArray=0;    MCE=1, REORDERS INPUTS: [8,0,1,2,3,4,5,6,7], ENUMERATION INPUTS: 5=Loop, 7=DoneAction+-}+recordBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen -> DoneAction Ugen -> Ugen -> Ugen+recordBuf rate bufnum offset recLevel preLevel run loop trigger doneAction inputArray = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RecordBuf" [bufnum, offset, recLevel, preLevel, run, (from_loop loop), trigger, (from_done_action doneAction)] (Just [inputArray]) 1 (Special 0) NoId++{- | Send signal to a bus, overwriting previous contents.++ ReplaceOut [ControlRate,AudioRate] bus=0 *channelsArray=0;    MCE=1, FILTER: TRUE+-}+replaceOut :: Ugen -> Ugen -> Ugen+replaceOut bus input = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "ReplaceOut" [bus] (Just [input]) 0 (Special 0) NoId++{- | Resonant filter.++ Resonz [ControlRate,AudioRate] in=0 freq=440 bwr=1;    FILTER: TRUE+-}+resonz :: Ugen -> Ugen -> Ugen -> Ugen+resonz in_ freq bwr = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Resonz" [in_, freq, bwr] Nothing 1 (Special 0) NoId++{- | Ringing filter.++ Ringz [ControlRate,AudioRate] in=0 freq=440 decaytime=1;    FILTER: TRUE+-}+ringz :: Ugen -> Ugen -> Ugen -> Ugen+ringz in_ freq decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Ringz" [in_, freq, decaytime] Nothing 1 (Special 0) NoId++{- | Rotate a sound field.++ Rotate2 [ControlRate,AudioRate] x=0 y=0 pos=0;    FILTER: TRUE+-}+rotate2 :: Ugen -> Ugen -> Ugen -> Ugen+rotate2 x y pos = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "Rotate2" [x, y, pos] Nothing 2 (Special 0) NoId++{- | Track maximum level.++ RunningMax [ControlRate,AudioRate] in=0 trig=0;    FILTER: TRUE+-}+runningMax :: Ugen -> Ugen -> Ugen+runningMax in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RunningMax" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Track minimum level.++ RunningMin [ControlRate,AudioRate] in=0 trig=0;    FILTER: TRUE+-}+runningMin :: Ugen -> Ugen -> Ugen+runningMin in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RunningMin" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Running sum over n frames++ RunningSum [ControlRate,AudioRate] in=0 numsamp=40;    FILTER: TRUE+-}+runningSum :: Ugen -> Ugen -> Ugen+runningSum in_ numsamp = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RunningSum" [in_, numsamp] Nothing 1 (Special 0) NoId++{- | Second order filter section (biquad).++ SOS [ControlRate,AudioRate] in=0 a0=0 a1=0 a2=0 b1=0 b2=0;    FILTER: TRUE+-}+sos :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sos in_ a0 a1 a2 b1 b2 = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "SOS" [in_, a0, a1, a2, b1, b2] Nothing 1 (Special 0) NoId++{- | Duration of one sample.++ SampleDur [InitialisationRate]+-}+sampleDur :: Ugen+sampleDur = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SampleDur" [] Nothing 1 (Special 0) NoId++{- | Server sample rate.++ SampleRate [InitialisationRate]+-}+sampleRate :: Ugen+sampleRate = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SampleRate" [] Nothing 1 (Special 0) NoId++{- | Remove infinity, NaN, and denormals++ Sanitize [ControlRate,AudioRate] in=0 replace=0;    FILTER: TRUE+-}+sanitize :: Ugen -> Ugen -> Ugen+sanitize in_ replace = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Sanitize" [in_, replace] Nothing 1 (Special 0) NoId++{- | Band limited sawtooth.++ Saw [ControlRate,AudioRate] freq=440+-}+saw :: Rate -> Ugen -> Ugen+saw rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Saw" [freq] Nothing 1 (Special 0) NoId++{- | Schmidt trigger.++ Schmidt [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1;    FILTER: TRUE+-}+schmidt :: Ugen -> Ugen -> Ugen -> Ugen+schmidt in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Schmidt" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Select output from an array of inputs.++ Select [InitialisationRate,ControlRate,AudioRate] which=0 *array=0;    MCE=1, FILTER: TRUE+-}+select :: Ugen -> Ugen -> Ugen+select which array = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0, 1]) "Select" [which] (Just [array]) 1 (Special 0) NoId++{- | Send a trigger message from the server back to the client.++ SendTrig [ControlRate,AudioRate] in=0 id=0 value=0;    FILTER: TRUE+-}+sendTrig :: Ugen -> Ugen -> Ugen -> Ugen+sendTrig in_ id_ value = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "SendTrig" [in_, id_, value] Nothing 0 (Special 0) NoId++{- | Set-reset flip flop.++ SetResetFF [ControlRate,AudioRate] trig=0 reset=0;    FILTER: TRUE+-}+setResetFF :: Ugen -> Ugen -> Ugen+setResetFF trig_ reset = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "SetResetFF" [trig_, reset] Nothing 1 (Special 0) NoId++{- | Wave shaper.++ Shaper [ControlRate,AudioRate] bufnum=0 in=0;    FILTER: TRUE+-}+shaper :: Ugen -> Ugen -> Ugen+shaper bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Shaper" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Interpolating sine wavetable oscillator.++ SinOsc [ControlRate,AudioRate] freq=440 phase=0+-}+sinOsc :: Rate -> Ugen -> Ugen -> Ugen+sinOsc rate freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SinOsc" [freq, phase] Nothing 1 (Special 0) NoId++{- | Feedback FM oscillator++ SinOscFB [ControlRate,AudioRate] freq=440 feedback=0+-}+sinOscFB :: Rate -> Ugen -> Ugen -> Ugen+sinOscFB rate freq feedback = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SinOscFB" [freq, feedback] Nothing 1 (Special 0) NoId++{- | Slew rate limiter.++ Slew [ControlRate,AudioRate] in=0 up=1 dn=1;    FILTER: TRUE+-}+slew :: Ugen -> Ugen -> Ugen -> Ugen+slew in_ up dn = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Slew" [in_, up, dn] Nothing 1 (Special 0) NoId++{- | Slope of signal++ Slope [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+slope :: Ugen -> Ugen+slope in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Slope" [in_] Nothing 1 (Special 0) NoId++{- | Spectral centroid++ SpecCentroid [ControlRate] buffer=0+-}+specCentroid :: Rate -> Ugen -> Ugen+specCentroid rate buffer = mkUgen Nothing [ControlRate] (Left rate) "SpecCentroid" [buffer] Nothing 1 (Special 0) NoId++{- | Spectral Flatness measure++ SpecFlatness [ControlRate] buffer=0+-}+specFlatness :: Rate -> Ugen -> Ugen+specFlatness rate buffer = mkUgen Nothing [ControlRate] (Left rate) "SpecFlatness" [buffer] Nothing 1 (Special 0) NoId++{- | Find a percentile of FFT magnitude spectrum++ SpecPcile [ControlRate] buffer=0 fraction=0.5 interpolate=0+-}+specPcile :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+specPcile rate buffer fraction interpolate = mkUgen Nothing [ControlRate] (Left rate) "SpecPcile" [buffer, fraction, interpolate] Nothing 1 (Special 0) NoId++{- | physical model of resonating spring++ Spring [ControlRate,AudioRate] in=0 spring=1 damp=0+-}+spring :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+spring rate in_ spring_ damp = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Spring" [in_, spring_, damp] Nothing 1 (Special 0) NoId++{- | Standard map chaotic generator++ StandardL [AudioRate] freq=22050 k=1 xi=0.5 yi=0+-}+standardL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standardL rate freq k xi yi = mkUgen Nothing [AudioRate] (Left rate) "StandardL" [freq, k, xi, yi] Nothing 1 (Special 0) NoId++{- | Standard map chaotic generator++ StandardN [AudioRate] freq=22050 k=1 xi=0.5 yi=0+-}+standardN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standardN rate freq k xi yi = mkUgen Nothing [AudioRate] (Left rate) "StandardN" [freq, k, xi, yi] Nothing 1 (Special 0) NoId++{- | Pulse counter.++ Stepper [ControlRate,AudioRate] trig=0 reset=0 min=0 max=7 step=1 resetval=0;    FILTER: TRUE+-}+stepper :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stepper trig_ reset min_ max_ step resetval = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Stepper" [trig_, reset, min_, max_, step, resetval] Nothing 1 (Special 0) NoId++{- | Stereo real-time convolver with linear interpolation++ StereoConvolution2L [AudioRate] in=0 kernelL=0 kernelR=0 trigger=0 framesize=2048 crossfade=1+-}+stereoConvolution2L :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stereoConvolution2L rate in_ kernelL kernelR trigger framesize crossfade = mkUgen Nothing [AudioRate] (Left rate) "StereoConvolution2L" [in_, kernelL, kernelR, trigger, framesize, crossfade] Nothing 2 (Special 0) NoId++{- | Offset from synth start within one sample.++ SubsampleOffset [InitialisationRate]+-}+subsampleOffset :: Ugen+subsampleOffset = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SubsampleOffset" [] Nothing 1 (Special 0) NoId++{- | Sum three signals++ Sum3 [] in0=0 in1=0 in2=0;    FILTER: TRUE+-}+sum3 :: Ugen -> Ugen -> Ugen -> Ugen+sum3 in0 in1 in2 = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0, 1, 2]) "Sum3" [in0, in1, in2] Nothing 1 (Special 0) NoId++{- | Sum four signals++ Sum4 [] in0=0 in1=0 in2=0 in3=0;    FILTER: TRUE+-}+sum4 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sum4 in0 in1 in2 in3 = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0, 1, 2, 3]) "Sum4" [in0, in1, in2, in3] Nothing 1 (Special 0) NoId++{- | Triggered linear ramp++ Sweep [ControlRate,AudioRate] trig=0 rate=1;    FILTER: TRUE+-}+sweep :: Rate -> Ugen -> Ugen -> Ugen+sweep rate trig_ rate_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Sweep" [trig_, rate_] Nothing 1 (Special 0) NoId++{- | Hard sync sawtooth wave.++ SyncSaw [ControlRate,AudioRate] syncFreq=440 sawFreq=440+-}+syncSaw :: Rate -> Ugen -> Ugen -> Ugen+syncSaw rate syncFreq sawFreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SyncSaw" [syncFreq, sawFreq] Nothing 1 (Special 0) NoId++{- | Control rate trigger to audio rate trigger converter++ T2A [AudioRate] in=0 offset=0+-}+t2a :: Ugen -> Ugen -> Ugen+t2a in_ offset = mkUgen Nothing [AudioRate] (Left AudioRate) "T2A" [in_, offset] Nothing 1 (Special 0) NoId++{- | Audio rate trigger to control rate trigger converter++ T2K [ControlRate] in=0+-}+t2k :: Ugen -> Ugen+t2k in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "T2K" [in_] Nothing 1 (Special 0) NoId++{- | physical model of bouncing object++ TBall [ControlRate,AudioRate] in=0 g=10 damp=0 friction=0.01+-}+tBall :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBall rate in_ g damp friction_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TBall" [in_, g, damp, friction_] Nothing 1 (Special 0) NoId++{- | Trigger delay.++ TDelay [ControlRate,AudioRate] in=0 dur=0.1;    FILTER: TRUE+-}+tDelay :: Ugen -> Ugen -> Ugen+tDelay in_ dur = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TDelay" [in_, dur] Nothing 1 (Special 0) NoId++{- | Demand results as trigger from demand rate Ugens.++ TDuty [ControlRate,AudioRate] dur=1 reset=0 doneAction=0 level=1 gapFirst=0;    REORDERS INPUTS: [0,1,3,2,4], ENUMERATION INPUTS: 2=DoneAction+-}+tDuty :: Rate -> Ugen -> Ugen -> DoneAction Ugen -> Ugen -> Ugen -> Ugen+tDuty rate dur reset doneAction level gapFirst = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TDuty" [dur, reset, (from_done_action doneAction), level, gapFirst] Nothing 1 (Special 0) NoId++{- | Triggered exponential random number generator.++ TExpRand [ControlRate,AudioRate] lo=0.01 hi=1 trig=0;    FILTER: TRUE, NONDET+-}+tExpRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tExpRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TExpRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TExpRand.+tExpRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tExpRandM = liftUid3 tExpRandId++-- | Unsafe variant of TExpRand.+tExpRand :: Ugen -> Ugen -> Ugen -> Ugen+tExpRand = liftUnsafe3 tExpRandM++{- | Buffer granulator.++ TGrains [AudioRate] trigger=0 bufnum=0 rate=1 centerPos=0 dur=0.1 pan=0 amp=0.1 interp=4;    NC INPUT: True+-}+tGrains :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tGrains numChannels trigger bufnum rate_ centerPos dur pan amp interp = mkUgen Nothing [AudioRate] (Left AudioRate) "TGrains" [trigger, bufnum, rate_, centerPos, dur, pan, amp, interp] Nothing numChannels (Special 0) NoId++{- | Triggered integer random number generator.++ TIRand [ControlRate,AudioRate] lo=0 hi=127 trig=0;    FILTER: TRUE, NONDET+-}+tiRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tiRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TIRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Tirand.+tiRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tiRandM = liftUid3 tiRandId++-- | Unsafe variant of Tirand.+tiRand :: Ugen -> Ugen -> Ugen -> Ugen+tiRand = liftUnsafe3 tiRandM++{- | Triggered random number generator.++ TRand [ControlRate,AudioRate] lo=0 hi=1 trig=0;    FILTER: TRUE, NONDET+-}+tRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TRand.+tRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tRandM = liftUid3 tRandId++-- | Unsafe variant of TRand.+tRand :: Ugen -> Ugen -> Ugen -> Ugen+tRand = liftUnsafe3 tRandM++{- | Triggered windex.++ TWindex [ControlRate,AudioRate] in=0 normalize=0 *array=0;    MCE=1, FILTER: TRUE, REORDERS INPUTS: [0,2,1], NONDET+-}+tWindexId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tWindexId z in_ normalize array = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TWindex" [in_, normalize] (Just [array]) 1 (Special 0) (toUid z)++-- | Monad variant of TWindex.+tWindexM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tWindexM = liftUid3 tWindexId++-- | Unsafe variant of TWindex.+tWindex :: Ugen -> Ugen -> Ugen -> Ugen+tWindex = liftUnsafe3 tWindexM++{- | Returns time since last triggered.++ Timer [ControlRate,AudioRate] trig=0;    FILTER: TRUE+-}+timer :: Ugen -> Ugen+timer trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Timer" [trig_] Nothing 1 (Special 0) NoId++{- | Toggle flip flop.++ ToggleFF [ControlRate,AudioRate] trig=0;    FILTER: TRUE+-}+toggleFF :: Ugen -> Ugen+toggleFF trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ToggleFF" [trig_] Nothing 1 (Special 0) NoId++{- | Timed trigger.++ Trig [ControlRate,AudioRate] in=0 dur=0.1;    FILTER: TRUE+-}+trig :: Ugen -> Ugen -> Ugen+trig in_ dur = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Trig" [in_, dur] Nothing 1 (Special 0) NoId++{- | Timed trigger.++ Trig1 [ControlRate,AudioRate] in=0 dur=0.1;    FILTER: TRUE+-}+trig1 :: Ugen -> Ugen -> Ugen+trig1 in_ dur = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Trig1" [in_, dur] Nothing 1 (Special 0) NoId++{- | Two pole filter.++ TwoPole [ControlRate,AudioRate] in=0 freq=440 radius=0.8;    FILTER: TRUE+-}+twoPole :: Ugen -> Ugen -> Ugen -> Ugen+twoPole in_ freq radius = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TwoPole" [in_, freq, radius] Nothing 1 (Special 0) NoId++{- | Two zero filter.++ TwoZero [ControlRate,AudioRate] in=0 freq=440 radius=0.8;    FILTER: TRUE+-}+twoZero :: Ugen -> Ugen -> Ugen -> Ugen+twoZero in_ freq radius = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TwoZero" [in_, freq, radius] Nothing 1 (Special 0) NoId++{- | Stream in audio from a file, with variable rate++ VDiskIn [AudioRate] bufnum=0 rate=1 loop=0 sendID=0;    NC INPUT: True, ENUMERATION INPUTS: 2=Loop+-}+vDiskIn :: Int -> Ugen -> Ugen -> Loop Ugen -> Ugen -> Ugen+vDiskIn numChannels bufnum rate_ loop sendID = mkUgen Nothing [AudioRate] (Left AudioRate) "VDiskIn" [bufnum, rate_, (from_loop loop), sendID] Nothing numChannels (Special 0) NoId++{- | Variable wavetable oscillator.++ VOsc [ControlRate,AudioRate] bufpos=0 freq=440 phase=0+-}+vOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+vOsc rate bufpos freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VOsc" [bufpos, freq, phase] Nothing 1 (Special 0) NoId++{- | Three variable wavetable oscillators.++ VOsc3 [ControlRate,AudioRate] bufpos=0 freq1=110 freq2=220 freq3=440+-}+vOsc3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vOsc3 rate bufpos freq1 freq2 freq3 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VOsc3" [bufpos, freq1, freq2, freq3] Nothing 1 (Special 0) NoId++{- | Variable shaped lag++ VarLag [ControlRate,AudioRate] in=0 time=0.1 curvature=0 warp=5 start=0;    FILTER: TRUE+-}+varLag :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+varLag in_ time curvature warp start = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "VarLag" [in_, time, curvature, warp, start] Nothing 1 (Special 0) NoId++{- | Variable duty saw++ VarSaw [ControlRate,AudioRate] freq=440 iphase=0 width=0.5+-}+varSaw :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+varSaw rate freq iphase width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VarSaw" [freq, iphase, width] Nothing 1 (Special 0) NoId++{- | The Vibrato oscillator models a slow frequency modulation.++ Vibrato [ControlRate,AudioRate] freq=440 rate=6 depth=0.02 delay=0 onset=0 rateVariation=0.04 depthVariation=0.1 iphase=0 trig=0;    NONDET+-}+vibratoId :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vibratoId z rate freq rate_ depth delay onset rateVariation depthVariation iphase trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Vibrato" [freq, rate_, depth, delay, onset, rateVariation, depthVariation, iphase, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Vibrato.+vibratoM :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+vibratoM = liftUid10 vibratoId++-- | Unsafe variant of Vibrato.+vibrato :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vibrato = liftUnsafe10 vibratoM++{- | Warp a buffer with a time pointer++ Warp1 [AudioRate] bufnum=0 pointer=0 freqScale=1 windowSize=0.2 envbufnum=-1 overlaps=8 windowRandRatio=0 interp=1;    NC INPUT: True+-}+warp1 :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+warp1 numChannels bufnum pointer freqScale windowSize envbufnum overlaps windowRandRatio interp = mkUgen Nothing [AudioRate] (Left AudioRate) "Warp1" [bufnum, pointer, freqScale, windowSize, envbufnum, overlaps, windowRandRatio, interp] Nothing numChannels (Special 0) NoId++{- | White noise.++ WhiteNoise [ControlRate,AudioRate] ;    NONDET+-}+whiteNoiseId :: ID a => a -> Rate -> Ugen+whiteNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "WhiteNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of WhiteNoise.+whiteNoiseM :: Uid m => Rate -> m Ugen+whiteNoiseM = liftUid1 whiteNoiseId++-- | Unsafe variant of WhiteNoise.+whiteNoise :: Rate -> Ugen+whiteNoise = liftUnsafe1 whiteNoiseM++{- | Wrap a signal outside given thresholds.++ Wrap [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1;    FILTER: TRUE+-}+wrap :: Ugen -> Ugen -> Ugen -> Ugen+wrap in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Wrap" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Index into a table with a signal.++ WrapIndex [ControlRate,AudioRate] bufnum=0 in=0;    FILTER: TRUE+-}+wrapIndex :: Ugen -> Ugen -> Ugen+wrapIndex bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "WrapIndex" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Equal power two channel cross fade.++ XFade2 [ControlRate,AudioRate] inA=0 inB=0 pan=0 level=1;    FILTER: TRUE+-}+xFade2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+xFade2 inA inB pan level = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "XFade2" [inA, inB, pan, level] Nothing 1 (Special 0) NoId++{- | Exponential line generator.++ XLine [ControlRate,AudioRate] start=1 end=2 dur=1 doneAction=0;    ENUMERATION INPUTS: 3=DoneAction+-}+xLine :: Rate -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+xLine rate start end dur doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "XLine" [start, end, dur, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Send signal to a bus, crossfading with previous contents.++ XOut [ControlRate,AudioRate] bus=0 xfade=0 *channelsArray=0;    MCE=1, FILTER: TRUE+-}+xOut :: Ugen -> Ugen -> Ugen -> Ugen+xOut bus xfade input = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "XOut" [bus, xfade] (Just [input]) 0 (Special 0) NoId++{- | Zero crossing frequency follower++ ZeroCrossing [ControlRate,AudioRate] in=0;    FILTER: TRUE+-}+zeroCrossing :: Ugen -> Ugen+zeroCrossing in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ZeroCrossing" [in_] Nothing 1 (Special 0) NoId++{- | LocalBuf count++ MaxLocalBufs [InitialisationRate,ControlRate] count=0+-}+maxLocalBufs :: Ugen -> Ugen+maxLocalBufs count = mkUgen Nothing [InitialisationRate, ControlRate] (Left ControlRate) "MaxLocalBufs" [count] Nothing 1 (Special 0) NoId++{- | Multiply add++ MulAdd [InitialisationRate,ControlRate,AudioRate] in=0 mul=0 add=0;    FILTER: TRUE+-}+mulAdd :: Ugen -> Ugen -> Ugen -> Ugen+mulAdd in_ mul add = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0, 1, 2]) "MulAdd" [in_, mul, add] Nothing 1 (Special 0) NoId++{- | Set local buffer++ SetBuf [InitialisationRate] buf=0 offset=0 length=0 *array=0;    MCE=1, REORDERS INPUTS: [0,1,2,3]+-}+setBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+setBuf buf offset length_ array = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SetBuf" [buf, offset, length_] (Just [array]) 1 (Special 0) NoId
+ Sound/Sc3/Ugen/Bindings/Db/External.hs view
@@ -0,0 +1,3541 @@+-- | SC3 Ugen bindings (auto-generated).+module Sound.Sc3.Ugen.Bindings.Db.External where++-- import Sound.Sc3.Common.Enum+-- import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import Sound.Sc3.Ugen.Primitive+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++{- | (Undocumented class)++ A2B [AudioRate] a=0 b=0 c=0 d=0+-}+a2b :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+a2b rate a b c d = mkUgen Nothing [AudioRate] (Left rate) "A2B" [a, b, c, d] Nothing 4 (Special 0) NoId++{- | Emulator of the AY (aka YM) soundchip, used in Spectrum/Atari++ AY [AudioRate] tonea=1777 toneb=1666 tonec=1555 noise=1 control=7 vola=15 volb=15 volc=15 envfreq=4 envstyle=1 chiptype=0+-}+ay :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ay rate tonea toneb tonec noise control_ vola volb volc envfreq envstyle chiptype = mkUgen Nothing [AudioRate] (Left rate) "AY" [tonea, toneb, tonec, noise, control_, vola, volb, volc, envfreq, envstyle, chiptype] Nothing 1 (Special 0) NoId++{- | AY-3-891X Chip Sound Simulator++ AY8910 [AudioRate] r0=0 r1=0 r2=0 r3=0 r4=0 r5=0 r6=0 r7=0 r8=0 r9=0 rA=0 rB=0 rC=0 rD=0 rate=1+-}+ay8910 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ay8910 rate r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 rA rB rC rD rate_ = mkUgen Nothing [AudioRate] (Left rate) "AY8910" [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, rA, rB, rC, rD, rate_] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ Allpass1 [AudioRate] in=0 freq=1200+-}+allpass1 :: Rate -> Ugen -> Ugen -> Ugen+allpass1 rate in_ freq = mkUgen Nothing [AudioRate] (Left rate) "Allpass1" [in_, freq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Allpass2 [AudioRate] in=0 freq=1200 rq=1+-}+allpass2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+allpass2 rate in_ freq rq = mkUgen Nothing [AudioRate] (Left rate) "Allpass2" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | amplitude follower (deprecated)++ AmplitudeMod [ControlRate,AudioRate] in=0 attackTime=0.01 releaseTime=0.01+-}+amplitudeMod :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+amplitudeMod rate in_ attackTime releaseTime = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AmplitudeMod" [in_, attackTime, releaseTime] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogBassDrum [AudioRate] trig=0 infsustain=0 accent=0.5 freq=50 tone=0.5 decay=0.5 attackfm=0.5 selffm=0.25+-}+analogBassDrum :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogBassDrum rate trig_ infsustain accent freq tone decay_ attackfm selffm = mkUgen Nothing [AudioRate] (Left rate) "AnalogBassDrum" [trig_, infsustain, accent, freq, tone, decay_, attackfm, selffm] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogFoldOsc [AudioRate] freq=100 amp=1+-}+analogFoldOsc :: Rate -> Ugen -> Ugen -> Ugen+analogFoldOsc rate freq amp = mkUgen Nothing [AudioRate] (Left rate) "AnalogFoldOsc" [freq, amp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogPhaser [AudioRate] input=0 lfoinput=0 skew=0 feedback=0.25 modulation=0.5 stages=8;    FILTER: TRUE+-}+analogPhaser :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogPhaser input lfoinput skew feedback modulation stages = mkUgen Nothing [AudioRate] (Right [0]) "AnalogPhaser" [input, lfoinput, skew, feedback, modulation, stages] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogPhaserMod [ControlRate,AudioRate] input=0 skew=0 modulation=0.5 stages=8;    FILTER: TRUE+-}+analogPhaserMod :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogPhaserMod input skew modulation stages = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AnalogPhaserMod" [input, skew, modulation, stages] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogPulseShaper [AudioRate] pulseinput=0 width=0.5 decay=0.5 double=0.5+-}+analogPulseShaper :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogPulseShaper rate pulseinput width decay_ double = mkUgen Nothing [AudioRate] (Left rate) "AnalogPulseShaper" [pulseinput, width, decay_, double] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogSnareDrum [AudioRate] trig=0 infsustain=0 accent=0.1 freq=200 tone=0.5 decay=0.5 snappy=0.5+-}+analogSnareDrum :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogSnareDrum rate trig_ infsustain accent freq tone decay_ snappy = mkUgen Nothing [AudioRate] (Left rate) "AnalogSnareDrum" [trig_, infsustain, accent, freq, tone, decay_, snappy] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogTape [AudioRate] input=0 bias=0.5 saturation=0.5 drive=0.5 oversample=1 mode=0;    FILTER: TRUE+-}+analogTape :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogTape input bias saturation drive oversample mode = mkUgen Nothing [AudioRate] (Right [0]) "AnalogTape" [input, bias, saturation, drive, oversample, mode] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogVintageDistortion [AudioRate] input=0 drivegain=0.5 bias=0 lowgain=0.1 highgain=0.1 shelvingfreq=600 oversample=0;    FILTER: TRUE+-}+analogVintageDistortion :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogVintageDistortion input drivegain bias lowgain highgain shelvingfreq oversample = mkUgen Nothing [AudioRate] (Right [0]) "AnalogVintageDistortion" [input, drivegain, bias, lowgain, highgain, shelvingfreq, oversample] Nothing 1 (Special 0) NoId++{- | event analyser (BBCut)++ AnalyseEvents2 [AudioRate] in=0 bufnum=0 threshold=0.34 triggerid=101 circular=0 pitch=0+-}+analyseEvents2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analyseEvents2 rate in_ bufnum threshold triggerid circular pitch_ = mkUgen Nothing [AudioRate] (Left rate) "AnalyseEvents2" [in_, bufnum, threshold, triggerid, circular, pitch_] Nothing 1 (Special 0) NoId++{- | 2-species Predator-Prey model++ ArneodoCoulletTresser [AudioRate] freq=22050 alpha=1.5 h=0.05 xi=0.5 yi=0.5 zi=0.5+-}+arneodoCoulletTresser :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+arneodoCoulletTresser rate freq alpha h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "ArneodoCoulletTresser" [freq, alpha, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | detect the largest value (and its position) in an array of Ugens++ ArrayMax [ControlRate,AudioRate] *array=0;    MCE=1, FILTER: TRUE+-}+arrayMax :: Ugen -> Ugen+arrayMax array = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ArrayMax" [] (Just [array]) 2 (Special 0) NoId++{- | detect the smallest value (and its position) in an array of Ugens++ ArrayMin [ControlRate,AudioRate] *array=0;    MCE=1, FILTER: TRUE+-}+arrayMin :: Ugen -> Ugen+arrayMin array = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ArrayMin" [] (Just [array]) 2 (Special 0) NoId++{- | Sound Chip Simulator++ Astrocade [AudioRate] reg0=0 reg1=127 reg2=0 reg3=0 reg4=0 reg5=0 reg6=15 reg7=0+-}+astrocade :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+astrocade rate reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 = mkUgen Nothing [AudioRate] (Left rate) "Astrocade" [reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7] Nothing 1 (Special 0) NoId++{- | TIA Chip Sound Simulator++ Atari2600 [AudioRate] audc0=1 audc1=2 audf0=3 audf1=4 audv0=5 audv1=5 rate=1+-}+atari2600 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atari2600 rate audc0 audc1 audf0 audf1 audv0 audv1 rate_ = mkUgen Nothing [AudioRate] (Left rate) "Atari2600" [audc0, audc1, audf0, audf1, audv0, audv1, rate_] Nothing 1 (Special 0) NoId++{- | Use Amp data from a given partial++ AtsAmp [ControlRate,AudioRate] atsbuffer=0 partialNum=0 filePointer=0+-}+atsAmp :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsAmp rate atsbuffer partialNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsAmp" [atsbuffer, partialNum, filePointer] Nothing 1 (Special 0) NoId++{- | (put short description here)++ AtsBand [AudioRate] atsbuffer=0 band=0 filePointer=0+-}+atsBand :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsBand rate atsbuffer band filePointer = mkUgen Nothing [AudioRate] (Left rate) "AtsBand" [atsbuffer, band, filePointer] Nothing 1 (Special 0) NoId++{- | Use Freq data from a given partial++ AtsFreq [ControlRate,AudioRate] atsbuffer=0 partialNum=0 filePointer=0+-}+atsFreq :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsFreq rate atsbuffer partialNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsFreq" [atsbuffer, partialNum, filePointer] Nothing 1 (Special 0) NoId++{- | Resynthesize sine and noise data from an ATS analysis file++ AtsNoiSynth [AudioRate] atsbuffer=0 numPartials=0 partialStart=0 partialSkip=1 filePointer=0 sinePct=1 noisePct=1 freqMul=1 freqAdd=0 numBands=25 bandStart=0 bandSkip=1+-}+atsNoiSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atsNoiSynth rate atsbuffer numPartials partialStart partialSkip filePointer sinePct noisePct freqMul freqAdd numBands bandStart bandSkip = mkUgen Nothing [AudioRate] (Left rate) "AtsNoiSynth" [atsbuffer, numPartials, partialStart, partialSkip, filePointer, sinePct, noisePct, freqMul, freqAdd, numBands, bandStart, bandSkip] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AtsNoise [ControlRate,AudioRate] atsbuffer=0 bandNum=0 filePointer=0+-}+atsNoise :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsNoise rate atsbuffer bandNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsNoise" [atsbuffer, bandNum, filePointer] Nothing 1 (Special 0) NoId++{- | One Ugen to return both Amp and Freq info++ AtsParInfo [ControlRate,AudioRate] atsbuffer=0 partialNum=0 filePointer=0+-}+atsParInfo :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsParInfo rate atsbuffer partialNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsParInfo" [atsbuffer, partialNum, filePointer] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ AtsPartial [AudioRate] atsbuffer=0 partial=0 filePointer=0 freqMul=1 freqAdd=0+-}+atsPartial :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atsPartial rate atsbuffer partial filePointer freqMul freqAdd = mkUgen Nothing [AudioRate] (Left rate) "AtsPartial" [atsbuffer, partial, filePointer, freqMul, freqAdd] Nothing 1 (Special 0) NoId++{- | Resynthesize sine data from an ATS analysis file++ AtsSynth [AudioRate] atsbuffer=0 numPartials=0 partialStart=0 partialSkip=1 filePointer=0 freqMul=1 freqAdd=0+-}+atsSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atsSynth rate atsbuffer numPartials partialStart partialSkip filePointer freqMul freqAdd = mkUgen Nothing [AudioRate] (Left rate) "AtsSynth" [atsbuffer, numPartials, partialStart, partialSkip, filePointer, freqMul, freqAdd] Nothing 1 (Special 0) NoId++{- | Detect onsets and assess the nature of the attack slope++ AttackSlope [ControlRate] input=0 windowsize=1024 peakpicksize=20 leak=0.999 energythreshold=0.01 sumthreshold=20 mingap=30 numslopesaveraged=10+-}+attackSlope :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+attackSlope rate input windowsize peakpicksize leak energythreshold sumthreshold mingap numslopesaveraged = mkUgen Nothing [ControlRate] (Left rate) "AttackSlope" [input, windowsize, peakpicksize, leak, energythreshold, sumthreshold, mingap, numslopesaveraged] Nothing 6 (Special 0) NoId++{- | (Undocumented class)++ AudioMSG [AudioRate] in=0 index=0;    FILTER: TRUE+-}+audioMSG :: Ugen -> Ugen -> Ugen+audioMSG in_ index_ = mkUgen Nothing [AudioRate] (Right [0]) "AudioMSG" [in_, index_] Nothing 1 (Special 0) NoId++{- | calculates mean average of audio or control rate signal++ AverageOutput [ControlRate,AudioRate] in=0 trig=0;    FILTER: TRUE+-}+averageOutput :: Ugen -> Ugen -> Ugen+averageOutput in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AverageOutput" [in_, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ B2A [AudioRate] w=0 x=0 y=0 z=0+-}+b2a :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+b2a rate w x y z = mkUgen Nothing [AudioRate] (Left rate) "B2A" [w, x, y, z] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ B2Ster [AudioRate] w=0 x=0 y=0+-}+b2Ster :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+b2Ster rate w x y = mkUgen Nothing [AudioRate] (Left rate) "B2Ster" [w, x, y] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ B2UHJ [AudioRate] w=0 x=0 y=0+-}+b2uhj :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+b2uhj rate w x y = mkUgen Nothing [AudioRate] (Left rate) "B2UHJ" [w, x, y] Nothing 2 (Special 0) NoId++{- | MultiOut BetaBlocker VChip++ BBlockerBuf [AudioRate] freq=0 bufnum=0 startpoint=0+-}+bBlockerBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+bBlockerBuf rate freq bufnum startpoint = mkUgen Nothing [AudioRate] (Left rate) "BBlockerBuf" [freq, bufnum, startpoint] Nothing 9 (Special 0) NoId++{- | 3D Ambisonic decoder++ BFDecode1 [AudioRate] w=0 x=0 y=0 z=0 azimuth=0 elevation=0 wComp=0+-}+bfDecode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfDecode1 rate w x y z azimuth elevation wComp = mkUgen Nothing [AudioRate] (Left rate) "BFDecode1" [w, x, y, z, azimuth, elevation, wComp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BFDecoder [] maxSize=0+-}+bfDecoder :: Rate -> Ugen -> Ugen+bfDecoder rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BFDecoder" [maxSize] Nothing 1 (Special 0) NoId++{- | Ambisonic B format encoder++ BFEncode1 [AudioRate] in=0 azimuth=0 elevation=0 rho=1 gain=1 wComp=0+-}+bfEncode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfEncode1 rate in_ azimuth elevation rho gain wComp = mkUgen Nothing [AudioRate] (Left rate) "BFEncode1" [in_, azimuth, elevation, rho, gain, wComp] Nothing 4 (Special 0) NoId++{- | Ambisonic B format encoder++ BFEncode2 [AudioRate] in=0 point_x=1 point_y=1 elevation=0 gain=1 wComp=0+-}+bfEncode2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfEncode2 rate in_ point_x point_y elevation gain wComp = mkUgen Nothing [AudioRate] (Left rate) "BFEncode2" [in_, point_x, point_y, elevation, gain, wComp] Nothing 4 (Special 0) NoId++{- | Ambisonic B format encoder for stereo signals++ BFEncodeSter [AudioRate] l=0 r=0 azimuth=0 width=1.5708 elevation=0 rho=1 gain=1 wComp=0+-}+bfEncodeSter :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfEncodeSter rate l r azimuth width elevation rho gain wComp = mkUgen Nothing [AudioRate] (Left rate) "BFEncodeSter" [l, r, azimuth, width, elevation, rho, gain, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ BFGrainPanner [] maxSize=0+-}+bfGrainPanner :: Rate -> Ugen -> Ugen+bfGrainPanner rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BFGrainPanner" [maxSize] Nothing 1 (Special 0) NoId++{- | BFormat sound manipulation++ BFManipulate [AudioRate] w=0 x=0 y=0 z=0 rotate=0 tilt=0 tumble=0+-}+bfManipulate :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfManipulate rate w x y z rotate_ tilt_ tumble_ = mkUgen Nothing [AudioRate] (Left rate) "BFManipulate" [w, x, y, z, rotate_, tilt_, tumble_] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ BFPanner [] maxSize=0+-}+bfPanner :: Rate -> Ugen -> Ugen+bfPanner rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BFPanner" [maxSize] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BLBufRd [ControlRate,AudioRate] bufnum=0 phase=0 ratio=1+-}+blBufRd :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+blBufRd rate bufnum phase ratio = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BLBufRd" [bufnum, phase, ratio] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BLOsc [ControlRate,AudioRate] freq=100 pulsewidth=0.5 waveform=0+-}+blOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+blOsc rate freq pulsewidth waveform = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BLOsc" [freq, pulsewidth, waveform] Nothing 1 (Special 0) NoId++{- | 24db/oct rolloff - 4nd order resonant Low/High/Band Pass Filter++ BMoog [AudioRate] in=0 freq=440 q=0.2 mode=0 saturation=0.95;    FILTER: TRUE+-}+bMoog :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bMoog in_ freq q mode saturation = mkUgen Nothing [AudioRate] (Right [0]) "BMoog" [in_, freq, q, mode, saturation] Nothing 1 (Special 0) NoId++{- | Balances two signals with each other++ Balance [AudioRate] in=0 test=0 hp=10 stor=0+-}+balance :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+balance rate in_ test hp stor = mkUgen Nothing [AudioRate] (Left rate) "Balance" [in_, test, hp, stor] Nothing 1 (Special 0) NoId++{- | Extracts statistics on a beat histogram++ BeatStatistics [ControlRate] fft=0 leak=0.995 numpreviousbeats=4+-}+beatStatistics :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+beatStatistics rate fft_ leak numpreviousbeats = mkUgen Nothing [ControlRate] (Left rate) "BeatStatistics" [fft_, leak, numpreviousbeats] Nothing 4 (Special 0) NoId++{- | Sound Chip Simulator (well...)++ Beep [AudioRate] freq=3250 vol=1+-}+beep :: Rate -> Ugen -> Ugen -> Ugen+beep rate freq vol = mkUgen Nothing [AudioRate] (Left rate) "Beep" [freq, vol] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BeepU [] maxSize=0+-}+beepU :: Rate -> Ugen -> Ugen+beepU rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BeepU" [maxSize] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BinData [ControlRate,AudioRate] buffer=0 bin=0 overlaps=0.5+-}+binData :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+binData rate buffer bin overlaps = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BinData" [buffer, bin, overlaps] Nothing 2 (Special 0) NoId++{- | Band limited impulse generation++ BlitB3 [AudioRate] freq=440+-}+blitB3 :: Rate -> Ugen -> Ugen+blitB3 rate freq = mkUgen Nothing [AudioRate] (Left rate) "BlitB3" [freq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BlitB3D [AudioRate] freq=440+-}+blitB3D :: Rate -> Ugen -> Ugen+blitB3D rate freq = mkUgen Nothing [AudioRate] (Left rate) "BlitB3D" [freq] Nothing 1 (Special 0) NoId++{- | BLIT derived sawtooth++ BlitB3Saw [AudioRate] freq=440 leak=0.99+-}+blitB3Saw :: Rate -> Ugen -> Ugen -> Ugen+blitB3Saw rate freq leak = mkUgen Nothing [AudioRate] (Left rate) "BlitB3Saw" [freq, leak] Nothing 1 (Special 0) NoId++{- | Bipolar BLIT derived square waveform++ BlitB3Square [AudioRate] freq=440 leak=0.99+-}+blitB3Square :: Rate -> Ugen -> Ugen -> Ugen+blitB3Square rate freq leak = mkUgen Nothing [AudioRate] (Left rate) "BlitB3Square" [freq, leak] Nothing 1 (Special 0) NoId++{- | Bipolar BLIT derived triangle++ BlitB3Tri [AudioRate] freq=440 leak=0.99 leak2=0.99+-}+blitB3Tri :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+blitB3Tri rate freq leak leak2 = mkUgen Nothing [AudioRate] (Left rate) "BlitB3Tri" [freq, leak, leak2] Nothing 1 (Special 0) NoId++{- | breakcore simulator++ Breakcore [AudioRate] bufnum=0 capturein=0 capturetrigger=0 duration=0.1 ampdropout=0+-}+breakcore :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+breakcore rate bufnum capturein capturetrigger duration ampdropout = mkUgen Nothing [AudioRate] (Left rate) "Breakcore" [bufnum, capturein, capturetrigger, duration, ampdropout] Nothing 1 (Special 0) NoId++{- | Prigogine oscillator++ Brusselator [AudioRate] reset=0 rate=0.01 mu=1 gamma=1 initx=0.5 inity=0.5+-}+brusselator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+brusselator rate reset rate_ mu gamma initx inity = mkUgen Nothing [AudioRate] (Left rate) "Brusselator" [reset, rate_, mu, gamma, initx, inity] Nothing 2 (Special 0) NoId++{- | Granular synthesis with sound sampled in a buffer++ BufGrain [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 interp=2+-}+bufGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrain rate trigger dur sndbuf rate_ pos interp = mkUgen Nothing [AudioRate] (Left rate) "BufGrain" [trigger, dur, sndbuf, rate_, pos, interp] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sound sampled in a buffer and user supplied envelope++ BufGrainB [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf=0 interp=2+-}+bufGrainB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainB rate trigger dur sndbuf rate_ pos envbuf interp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainB" [trigger, dur, sndbuf, rate_, pos, envbuf, interp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BufGrainBBF [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf=0 azimuth=0 elevation=0 rho=1 interp=2 wComp=0+-}+bufGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainBBF rate trigger dur sndbuf rate_ pos envbuf azimuth elevation rho interp wComp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainBBF" [trigger, dur, sndbuf, rate_, pos, envbuf, azimuth, elevation, rho, interp, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ BufGrainBF [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 azimuth=0 elevation=0 rho=1 interp=2 wComp=0+-}+bufGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainBF rate trigger dur sndbuf rate_ pos azimuth elevation rho interp wComp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainBF" [trigger, dur, sndbuf, rate_, pos, azimuth, elevation, rho, interp, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with sound sampled in a buffer and user supplied envelopes++ BufGrainI [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf1=0 envbuf2=0 ifac=0.5 interp=2+-}+bufGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainI rate trigger dur sndbuf rate_ pos envbuf1 envbuf2 ifac interp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainI" [trigger, dur, sndbuf, rate_, pos, envbuf1, envbuf2, ifac, interp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BufGrainIBF [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 interp=2 wComp=0+-}+bufGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainIBF rate trigger dur sndbuf rate_ pos envbuf1 envbuf2 ifac azimuth elevation rho interp wComp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainIBF" [trigger, dur, sndbuf, rate_, pos, envbuf1, envbuf2, ifac, azimuth, elevation, rho, interp, wComp] Nothing 4 (Special 0) NoId++{- | detect the largest value (and its position) in an array of Ugens++ BufMax [ControlRate] bufnum=0 gate=1+-}+bufMax :: Rate -> Ugen -> Ugen -> Ugen+bufMax rate bufnum gate_ = mkUgen Nothing [ControlRate] (Left rate) "BufMax" [bufnum, gate_] Nothing 2 (Special 0) NoId++{- | detect the largest value (and its position) in an array of Ugens++ BufMin [ControlRate] bufnum=0 gate=1+-}+bufMin :: Rate -> Ugen -> Ugen -> Ugen+bufMin rate bufnum gate_ = mkUgen Nothing [ControlRate] (Left rate) "BufMin" [bufnum, gate_] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ CQ_Diff [ControlRate] in1=0 in2=0 databufnum=0+-}+cq_Diff :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+cq_Diff rate in1 in2 databufnum = mkUgen Nothing [ControlRate] (Left rate) "CQ_Diff" [in1, in2, databufnum] Nothing 1 (Special 0) NoId++{- | Quefrency analysis and liftering++ Cepstrum [] cepbuf=0 fftchain=0+-}+cepstrum :: Rate -> Ugen -> Ugen -> Ugen+cepstrum rate cepbuf fftchain = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Cepstrum" [cepbuf, fftchain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Chen [ControlRate,AudioRate] speed=0.5 a=0.5 b=0.3 c=0.28+-}+chen :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+chen rate speed a b c = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Chen" [speed, a, b, c] Nothing 3 (Special 0) NoId++{- | Octave chroma band based representation of energy in a signal; Chromagram for nTET tuning systems with any base reference++ Chromagram [ControlRate] fft=0 fftsize=2048 n=12 tuningbase=32.7032 octaves=8 integrationflag=0 coeff=0.9 octaveratio=2 perframenormalize=0+-}+chromagram :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+chromagram rate fft_ fftsize n tuningbase octaves integrationflag coeff octaveratio perframenormalize = mkUgen Nothing [ControlRate] (Left rate) "Chromagram" [fft_, fftsize, n, tuningbase, octaves, integrationflag, coeff, octaveratio, perframenormalize] Nothing 12 (Special 0) NoId++{- | circular linear lag++ CircleRamp [ControlRate,AudioRate] in=0 lagTime=0.1 circmin=-180 circmax=180+-}+circleRamp :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+circleRamp rate in_ lagTime circmin circmax = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "CircleRamp" [in_, lagTime, circmin, circmax] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clipper32 [AudioRate] in=0 lo=-0.8 hi=0.8+-}+clipper32 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+clipper32 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "Clipper32" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clipper4 [AudioRate] in=0 lo=-0.8 hi=0.8+-}+clipper4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+clipper4 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "Clipper4" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clipper8 [AudioRate] in=0 lo=-0.8 hi=0.8+-}+clipper8 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+clipper8 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "Clipper8" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clockmus [ControlRate]+-}+clockmus :: Rate -> Ugen+clockmus rate = mkUgen Nothing [ControlRate] (Left rate) "Clockmus" [] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ CombLP [AudioRate] in=0 gate=1 maxdelaytime=0.2 delaytime=0.2 decaytime=1 coef=0.5+-}+combLP :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combLP rate in_ gate_ maxdelaytime delaytime decaytime coef = mkUgen Nothing [AudioRate] (Left rate) "CombLP" [in_, gate_, maxdelaytime, delaytime, decaytime, coef] Nothing 1 (Special 0) NoId++{- | FM-modulable resonating filter++ ComplexRes [AudioRate] in=0 freq=100 decay=0.2;    FILTER: TRUE+-}+complexRes :: Ugen -> Ugen -> Ugen -> Ugen+complexRes in_ freq decay_ = mkUgen Nothing [AudioRate] (Right [0]) "ComplexRes" [in_, freq, decay_] Nothing 1 (Special 0) NoId++{- | Concatenative Cross-Synthesis on Live Streams++ Concat [AudioRate] control=0 source=0 storesize=1 seektime=1 seekdur=1 matchlength=0.05 freezestore=0 zcr=1 lms=1 sc=1 st=0 randscore=0+-}+concat :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+concat rate control_ source storesize seektime seekdur matchlength freezestore zcr lms sc st randscore = mkUgen Nothing [AudioRate] (Left rate) "Concat" [control_, source, storesize, seektime, seekdur, matchlength, freezestore, zcr, lms, sc, st, randscore] Nothing 1 (Special 0) NoId++{- | Concatenative Cross-Synthesis on Live Streams++ Concat2 [AudioRate] control=0 source=0 storesize=1 seektime=1 seekdur=1 matchlength=0.05 freezestore=0 zcr=1 lms=1 sc=1 st=0 randscore=0 threshold=0.01+-}+concat2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+concat2 rate control_ source storesize seektime seekdur matchlength freezestore zcr lms sc st randscore threshold = mkUgen Nothing [AudioRate] (Left rate) "Concat2" [control_, source, storesize, seektime, seekdur, matchlength, freezestore, zcr, lms, sc, st, randscore, threshold] Nothing 1 (Special 0) NoId++{- | an amplitude tracking based onset detector++ Coyote [ControlRate] in=0 trackFall=0.2 slowLag=0.2 fastLag=0.01 fastMul=0.5 thresh=0.05 minDur=0.1+-}+coyote :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+coyote rate in_ trackFall slowLag fastLag fastMul thresh minDur = mkUgen Nothing [ControlRate] (Left rate) "Coyote" [in_, trackFall, slowLag, fastLag, fastMul, thresh, minDur] Nothing 1 (Special 0) NoId++{- | Measure the temporal crest factor of a signal++ Crest [ControlRate] in=0 numsamps=400 gate=1+-}+crest :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+crest rate in_ numsamps gate_ = mkUgen Nothing [ControlRate] (Left rate) "Crest" [in_, numsamps, gate_] Nothing 1 (Special 0) NoId++{- | class B/AB power amp distortion simulation++ CrossoverDistortion [AudioRate] in=0 amp=0.5 smooth=0.5;    FILTER: TRUE+-}+crossoverDistortion :: Ugen -> Ugen -> Ugen -> Ugen+crossoverDistortion in_ amp smooth = mkUgen Nothing [AudioRate] (Right [0]) "CrossoverDistortion" [in_, amp, smooth] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DCompressor [AudioRate] input=0 sidechainIn=0 sidechain=0 ratio=4 threshold=-40 attack=0.1 release=100.1 makeup=0.5 automakeup=1;    FILTER: TRUE+-}+dCompressor :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dCompressor input sidechainIn sidechain ratio threshold attack release makeup automakeup = mkUgen Nothing [AudioRate] (Right [0]) "DCompressor" [input, sidechainIn, sidechain, ratio, threshold, attack, release, makeup, automakeup] Nothing 1 (Special 0) NoId++{- | Digitally modelled analog filter++ DFM1 [AudioRate] in=0 freq=1000 res=0.1 inputgain=1 type=0 noiselevel=0.0003;    FILTER: TRUE+-}+dfm1 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dfm1 in_ freq res inputgain type_ noiselevel = mkUgen Nothing [AudioRate] (Right [0]) "DFM1" [in_, freq, res, inputgain, type_, noiselevel] Nothing 1 (Special 0) NoId++{- | Demand rate implementation of a Wiard noise ring++ DNoiseRing [DemandRate] change=0.5 chance=0.5 shift=1 numBits=8 resetval=0;    DEMAND/NONDET+-}+dNoiseRingId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dNoiseRingId z change chance shift numBits resetval = mkUgen Nothing [DemandRate] (Left DemandRate) "DNoiseRing" [change, chance, shift, numBits, resetval] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of DNoiseRing.+dNoiseRingM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dNoiseRingM = liftUid5 dNoiseRingId++-- | Unsafe variant of DNoiseRing.+dNoiseRing :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dNoiseRing = liftUnsafe5 dNoiseRingM++{- | Triangle via 3rd order differerentiated polynomial waveform++ DPW3Tri [AudioRate] freq=440+-}+dpw3Tri :: Rate -> Ugen -> Ugen+dpw3Tri rate freq = mkUgen Nothing [AudioRate] (Left rate) "DPW3Tri" [freq] Nothing 1 (Special 0) NoId++{- | Sawtooth via 4th order differerentiated polynomial waveform++ DPW4Saw [AudioRate] freq=440+-}+dpw4Saw :: Rate -> Ugen -> Ugen+dpw4Saw rate freq = mkUgen Nothing [AudioRate] (Left rate) "DPW4Saw" [freq] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGBowed [AudioRate] freq=440 velb=0.5 force=1 gate=1 pos=0.14 release=0.1 c1=1 c3=3 impZ=0.55 fB=2+-}+dwgBowed :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgBowed rate freq velb force gate_ pos release c1 c3 impZ fB = mkUgen Nothing [AudioRate] (Left rate) "DWGBowed" [freq, velb, force, gate_, pos, release, c1, c3, impZ, fB] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGBowedSimple [AudioRate] freq=440 velb=0.5 force=1 gate=1 pos=0.14 release=0.1 c1=1 c3=30+-}+dwgBowedSimple :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgBowedSimple rate freq velb force gate_ pos release c1 c3 = mkUgen Nothing [AudioRate] (Left rate) "DWGBowedSimple" [freq, velb, force, gate_, pos, release, c1, c3] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGBowedTor [AudioRate] freq=440 velb=0.5 force=1 gate=1 pos=0.14 release=0.1 c1=1 c3=3 impZ=0.55 fB=2 mistune=5.2 c1tor=1 c3tor=3000 iZtor=1.8+-}+dwgBowedTor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgBowedTor rate freq velb force gate_ pos release c1 c3 impZ fB mistune c1tor c3tor iZtor = mkUgen Nothing [AudioRate] (Left rate) "DWGBowedTor" [freq, velb, force, gate_, pos, release, c1, c3, impZ, fB, mistune, c1tor, c3tor, iZtor] Nothing 1 (Special 0) NoId++{- | Clarinet physical model.++ DWGClarinet3 [AudioRate] freq=440.0 pm=1.0 pc=1.0 m=0.8 gate=1.0 release=1.0e-2 c1=0.25 c3=7.0+-}+dwgClarinet3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgClarinet3 rate freq pm pc m gate_ release c1 c3 = mkUgen Nothing [AudioRate] (Left rate) "DWGClarinet3" [freq, pm, pc, m, gate_, release, c1, c3] Nothing 1 (Special 0) NoId++{- | Reimplementation of STK flute model.++ DWGFlute [AudioRate] freq=400.0 pm=1.0 endr=0.5 jetr=0.25 jetRa=0.33 gate=1.0 release=0.1+-}+dwgFlute :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgFlute rate freq pm endr jetr jetRa gate_ release = mkUgen Nothing [AudioRate] (Left rate) "DWGFlute" [freq, pm, endr, jetr, jetRa, gate_, release] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGPlucked [AudioRate] freq=440 amp=0.5 gate=1 pos=0.14 c1=1 c3=30 inp=0 release=0.1+-}+dwgPlucked :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgPlucked rate freq amp gate_ pos c1 c3 inp release = mkUgen Nothing [AudioRate] (Left rate) "DWGPlucked" [freq, amp, gate_, pos, c1, c3, inp, release] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGPlucked2 [AudioRate] freq=440 amp=0.5 gate=1 pos=0.14 c1=1 c3=30 inp=0 release=0.1 mistune=1.008 mp=0.55 gc=0.01+-}+dwgPlucked2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgPlucked2 rate freq amp gate_ pos c1 c3 inp release mistune mp gc = mkUgen Nothing [AudioRate] (Left rate) "DWGPlucked2" [freq, amp, gate_, pos, c1, c3, inp, release, mistune, mp, gc] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGPluckedStiff [AudioRate] freq=440 amp=0.5 gate=1 pos=0.14 c1=1 c3=30 inp=0 release=0.1 fB=2+-}+dwgPluckedStiff :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgPluckedStiff rate freq amp gate_ pos c1 c3 inp release fB = mkUgen Nothing [AudioRate] (Left rate) "DWGPluckedStiff" [freq, amp, gate_, pos, c1, c3, inp, release, fB] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DWGSoundBoard [AudioRate] inp=0 c1=20 c3=20 mix=0.8 d1=199 d2=211 d3=223 d4=227 d5=229 d6=233 d7=239 d8=241;    FILTER: TRUE+-}+dwgSoundBoard :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgSoundBoard inp c1 c3 mix d1 d2 d3 d4 d5 d6 d7 d8 = mkUgen Nothing [AudioRate] (Right [0]) "DWGSoundBoard" [inp, c1, c3, mix, d1, d2, d3, d4, d5, d6, d7, d8] Nothing 1 (Special 0) NoId++{- | demand rate brownian movement with Gendyn distributions++ Dbrown2 [] lo=0 hi=0 step=0 dist=0 length=100000000+-}+dbrown2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbrown2 rate lo hi step dist length_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Dbrown2" [lo, hi, step, dist, length_] Nothing 1 (Special 0) NoId++{- | demand rate tag system on a buffer++ DbufTag [DemandRate] bufnum=0 v=0 axiom=0 rules=0 recycle=0 mode=0;    DEMAND/NONDET+-}+dbufTagId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbufTagId z bufnum v axiom rules recycle mode = mkUgen Nothing [DemandRate] (Left DemandRate) "DbufTag" [bufnum, v, axiom, rules, recycle, mode] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of DbufTag.+dbufTagM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dbufTagM = liftUid6 dbufTagId++-- | Unsafe variant of DbufTag.+dbufTag :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbufTag = liftUnsafe6 dbufTagM++{- | Samplerate and bitrate reduction++ Decimator [AudioRate] in=0 rate=44100 bits=24+-}+decimator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+decimator rate in_ rate_ bits = mkUgen Nothing [AudioRate] (Left rate) "Decimator" [in_, rate_, bits] Nothing 1 (Special 0) NoId++{- | Demand version of the BetaBlocker VChip++ DetaBlockerBuf [DemandRate] bufnum=0 startpoint=0;    DEMAND/NONDET+-}+detaBlockerBufId :: ID a => a -> Ugen -> Ugen -> Ugen+detaBlockerBufId z bufnum startpoint = mkUgen Nothing [DemandRate] (Left DemandRate) "DetaBlockerBuf" [bufnum, startpoint] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of DetaBlockerBuf.+detaBlockerBufM :: Uid m => Ugen -> Ugen -> m Ugen+detaBlockerBufM = liftUid2 detaBlockerBufId++-- | Unsafe variant of DetaBlockerBuf.+detaBlockerBuf :: Ugen -> Ugen -> Ugen+detaBlockerBuf = liftUnsafe2 detaBlockerBufM++{- | demand rate finite state machine++ Dfsm [DemandRate] rules=0 n=1 rgen=0;    DEMAND/NONDET+-}+dfsmId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dfsmId z rules n rgen = mkUgen Nothing [DemandRate] (Left DemandRate) "Dfsm" [rules, n, rgen] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dfsm.+dfsmM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dfsmM = liftUid3 dfsmId++-- | Unsafe variant of Dfsm.+dfsm :: Ugen -> Ugen -> Ugen -> Ugen+dfsm = liftUnsafe3 dfsmM++{- | (Undocumented class)++ Dgauss [] lo=0 hi=0 length=100000000+-}+dgauss :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+dgauss rate lo hi length_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Dgauss" [lo, hi, length_] Nothing 1 (Special 0) NoId++{- | Ring modulation based on the physical model of a diode.++ DiodeRingMod [AudioRate] car=0 mod=0;    FILTER: TRUE+-}+diodeRingMod :: Ugen -> Ugen -> Ugen+diodeRingMod car mod_ = mkUgen Nothing [AudioRate] (Right [0]) "DiodeRingMod" [car, mod_] Nothing 1 (Special 0) NoId++{- | port of some ladspa plugins++ Disintegrator [AudioRate] in=0 probability=0.5 multiplier=0;    FILTER: TRUE, NONDET+-}+disintegratorId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+disintegratorId z in_ probability multiplier = mkUgen Nothing [AudioRate] (Right [0]) "Disintegrator" [in_, probability, multiplier] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Disintegrator.+disintegratorM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+disintegratorM = liftUid3 disintegratorId++-- | Unsafe variant of Disintegrator.+disintegrator :: Ugen -> Ugen -> Ugen -> Ugen+disintegrator = liftUnsafe3 disintegratorM++{- | discrete time neurodynamics++ Dneuromodule [ControlRate,AudioRate,DemandRate] dt=0 *theta=0 *x=0 *weights=0;    MCE=3, NC INPUT: True, NONDET+-}+dneuromoduleId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dneuromoduleId numChannels z dt theta x weights = mkUgen Nothing [ControlRate, AudioRate, DemandRate] (Left DemandRate) "Dneuromodule" [dt] (Just [theta, x, weights]) numChannels (Special 0) (toUid z)++-- | Monad variant of Dneuromodule.+dneuromoduleM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dneuromoduleM = liftUid5 dneuromoduleId++-- | Unsafe variant of Dneuromodule.+dneuromodule :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dneuromodule = liftUnsafe5 dneuromoduleM++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ DoubleNestedAllpassC [AudioRate] in=0 maxdelay1=0.0047 delay1=0.0047 gain1=0.15 maxdelay2=0.022 delay2=0.022 gain2=0.25 maxdelay3=0.0083 delay3=0.0083 gain3=0.3;    FILTER: TRUE+-}+doubleNestedAllpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleNestedAllpassC in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 maxdelay3 delay3 gain3 = mkUgen Nothing [AudioRate] (Right [0]) "DoubleNestedAllpassC" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2, maxdelay3, delay3, gain3] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ DoubleNestedAllpassL [AudioRate] in=0 maxdelay1=0.0047 delay1=0.0047 gain1=0.15 maxdelay2=0.022 delay2=0.022 gain2=0.25 maxdelay3=0.0083 delay3=0.0083 gain3=0.3;    FILTER: TRUE+-}+doubleNestedAllpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleNestedAllpassL in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 maxdelay3 delay3 gain3 = mkUgen Nothing [AudioRate] (Right [0]) "DoubleNestedAllpassL" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2, maxdelay3, delay3, gain3] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ DoubleNestedAllpassN [AudioRate] in=0 maxdelay1=0.0047 delay1=0.0047 gain1=0.15 maxdelay2=0.022 delay2=0.022 gain2=0.25 maxdelay3=0.0083 delay3=0.0083 gain3=0.3;    FILTER: TRUE+-}+doubleNestedAllpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleNestedAllpassN in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 maxdelay3 delay3 gain3 = mkUgen Nothing [AudioRate] (Right [0]) "DoubleNestedAllpassN" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2, maxdelay3, delay3, gain3] Nothing 1 (Special 0) NoId++{- | Forced DoubleWell Oscillator++ DoubleWell [AudioRate] reset=0 ratex=0.01 ratey=0.01 f=1 w=0.001 delta=1 initx=0 inity=0+-}+doubleWell :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleWell rate reset ratex ratey f w delta initx inity = mkUgen Nothing [AudioRate] (Left rate) "DoubleWell" [reset, ratex, ratey, f, w, delta, initx, inity] Nothing 1 (Special 0) NoId++{- | Forced DoubleWell Oscillator++ DoubleWell2 [AudioRate] reset=0 ratex=0.01 ratey=0.01 f=1 w=0.001 delta=1 initx=0 inity=0+-}+doubleWell2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleWell2 rate reset ratex ratey f w delta initx inity = mkUgen Nothing [AudioRate] (Left rate) "DoubleWell2" [reset, ratex, ratey, f, w, delta, initx, inity] Nothing 1 (Special 0) NoId++{- | Forced DoubleWell Oscillator++ DoubleWell3 [AudioRate] reset=0 rate=0.01 f=0 delta=0.25 initx=0 inity=0+-}+doubleWell3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleWell3 rate reset rate_ f delta initx inity = mkUgen Nothing [AudioRate] (Left rate) "DoubleWell3" [reset, rate_, f, delta, initx, inity] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DriveNoise [AudioRate] in=0 amount=1 multi=5+-}+driveNoise :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+driveNoise rate in_ amount multi = mkUgen Nothing [AudioRate] (Left rate) "DriveNoise" [in_, amount, multi] Nothing 1 (Special 0) NoId++{- | Crosscorrelation search and drum pattern matching beat tracker++ DrumTrack [ControlRate] in=0 lock=0 dynleak=0 tempowt=0 phasewt=0 basswt=0 patternwt=1 prior=0 kicksensitivity=1 snaresensitivity=1 debugmode=0+-}+drumTrack :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+drumTrack rate in_ lock dynleak tempowt phasewt basswt patternwt prior kicksensitivity snaresensitivity debugmode = mkUgen Nothing [ControlRate] (Left rate) "DrumTrack" [in_, lock, dynleak, tempowt, phasewt, basswt, patternwt, prior, kicksensitivity, snaresensitivity, debugmode] Nothing 4 (Special 0) NoId++{- | demand rate tag system++ Dtag [] bufsize=0 v=0 axiom=0 rules=0 recycle=0 mode=0+-}+dtag :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dtag rate bufsize v axiom rules recycle mode = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Dtag" [bufsize, v, axiom, rules, recycle, mode] Nothing 1 (Special 0) NoId++{- | Envelope Follower Filter++ EnvDetect [AudioRate] in=0 attack=100 release=0+-}+envDetect :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+envDetect rate in_ attack release = mkUgen Nothing [AudioRate] (Left rate) "EnvDetect" [in_, attack, release] Nothing 1 (Special 0) NoId++{- | Envelope Follower++ EnvFollow [ControlRate,AudioRate] input=0 decaycoeff=0.99+-}+envFollow :: Rate -> Ugen -> Ugen -> Ugen+envFollow rate input decaycoeff = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "EnvFollow" [input, decaycoeff] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTComplexDev [ControlRate] buffer=0 rectify=0 powthresh=0.1+-}+fftComplexDev :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftComplexDev rate buffer rectify powthresh = mkUgen Nothing [ControlRate] (Left rate) "FFTComplexDev" [buffer, rectify, powthresh] Nothing 1 (Special 0) NoId++{- | Spectral crest measure++ FFTCrest [ControlRate] buffer=0 freqlo=0 freqhi=50000+-}+fftCrest :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftCrest rate buffer freqlo freqhi = mkUgen Nothing [ControlRate] (Left rate) "FFTCrest" [buffer, freqlo, freqhi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTDiffMags [ControlRate] bufferA=0 bufferB=0+-}+fftDiffMags :: Rate -> Ugen -> Ugen -> Ugen+fftDiffMags rate bufferA bufferB = mkUgen Nothing [ControlRate] (Left rate) "FFTDiffMags" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTFlux [ControlRate] buffer=0 normalise=1+-}+fftFlux :: Rate -> Ugen -> Ugen -> Ugen+fftFlux rate buffer normalise = mkUgen Nothing [ControlRate] (Left rate) "FFTFlux" [buffer, normalise] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTFluxPos [ControlRate] buffer=0 normalise=1+-}+fftFluxPos :: Rate -> Ugen -> Ugen -> Ugen+fftFluxPos rate buffer normalise = mkUgen Nothing [ControlRate] (Left rate) "FFTFluxPos" [buffer, normalise] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTMKL [ControlRate] buffer=0 epsilon=0.0+-}+fftmkl :: Rate -> Ugen -> Ugen -> Ugen+fftmkl rate buffer epsilon = mkUgen Nothing [ControlRate] (Left rate) "FFTMKL" [buffer, epsilon] Nothing 1 (Special 0) NoId++{- | Find peak value in an FFT frame++ FFTPeak [ControlRate] buffer=0 freqlo=0 freqhi=50000+-}+fftPeak :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftPeak rate buffer freqlo freqhi = mkUgen Nothing [ControlRate] (Left rate) "FFTPeak" [buffer, freqlo, freqhi] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ FFTPhaseDev [ControlRate] buffer=0 weight=0 powthresh=0.1+-}+fftPhaseDev :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftPhaseDev rate buffer weight powthresh = mkUgen Nothing [ControlRate] (Left rate) "FFTPhaseDev" [buffer, weight, powthresh] Nothing 1 (Special 0) NoId++{- | Instantaneous spectral power++ FFTPower [ControlRate] buffer=0 square=1+-}+fftPower :: Rate -> Ugen -> Ugen -> Ugen+fftPower rate buffer square = mkUgen Nothing [ControlRate] (Left rate) "FFTPower" [buffer, square] Nothing 1 (Special 0) NoId++{- | Spectral slope++ FFTSlope [ControlRate] buffer=0+-}+fftSlope :: Rate -> Ugen -> Ugen+fftSlope rate buffer = mkUgen Nothing [ControlRate] (Left rate) "FFTSlope" [buffer] Nothing 1 (Special 0) NoId++{- | Spectral spread++ FFTSpread [ControlRate] buffer=0 centroid=0+-}+fftSpread :: Rate -> Ugen -> Ugen -> Ugen+fftSpread rate buffer centroid = mkUgen Nothing [ControlRate] (Left rate) "FFTSpread" [buffer, centroid] Nothing 1 (Special 0) NoId++{- | Spectral flatness, divided into subbands++ FFTSubbandFlatness [ControlRate] chain=0 cutfreqs=0+-}+fftSubbandFlatness :: Rate -> Ugen -> Ugen -> Ugen+fftSubbandFlatness rate chain cutfreqs = mkUgen Nothing [ControlRate] (Left rate) "FFTSubbandFlatness" [chain, cutfreqs] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTSubbandFlux [ControlRate] chain=0 cutfreqs=0 posonly=0+-}+fftSubbandFlux :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftSubbandFlux rate chain cutfreqs posonly = mkUgen Nothing [ControlRate] (Left rate) "FFTSubbandFlux" [chain, cutfreqs, posonly] Nothing 1 (Special 0) NoId++{- | Spectral power, divided into subbands++ FFTSubbandPower [ControlRate] chain=0 cutfreqs=0 square=1 scalemode=1+-}+fftSubbandPower :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fftSubbandPower rate chain cutfreqs square scalemode = mkUgen Nothing [ControlRate] (Left rate) "FFTSubbandPower" [chain, cutfreqs, square, scalemode] Nothing 1 (Special 0) NoId++{- | Phase modulation oscillator matrix.++ FM7 [AudioRate] *ctlMatrix=0 *modMatrix=0;    MCE=2+-}+fm7 :: Rate -> Ugen -> Ugen -> Ugen+fm7 rate ctlMatrix modMatrix = mkUgen Nothing [AudioRate] (Left rate) "FM7" [] (Just [ctlMatrix, modMatrix]) 6 (Special 0) NoId++{- | Granular synthesis with FM grains++ FMGrain [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1;    FILTER: TRUE+-}+fmGrain :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrain trigger dur carfreq modfreq index_ = mkUgen Nothing [AudioRate] (Right [0]) "FMGrain" [trigger, dur, carfreq, modfreq, index_] Nothing 1 (Special 0) NoId++{- | Granular synthesis with FM grains and user supplied envelope++ FMGrainB [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf=0;    FILTER: TRUE+-}+fmGrainB :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainB trigger dur carfreq modfreq index_ envbuf = mkUgen Nothing [AudioRate] (Right [0]) "FMGrainB" [trigger, dur, carfreq, modfreq, index_, envbuf] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FMGrainBBF [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+fmGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainBBF rate trigger dur carfreq modfreq index_ envbuf azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "FMGrainBBF" [trigger, dur, carfreq, modfreq, index_, envbuf, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ FMGrainBF [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 azimuth=0 elevation=0 rho=1 wComp=0+-}+fmGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainBF rate trigger dur carfreq modfreq index_ azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "FMGrainBF" [trigger, dur, carfreq, modfreq, index_, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with FM grains and user supplied envelopes++ FMGrainI [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf1=0 envbuf2=0 ifac=0.5+-}+fmGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainI rate trigger dur carfreq modfreq index_ envbuf1 envbuf2 ifac = mkUgen Nothing [AudioRate] (Left rate) "FMGrainI" [trigger, dur, carfreq, modfreq, index_, envbuf1, envbuf2, ifac] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FMGrainIBF [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 wComp=0+-}+fmGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainIBF rate trigger dur carfreq modfreq index_ envbuf1 envbuf2 ifac azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "FMGrainIBF" [trigger, dur, carfreq, modfreq, index_, envbuf1, envbuf2, ifac, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Decode an FMH signal for a specific speaker++ FMHDecode1 [AudioRate] w=0 x=0 y=0 z=0 r=0 s=0 t=0 u=0 v=0 azimuth=0 elevation=0+-}+fmhDecode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhDecode1 rate w x y z r s t u v azimuth elevation = mkUgen Nothing [AudioRate] (Left rate) "FMHDecode1" [w, x, y, z, r, s, t, u, v, azimuth, elevation] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FMHEncode0 [AudioRate] in=0 azimuth=0 elevation=0 gain=1+-}+fmhEncode0 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhEncode0 rate in_ azimuth elevation gain = mkUgen Nothing [AudioRate] (Left rate) "FMHEncode0" [in_, azimuth, elevation, gain] Nothing 9 (Special 0) NoId++{- | Second Order Ambisonic encoder++ FMHEncode1 [AudioRate] in=0 azimuth=0 elevation=0 rho=1 gain=1 wComp=0+-}+fmhEncode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhEncode1 rate in_ azimuth elevation rho gain wComp = mkUgen Nothing [AudioRate] (Left rate) "FMHEncode1" [in_, azimuth, elevation, rho, gain, wComp] Nothing 9 (Special 0) NoId++{- | Second Order Ambisonic encoder++ FMHEncode2 [AudioRate] in=0 point_x=0 point_y=0 elevation=0 gain=1 wComp=0+-}+fmhEncode2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhEncode2 rate in_ point_x point_y elevation gain wComp = mkUgen Nothing [AudioRate] (Left rate) "FMHEncode2" [in_, point_x, point_y, elevation, gain, wComp] Nothing 9 (Special 0) NoId++{- | Storing feature data from Ugens in NRT mode++ FeatureSave [ControlRate] features=0 trig=0+-}+featureSave :: Rate -> Ugen -> Ugen -> Ugen+featureSave rate features trig_ = mkUgen Nothing [ControlRate] (Left rate) "FeatureSave" [features, trig_] Nothing 1 (Special 0) NoId++{- | FitzHughNagumo Neuron Firing Oscillator++ Fhn2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhn2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhn2DC rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Fhn2DC" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | FitzHughNagumo Neuron Firing Oscillator++ Fhn2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhn2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhn2DL rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Fhn2DL" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | FitzHughNagumo Neuron Firing Oscillator++ Fhn2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhn2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhn2DN rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Fhn2DN" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FhnTrig [ControlRate,AudioRate] minfreq=4 maxfreq=10 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhnTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhnTrig rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "FhnTrig" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FincoSprottL [AudioRate] freq=22050 a=2.45 h=0.05 xi=0 yi=0 zi=0+-}+fincoSprottL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fincoSprottL rate freq a h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "FincoSprottL" [freq, a, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ FincoSprottM [AudioRate] freq=22050 a=-7 b=4 h=0.05 xi=0 yi=0 zi=0+-}+fincoSprottM :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fincoSprottM rate freq a b h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "FincoSprottM" [freq, a, b, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ FincoSprottS [AudioRate] freq=22050 a=8 b=2 h=0.05 xi=0 yi=0 zi=0+-}+fincoSprottS :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fincoSprottS rate freq a b h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "FincoSprottS" [freq, a, b, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | Neuron Firing Model Oscillator++ FitzHughNagumo [AudioRate] reset=0 rateu=0.01 ratew=0.01 b0=1 b1=1 initu=0 initw=0+-}+fitzHughNagumo :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fitzHughNagumo rate reset rateu ratew b0 b1 initu initw = mkUgen Nothing [AudioRate] (Left rate) "FitzHughNagumo" [reset, rateu, ratew, b0, b1, initu, initw] Nothing 1 (Special 0) NoId++{- | calculates spectral MSE distance of two fft chains++ FrameCompare [ControlRate] buffer1=0 buffer2=0 wAmount=0.5+-}+frameCompare :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+frameCompare rate buffer1 buffer2 wAmount = mkUgen Nothing [ControlRate] (Left rate) "FrameCompare" [buffer1, buffer2, wAmount] Nothing 1 (Special 0) NoId++{- | A physical model of a system with dry-friction. A chaotic filter.++ Friction [ControlRate,AudioRate] in=0 friction=0.5 spring=0.414 damp=0.313 mass=0.1 beltmass=1+-}+friction :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+friction rate in_ friction_ spring_ damp mass beltmass = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Friction" [in_, friction_, spring_, damp, mass, beltmass] Nothing 1 (Special 0) NoId++{- | Single gammatone filter++ Gammatone [AudioRate] input=0 centrefrequency=440 bandwidth=200;    FILTER: TRUE+-}+gammatone :: Ugen -> Ugen -> Ugen -> Ugen+gammatone input centrefrequency bandwidth = mkUgen Nothing [AudioRate] (Right [0]) "Gammatone" [input, centrefrequency, bandwidth] Nothing 1 (Special 0) NoId++{- | Gaussian classifier++ GaussClass [ControlRate] in=0 bufnum=0 gate=0+-}+gaussClass :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+gaussClass rate in_ bufnum gate_ = mkUgen Nothing [ControlRate] (Left rate) "GaussClass" [in_, bufnum, gate_] Nothing 1 (Special 0) NoId++{- | impulses around a certain frequency++ GaussTrig [ControlRate,AudioRate] freq=440 dev=0.3+-}+gaussTrig :: Rate -> Ugen -> Ugen -> Ugen+gaussTrig rate freq dev = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GaussTrig" [freq, dev] Nothing 1 (Special 0) NoId++{- | gingerbreadman map 2D chaotic generator++ Gbman2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 x0=1.2 y0=2.1+-}+gbman2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbman2DC rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gbman2DC" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | gingerbreadman map 2D chaotic generator++ Gbman2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 x0=1.2 y0=2.1+-}+gbman2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbman2DL rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gbman2DL" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | gingerbreadman map 2D chaotic generator++ Gbman2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 x0=1.2 y0=2.1+-}+gbman2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbman2DN rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gbman2DN" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GbmanTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 x0=1.2 y0=2.1+-}+gbmanTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbmanTrig rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GbmanTrig" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | Dynamic stochastic synthesis generator++ Gendy4 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0+-}+gendy4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy4 rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy4" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) NoId++{- | Dynamic stochastic synthesis generator++ Gendy5 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0+-}+gendy5 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy5 rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy5" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) NoId++{- | Read (numeric) shell environment variables into a synth++ Getenv [] key=0 defaultval=0+-}+getenv :: Rate -> Ugen -> Ugen -> Ugen+getenv rate key defaultval = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Getenv" [key, defaultval] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchBPF [ControlRate,AudioRate] in=0 freq=440 rq=1+-}+glitchBPF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+glitchBPF rate in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GlitchBPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchBRF [ControlRate,AudioRate] in=0 freq=440 rq=1+-}+glitchBRF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+glitchBRF rate in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GlitchBRF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchHPF [ControlRate,AudioRate] in=0 freq=440+-}+glitchHPF :: Rate -> Ugen -> Ugen -> Ugen+glitchHPF rate in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GlitchHPF" [in_, freq] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchRHPF [ControlRate,AudioRate] in=0 freq=440 rq=1;    FILTER: TRUE+-}+glitchRHPF :: Ugen -> Ugen -> Ugen -> Ugen+glitchRHPF in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "GlitchRHPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Calculate a single DFT bin, to detect presence of a frequency++ Goertzel [ControlRate] in=0 bufsize=1024 freq=0 hop=1+-}+goertzel :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+goertzel rate in_ bufsize freq hop = mkUgen Nothing [ControlRate] (Left rate) "Goertzel" [in_, bufsize, freq, hop] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ GrainBufJ [AudioRate] numChannels=1 trigger=0 dur=1 sndbuf=0 rate=1 pos=0 loop=0 interp=2 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainBufJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainBufJ rate numChannels trigger dur sndbuf rate_ pos loop interp grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainBufJ" [numChannels, trigger, dur, sndbuf, rate_, pos, loop, interp, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GrainFMJ [AudioRate] numChannels=1 trigger=0 dur=1 carfreq=440 modfreq=200 index=1 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainFMJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainFMJ rate numChannels trigger dur carfreq modfreq index_ grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainFMJ" [numChannels, trigger, dur, carfreq, modfreq, index_, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GrainInJ [AudioRate] numChannels=1 trigger=0 dur=1 in=0 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainInJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainInJ rate numChannels trigger dur in_ grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainInJ" [numChannels, trigger, dur, in_, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GrainSinJ [AudioRate] numChannels=1 trigger=0 dur=1 freq=440 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainSinJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainSinJ rate numChannels trigger dur freq grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainSinJ" [numChannels, trigger, dur, freq, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | dynamical system simulation (Newtonian gravitational force)++ GravityGrid [AudioRate] reset=0 rate=0.1 newx=0 newy=0 bufnum=0+-}+gravityGrid :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gravityGrid rate reset rate_ newx newy bufnum = mkUgen Nothing [AudioRate] (Left rate) "GravityGrid" [reset, rate_, newx, newy, bufnum] Nothing 1 (Special 0) NoId++{- | dynamical system simulation (Newtonian gravitational force)++ GravityGrid2 [AudioRate] reset=0 rate=0.1 newx=0 newy=0 bufnum=0+-}+gravityGrid2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gravityGrid2 rate reset rate_ newx newy bufnum = mkUgen Nothing [AudioRate] (Left rate) "GravityGrid2" [reset, rate_, newx, newy, bufnum] Nothing 1 (Special 0) NoId++{- | algorithmic delay++ GreyholeRaw [AudioRate] in1=0 in2=0 damping=0 delaytime=2 diffusion=0.5 feedback=0.9 moddepth=0.1 modfreq=2 size=1;    FILTER: TRUE+-}+greyholeRaw :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+greyholeRaw in1 in2 damping delaytime diffusion feedback moddepth modfreq size = mkUgen Nothing [AudioRate] (Right [0, 1]) "GreyholeRaw" [in1, in2, damping, delaytime, diffusion, feedback, moddepth, modfreq, size] Nothing 2 (Special 0) NoId++{- | Simple cochlear hair cell model++ HairCell [ControlRate,AudioRate] input=0 spontaneousrate=0 boostrate=200 restorerate=1000 loss=0.99;    FILTER: TRUE+-}+hairCell :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+hairCell input spontaneousrate boostrate restorerate loss = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HairCell" [input, spontaneousrate, boostrate, restorerate, loss] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ HarmonicOsc [ControlRate,AudioRate] freq=100 firstharmonic=1 *amplitudes=0;    MCE=1+-}+harmonicOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+harmonicOsc rate freq firstharmonic amplitudes = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "HarmonicOsc" [freq, firstharmonic] (Just [amplitudes]) 1 (Special 0) NoId++{- | henon map 2D chaotic generator++ Henon2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henon2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henon2DC rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Henon2DC" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | henon map 2D chaotic generator++ Henon2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henon2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henon2DL rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Henon2DL" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | henon map 2D chaotic generator++ Henon2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henon2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henon2DN rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Henon2DN" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ HenonTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henonTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonTrig rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "HenonTrig" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | Transform a cepstrum back to a spectrum++ ICepstrum [] cepchain=0 fftbuf=0+-}+iCepstrum :: Rate -> Ugen -> Ugen -> Ugen+iCepstrum rate cepchain fftbuf = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "ICepstrum" [cepchain, fftbuf] Nothing 1 (Special 0) NoId++{- | 24db/oct rolloff, 4nd order resonant Low Pass Filter++ IirFilter [AudioRate] in=0 freq=440 rq=1;    FILTER: TRUE+-}+iirFilter :: Ugen -> Ugen -> Ugen -> Ugen+iirFilter in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "IirFilter" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrain [AudioRate] trigger=0 dur=1 in=0+-}+inGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+inGrain rate trigger dur in_ = mkUgen Nothing [AudioRate] (Left rate) "InGrain" [trigger, dur, in_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrainB [AudioRate] trigger=0 dur=1 in=0 envbuf=0+-}+inGrainB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainB rate trigger dur in_ envbuf = mkUgen Nothing [AudioRate] (Left rate) "InGrainB" [trigger, dur, in_, envbuf] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrainBBF [AudioRate] trigger=0 dur=1 in=0 envbuf=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+inGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainBBF rate trigger dur in_ envbuf azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "InGrainBBF" [trigger, dur, in_, envbuf, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ InGrainBF [AudioRate] trigger=0 dur=1 in=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+inGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainBF rate trigger dur in_ azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "InGrainBF" [trigger, dur, in_, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ InGrainI [AudioRate] trigger=0 dur=1 in=0 envbuf1=0 envbuf2=0 ifac=0.5+-}+inGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainI rate trigger dur in_ envbuf1 envbuf2 ifac = mkUgen Nothing [AudioRate] (Left rate) "InGrainI" [trigger, dur, in_, envbuf1, envbuf2, ifac] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrainIBF [AudioRate] trigger=0 dur=1 in=0 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 wComp=0+-}+inGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainIBF rate trigger dur in_ envbuf1 envbuf2 ifac azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "InGrainIBF" [trigger, dur, in_, envbuf1, envbuf2, ifac, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Distortion by subtracting magnitude from 1++ InsideOut [ControlRate,AudioRate] in=0+-}+insideOut :: Rate -> Ugen -> Ugen+insideOut rate in_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "InsideOut" [in_] Nothing 1 (Special 0) NoId++{- | instruction synthesis (breakpoint set interpreter)++ Instruction [AudioRate] bufnum=0+-}+instruction :: Rate -> Ugen -> Ugen+instruction rate bufnum = mkUgen Nothing [AudioRate] (Left rate) "Instruction" [bufnum] Nothing 1 (Special 0) NoId++{- | Raw version of the JPverb algorithmic reverberator, designed to produce long tails with chorusing++ JPverbRaw [ControlRate,AudioRate] in1=0 in2=0 damp=0 earlydiff=0.707 highband=2000 highx=1 lowband=500 lowx=1 mdepth=0.1 mfreq=2 midx=1 size=1 t60=1;    FILTER: TRUE+-}+jPverbRaw :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+jPverbRaw in1 in2 damp earlydiff highband highx lowband lowx mdepth mfreq midx size t60 = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "JPverbRaw" [in1, in2, damp, earlydiff, highband, highx, lowband, lowx, mdepth, mfreq, midx, size, t60] Nothing 2 (Special 0) NoId++{- | k-means classification in real time++ KMeansRT [ControlRate] bufnum=0 inputdata=0 k=5 gate=1 reset=0 learn=1+-}+kMeansRT :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+kMeansRT rate bufnum inputdata k gate_ reset learn = mkUgen Nothing [ControlRate] (Left rate) "KMeansRT" [bufnum, inputdata, k, gate_, reset, learn] Nothing 1 (Special 0) NoId++{- | Running score of maximum correlation of chromagram with key profiles++ KeyClarity [ControlRate] chain=0 keydecay=2 chromaleak=0.5+-}+keyClarity :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+keyClarity rate chain keydecay chromaleak = mkUgen Nothing [ControlRate] (Left rate) "KeyClarity" [chain, keydecay, chromaleak] Nothing 1 (Special 0) NoId++{- | Find best correlated key mode with chromagram between major, minor and chromatic cluster++ KeyMode [ControlRate] chain=0 keydecay=2 chromaleak=0.5+-}+keyMode :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+keyMode rate chain keydecay chromaleak = mkUgen Nothing [ControlRate] (Left rate) "KeyMode" [chain, keydecay, chromaleak] Nothing 1 (Special 0) NoId++{- | K-means Oscillator++ KmeansToBPSet1 [AudioRate] freq=440 numdatapoints=20 maxnummeans=4 nummeans=4 tnewdata=1 tnewmeans=1 soft=1 bufnum=0+-}+kmeansToBPSet1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+kmeansToBPSet1 rate freq numdatapoints maxnummeans nummeans tnewdata tnewmeans soft bufnum = mkUgen Nothing [AudioRate] (Left rate) "KmeansToBPSet1" [freq, numdatapoints, maxnummeans, nummeans, tnewdata, tnewmeans, soft, bufnum] Nothing 1 (Special 0) NoId++{-+-- | Run any LADSPA plugin inside SuperCollider+--+--  LADSPA [AudioRate] nChans=0 id=0 args=0+ladspa :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+ladspa rate nChans id_ args = mkUgen Nothing [AudioRate] (Left rate) "LADSPA" [nChans,id_,args] Nothing 0 (Special 0) NoId+-}++{- | random walk step++ LFBrownNoise0 [ControlRate,AudioRate] freq=20 dev=1 dist=0;    NONDET+-}+lfBrownNoise0Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise0Id z rate freq dev dist = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFBrownNoise0" [freq, dev, dist] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFBrownNoise0.+lfBrownNoise0M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> m Ugen+lfBrownNoise0M = liftUid4 lfBrownNoise0Id++-- | Unsafe variant of LFBrownNoise0.+lfBrownNoise0 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise0 = liftUnsafe4 lfBrownNoise0M++{- | random walk linear interp++ LFBrownNoise1 [ControlRate,AudioRate] freq=20 dev=1 dist=0;    NONDET+-}+lfBrownNoise1Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise1Id z rate freq dev dist = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFBrownNoise1" [freq, dev, dist] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFBrownNoise1.+lfBrownNoise1M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> m Ugen+lfBrownNoise1M = liftUid4 lfBrownNoise1Id++-- | Unsafe variant of LFBrownNoise1.+lfBrownNoise1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise1 = liftUnsafe4 lfBrownNoise1M++{- | random walk cubic interp++ LFBrownNoise2 [ControlRate,AudioRate] freq=20 dev=1 dist=0;    NONDET+-}+lfBrownNoise2Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise2Id z rate freq dev dist = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFBrownNoise2" [freq, dev, dist] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFBrownNoise2.+lfBrownNoise2M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> m Ugen+lfBrownNoise2M = liftUid4 lfBrownNoise2Id++-- | Unsafe variant of LFBrownNoise2.+lfBrownNoise2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise2 = liftUnsafe4 lfBrownNoise2M++{- | Live Linear Predictive Coding Analysis and Resynthesis++ LPCAnalyzer [AudioRate] input=0 source=0.01 n=256 p=10 testE=0 delta=0.999 windowtype=0;    FILTER: TRUE+-}+lpcAnalyzer :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lpcAnalyzer input source n p testE delta windowtype = mkUgen Nothing [AudioRate] (Right [0, 1]) "LPCAnalyzer" [input, source, n, p, testE, delta, windowtype] Nothing 1 (Special 0) NoId++{- | Linear Predictive Coding Gone Wrong++ LPCError [AudioRate] input=0 p=10+-}+lpcError :: Rate -> Ugen -> Ugen -> Ugen+lpcError rate input p = mkUgen Nothing [AudioRate] (Left rate) "LPCError" [input, p] Nothing 1 (Special 0) NoId++{- | Utilize LPC data++ LPCSynth [AudioRate] buffer=0 signal=0 pointer=0+-}+lpcSynth :: Ugen -> Ugen -> Ugen -> Ugen+lpcSynth buffer signal pointer = mkUgen Nothing [AudioRate] (Left AudioRate) "LPCSynth" [buffer, signal, pointer] Nothing 1 (Special 0) NoId++{- | Utilize LPC data++ LPCVals [ControlRate,AudioRate] buffer=0 pointer=0+-}+lpcVals :: Ugen -> Ugen -> Ugen+lpcVals buffer pointer = mkUgen Nothing [ControlRate, AudioRate] (Left AudioRate) "LPCVals" [buffer, pointer] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ LPF1 [ControlRate,AudioRate] in=0 freq=1000+-}+lpf1 :: Rate -> Ugen -> Ugen -> Ugen+lpf1 rate in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LPF1" [in_, freq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LPF18 [AudioRate] in=0 freq=100 res=1 dist=0.4+-}+lpf18 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lpf18 rate in_ freq res dist = mkUgen Nothing [AudioRate] (Left rate) "LPF18" [in_, freq, res, dist] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LPFVS6 [ControlRate,AudioRate] in=0 freq=1000 slope=0.5+-}+lpfvs6 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lpfvs6 rate in_ freq slope_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LPFVS6" [in_, freq, slope_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LPG [AudioRate] input=0 controlinput=0 controloffset=0 controlscale=1 vca=1 resonance=1.5 lowpassmode=1 linearity=1;    FILTER: TRUE+-}+lpg :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lpg input controlinput controloffset controlscale vca resonance lowpassmode linearity = mkUgen Nothing [AudioRate] (Right [0]) "LPG" [input, controlinput, controloffset, controlscale, vca, resonance, lowpassmode, linearity] Nothing 1 (Special 0) NoId++{- | Linear Time Invariant General Filter Equation++ LTI [AudioRate] input=0 bufnuma=0 bufnumb=1+-}+lti :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lti rate input bufnuma bufnumb = mkUgen Nothing [AudioRate] (Left rate) "LTI" [input, bufnuma, bufnumb] Nothing 1 (Special 0) NoId++{- | latoocarfian 2D chaotic generator++ Latoocarfian2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfian2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfian2DC rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Latoocarfian2DC" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | latoocarfian 2D chaotic generator++ Latoocarfian2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfian2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfian2DL rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Latoocarfian2DL" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | latoocarfian 2D chaotic generator++ Latoocarfian2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfian2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfian2DN rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Latoocarfian2DN" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LatoocarfianTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfianTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianTrig rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LatoocarfianTrig" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | Emit a sequence of triggers at specified time offsets++ ListTrig [ControlRate] bufnum=0 reset=0 offset=0 numframes=0+-}+listTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+listTrig rate bufnum reset offset numframes = mkUgen Nothing [ControlRate] (Left rate) "ListTrig" [bufnum, reset, offset, numframes] Nothing 1 (Special 0) NoId++{- | Emit a sequence of triggers at specified time offsets++ ListTrig2 [ControlRate] bufnum=0 reset=0 numframes=0+-}+listTrig2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+listTrig2 rate bufnum reset numframes = mkUgen Nothing [ControlRate] (Left rate) "ListTrig2" [bufnum, reset, numframes] Nothing 1 (Special 0) NoId++{- | Store values to a buffer, whenever triggered++ Logger [ControlRate] inputArray=0 trig=0 bufnum=0 reset=0+-}+logger :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+logger rate inputArray trig_ bufnum reset = mkUgen Nothing [ControlRate] (Left rate) "Logger" [inputArray, trig_, bufnum, reset] Nothing 1 (Special 0) NoId++{- | sample looping oscillator++ LoopBuf [AudioRate] bufnum=0 rate=1 gate=1 startPos=0 startLoop=0 endLoop=0 interpolation=2;    NC INPUT: True+-}+loopBuf :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+loopBuf numChannels rate bufnum rate_ gate_ startPos startLoop endLoop interpolation = mkUgen Nothing [AudioRate] (Left rate) "LoopBuf" [bufnum, rate_, gate_, startPos, startLoop, endLoop, interpolation] Nothing numChannels (Special 0) NoId++{- | lorenz 2D chaotic generator++ Lorenz2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenz2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenz2DC rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Lorenz2DC" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | lorenz 2D chaotic generator++ Lorenz2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenz2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenz2DL rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Lorenz2DL" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | lorenz 2D chaotic generator++ Lorenz2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenz2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenz2DN rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Lorenz2DN" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | lorenz chaotic trigger generator++ LorenzTrig [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenzTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenzTrig rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LorenzTrig" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | simple resonating lowpass filter++ Lores [AudioRate] in=0 freq=880 res=0.5;    FILTER: TRUE+-}+lores :: Ugen -> Ugen -> Ugen -> Ugen+lores in_ freq res = mkUgen Nothing [AudioRate] (Right [0]) "Lores" [in_, freq, res] Nothing 1 (Special 0) NoId++{- | 2-species Predator-Prey model++ LotkaVolterra [AudioRate] freq=22050 a=1.5 b=1.5 c=0.5 d=1.5 h=0.05 xi=1 yi=0.2+-}+lotkaVolterra :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lotkaVolterra rate freq a b c d h xi yi = mkUgen Nothing [AudioRate] (Left rate) "LotkaVolterra" [freq, a, b, c, d, h, xi, yi] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ MCLDChaosGen [] maxSize=0+-}+mcldChaosGen :: Rate -> Ugen -> Ugen+mcldChaosGen rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "MCLDChaosGen" [maxSize] Nothing 1 (Special 0) NoId++{- | POKEY Chip Sound Simulator++ MZPokey [AudioRate] audf1=0 audc1=0 audf2=0 audc2=0 audf3=0 audc3=0 audf4=0 audc4=0 audctl=0+-}+mzPokey :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+mzPokey rate audf1 audc1 audf2 audc2 audf3 audc3 audf4 audc4 audctl = mkUgen Nothing [AudioRate] (Left rate) "MZPokey" [audf1, audc1, audf2, audc2, audf3, audc3, audf4, audc4, audctl] Nothing 1 (Special 0) NoId++{- | First order Markov Chain implementation for audio signals++ MarkovSynth [AudioRate] in=0 isRecording=1 waitTime=2 tableSize=10+-}+markovSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+markovSynth rate in_ isRecording waitTime tableSize = mkUgen Nothing [AudioRate] (Left rate) "MarkovSynth" [in_, isRecording, waitTime, tableSize] Nothing 1 (Special 0) NoId++{- | Real time sparse representation++ MatchingP [ControlRate,AudioRate] dict=0 in=0 dictsize=1 ntofind=1 hop=1 method=0+-}+matchingP :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+matchingP rate dict in_ dictsize ntofind hop method = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MatchingP" [dict, in_, dictsize, ntofind, hop, method] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ MatchingPResynth [ControlRate,AudioRate] dict=0 method=0 trigger=0 residual=0 activs=0+-}+matchingPResynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+matchingPResynth rate dict method trigger residual activs = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MatchingPResynth" [dict, method, trigger, residual, activs] Nothing 1 (Special 0) NoId++{- | maximum within last x samples++ Max [ControlRate] in=0 numsamp=64+-}+max :: Rate -> Ugen -> Ugen -> Ugen+max rate in_ numsamp = mkUgen Nothing [ControlRate] (Left rate) "Max" [in_, numsamp] Nothing 1 (Special 0) NoId++{- | Tracks and prints amplitudes++ Maxamp [AudioRate] in=0 numSamps=1000+-}+maxamp :: Rate -> Ugen -> Ugen -> Ugen+maxamp rate in_ numSamps = mkUgen Nothing [AudioRate] (Left rate) "Maxamp" [in_, numSamps] Nothing 1 (Special 0) NoId++{- | Piano synthesiser++ MdaPiano [AudioRate] freq=440 gate=1 vel=100 decay=0.8 release=0.8 hard=0.8 velhard=0.8 muffle=0.8 velmuff=0.8 velcurve=0.8 stereo=0.2 tune=0.5 random=0.1 stretch=0.1 sustain=0+-}+mdaPiano :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+mdaPiano rate freq gate_ vel decay_ release hard velhard muffle velmuff velcurve stereo tune random stretch sustain = mkUgen Nothing [AudioRate] (Left rate) "MdaPiano" [freq, gate_, vel, decay_, release, hard, velhard, muffle, velmuff, velcurve, stereo, tune, random, stretch, sustain] Nothing 2 (Special 0) NoId++{- | Mean of recent values, triggered++ MeanTriggered [ControlRate,AudioRate] in=0 trig=0 length=10+-}+meanTriggered :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+meanTriggered rate in_ trig_ length_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MeanTriggered" [in_, trig_, length_] Nothing 1 (Special 0) NoId++{- | Meddis cochlear hair cell model++ Meddis [ControlRate,AudioRate] input=0;    FILTER: TRUE+-}+meddis :: Ugen -> Ugen+meddis input = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Meddis" [input] Nothing 1 (Special 0) NoId++{- | Separate harmonic and percussive parts of a signal++ MedianSeparation [] fft=0 fftharmonic=0 fftpercussive=0 fftsize=1024 mediansize=17 hardorsoft=0 p=2 medianormax=0+-}+medianSeparation :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+medianSeparation rate fft_ fftharmonic fftpercussive fftsize mediansize hardorsoft p medianormax = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "MedianSeparation" [fft_, fftharmonic, fftpercussive, fftsize, mediansize, hardorsoft, p, medianormax] Nothing 2 (Special 0) NoId++{- | Median of recent values, triggered++ MedianTriggered [ControlRate,AudioRate] in=0 trig=0 length=10+-}+medianTriggered :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+medianTriggered rate in_ trig_ length_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MedianTriggered" [in_, trig_, length_] Nothing 1 (Special 0) NoId++{- | Waveguide mesh physical models of drum membranes++ MembraneCircle [AudioRate] excitation=0 tension=0.05 loss=0.99999+-}+membraneCircle :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+membraneCircle rate excitation tension loss = mkUgen Nothing [AudioRate] (Left rate) "MembraneCircle" [excitation, tension, loss] Nothing 1 (Special 0) NoId++{- | Waveguide mesh physical models of drum membranes++ MembraneHexagon [AudioRate] excitation=0 tension=0.05 loss=0.99999+-}+membraneHexagon :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+membraneHexagon rate excitation tension loss = mkUgen Nothing [AudioRate] (Left rate) "MembraneHexagon" [excitation, tension, loss] Nothing 1 (Special 0) NoId++{- | Metronome++ Metro [ControlRate,AudioRate] bpm=0 numBeats=0+-}+metro :: Rate -> Ugen -> Ugen -> Ugen+metro rate bpm numBeats = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Metro" [bpm, numBeats] Nothing 1 (Special 0) NoId++{- | a macro oscillator++ MiBraids [AudioRate] pitch=60 timbre=0.5 color=0.5 model=0 trig=0 resamp=0 decim=0 bits=0 ws=0+-}+miBraids :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miBraids rate pitch_ timbre color model trig_ resamp decim bits ws = mkUgen Nothing [AudioRate] (Left rate) "MiBraids" [pitch_, timbre, color, model, trig_, resamp, decim, bits, ws] Nothing 1 (Special 0) NoId++{- | granular audio processor and texture synthesizer++ MiClouds [AudioRate] pit=0 pos=0.5 size=0.25 dens=0.4 tex=0.5 drywet=0.5 in_gain=1 spread=0.5 rvb=0 fb=0 freeze=0 mode=0 lofi=0 trig=0 *inputArray=0;    MCE=1, REORDERS INPUTS: [14,0,1,2,3,4,5,6,7,8,9,10,11,12,13]+-}+miClouds :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miClouds rate pit pos size dens tex drywet in_gain spread rvb fb freeze mode lofi trig_ inputArray = mkUgen Nothing [AudioRate] (Left rate) "MiClouds" [pit, pos, size, dens, tex, drywet, in_gain, spread, rvb, fb, freeze, mode, lofi, trig_] (Just [inputArray]) 2 (Special 0) NoId++{- | Physical modelling based on Modal Synthesis.++ MiElements [AudioRate] blow_in=0 strike_in=0 gate=0 pit=48 strength=0.5 contour=0.2 bow_level=0 blow_level=0 strike_level=0 flow=0.5 mallet=0.5 bow_timb=0.5 blow_timb=0.5 strike_timb=0.5 geom=0.25 bright=0.5 damp=0.7 pos=0.2 space=0.3 model=0 easteregg=0+-}+miElements :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miElements rate blow_in strike_in gate_ pit strength contour bow_level blow_level strike_level flow mallet bow_timb blow_timb strike_timb geom bright damp pos space model easteregg = mkUgen Nothing [AudioRate] (Left rate) "MiElements" [blow_in, strike_in, gate_, pit, strength, contour, bow_level, blow_level, strike_level, flow, mallet, bow_timb, blow_timb, strike_timb, geom, bright, damp, pos, space, model, easteregg] Nothing 2 (Special 0) NoId++{- | topographic drum sequencer++ MiGrids [AudioRate] bpm=120 map_x=0.5 map_y=0.5 chaos=0 bd_density=0.25 sd_density=0.25 hh_density=0.25 mode=1 swing=0 config=0+-}+miGrids :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miGrids rate bpm map_x map_y chaos bd_density sd_density hh_density mode swing config = mkUgen Nothing [AudioRate] (Left rate) "MiGrids" [bpm, map_x, map_y, chaos, bd_density, sd_density, hh_density, mode, swing, config] Nothing 6 (Special 0) NoId++{- | µ-law audio companding++ MiMu [AudioRate] in=0 gain=1 bypass=0+-}+miMu :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+miMu rate in_ gain bypass = mkUgen Nothing [AudioRate] (Left rate) "MiMu" [in_, gain, bypass] Nothing 1 (Special 0) NoId++{- | FM Synth-Voice based on 'ominous'++ MiOmi [AudioRate] audio_in=0 gate=0 pit=48 contour=0.2 detune=0.25 level1=0.5 level2=0.5 ratio1=0.5 ratio2=0.5 fm1=0 fm2=0 fb=0 xfb=0 filter_mode=0 cutoff=0.5 reson=0 strength=0.5 env=0.5 rotate=0.2 space=0.5+-}+miOmi :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miOmi rate audio_in gate_ pit contour detune level1 level2 ratio1 ratio2 fm1 fm2 fb xfb filter_mode cutoff reson strength env rotate_ space = mkUgen Nothing [AudioRate] (Left rate) "MiOmi" [audio_in, gate_, pit, contour, detune, level1, level2, ratio1, ratio2, fm1, fm2, fb, xfb, filter_mode, cutoff, reson, strength, env, rotate_, space] Nothing 2 (Special 0) NoId++{- | a macro oscillator++ MiPlaits [AudioRate] pitch=60 engine=0 harm=0.1 timbre=0.5 morph=0.5 trigger=0 level=0 fm_mod=0 timb_mod=0 morph_mod=0 decay=0.5 lpg_colour=0.5+-}+miPlaits :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miPlaits rate pitch_ engine harm timbre morph trigger level fm_mod timb_mod morph_mod decay_ lpg_colour = mkUgen Nothing [AudioRate] (Left rate) "MiPlaits" [pitch_, engine, harm, timbre, morph, trigger, level, fm_mod, timb_mod, morph_mod, decay_, lpg_colour] Nothing 2 (Special 0) NoId++{- | a resonator++ MiRings [AudioRate] in=0 trig=0 pit=60 struct=0.25 bright=0.5 damp=0.7 pos=0.25 model=0 poly=1 intern_exciter=0 easteregg=0 bypass=0+-}+miRings :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miRings rate in_ trig_ pit struct bright damp pos model poly intern_exciter easteregg bypass = mkUgen Nothing [AudioRate] (Left rate) "MiRings" [in_, trig_, pit, struct, bright, damp, pos, model, poly, intern_exciter, easteregg, bypass] Nothing 2 (Special 0) NoId++{- | Classic resonant LP filter++ MiRipples [AudioRate] in=0 cf=0.3 reson=0.2 drive=1;    FILTER: TRUE+-}+miRipples :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miRipples in_ cf reson drive = mkUgen Nothing [AudioRate] (Right [0]) "MiRipples" [in_, cf, reson, drive] Nothing 1 (Special 0) NoId++{- | a quad LFO++ MiTides [AudioRate] freq=1 shape=0.5 slope=0.5 smooth=0.5 shift=0.2 trig=0 clock=0 output_mode=3 ramp_mode=1 ratio=9 rate=1+-}+miTides :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miTides rate freq shape slope_ smooth shift trig_ clock output_mode ramp_mode ratio rate_ = mkUgen Nothing [AudioRate] (Left rate) "MiTides" [freq, shape, slope_, smooth, shift, trig_, clock, output_mode, ramp_mode, ratio, rate_] Nothing 4 (Special 0) NoId++{- | stereo reverb++ MiVerb [AudioRate] time=0.7 drywet=0.5 damp=0.5 hp=0.05 freeze=0 diff=0.625 *inputArray=0;    MCE=1, FILTER: TRUE, REORDERS INPUTS: [6,0,1,2,3,4,5]+-}+miVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miVerb time drywet damp hp freeze diff inputArray = mkUgen Nothing [AudioRate] (Right [6]) "MiVerb" [time, drywet, damp, hp, freeze, diff] (Just [inputArray]) 2 (Special 0) NoId++{- | a meta modulator++ MiWarps [AudioRate] carrier=0 modulator=0 lev1=0.5 lev2=0.5 algo=0 timb=0 osc=0 freq=110 vgain=1 easteregg=0+-}+miWarps :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miWarps rate carrier modulator lev1 lev2 algo timb osc_ freq vgain easteregg = mkUgen Nothing [AudioRate] (Left rate) "MiWarps" [carrier, modulator, lev1, lev2, algo, timb, osc_, freq, vgain, easteregg] Nothing 2 (Special 0) NoId++{- | Granulates real-time input++ MonoGrain [AudioRate] in=0 winsize=0.1 grainrate=10 winrandpct=0+-}+monoGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+monoGrain rate in_ winsize grainrate winrandpct = mkUgen Nothing [AudioRate] (Left rate) "MonoGrain" [in_, winsize, grainrate, winrandpct] Nothing 1 (Special 0) NoId++{- | Granulates real-time input with Ambisonic panning++ MonoGrainBF [AudioRate] in=0 winsize=0.1 grainrate=10 winrandpct=0 azimuth=0 azrand=0 elevation=0 elrand=0 rho=1+-}+monoGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+monoGrainBF rate in_ winsize grainrate winrandpct azimuth azrand elevation elrand rho = mkUgen Nothing [AudioRate] (Left rate) "MonoGrainBF" [in_, winsize, grainrate, winrandpct, azimuth, azrand, elevation, elrand, rho] Nothing 4 (Special 0) NoId++{- | Moog Filter Emulation++ MoogLadder [ControlRate,AudioRate] in=0 ffreq=440 res=0;    FILTER: TRUE+-}+moogLadder :: Ugen -> Ugen -> Ugen -> Ugen+moogLadder in_ ffreq res = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MoogLadder" [in_, ffreq, res] Nothing 1 (Special 0) NoId++{- | Moog  filter emulation++ MoogVCF [AudioRate] in=0 fco=0 res=0;    FILTER: TRUE+-}+moogVCF :: Ugen -> Ugen -> Ugen -> Ugen+moogVCF in_ fco res = mkUgen Nothing [AudioRate] (Right [0]) "MoogVCF" [in_, fco, res] Nothing 1 (Special 0) NoId++{- | Stereo reverb++ NHHall [AudioRate] in1=0.0 in2=0.0 rt60=1.0 stereo=0.5 lowFreq=200.0 lowRatio=0.5 hiFreq=4000.0 hiRatio=0.5 earlyDiffusion=0.5 lateDiffusion=0.5 modRate=0.2 modDepth=0.3+-}+nhHall :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nhHall in1 in2 rt60 stereo lowFreq lowRatio hiFreq hiRatio earlyDiffusion lateDiffusion modRate modDepth = mkUgen Nothing [AudioRate] (Right [0, 1]) "NHHall" [in1, in2, rt60, stereo, lowFreq, lowRatio, hiFreq, hiRatio, earlyDiffusion, lateDiffusion, modRate, modDepth] Nothing 2 (Special 0) NoId++{- | Non Linear Filter Equation++ NL [AudioRate] input=0 bufnuma=0 bufnumb=1 guard1=1000 guard2=100+-}+nl :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nl rate input bufnuma bufnumb guard1 guard2 = mkUgen Nothing [AudioRate] (Left rate) "NL" [input, bufnuma, bufnumb, guard1, guard2] Nothing 1 (Special 0) NoId++{- | Arbitrary Non Linear Filter Equation++ NL2 [AudioRate] input=0 bufnum=0 maxsizea=10 maxsizeb=10 guard1=1000 guard2=100+-}+nl2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nl2 rate input bufnum maxsizea maxsizeb guard1 guard2 = mkUgen Nothing [AudioRate] (Left rate) "NL2" [input, bufnum, maxsizea, maxsizeb, guard1, guard2] Nothing 1 (Special 0) NoId++{- | Non-linear Filter++ NLFiltC [ControlRate,AudioRate] input=0 a=0 b=0 d=0 c=0 l=0+-}+nlFiltC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nlFiltC rate input a b d c l = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NLFiltC" [input, a, b, d, c, l] Nothing 1 (Special 0) NoId++{- | Non-linear Filter++ NLFiltL [ControlRate,AudioRate] input=0 a=0 b=0 d=0 c=0 l=0+-}+nlFiltL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nlFiltL rate input a b d c l = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NLFiltL" [input, a, b, d, c, l] Nothing 1 (Special 0) NoId++{- | Non-linear Filter++ NLFiltN [ControlRate,AudioRate] input=0 a=0 b=0 d=0 c=0 l=0+-}+nlFiltN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nlFiltN rate input a b d c l = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NLFiltN" [input, a, b, d, c, l] Nothing 1 (Special 0) NoId++{- | physical modeling simulation; N tubes++ NTube [AudioRate] input=0 lossarray=1 karray=0 delaylengtharray=0+-}+nTube :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nTube rate input lossarray karray delaylengtharray = mkUgen Nothing [AudioRate] (Left rate) "NTube" [input, lossarray, karray, delaylengtharray] Nothing 1 (Special 0) NoId++{- | Find the nearest-neighbours in a set of points++ NearestN [ControlRate] treebuf=0 in=0 gate=1 num=1+-}+nearestN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nearestN rate treebuf in_ gate_ num = mkUgen Nothing [ControlRate] (Left rate) "NearestN" [treebuf, in_, gate_, num] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ NeedleRect [AudioRate] rate=1 imgWidth=100 imgHeight=100 rectX=0 rectY=0 rectW=100 rectH=100+-}+needleRect :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+needleRect rate rate_ imgWidth imgHeight rectX rectY rectW rectH = mkUgen Nothing [AudioRate] (Left rate) "NeedleRect" [rate_, imgWidth, imgHeight, rectX, rectY, rectW, rectH] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ NeoFormant [ControlRate,AudioRate] formantfreq=100 carrierfreq=200 phaseshift=0.5+-}+neoFormant :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+neoFormant rate formantfreq carrierfreq phaseshift = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NeoFormant" [formantfreq, carrierfreq, phaseshift] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ NeoVarSawOsc [ControlRate,AudioRate] freq=100 pw=0.5 waveshape=0.5+-}+neoVarSawOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+neoVarSawOsc rate freq pw waveshape = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NeoVarSawOsc" [freq, pw, waveshape] Nothing 1 (Special 0) NoId++{- | APU Chip Sound Simulator++ Nes2 [AudioRate] trig=0 a0=0 a1=0 a2=0 a3=0 b0=0 b1=0 b2=0 b3=0 c0=0 c2=0 c3=0 d0=0 d2=0 d3=0 e0=0 e1=0 e2=0 e3=0 smask=0+-}+nes2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nes2 rate trig_ a0 a1 a2 a3 b0 b1 b2 b3 c0 c2 c3 d0 d2 d3 e0 e1 e2 e3 smask = mkUgen Nothing [AudioRate] (Left rate) "Nes2" [trig_, a0, a1, a2, a3, b0, b1, b2, b3, c0, c2, c3, d0, d2, d3, e0, e1, e2, e3, smask] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ NestedAllpassC [AudioRate] in=0 maxdelay1=0.036 delay1=0.036 gain1=0.08 maxdelay2=0.03 delay2=0.03 gain2=0.3;    FILTER: TRUE+-}+nestedAllpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nestedAllpassC in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 = mkUgen Nothing [AudioRate] (Right [0]) "NestedAllpassC" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ NestedAllpassL [AudioRate] in=0 maxdelay1=0.036 delay1=0.036 gain1=0.08 maxdelay2=0.03 delay2=0.03 gain2=0.3;    FILTER: TRUE+-}+nestedAllpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nestedAllpassL in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 = mkUgen Nothing [AudioRate] (Right [0]) "NestedAllpassL" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ NestedAllpassN [AudioRate] in=0 maxdelay1=0.036 delay1=0.036 gain1=0.08 maxdelay2=0.03 delay2=0.03 gain2=0.3;    FILTER: TRUE+-}+nestedAllpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nestedAllpassN in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 = mkUgen Nothing [AudioRate] (Right [0]) "NestedAllpassN" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSFold4 [AudioRate] in=0 lo=0 hi=0+-}+osFold4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osFold4 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSFold4" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSFold8 [AudioRate] in=0 lo=0 hi=0+-}+osFold8 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osFold8 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSFold8" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSTrunc4 [AudioRate] in=0 quant=0.5+-}+osTrunc4 :: Rate -> Ugen -> Ugen -> Ugen+osTrunc4 rate in_ quant = mkUgen Nothing [AudioRate] (Left rate) "OSTrunc4" [in_, quant] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSTrunc8 [AudioRate] in=0 quant=0.5+-}+osTrunc8 :: Rate -> Ugen -> Ugen -> Ugen+osTrunc8 rate in_ quant = mkUgen Nothing [AudioRate] (Left rate) "OSTrunc8" [in_, quant] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSWrap4 [AudioRate] in=0 lo=0 hi=0+-}+osWrap4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osWrap4 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSWrap4" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSWrap8 [AudioRate] in=0 lo=0 hi=0+-}+osWrap8 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osWrap8 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSWrap8" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Extract basic statistics from a series of onset triggers++ OnsetStatistics [ControlRate] input=0 windowsize=1 hopsize=0.1+-}+onsetStatistics :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+onsetStatistics rate input windowsize hopsize = mkUgen Nothing [ControlRate] (Left rate) "OnsetStatistics" [input, windowsize, hopsize] Nothing 3 (Special 0) NoId++{- | Chemical reaction modelling Oscillator++ Oregonator [AudioRate] reset=0 rate=0.01 epsilon=1 mu=1 q=1 initx=0.5 inity=0.5 initz=0.5+-}+oregonator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oregonator rate reset rate_ epsilon mu q initx inity initz = mkUgen Nothing [AudioRate] (Left rate) "Oregonator" [reset, rate_, epsilon, mu, q, initx, inity, initz] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ OscBank [ControlRate,AudioRate] freq=100 gain=1 saw8=0.5 square8=0.5 saw4=0.5 square4=0.5 saw2=0.5 square2=0.5 saw1=0.5+-}+oscBank :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oscBank rate freq gain saw8 square8 saw4 square4 saw2 square2 saw1 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "OscBank" [freq, gain, saw8, square8, saw4, square4, saw2, square2, saw1] Nothing 1 (Special 0) NoId++{- | Piano physical model.++ OteyPiano [AudioRate] freq=440 vel=1 t_gate=0 rmin=0.35 rmax=2 rampl=4 rampr=8 rcore=1 lmin=0.07 lmax=1.4 lampl=-4 lampr=4 rho=1 e=1 zb=1 zh=0 mh=1 k=0.2 alpha=1 p=1 hpos=0.142 loss=1 detune=0.0003 hammer_type=1+-}+oteyPiano :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oteyPiano rate freq vel t_gate rmin rmax rampl rampr rcore lmin lmax lampl lampr rho e zb zh mh k alpha p hpos loss detune hammer_type = mkUgen Nothing [AudioRate] (Left rate) "OteyPiano" [freq, vel, t_gate, rmin, rmax, rampl, rampr, rcore, lmin, lmax, lampl, lampr, rho, e, zb, zh, mh, k, alpha, p, hpos, loss, detune, hammer_type] Nothing 1 (Special 0) NoId++{- | Piano physical model.++ OteyPianoStrings [AudioRate] freq=440 vel=1 t_gate=0 rmin=0.35 rmax=2 rampl=4 rampr=8 rcore=1 lmin=0.07 lmax=1.4 lampl=-4 lampr=4 rho=1 e=1 zb=1 zh=0 mh=1 k=0.2 alpha=1 p=1 hpos=0.142 loss=1 detune=0.0003 hammer_type=1+-}+oteyPianoStrings :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oteyPianoStrings rate freq vel t_gate rmin rmax rampl rampr rcore lmin lmax lampl lampr rho e zb zh mh k alpha p hpos loss detune hammer_type = mkUgen Nothing [AudioRate] (Left rate) "OteyPianoStrings" [freq, vel, t_gate, rmin, rmax, rampl, rampr, rcore, lmin, lmax, lampl, lampr, rho, e, zb, zh, mh, k, alpha, p, hpos, loss, detune, hammer_type] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OteySoundBoard [AudioRate] inp=0 c1=20 c3=20 mix=0.8;    FILTER: TRUE+-}+oteySoundBoard :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oteySoundBoard inp c1 c3 mix = mkUgen Nothing [AudioRate] (Right [0]) "OteySoundBoard" [inp, c1, c3, mix] Nothing 1 (Special 0) NoId++{- | Return mag and freq data from a CSound pv++ PVInfo [ControlRate,AudioRate] pvbuffer=0 binNum=0 filePointer=0+-}+pvInfo :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+pvInfo rate pvbuffer binNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PVInfo" [pvbuffer, binNum, filePointer] Nothing 2 (Special 0) NoId++{- | Resynthesize Csound PV data++ PVSynth [AudioRate] pvbuffer=0 numBins=0 binStart=0 binSkip=1 filePointer=0 freqMul=1 freqAdd=0+-}+pvSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pvSynth rate pvbuffer numBins binStart binSkip filePointer freqMul freqAdd = mkUgen Nothing [AudioRate] (Left rate) "PVSynth" [pvbuffer, numBins, binStart, binSkip, filePointer, freqMul, freqAdd] Nothing 1 (Special 0) NoId++{- | Plays FFT data to a memory buffer++ PV_BinBufRd [ControlRate] buffer=0 playbuf=0 point=1 binStart=0 binSkip=1 numBins=1 clear=0+-}+pv_BinBufRd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinBufRd buffer playbuf_ point binStart binSkip numBins clear = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinBufRd" [buffer, playbuf_, point, binStart, binSkip, numBins, clear] Nothing 1 (Special 0) NoId++{- | Delay and Feedback on a bin by bin basis.++ PV_BinDelay [ControlRate] buffer=0 maxdelay=0 delaybuf=0 fbbuf=0 hop=0.5+-}+pv_BinDelay :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinDelay buffer maxdelay delaybuf fbbuf hop = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinDelay" [buffer, maxdelay, delaybuf, fbbuf, hop] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_BinFilter [ControlRate] buffer=0 start=0 end=0+-}+pv_BinFilter :: Ugen -> Ugen -> Ugen -> Ugen+pv_BinFilter buffer start end = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinFilter" [buffer, start, end] Nothing 1 (Special 0) NoId++{- | Plays FFT data to a memory buffer++ PV_BinPlayBuf [ControlRate] buffer=0 playbuf=0 rate=1 offset=0 binStart=0 binSkip=1 numBins=1 loop=0 clear=0+-}+pv_BinPlayBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinPlayBuf buffer playbuf_ rate_ offset binStart binSkip numBins loop clear = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinPlayBuf" [buffer, playbuf_, rate_, offset, binStart, binSkip, numBins, loop, clear] Nothing 1 (Special 0) NoId++{- | Plays FFT data from a memory buffer++ PV_BufRd [ControlRate] buffer=0 playbuf=0 point=1+-}+pv_BufRd :: Ugen -> Ugen -> Ugen -> Ugen+pv_BufRd buffer playbuf_ point = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BufRd" [buffer, playbuf_, point] Nothing 1 (Special 0) NoId++{- | returns common magnitudes++ PV_CommonMag [ControlRate] bufferA=0 bufferB=0 tolerance=0 remove=0+-}+pv_CommonMag :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_CommonMag bufferA bufferB tolerance remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_CommonMag" [bufferA, bufferB, tolerance, remove] Nothing 1 (Special 0) NoId++{- | multiplies common magnitudes++ PV_CommonMul [ControlRate] bufferA=0 bufferB=0 tolerance=0 remove=0+-}+pv_CommonMul :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_CommonMul bufferA bufferB tolerance remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_CommonMul" [bufferA, bufferB, tolerance, remove] Nothing 1 (Special 0) NoId++{- | simple spectral compression/expansion++ PV_Compander [ControlRate] buffer=0 thresh=50 slopeBelow=1 slopeAbove=1+-}+pv_Compander :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_Compander buffer thresh slopeBelow slopeAbove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Compander" [buffer, thresh, slopeBelow, slopeAbove] Nothing 1 (Special 0) NoId++{- | zero bins with interpolation++ PV_Cutoff [ControlRate] bufferA=0 bufferB=0 wipe=0+-}+pv_Cutoff :: Ugen -> Ugen -> Ugen -> Ugen+pv_Cutoff bufferA bufferB wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Cutoff" [bufferA, bufferB, wipe] Nothing 1 (Special 0) NoId++{- | Return the even numbered bins in an FFT buffer++ PV_EvenBin [ControlRate] buffer=0+-}+pv_EvenBin :: Ugen -> Ugen+pv_EvenBin buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_EvenBin" [buffer] Nothing 1 (Special 0) NoId++{- | extract a repeating loop out from audio++ PV_ExtractRepeat [ControlRate] buffer=0 loopbuf=0 loopdur=0 memorytime=30 which=0 ffthop=0.5 thresh=1+-}+pv_ExtractRepeat :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_ExtractRepeat buffer loopbuf_ loopdur memorytime which ffthop thresh = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_ExtractRepeat" [buffer, loopbuf_, loopdur, memorytime, which, ffthop, thresh] Nothing 1 (Special 0) NoId++{- | Freeze FFT frames++ PV_Freeze [ControlRate] buffer=0 freeze=0+-}+pv_Freeze :: Ugen -> Ugen -> Ugen+pv_Freeze buffer freeze = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Freeze" [buffer, freeze] Nothing 1 (Special 0) NoId++{- | Store FFT data in another buffer for other use++ PV_FreqBuffer [ControlRate] buffer=0 databuffer=0+-}+pv_FreqBuffer :: Ugen -> Ugen -> Ugen+pv_FreqBuffer buffer databuffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_FreqBuffer" [buffer, databuffer] Nothing 1 (Special 0) NoId++{- | Invert FFT frames++ PV_Invert [ControlRate] buffer=0+-}+pv_Invert :: Ugen -> Ugen+pv_Invert buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Invert" [buffer] Nothing 1 (Special 0) NoId++{- | Store FFT data in another buffer for other use++ PV_MagBuffer [ControlRate] buffer=0 databuffer=0+-}+pv_MagBuffer :: Ugen -> Ugen -> Ugen+pv_MagBuffer buffer databuffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagBuffer" [buffer, databuffer] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagExp [ControlRate] buffer=0+-}+pv_MagExp :: Ugen -> Ugen+pv_MagExp buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagExp" [buffer] Nothing 1 (Special 0) NoId++{- | reduces magnitudes above or below thresh++ PV_MagGate [ControlRate] buffer=0 thresh=1 remove=0+-}+pv_MagGate :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagGate buffer thresh remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagGate" [buffer, thresh, remove] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagLog [ControlRate] buffer=0+-}+pv_MagLog :: Ugen -> Ugen+pv_MagLog buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagLog" [buffer] Nothing 1 (Special 0) NoId++{- | Remap magnitudes to a new mag curve++ PV_MagMap [ControlRate] buffer=0 mapbuf=0+-}+pv_MagMap :: Ugen -> Ugen -> Ugen+pv_MagMap buffer mapbuf = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMap" [buffer, mapbuf] Nothing 1 (Special 0) NoId++{- | subtract spectral energy++ PV_MagMinus [ControlRate] bufferA=0 bufferB=0 remove=1+-}+pv_MagMinus :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagMinus bufferA bufferB remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMinus" [bufferA, bufferB, remove] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagMulAdd [ControlRate] buffer=0+-}+pv_MagMulAdd :: Ugen -> Ugen+pv_MagMulAdd buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMulAdd" [buffer] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagScale [ControlRate] bufferA=0 bufferB=0+-}+pv_MagScale :: Ugen -> Ugen -> Ugen+pv_MagScale bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagScale" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Smooth spectral magnitudes over time++ PV_MagSmooth [ControlRate] buffer=0 factor=0.1+-}+pv_MagSmooth :: Ugen -> Ugen -> Ugen+pv_MagSmooth buffer factor = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSmooth" [buffer, factor] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagSubtract [ControlRate] bufferA=0 bufferB=0 zerolimit=0+-}+pv_MagSubtract :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagSubtract bufferA bufferB zerolimit = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSubtract" [bufferA, bufferB, zerolimit] Nothing 1 (Special 0) NoId++{- | Return the N strongest bins++ PV_MaxMagN [ControlRate] buffer=0 numbins=0+-}+pv_MaxMagN :: Ugen -> Ugen -> Ugen+pv_MaxMagN buffer numbins = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MaxMagN" [buffer, numbins] Nothing 1 (Special 0) NoId++{- | Return the N weakest bins++ PV_MinMagN [ControlRate] buffer=0 numbins=0+-}+pv_MinMagN :: Ugen -> Ugen -> Ugen+pv_MinMagN buffer numbins = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MinMagN" [buffer, numbins] Nothing 1 (Special 0) NoId++{- | one kind of spectral morphing++ PV_Morph [ControlRate] bufferA=0 bufferB=0 morph=0+-}+pv_Morph :: Ugen -> Ugen -> Ugen -> Ugen+pv_Morph bufferA bufferB morph = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Morph" [bufferA, bufferB, morph] Nothing 1 (Special 0) NoId++{- | Return only bins that are unstable++ PV_NoiseSynthF [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_NoiseSynthF :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_NoiseSynthF buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_NoiseSynthF" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | Return only bins that are unstable++ PV_NoiseSynthP [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_NoiseSynthP :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_NoiseSynthP buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_NoiseSynthP" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | Return the odd numbered bins in an FFT buffer++ PV_OddBin [ControlRate] buffer=0+-}+pv_OddBin :: Ugen -> Ugen+pv_OddBin buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_OddBin" [buffer] Nothing 1 (Special 0) NoId++{- | Return only bins that are stable++ PV_PartialSynthF [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_PartialSynthF :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_PartialSynthF buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PartialSynthF" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | Return only bins that are stable++ PV_PartialSynthP [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_PartialSynthP :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_PartialSynthP buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PartialSynthP" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_PitchShift [ControlRate] buffer=0 ratio=0+-}+pv_PitchShift :: Ugen -> Ugen -> Ugen+pv_PitchShift buffer ratio = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PitchShift" [buffer, ratio] Nothing 1 (Special 0) NoId++{- | Plays FFT data to a memory buffer++ PV_PlayBuf [ControlRate] buffer=0 playbuf=0 rate=1 offset=0 loop=0+-}+pv_PlayBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_PlayBuf buffer playbuf_ rate_ offset loop = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PlayBuf" [buffer, playbuf_, rate_, offset, loop] Nothing 1 (Special 0) NoId++{- | Records FFT data to a memory buffer++ PV_RecordBuf [ControlRate] buffer=0 recbuf=0 offset=0 run=0 loop=0 hop=0.5 wintype=0+-}+pv_RecordBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RecordBuf buffer recbuf offset run loop hop wintype = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RecordBuf" [buffer, recbuf, offset, run, loop, hop, wintype] Nothing 1 (Special 0) NoId++{- | combine low and high bins from two inputs with interpolation++ PV_SoftWipe [ControlRate] bufferA=0 bufferB=0 wipe=0+-}+pv_SoftWipe :: Ugen -> Ugen -> Ugen -> Ugen+pv_SoftWipe bufferA bufferB wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_SoftWipe" [bufferA, bufferB, wipe] Nothing 1 (Special 0) NoId++{- | A harmonic enhancer++ PV_SpectralEnhance [ControlRate] buffer=0 numPartials=8 ratio=2 strength=0.1+-}+pv_SpectralEnhance :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_SpectralEnhance buffer numPartials ratio strength = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_SpectralEnhance" [buffer, numPartials, ratio, strength] Nothing 1 (Special 0) NoId++{- | Maps the spectral envelope of one FFT process onto another++ PV_SpectralMap [ControlRate] buffer=0 specBuffer=0 floor=0 freeze=0 mode=0 norm=0 window=0+-}+pv_SpectralMap :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_SpectralMap buffer specBuffer floor_ freeze mode norm window = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_SpectralMap" [buffer, specBuffer, floor_, freeze, mode, norm, window] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_Split [ControlRate] bufferA=0 bufferB=0+-}+pv_Split :: Ugen -> Ugen -> Ugen+pv_Split bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Split" [bufferA, bufferB] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ PV_Whiten [ControlRate] chain=0 trackbufnum=0 relaxtime=2 floor=0.1 smear=0 bindownsample=0+-}+pv_Whiten :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_Whiten chain trackbufnum relaxtime floor_ smear bindownsample = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Whiten" [chain, trackbufnum, relaxtime, floor_, smear, bindownsample] Nothing 1 (Special 0) NoId++{- | one kind of spectral morphing++ PV_XFade [ControlRate] bufferA=0 bufferB=0 fade=0+-}+pv_xFade :: Ugen -> Ugen -> Ugen -> Ugen+pv_xFade bufferA bufferB fade = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_XFade" [bufferA, bufferB, fade] Nothing 1 (Special 0) NoId++{- | Equal power pan across an array of speakers++ PanX [ControlRate,AudioRate] numChans=0 in=0 pos=0 level=1 width=2+-}+panX :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panX rate numChans in_ pos level width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PanX" [numChans, in_, pos, level, width] Nothing 0 (Special 0) NoId++{- | (Undocumented class)++ PanX2D [ControlRate,AudioRate] numChansX=0 numChansY=0 in=0 posX=0 posY=0 level=1 widthX=2 widthY=2+-}+panX2D :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panX2D rate numChansX numChansY in_ posX posY level widthX widthY = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PanX2D" [numChansX, numChansY, in_, posX, posY, level, widthX, widthY] Nothing 0 (Special 0) NoId++{- | (Undocumented class)++ PeakEQ2 [AudioRate] in=0 freq=1200 rs=1 db=0+-}+peakEQ2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+peakEQ2 rate in_ freq rs db = mkUgen Nothing [AudioRate] (Left rate) "PeakEQ2" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PeakEQ4 [AudioRate] in=0 freq=1200 rs=1 db=0+-}+peakEQ4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+peakEQ4 rate in_ freq rs db = mkUgen Nothing [AudioRate] (Left rate) "PeakEQ4" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | 3D Perlin Noise++ Perlin3 [ControlRate,AudioRate] x=0 y=0 z=0+-}+perlin3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+perlin3 rate x y z = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Perlin3" [x, y, z] Nothing 1 (Special 0) NoId++{- | Sample permutation Ugen.++ PermMod [AudioRate] in=0 freq=100+-}+permMod :: Rate -> Ugen -> Ugen -> Ugen+permMod rate in_ freq = mkUgen Nothing [AudioRate] (Left rate) "PermMod" [in_, freq] Nothing 1 (Special 0) NoId++{- | Sample permutation Ugen with programmable pattern.++ PermModArray [AudioRate] in=0 freq=50 pattern=0+-}+permModArray :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+permModArray rate in_ freq pattern_ = mkUgen Nothing [AudioRate] (Left rate) "PermModArray" [in_, freq, pattern_] Nothing 1 (Special 0) NoId++{- | Sample permutation Ugen with tail.++ PermModT [AudioRate] in=0 outfreq=440 infreq=5000+-}+permModT :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+permModT rate in_ outfreq infreq = mkUgen Nothing [AudioRate] (Left rate) "PermModT" [in_, outfreq, infreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PhasorModal [AudioRate] input=0 freq=100 decay=0.25 damp=1 amp=0.5 phase=0;    FILTER: TRUE+-}+phasorModal :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+phasorModal input freq decay_ damp amp phase = mkUgen Nothing [AudioRate] (Right [0]) "PhasorModal" [input, freq, decay_, damp, amp, phase] Nothing 1 (Special 0) NoId++{- | Tree classifier using (hyper)planes – Ugen or language-side++ PlaneTree [ControlRate] treebuf=0 in=0 gate=1+-}+planeTree :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+planeTree rate treebuf in_ gate_ = mkUgen Nothing [ControlRate] (Left rate) "PlaneTree" [treebuf, in_, gate_] Nothing 1 (Special 0) NoId++{- | POKEY Chip Sound Simulator++ Pokey [AudioRate] audf1=0 audc1=0 audf2=0 audc2=0 audf3=0 audc3=0 audf4=0 audc4=0 audctl=0+-}+pokey :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pokey rate audf1 audc1 audf2 audc2 audf3 audc3 audf4 audc4 audctl = mkUgen Nothing [AudioRate] (Left rate) "Pokey" [audf1, audc1, audf2, audc2, audf3, audc3, audf4, audc4, audctl] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PosRatio [AudioRate] in=0 period=100 thresh=0.1+-}+posRatio :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+posRatio rate in_ period thresh = mkUgen Nothing [AudioRate] (Left rate) "PosRatio" [in_, period, thresh] Nothing 1 (Special 0) NoId++{- | debug assistance++ PrintVal [ControlRate] in=0 numblocks=100 id=0+-}+printVal :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+printVal rate in_ numblocks id_ = mkUgen Nothing [ControlRate] (Left rate) "PrintVal" [in_, numblocks, id_] Nothing 1 (Special 0) NoId++{- | constant Q transform pitch follower++ Qitch [ControlRate] in=0 databufnum=0 ampThreshold=0.01 algoflag=1 ampbufnum=0 minfreq=0 maxfreq=2500+-}+qitch :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+qitch rate in_ databufnum ampThreshold algoflag ampbufnum minfreq maxfreq = mkUgen Nothing [ControlRate] (Left rate) "Qitch" [in_, databufnum, ampThreshold, algoflag, ampbufnum, minfreq, maxfreq] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ Bezier [ControlRate,AudioRate] haltAfter=100 dx=0.0001 freq=440 phase=0 *param=0;    MCE=1+-}+bezier :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bezier rate haltAfter dx freq phase param = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Bezier" [haltAfter, dx, freq, phase] (Just [param]) 1 (Special 0) NoId++{- | rotating clock divider++ RCD [AudioRate] clock=0 rotate=0 reset=0 div=0 spread=0 auto=0 len=0 down=0 gates=0;    FILTER: TRUE+-}+rcd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rcd clock rotate_ reset div_ spread auto len down gates = mkUgen Nothing [AudioRate] (Right [0]) "RCD" [clock, rotate_, reset, div_, spread, auto, len, down, gates] Nothing 8 (Special 0) NoId++{- | (Undocumented class)++ RDL [AudioRate] numChannels=1 inputArray=0+-}+rdl :: Rate -> Ugen -> Ugen -> Ugen+rdl rate numChannels inputArray = mkUgen Nothing [AudioRate] (Left rate) "RDL" [numChannels, inputArray] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DX7 [AudioRate] bufnum=0 on=0 off=0 data=0 vc=0 mnn=60 vel=99 pw=0 mw=0 bc=0 fc=0+-}+dx7 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dx7 rate bufnum on off data_ vc mnn vel pw mw bc fc = mkUgen Nothing [AudioRate] (Left rate) "DX7" [bufnum, on, off, data_, vc, mnn, vel, pw, mw, bc, fc] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RDX7Env [AudioRate] gate=0 data=0 r1=0 r2=0 r3=0 r4=0 l1=0 l2=0 l3=0 l4=0 ol=0+-}+rdx7Env :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rdx7Env rate gate_ data_ r1 r2 r3 r4 l1 l2 l3 l4 ol = mkUgen Nothing [AudioRate] (Left rate) "RDX7Env" [gate_, data_, r1, r2, r3, r4, l1, l2, l3, l4, ol] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RDelayMap [AudioRate] bufnum=0 in=0 dynamic=0 *spec=0;    MCE=1, FILTER: TRUE+-}+rDelayMap :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rDelayMap bufnum in_ dynamic spec = mkUgen Nothing [AudioRate] (Right [1]) "RDelayMap" [bufnum, in_, dynamic] (Just [spec]) 1 (Special 0) NoId++{- | (Undocumented class)++ RDelaySet [AudioRate] input=0 *setArray=0;    MCE=1, FILTER: TRUE+-}+rDelaySet :: Ugen -> Ugen -> Ugen+rDelaySet input setArray = mkUgen Nothing [AudioRate] (Right [0]) "RDelaySet" [input] (Just [setArray]) 1 (Special 0) NoId++{- | (Undocumented class)++ RDelaySetBuf [AudioRate] bufnum=0 in=0 spec=0+-}+rDelaySetBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rDelaySetBuf rate bufnum in_ spec = mkUgen Nothing [AudioRate] (Left rate) "RDelaySetBuf" [bufnum, in_, spec] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ dustRange [AudioRate] iot_min=0.1 iot_max=1+-}+dustRangeId :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen+dustRangeId z rate iot_min iot_max = mkUgen Nothing [AudioRate] (Left rate) "DustRange" [iot_min, iot_max] Nothing 1 (Special 0) (toUid z)++{- | (Undocumented class)++ ExpRandN [InitialisationRate] lo=0 hi=1;    NC INPUT: True, NONDET+-}+expRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen+expRandNId numChannels z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ExpRandN" [lo, hi] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of ExpRandN.+expRandNM :: Uid m => Int -> Ugen -> Ugen -> m Ugen+expRandNM nc = liftUid2 (expRandNId nc)++-- | Unsafe variant of ExpRandN.+expRandN :: Int -> Ugen -> Ugen -> Ugen+expRandN nc = liftUnsafe2 (expRandNM nc)++{- | (Undocumented class)++ Freezer [AudioRate] bufnum=0 left=0 right=1 gain=1 increment=1 incrementOffset=0 incrementRandom=0 rightRandom=0 syncPhaseTrigger=0 randomizePhaseTrigger=0 numberOfLoops=4+-}+freezer :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+freezer bufnum left right gain increment incrementOffset incrementRandom rightRandom syncPhaseTrigger randomizePhaseTrigger numberOfLoops = mkUgen Nothing [AudioRate] (Left AudioRate) "Freezer" [bufnum, left, right, gain, increment, incrementOffset, incrementRandom, rightRandom, syncPhaseTrigger, randomizePhaseTrigger, numberOfLoops] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ IRandN [] numChannels=2 lo=0 hi=127+-}+iRandNId :: ID a => a -> Int -> Ugen -> Ugen -> Ugen+iRandNId z numChannels lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "IRandN" [lo, hi] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of IRandN.+iRandNM :: Uid m => Int -> Ugen -> Ugen -> m Ugen+iRandNM nc = liftUid2 (iRandNId nc)++-- | Unsafe variant of IRandN.+iRandN :: Int -> Ugen -> Ugen -> Ugen+iRandN nc = liftUnsafe2 (iRandNM nc)++{- | TB303 Filter Emulation++ RLPFD [ControlRate,AudioRate] in=0 ffreq=440 res=0 dist=0;    FILTER: TRUE+-}+rlpfd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rlpfd in_ ffreq res dist = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RLPFD" [in_, ffreq, res, dist] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RLagC [ControlRate] in=0 timeUp=0.1 curveUp=0 timeDown=0.1 curveDown=0;    FILTER: TRUE+-}+rLagC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rLagC in_ timeUp curveUp timeDown curveDown = mkUgen Nothing [ControlRate] (Right [0]) "RLagC" [in_, timeUp, curveUp, timeDown, curveDown] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LinRandN [InitialisationRate] lo=0 hi=1 minmax=0;    NC INPUT: True, NONDET+-}+linRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen+linRandNId numChannels z lo hi minmax = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "LinRandN" [lo, hi, minmax] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of LinRandN.+linRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> m Ugen+linRandNM nc = liftUid3 (linRandNId nc)++-- | Unsafe variant of LinRandN.+linRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen+linRandN nc = liftUnsafe3 (linRandNM nc)++{- | (Undocumented class)++ RLoopSet [AudioRate] bufnum=0 left=0 right=1 gain=1 increment=1 spec=0+-}+rLoopSet :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rLoopSet rate bufnum left right gain increment spec = mkUgen Nothing [AudioRate] (Left rate) "RLoopSet" [bufnum, left, right, gain, increment, spec] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMAFoodChainL [AudioRate] freq=22050 a1=5 b1=3 d1=0.4 a2=0.1 b2=2 d2=0.01 k=1.0943 r=0.8904 h=0.05 xi=0.1 yi=0 zi=0+-}+rmaFoodChainL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rmaFoodChainL rate freq a1 b1 d1 a2 b2 d2 k r h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "RMAFoodChainL" [freq, a1, b1, d1, a2, b2, d2, k, r, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ RMEQ [AudioRate] in=0 freq=440 rq=0.1 k=0;    FILTER: TRUE+-}+rmeq :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rmeq in_ freq rq k = mkUgen Nothing [AudioRate] (Right [0]) "RMEQ" [in_, freq, rq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMEQSuite [] maxSize=0+-}+rmeqSuite :: Rate -> Ugen -> Ugen+rmeqSuite rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "RMEQSuite" [maxSize] Nothing 1 (Special 0) NoId++{- | root mean square++ RMS [ControlRate,AudioRate] in=0 lpFreq=10+-}+rms :: Rate -> Ugen -> Ugen -> Ugen+rms rate in_ lpFreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RMS" [in_, lpFreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMShelf [AudioRate] in=0 freq=440 k=0+-}+rmShelf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rmShelf rate in_ freq k = mkUgen Nothing [AudioRate] (Left rate) "RMShelf" [in_, freq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMShelf2 [AudioRate] in=0 freq=440 k=0+-}+rmShelf2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rmShelf2 rate in_ freq k = mkUgen Nothing [AudioRate] (Left rate) "RMShelf2" [in_, freq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ ObxdFilter [AudioRate] in=0 cutoff=440 resonance=0 multimode=0.5 bandpass=0 fourpole=0+-}+obxdFilter :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+obxdFilter in_ cutoff resonance multimode bandpass fourpole = mkUgen Nothing [AudioRate] (Right [0]) "ObxdFilter" [in_, cutoff, resonance, multimode, bandpass, fourpole] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RPVDecayTbl [] fft_buf=0 decay_rate_buf=0 history_buf=0+-}+rpvDecayTbl :: Ugen -> Ugen -> Ugen -> Ugen+rpvDecayTbl fft_buf decay_rate_buf history_buf = mkUgen Nothing [ControlRate] (Left ControlRate) "RPVDecayTbl" [fft_buf, decay_rate_buf, history_buf] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RandN [InitialisationRate] lo=0 hi=1;    NC INPUT: True, NONDET+-}+randNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen+randNId numChannels z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "RandN" [lo, hi] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of RandN.+randNM :: Uid m => Int -> Ugen -> Ugen -> m Ugen+randNM nc = liftUid2 (randNId nc)++-- | Unsafe variant of RandN.+randN :: Int -> Ugen -> Ugen -> Ugen+randN nc = liftUnsafe2 (randNM nc)++{- | (Undocumented class)++ RSVFBP [AudioRate] in=0 freq=440 q=0+-}+svfBp :: Ugen -> Ugen -> Ugen -> Ugen+svfBp in_ freq q = mkUgen Nothing [AudioRate] (Right [0]) "SvfBp" [in_, freq, q] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SvfHp [AudioRate] in=0 freq=440 q=0+-}+svfHp :: Ugen -> Ugen -> Ugen -> Ugen+svfHp in_ freq q = mkUgen Nothing [AudioRate] (Right [0]) "SvfHp" [in_, freq, q] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SvflP [AudioRate] in=0 freq=440 q=0+-}+svfLp :: Ugen -> Ugen -> Ugen -> Ugen+svfLp in_ freq q = mkUgen Nothing [AudioRate] (Right [0]) "SvfLp" [in_, freq, q] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ ShufflerB [AudioRate] bufnum=0 readLocationMinima=0.01 readLocationMaxima=0.02 readIncrementMinima=1 readIncrementMaxima=1 durationMinima=0.2 durationMaxima=0.2 envelopeAmplitudeMinima=0.5 envelopeAmplitudeMaxima=0.5 envelopeShapeMinima=0.5 envelopeShapeMaxima=0.5 envelopeSkewMinima=0.5 envelopeSkewMaxima=0.5 stereoLocationMinima=0.5 stereoLocationMaxima=0.5 interOffsetTimeMinima=0.05 interOffsetTimeMaxima=0.01 ftableReadLocationIncrement=1 readIncrementQuanta=0 interOffsetTimeQuanta=0+-}+shufflerB :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+shufflerB bufnum readLocationMinima readLocationMaxima readIncrementMinima readIncrementMaxima durationMinima durationMaxima envelopeAmplitudeMinima envelopeAmplitudeMaxima envelopeShapeMinima envelopeShapeMaxima envelopeSkewMinima envelopeSkewMaxima stereoLocationMinima stereoLocationMaxima interOffsetTimeMinima interOffsetTimeMaxima ftableReadLocationIncrement readIncrementQuanta interOffsetTimeQuanta = mkUgen Nothing [AudioRate] (Left AudioRate) "ShufflerB" [bufnum, readLocationMinima, readLocationMaxima, readIncrementMinima, readIncrementMaxima, durationMinima, durationMaxima, envelopeAmplitudeMinima, envelopeAmplitudeMaxima, envelopeShapeMinima, envelopeShapeMaxima, envelopeSkewMinima, envelopeSkewMaxima, stereoLocationMinima, stereoLocationMaxima, interOffsetTimeMinima, interOffsetTimeMaxima, ftableReadLocationIncrement, readIncrementQuanta, interOffsetTimeQuanta] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ RShufflerL [AudioRate] in=0 fragmentSize=0.01 maxDelay=0.01+-}+rShufflerL :: Ugen -> Ugen -> Ugen -> Ugen+rShufflerL in_ fragmentSize maxDelay = mkUgen Nothing [AudioRate] (Right [0]) "RShufflerL" [in_, fragmentSize, maxDelay] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RSmplrIndex [ControlRate] buf=0 size=0 mnn=60+-}+rSmplrIndex :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rSmplrIndex rate buf size mnn = mkUgen Nothing [ControlRate] (Left rate) "RSmplrIndex" [buf, size, mnn] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ TExpRandN [ControlRate] lo=0 hi=1 trigger=0;    NC INPUT: True, FILTER: TRUE, NONDET+-}+tExpRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen+tExpRandNId numChannels z lo hi trigger = mkUgen Nothing [ControlRate] (Right [2]) "TExpRandN" [lo, hi, trigger] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of TExpRandN.+tExpRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> m Ugen+tExpRandNM nc = liftUid3 (tExpRandNId nc)++-- | Unsafe variant of TExpRandN.+tExpRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen+tExpRandN nc = liftUnsafe3 (tExpRandNM nc)++{- | (Undocumented class)++ TLinRandN [ControlRate] lo=0 hi=1 minmax=0 trigger=0;    NC INPUT: True, FILTER: TRUE, NONDET+-}+tLinRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tLinRandNId numChannels z lo hi minmax trigger = mkUgen Nothing [ControlRate] (Right [3]) "TLinRandN" [lo, hi, minmax, trigger] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of TLinRandN.+tLinRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tLinRandNM nc = liftUid4 (tLinRandNId nc)++-- | Unsafe variant of TLinRandN.+tLinRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tLinRandN nc = liftUnsafe4 (tLinRandNM nc)++{- | (Undocumented class)++ TRandN [ControlRate] lo=0 hi=1 trigger=0;    NC INPUT: True, FILTER: TRUE, NONDET+-}+tRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen+tRandNId numChannels z lo hi trigger = mkUgen Nothing [ControlRate] (Right [2]) "TRandN" [lo, hi, trigger] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of TRandN.+tRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> m Ugen+tRandNM nc = liftUid3 (tRandNId nc)++-- | Unsafe variant of TRandN.+tRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen+tRandN nc = liftUnsafe3 (tRandNM nc)++{- | (Undocumented class)++ TScramble [InitialisationRate,ControlRate] trigger=0 *inputs=0;    MCE=1, FILTER: TRUE, NONDET+-}+tScrambleId :: ID a => a -> Ugen -> Ugen -> Ugen+tScrambleId z trigger inputs = mkUgen Nothing [InitialisationRate, ControlRate] (Right [0]) "TScramble" [trigger] (Just [inputs]) (length (mceChannels inputs) + 0) (Special 0) (toUid z)++-- | Monad variant of TScramble.+tScrambleM :: Uid m => Ugen -> Ugen -> m Ugen+tScrambleM = liftUid2 tScrambleId++-- | Unsafe variant of TScramble.+tScramble :: Ugen -> Ugen -> Ugen+tScramble = liftUnsafe2 tScrambleM++{- | (Undocumented class)++ RTracePlay [ControlRate,AudioRate] bufnum=0 degree=4 rate=0 axis=1+-}+rTracePlay :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rTracePlay rate bufnum degree rate_ axis = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RTracePlay" [bufnum, degree, rate_, axis] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RTraceRd [ControlRate,AudioRate] bufnum=0 degree=4 index=0 axis=1+-}+rTraceRd :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rTraceRd rate bufnum degree index_ axis = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RTraceRd" [bufnum, degree, index_, axis] Nothing 1 (Special 0) NoId++{- | differential pulse-code modulation++ RedDPCMdecode [ControlRate,AudioRate] in=0+-}+redDPCMdecode :: Rate -> Ugen -> Ugen+redDPCMdecode rate in_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedDPCMdecode" [in_] Nothing 1 (Special 0) NoId++{- | differential pulse-code modulation++ RedDPCMencode [ControlRate,AudioRate] in=0 round=0+-}+redDPCMencode :: Rate -> Ugen -> Ugen -> Ugen+redDPCMencode rate in_ round_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedDPCMencode" [in_, round_] Nothing 1 (Special 0) NoId++{- | look before you leap++ RedLbyl [ControlRate,AudioRate] in=0 thresh=0.5 samples=2+-}+redLbyl :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+redLbyl rate in_ thresh samples = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedLbyl" [in_, thresh, samples] Nothing 1 (Special 0) NoId++{- | a really bad pseudo-random noise generator++ RedNoise [ControlRate,AudioRate] clock=0+-}+redNoise :: Rate -> Ugen -> Ugen+redNoise rate clock = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedNoise" [clock] Nothing 1 (Special 0) NoId++{- | a phasor that can loop++ RedPhasor [ControlRate,AudioRate] trig=0 rate=1 start=0 end=1 loop=0 loopstart=0 loopend=1+-}+redPhasor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor rate trig_ rate_ start end loop loopstart loopend = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedPhasor" [trig_, rate_, start, end, loop, loopstart, loopend] Nothing 1 (Special 0) NoId++{- | a phasor that can loop - version2++ RedPhasor2 [ControlRate,AudioRate] trig=0 rate=1 start=0 end=1 loop=0 loopstart=0 loopend=1+-}+redPhasor2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor2 rate trig_ rate_ start end loop loopstart loopend = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedPhasor2" [trig_, rate_, start, end, loop, loopstart, loopend] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RegaliaMitraEQ [AudioRate] in=0 freq=440 rq=0.1 k=0+-}+regaliaMitraEQ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+regaliaMitraEQ rate in_ freq rq k = mkUgen Nothing [AudioRate] (Left rate) "RegaliaMitraEQ" [in_, freq, rq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Resonator [AudioRate] input=0 freq=100 position=0.001 resolution=24 structure=0.5 brightness=0.5 damping=0.5;    FILTER: TRUE+-}+resonator :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+resonator input freq position resolution structure brightness damping = mkUgen Nothing [AudioRate] (Right [0]) "Resonator" [input, freq, position, resolution, structure, brightness, damping] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Rongs [AudioRate] trigger=0 sustain=1 f0=0.01 structure=0.5 brightness=0.5 damping=0.75 accent=0.9 stretch=0.5 position=0.15 loss=0.15 modeNum=2 cosFreq=0.25+-}+rongs :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rongs rate trigger sustain f0 structure brightness damping accent stretch position loss modeNum cosFreq = mkUgen Nothing [AudioRate] (Left rate) "Rongs" [trigger, sustain, f0, structure, brightness, damping, accent, stretch, position, loss, modeNum, cosFreq] Nothing 1 (Special 0) NoId++{- | Rossler chaotic generator++ RosslerL [AudioRate] freq=22050 a=0.2 b=0.2 c=5.7 h=0.05 xi=0.1 yi=0 zi=0+-}+rosslerL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rosslerL rate freq a b c h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "RosslerL" [freq, a, b, c, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ RosslerResL [AudioRate] in=0 stiff=1 freq=22050 a=0.2 b=0.2 c=5.7 h=0.05 xi=0.1 yi=0 zi=0+-}+rosslerResL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rosslerResL rate in_ stiff freq a b c h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "RosslerResL" [in_, stiff, freq, a, b, c, h, xi, yi, zi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Rotate [AudioRate] w=0 x=0 y=0 z=0 rotate=0+-}+rotate :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rotate rate w x y z rotate_ = mkUgen Nothing [AudioRate] (Left rate) "Rotate" [w, x, y, z, rotate_] Nothing 1 (Special 0) NoId++{- | (faulty) SID Sound Chip Simulator++ SID6581f [AudioRate] freqLo0=0 freqHi0=0 pwLo0=0 pwHi0=0 ctrl0=0 atkDcy0=0 susRel0=0 freqLo1=0 freqHi1=0 pwLo1=0 pwHi1=0 ctrl1=0 atkDcy1=0 susRel1=0 freqLo2=0 freqHi2=0 pwLo2=0 pwHi2=0 ctrl2=0 atkDcy2=0 susRel2=0 fcLo=0 fcHi=0 resFilt=0 modeVol=0 rate=1+-}+sid6581f :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sid6581f rate freqLo0 freqHi0 pwLo0 pwHi0 ctrl0 atkDcy0 susRel0 freqLo1 freqHi1 pwLo1 pwHi1 ctrl1 atkDcy1 susRel1 freqLo2 freqHi2 pwLo2 pwHi2 ctrl2 atkDcy2 susRel2 fcLo fcHi resFilt modeVol rate_ = mkUgen Nothing [AudioRate] (Left rate) "SID6581f" [freqLo0, freqHi0, pwLo0, pwHi0, ctrl0, atkDcy0, susRel0, freqLo1, freqHi1, pwLo1, pwHi1, ctrl1, atkDcy1, susRel1, freqLo2, freqHi2, pwLo2, pwHi2, ctrl2, atkDcy2, susRel2, fcLo, fcHi, resFilt, modeVol, rate_] Nothing 1 (Special 0) NoId++{- | experimental time domain onset detector++ SLOnset [ControlRate] input=0 memorysize1=20 before=5 after=5 threshold=10 hysteresis=10+-}+slOnset :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+slOnset rate input memorysize1 before after threshold hysteresis = mkUgen Nothing [ControlRate] (Left rate) "SLOnset" [input, memorysize1, before, after, threshold, hysteresis] Nothing 1 (Special 0) NoId++{- | Spectral Modeling Synthesis++ SMS [AudioRate] input=0 maxpeaks=80 currentpeaks=80 tolerance=4 noisefloor=0.2 freqmult=1 freqadd=0 formantpreserve=0 useifft=0 ampmult=1 graphicsbufnum=0;    FILTER: TRUE+-}+sms :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sms input maxpeaks currentpeaks tolerance noisefloor freqmult freqadd formantpreserve useifft ampmult graphicsbufnum = mkUgen Nothing [AudioRate] (Right [0]) "SMS" [input, maxpeaks, currentpeaks, tolerance, noisefloor, freqmult, freqadd, formantpreserve, useifft, ampmult, graphicsbufnum] Nothing 2 (Special 0) NoId++{- | Sound Chip Simulator++ SN76489 [AudioRate] tone0=512 tone1=0 tone2=0 noise=0 vol0=15 vol1=0 vol2=0 vol3=0 rate=1+-}+sn76489 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sn76489 rate tone0 tone1 tone2 noise vol0 vol1 vol2 vol3 rate_ = mkUgen Nothing [AudioRate] (Left rate) "SN76489" [tone0, tone1, tone2, noise, vol0, vol1, vol2, vol3, rate_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SOMAreaWr [ControlRate] bufnum=0 inputdata=0 coords=0 netsize=10 numdims=2 nhood=0.5 gate=1+-}+somAreaWr :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+somAreaWr rate bufnum inputdata coords netsize numdims nhood gate_ = mkUgen Nothing [ControlRate] (Left rate) "SOMAreaWr" [bufnum, inputdata, coords, netsize, numdims, nhood, gate_] Nothing 1 (Special 0) NoId++{- | Map an input using a Self-Organising Map++ SOMRd [ControlRate,AudioRate] bufnum=0 inputdata=0 netsize=10 numdims=2 gate=1+-}+somRd :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+somRd rate bufnum inputdata netsize numdims gate_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SOMRd" [bufnum, inputdata, netsize, numdims, gate_] Nothing 2 (Special 0) NoId++{- | Create (train) a Self-Organising Map++ SOMTrain [ControlRate] bufnum=0 inputdata=0 netsize=10 numdims=2 traindur=5000 nhood=0.5 gate=1 initweight=1+-}+somTrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+somTrain rate bufnum inputdata netsize numdims traindur nhood gate_ initweight = mkUgen Nothing [ControlRate] (Left rate) "SOMTrain" [bufnum, inputdata, netsize, numdims, traindur, nhood, gate_, initweight] Nothing 3 (Special 0) NoId++{- | 12db/Oct State Variable Filter++ SVF [ControlRate,AudioRate] signal=0 cutoff=2200 res=0.1 lowpass=1 bandpass=0 highpass=0 notch=0 peak=0;    FILTER: TRUE+-}+svf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+svf signal cutoff res lowpass bandpass highpass notch peak_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "SVF" [signal, cutoff, res, lowpass, bandpass, highpass, notch, peak_] Nothing 1 (Special 0) NoId++{- | super-efficient sawtooth oscillator with low aliasing++ SawDPW [ControlRate,AudioRate] freq=440 iphase=0+-}+sawDPW :: Rate -> Ugen -> Ugen -> Ugen+sawDPW rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SawDPW" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Perceptual feature modeling sensory dissonance++ SensoryDissonance [ControlRate] fft=0 maxpeaks=100 peakthreshold=0.1 norm=0 clamp=1+-}+sensoryDissonance :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sensoryDissonance rate fft_ maxpeaks peakthreshold norm clamp = mkUgen Nothing [ControlRate] (Left rate) "SensoryDissonance" [fft_, maxpeaks, peakthreshold, norm, clamp] Nothing 1 (Special 0) NoId++{- | Fuzzy sieve based synthesis++ Sieve1 [ControlRate,AudioRate] bufnum=0 gap=2 alternate=1+-}+sieve1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+sieve1 rate bufnum gap alternate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Sieve1" [bufnum, gap, alternate] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains++ SinGrain [AudioRate] trigger=0 dur=1 freq=440+-}+sinGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+sinGrain rate trigger dur freq = mkUgen Nothing [AudioRate] (Left rate) "SinGrain" [trigger, dur, freq] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains and user supplied envelope++ SinGrainB [AudioRate] trigger=0 dur=1 freq=440 envbuf=0+-}+sinGrainB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainB rate trigger dur freq envbuf = mkUgen Nothing [AudioRate] (Left rate) "SinGrainB" [trigger, dur, freq, envbuf] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains with Ambisonic panning and user supplied envelope++ SinGrainBBF [AudioRate] trigger=0 dur=1 freq=440 envbuf=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+sinGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainBBF rate trigger dur freq envbuf azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "SinGrainBBF" [trigger, dur, freq, envbuf, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains with Ambisonic panning++ SinGrainBF [AudioRate] trigger=0 dur=1 freq=440 azimuth=0 elevation=0 rho=1 wComp=0+-}+sinGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainBF rate trigger dur freq azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "SinGrainBF" [trigger, dur, freq, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains and user supplied envelopes++ SinGrainI [AudioRate] trigger=0 dur=1 freq=440 envbuf1=0 envbuf2=0 ifac=0.5+-}+sinGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainI rate trigger dur freq envbuf1 envbuf2 ifac = mkUgen Nothing [AudioRate] (Left rate) "SinGrainI" [trigger, dur, freq, envbuf1, envbuf2, ifac] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains with Ambisonic panning and user supplied envelopes++ SinGrainIBF [AudioRate] trigger=0 dur=1 freq=440 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 wComp=0+-}+sinGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainIBF rate trigger dur freq envbuf1 envbuf2 ifac azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "SinGrainIBF" [trigger, dur, freq, envbuf1, envbuf2, ifac, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ SinTone [AudioRate] freq=440 phase=0+-}+sinTone :: Rate -> Ugen -> Ugen -> Ugen+sinTone rate freq phase = mkUgen Nothing [AudioRate] (Left rate) "SinTone" [freq, phase] Nothing 1 (Special 0) NoId++{- | port of some ladspa plugins++ SineShaper [AudioRate] in=0 limit=1;    FILTER: TRUE+-}+sineShaper :: Ugen -> Ugen -> Ugen+sineShaper in_ limit = mkUgen Nothing [AudioRate] (Right [0]) "SineShaper" [in_, limit] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SkipNeedle [AudioRate] range=44100 rate=10 offset=0+-}+skipNeedle :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+skipNeedle rate range rate_ offset = mkUgen Nothing [AudioRate] (Left rate) "SkipNeedle" [range, rate_, offset] Nothing 1 (Special 0) NoId++{- | lowpass filter for envelope following++ Slide [ControlRate,AudioRate] in=0 slideup=50 slidedown=3000+-}+slide :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+slide rate in_ slideup slidedown = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Slide" [in_, slideup, slidedown] Nothing 1 (Special 0) NoId++{- | generate cpu spikes++ Slub [ControlRate,AudioRate] trig=0 spike=4.04+-}+slub :: Rate -> Ugen -> Ugen -> Ugen+slub rate trig_ spike = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Slub" [trig_, spike] Nothing 1 (Special 0) NoId++{- | Smooth samplerate and bitrate reduction++ SmoothDecimator [AudioRate] in=0 rate=44100 smoothing=0.5+-}+smoothDecimator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+smoothDecimator rate in_ rate_ smoothing = mkUgen Nothing [AudioRate] (Left rate) "SmoothDecimator" [in_, rate_, smoothing] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipAmp [AudioRate] in=0 pregain=1;    FILTER: TRUE+-}+softClipAmp :: Ugen -> Ugen -> Ugen+softClipAmp in_ pregain = mkUgen Nothing [AudioRate] (Right [0]) "SoftClipAmp" [in_, pregain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipAmp4 [AudioRate] in=0 pregain=1;    FILTER: TRUE+-}+softClipAmp4 :: Ugen -> Ugen -> Ugen+softClipAmp4 in_ pregain = mkUgen Nothing [AudioRate] (Right [0]) "SoftClipAmp4" [in_, pregain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipAmp8 [AudioRate] in=0 pregain=1;    FILTER: TRUE+-}+softClipAmp8 :: Ugen -> Ugen -> Ugen+softClipAmp8 in_ pregain = mkUgen Nothing [AudioRate] (Right [0]) "SoftClipAmp8" [in_, pregain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipper4 [AudioRate] in=0+-}+softClipper4 :: Rate -> Ugen -> Ugen+softClipper4 rate in_ = mkUgen Nothing [AudioRate] (Left rate) "SoftClipper4" [in_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipper8 [AudioRate] in=0+-}+softClipper8 :: Rate -> Ugen -> Ugen+softClipper8 rate in_ = mkUgen Nothing [AudioRate] (Left rate) "SoftClipper8" [in_] Nothing 1 (Special 0) NoId++{- | LPC analizer.++ SonLPC [AudioRate] buff=-1.0 in=0.0 hop=0.5 poles=10.0+-}+sonLPC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sonLPC rate buff in_ hop poles = mkUgen Nothing [AudioRate] (Left rate) "SonLPC" [buff, in_, hop, poles] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SonLPCSynth [AudioRate] chain=-1.0+-}+sonLPCSynth :: Rate -> Ugen -> Ugen+sonLPCSynth rate chain = mkUgen Nothing [AudioRate] (Left rate) "SonLPCSynth" [chain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SonLPCSynthIn [AudioRate] chain=-1.0 in=0.0+-}+sonLPCSynthIn :: Rate -> Ugen -> Ugen -> Ugen+sonLPCSynthIn rate chain in_ = mkUgen Nothing [AudioRate] (Left rate) "SonLPCSynthIn" [chain, in_] Nothing 1 (Special 0) NoId++{- | Karplus-Strong via a sorting algorithm++ SortBuf [AudioRate] bufnum=0 sortrate=10 reset=0+-}+sortBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+sortBuf rate bufnum sortrate reset = mkUgen Nothing [AudioRate] (Left rate) "SortBuf" [bufnum, sortrate, reset] Nothing 1 (Special 0) NoId++{- | Spectral feature extraction++ SpectralEntropy [ControlRate] fft=0 fftsize=2048 numbands=1;    NC INPUT: True+-}+spectralEntropy :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+spectralEntropy numChannels rate fft_ fftsize numbands = mkUgen Nothing [ControlRate] (Left rate) "SpectralEntropy" [fft_, fftsize, numbands] Nothing numChannels (Special 0) NoId++{- | (Undocumented class)++ Spreader [AudioRate] in=0 theta=1.5708 filtsPerOctave=8+-}+spreader :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+spreader rate in_ theta filtsPerOctave = mkUgen Nothing [AudioRate] (Left rate) "Spreader" [in_, theta, filtsPerOctave] Nothing 2 (Special 0) NoId++{- | Spruce bud worm model equations++ SpruceBudworm [AudioRate] reset=0 rate=0.1 k1=27.9 k2=1.5 alpha=0.1 beta=10.1 mu=0.3 rho=10.1 initx=0.9 inity=0.1+-}+spruceBudworm :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+spruceBudworm rate reset rate_ k1 k2 alpha beta mu rho initx inity = mkUgen Nothing [AudioRate] (Left rate) "SpruceBudworm" [reset, rate_, k1, k2, alpha, beta, mu, rho, initx, inity] Nothing 2 (Special 0) NoId++{- | Wave squeezer. Maybe a kind of pitch shifter.++ Squiz [ControlRate,AudioRate] in=0 pitchratio=2 zcperchunk=1 memlen=0.1;    FILTER: TRUE+-}+squiz :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+squiz in_ pitchratio zcperchunk memlen = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Squiz" [in_, pitchratio, zcperchunk, memlen] Nothing 1 (Special 0) NoId++{- | standard map 2D chaotic generator++ Standard2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 k=1.4 x0=4.97898 y0=5.74734+-}+standard2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standard2DC rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Standard2DC" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | standard map 2D chaotic generator++ Standard2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 k=1.4 x0=4.97898 y0=5.74734+-}+standard2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standard2DL rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Standard2DL" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | standard map 2D chaotic generator++ Standard2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 k=1.4 x0=4.97898 y0=5.74734+-}+standard2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standard2DN rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Standard2DN" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StandardTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 k=1.4 x0=4.97898 y0=5.74734+-}+standardTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standardTrig rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StandardTrig" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBandedWG [ControlRate,AudioRate] freq=440 instr=0 bowpressure=0 bowmotion=0 integration=0 modalresonance=64 bowvelocity=0 setstriking=0 trig=1+-}+stkBandedWG :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBandedWG rate freq instr bowpressure bowmotion integration modalresonance bowvelocity setstriking trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBandedWG" [freq, instr, bowpressure, bowmotion, integration, modalresonance, bowvelocity, setstriking, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBeeThree [ControlRate,AudioRate] freq=440 op4gain=10 op3gain=20 lfospeed=64 lfodepth=0 adsrtarget=64 trig=1+-}+stkBeeThree :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBeeThree rate freq op4gain op3gain lfospeed lfodepth adsrtarget trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBeeThree" [freq, op4gain, op3gain, lfospeed, lfodepth, adsrtarget, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBlowHole [ControlRate,AudioRate] freq=440 reedstiffness=64 noisegain=20 tonehole=64 register=11 breathpressure=64+-}+stkBlowHole :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBlowHole rate freq reedstiffness noisegain tonehole register breathpressure = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBlowHole" [freq, reedstiffness, noisegain, tonehole, register, breathpressure] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBowed [ControlRate,AudioRate] freq=220 bowpressure=64 bowposition=64 vibfreq=64 vibgain=64 loudness=64 gate=1 attackrate=1 decayrate=1+-}+stkBowed :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBowed rate freq bowpressure bowposition vibfreq vibgain loudness_ gate_ attackrate decayrate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBowed" [freq, bowpressure, bowposition, vibfreq, vibgain, loudness_, gate_, attackrate, decayrate] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkClarinet [ControlRate,AudioRate] freq=440 reedstiffness=64 noisegain=4 vibfreq=64 vibgain=11 breathpressure=64 trig=1+-}+stkClarinet :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkClarinet rate freq reedstiffness noisegain vibfreq vibgain breathpressure trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkClarinet" [freq, reedstiffness, noisegain, vibfreq, vibgain, breathpressure, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkFlute [ControlRate,AudioRate] freq=440 jetDelay=49 noisegain=0.15 jetRatio=0.32+-}+stkFlute :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkFlute rate freq jetDelay noisegain jetRatio = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkFlute" [freq, jetDelay, noisegain, jetRatio] Nothing 1 (Special 0) NoId++{-+-- | Wrapping Synthesis toolkit.+--+--  StkGlobals [AudioRate] showWarnings=0 printErrors=0 rawfilepath=0+stkGlobals :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+stkGlobals rate showWarnings printErrors rawfilepath = mkUgen Nothing [AudioRate] (Left rate) "StkGlobals" [showWarnings,printErrors,rawfilepath] Nothing 1 (Special 0) NoId+-}++{- | Wrapping Synthesis toolkit.++ StkInst [AudioRate] freq=220 gate=1 onamp=1 offamp=0.5 instNumber=6 *args=0;    MCE=1, REORDERS INPUTS: [4,0,1,2,3,5]+-}+stkInst :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkInst rate freq gate_ onamp offamp instNumber args = mkUgen Nothing [AudioRate] (Left rate) "StkInst" [freq, gate_, onamp, offamp, instNumber] (Just [args]) 1 (Special 0) NoId++{- | (Undocumented class)++ StkMandolin [ControlRate,AudioRate] freq=520 bodysize=64 pickposition=64 stringdamping=69 stringdetune=10 aftertouch=64 trig=1+-}+stkMandolin :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkMandolin rate freq bodysize pickposition stringdamping stringdetune aftertouch trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkMandolin" [freq, bodysize, pickposition, stringdamping, stringdetune, aftertouch, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkModalBar [ControlRate,AudioRate] freq=440 instrument=0 stickhardness=64 stickposition=64 vibratogain=20 vibratofreq=20 directstickmix=64 volume=64 trig=1+-}+stkModalBar :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkModalBar rate freq instrument stickhardness stickposition vibratogain vibratofreq directstickmix volume trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkModalBar" [freq, instrument, stickhardness, stickposition, vibratogain, vibratofreq, directstickmix, volume, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkMoog [ControlRate,AudioRate] freq=440 filterQ=10 sweeprate=20 vibfreq=64 vibgain=0 gain=64 trig=1+-}+stkMoog :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkMoog rate freq filterQ sweeprate vibfreq vibgain gain trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkMoog" [freq, filterQ, sweeprate, vibfreq, vibgain, gain, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkPluck [ControlRate,AudioRate] freq=440 decay=0.99+-}+stkPluck :: Rate -> Ugen -> Ugen -> Ugen+stkPluck rate freq decay_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkPluck" [freq, decay_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkSaxofony [ControlRate,AudioRate] freq=220 reedstiffness=64 reedaperture=64 noisegain=20 blowposition=26 vibratofrequency=20 vibratogain=20 breathpressure=128 trig=1+-}+stkSaxofony :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkSaxofony rate freq reedstiffness reedaperture noisegain blowposition vibratofrequency vibratogain breathpressure trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkSaxofony" [freq, reedstiffness, reedaperture, noisegain, blowposition, vibratofrequency, vibratogain, breathpressure, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkShakers [ControlRate,AudioRate] instr=0 energy=64 decay=64 objects=64 resfreq=64+-}+stkShakers :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkShakers rate instr energy decay_ objects resfreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkShakers" [instr, energy, decay_, objects, resfreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkVoicForm [ControlRate,AudioRate] freq=440 vuvmix=64 vowelphon=64 vibfreq=64 vibgain=20 loudness=64 trig=1+-}+stkVoicForm :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkVoicForm rate freq vuvmix vowelphon vibfreq vibgain loudness_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkVoicForm" [freq, vuvmix, vowelphon, vibfreq, vibgain, loudness_, trig_] Nothing 1 (Special 0) NoId++{- | String resonance filter++ Streson [ControlRate,AudioRate] input=0 delayTime=0.003 res=0.9;    FILTER: TRUE+-}+streson :: Ugen -> Ugen -> Ugen -> Ugen+streson input delayTime res = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Streson" [input, delayTime, res] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StringVoice [AudioRate] trig=0 infsustain=0 freq=100 accent=0.5 structure=0.5 brightness=0.5 damping=0.5+-}+stringVoice :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stringVoice rate trig_ infsustain freq accent structure brightness damping = mkUgen Nothing [AudioRate] (Left rate) "StringVoice" [trig_, infsustain, freq, accent, structure, brightness, damping] Nothing 1 (Special 0) NoId++{- | Pulse counter with floating point steps++ Summer [ControlRate,AudioRate] trig=0 step=1 reset=0 resetval=0;    FILTER: TRUE+-}+summer :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+summer trig_ step reset resetval = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Summer" [trig_, step, reset, resetval] Nothing 1 (Special 0) NoId++{- | feedback delay line implementing switch-and-ramp buffer jumping++ SwitchDelay [AudioRate] in=0 drylevel=1 wetlevel=1 delaytime=1 delayfactor=0.7 maxdelaytime=20;    FILTER: TRUE+-}+switchDelay :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+switchDelay in_ drylevel wetlevel delaytime delayfactor maxdelaytime = mkUgen Nothing [AudioRate] (Right [0]) "SwitchDelay" [in_, drylevel, wetlevel, delaytime, delayfactor, maxdelaytime] Nothing 1 (Special 0) NoId++{- | triggered beta random distribution++ TBetaRand [ControlRate,AudioRate] lo=0 hi=1 prob1=0 prob2=0 trig=0;    FILTER: TRUE, NONDET+-}+tBetaRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBetaRandId z lo hi prob1 prob2 trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [4]) "TBetaRand" [lo, hi, prob1, prob2, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TBetaRand.+tBetaRandM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tBetaRandM = liftUid5 tBetaRandId++-- | Unsafe variant of TBetaRand.+tBetaRand :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBetaRand = liftUnsafe5 tBetaRandM++{- | triggered random walk generator++ TBrownRand [ControlRate,AudioRate] lo=0 hi=1 dev=1 dist=0 trig=0;    FILTER: TRUE, NONDET+-}+tBrownRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBrownRandId z lo hi dev dist trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [4]) "TBrownRand" [lo, hi, dev, dist, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TBrownRand.+tBrownRandM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tBrownRandM = liftUid5 tBrownRandId++-- | Unsafe variant of TBrownRand.+tBrownRand :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBrownRand = liftUnsafe5 tBrownRandM++{- | triggered gaussian random distribution++ TGaussRand [ControlRate,AudioRate] lo=0 hi=1 trig=0;    FILTER: TRUE, NONDET+-}+tGaussRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tGaussRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TGaussRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TGaussRand.+tGaussRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tGaussRandM = liftUid3 tGaussRandId++-- | Unsafe variant of TGaussRand.+tGaussRand :: Ugen -> Ugen -> Ugen -> Ugen+tGaussRand = liftUnsafe3 tGaussRandM++{- | buffer granulator with linear att/dec++ TGrains2 [AudioRate] trigger=0 bufnum=0 rate=1 centerPos=0 dur=0.1 pan=0 amp=0.1 att=0.5 dec=0.5 interp=4;    NC INPUT: True+-}+tGrains2 :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tGrains2 numChannels rate trigger bufnum rate_ centerPos dur pan amp att dec interp = mkUgen Nothing [AudioRate] (Left rate) "TGrains2" [trigger, bufnum, rate_, centerPos, dur, pan, amp, att, dec, interp] Nothing numChannels (Special 0) NoId++{- | buffer granulator with user envelope++ TGrains3 [AudioRate] trigger=0 bufnum=0 rate=1 centerPos=0 dur=0.1 pan=0 amp=0.1 att=0.5 dec=0.5 window=1 interp=4;    NC INPUT: True+-}+tGrains3 :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tGrains3 numChannels rate trigger bufnum rate_ centerPos dur pan amp att dec window interp = mkUgen Nothing [AudioRate] (Left rate) "TGrains3" [trigger, bufnum, rate_, centerPos, dur, pan, amp, att, dec, window, interp] Nothing numChannels (Special 0) NoId++{- | Tracking Phase Vocoder++ TPV [AudioRate] chain=0 windowsize=1024 hopsize=512 maxpeaks=80 currentpeaks=0 freqmult=1 tolerance=4 noisefloor=0.2+-}+tpv :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tpv chain windowsize hopsize maxpeaks currentpeaks freqmult tolerance noisefloor = mkUgen Nothing [AudioRate] (Left AudioRate) "TPV" [chain, windowsize, hopsize, maxpeaks, currentpeaks, freqmult, tolerance, noisefloor] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ TTendency [ControlRate,AudioRate] trigger=0 dist=0 parX=0 parY=1 parA=0 parB=0+-}+tTendency :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tTendency rate trigger dist parX parY parA parB = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TTendency" [trigger, dist, parX, parY, parA, parB] Nothing 1 (Special 0) NoId++{- | pitch tracker++ Tartini [ControlRate] in=0 threshold=0.93 n=2048 k=0 overlap=1024 smallCutoff=0.5+-}+tartini :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tartini rate in_ threshold n k overlap smallCutoff = mkUgen Nothing [ControlRate] (Left rate) "Tartini" [in_, threshold, n, k, overlap, smallCutoff] Nothing 2 (Special 0) NoId++{- | Neural Oscillator++ TermanWang [AudioRate] input=0 reset=0 ratex=0.01 ratey=0.01 alpha=1 beta=1 eta=1 initx=0 inity=0+-}+termanWang :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+termanWang rate input reset ratex ratey alpha beta eta initx inity = mkUgen Nothing [AudioRate] (Left rate) "TermanWang" [input, reset, ratex, ratey, alpha, beta, eta, initx, inity] Nothing 1 (Special 0) NoId++{- | display level of a Ugen as a textual meter++ TextVU [ControlRate,AudioRate] trig=2 in=0 label=0 width=21 reset=0 ana=0+-}+textVU :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+textVU rate trig_ in_ label_ width reset ana = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TextVU" [trig_, in_, label_, width, reset, ana] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Tilt [AudioRate] w=0 x=0 y=0 z=0 tilt=0+-}+tilt :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tilt rate w x y z tilt_ = mkUgen Nothing [AudioRate] (Left rate) "Tilt" [w, x, y, z, tilt_] Nothing 1 (Special 0) NoId++{- | triggered signal averager++ TrigAvg [ControlRate] in=0 trig=0+-}+trigAvg :: Rate -> Ugen -> Ugen -> Ugen+trigAvg rate in_ trig_ = mkUgen Nothing [ControlRate] (Left rate) "TrigAvg" [in_, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Tumble [AudioRate] w=0 x=0 y=0 z=0 tilt=0+-}+tumble :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tumble rate w x y z tilt_ = mkUgen Nothing [AudioRate] (Left rate) "Tumble" [w, x, y, z, tilt_] Nothing 1 (Special 0) NoId++{- | physical modeling simulation; two tubes++ TwoTube [AudioRate] input=0 k=0.01 loss=1 d1length=100 d2length=100+-}+twoTube :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+twoTube rate input k loss d1length d2length = mkUgen Nothing [AudioRate] (Left rate) "TwoTube" [input, k, loss, d1length, d2length] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ UHJ2B [AudioRate] ls=0 rs=0+-}+uhj2b :: Rate -> Ugen -> Ugen -> Ugen+uhj2b rate ls rs = mkUgen Nothing [AudioRate] (Left rate) "UHJ2B" [ls, rs] Nothing 3 (Special 0) NoId++{- | Vector Base Amplitude Panner++ VBAP [ControlRate,AudioRate] in=0 bufnum=0 azimuth=0 elevation=1 spread=0;    NC INPUT: True+-}+vbap :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbap numChannels rate in_ bufnum azimuth elevation spread = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VBAP" [in_, bufnum, azimuth, elevation, spread] Nothing numChannels (Special 0) NoId++{- | a Chebyshev low/highpass filter++ VBChebyFilt [AudioRate] in=0 freq=880 mode=0 order=4+-}+vbChebyFilt :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbChebyFilt rate in_ freq mode order = mkUgen Nothing [AudioRate] (Left rate) "VBChebyFilt" [in_, freq, mode, order] Nothing 1 (Special 0) NoId++{- | a chaotic oscillator network++ VBFourses [AudioRate] smoother=0.5 *freqarray=0;    MCE=1, REORDERS INPUTS: [1,0]+-}+vbFourses :: Rate -> Ugen -> Ugen -> Ugen+vbFourses rate smoother freqarray = mkUgen Nothing [AudioRate] (Left rate) "VBFourses" [smoother] (Just [freqarray]) 4 (Special 0) NoId++{- | artifical reverberator++ VBJonVerb [AudioRate] in=0 decay=0.6 damping=0.3 inputbw=0.8 erfl=0.5 tail=0.5;    FILTER: TRUE+-}+vbJonVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbJonVerb in_ decay_ damping inputbw erfl tail_ = mkUgen Nothing [AudioRate] (Right [0]) "VBJonVerb" [in_, decay_, damping, inputbw, erfl, tail_] Nothing 2 (Special 0) NoId++{- | a simple phase vocoder for time-stretching++ VBPVoc [AudioRate] numChannels=0 bufnum=0 playpos=0 fftsize=2048+-}+vbpVoc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbpVoc rate numChannels bufnum playpos fftsize = mkUgen Nothing [AudioRate] (Left rate) "VBPVoc" [numChannels, bufnum, playpos, fftsize] Nothing 1 (Special 0) NoId++{- | lowpass filter for envelope following++ VBSlide [KR,AR] in=0.0 slideup=50.0 slidedown=3000.0;    FILTER: TRUE+-}+vbSlide :: Ugen -> Ugen -> Ugen -> Ugen+vbSlide in_ slideup slidedown = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "VBSlide" [in_, slideup, slidedown] Nothing 1 (Special 0) NoId++{- | 2D scanning pattern virtual machine++ VMScan2D [AudioRate] bufnum=0+-}+vmScan2D :: Rate -> Ugen -> Ugen+vmScan2D rate bufnum = mkUgen Nothing [AudioRate] (Left rate) "VMScan2D" [bufnum] Nothing 2 (Special 0) NoId++{- | vosim pulse generator++ VOSIM [AudioRate] trig=0.1 freq=400 nCycles=1 decay=0.9+-}+vosim :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vosim rate trig_ freq nCycles decay_ = mkUgen Nothing [AudioRate] (Left rate) "VOSIM" [trig_, freq, nCycles, decay_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ VarShapeOsc [ControlRate,AudioRate] freq=100 pw=0.5 waveshape=0.5 sync=1 syncfreq=105+-}+varShapeOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+varShapeOsc rate freq pw waveshape sync syncfreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VarShapeOsc" [freq, pw, waveshape, sync, syncfreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ VosimOsc [ControlRate,AudioRate] freq=100 form1freq=951 form2freq=919 shape=0+-}+vosimOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vosimOsc rate freq form1freq form2freq shape = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VosimOsc" [freq, form1freq, form2freq, shape] Nothing 1 (Special 0) NoId++{- | windowed amplitude follower++ WAmp [ControlRate] in=0 winSize=0.1+-}+wAmp :: Rate -> Ugen -> Ugen -> Ugen+wAmp rate in_ winSize = mkUgen Nothing [ControlRate] (Left rate) "WAmp" [in_, winSize] Nothing 1 (Special 0) NoId++{- | decomposition into square waves, and reconstruction++ WalshHadamard [AudioRate] input=0 which=0+-}+walshHadamard :: Rate -> Ugen -> Ugen -> Ugen+walshHadamard rate input which = mkUgen Nothing [AudioRate] (Left rate) "WalshHadamard" [input, which] Nothing 1 (Special 0) NoId++{- | Warp a buffer with a time pointer++ WarpZ [AudioRate] bufnum=0 pointer=0 freqScale=1 windowSize=0.2 envbufnum=-1 overlaps=8 windowRandRatio=0 interp=1 zeroSearch=0 zeroStart=0;    NC INPUT: True+-}+warpZ :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+warpZ numChannels rate bufnum pointer freqScale windowSize envbufnum overlaps windowRandRatio interp zeroSearch zeroStart = mkUgen Nothing [AudioRate] (Left rate) "WarpZ" [bufnum, pointer, freqScale, windowSize, envbufnum, overlaps, windowRandRatio, interp, zeroSearch, zeroStart] Nothing numChannels (Special 0) NoId++{- | Lose bits of your waves++ WaveLoss [ControlRate,AudioRate] in=0 drop=20 outof=40 mode=1+-}+waveLoss :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+waveLoss rate in_ drop_ outof mode = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "WaveLoss" [in_, drop_, outof, mode] Nothing 1 (Special 0) NoId++{- | wave terrain synthesis++ WaveTerrain [AudioRate] bufnum=0 x=0 y=0 xsize=100 ysize=100+-}+waveTerrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+waveTerrain rate bufnum x y xsize ysize = mkUgen Nothing [AudioRate] (Left rate) "WaveTerrain" [bufnum, x, y, xsize, ysize] Nothing 1 (Special 0) NoId++{- | decomposition into Daub4 wavelets, and reconstruction++ WaveletDaub [AudioRate] input=0 n=64 which=0+-}+waveletDaub :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+waveletDaub rate input n which = mkUgen Nothing [AudioRate] (Left rate) "WaveletDaub" [input, n, which] Nothing 1 (Special 0) NoId++{- | Weakly Nonlinear Oscillator++ WeaklyNonlinear [AudioRate] input=0 reset=0 ratex=1 ratey=1 freq=440 initx=0 inity=0 alpha=0 xexponent=0 beta=0 yexponent=0+-}+weaklyNonlinear :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+weaklyNonlinear rate input reset ratex ratey freq initx inity alpha xexponent beta yexponent = mkUgen Nothing [AudioRate] (Left rate) "WeaklyNonlinear" [input, reset, ratex, ratey, freq, initx, inity, alpha, xexponent, beta, yexponent] Nothing 1 (Special 0) NoId++{- | Weakly Nonlinear Oscillator++ WeaklyNonlinear2 [AudioRate] input=0 reset=0 ratex=1 ratey=1 freq=440 initx=0 inity=0 alpha=0 xexponent=0 beta=0 yexponent=0+-}+weaklyNonlinear2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+weaklyNonlinear2 rate input reset ratex ratey freq initx inity alpha xexponent beta yexponent = mkUgen Nothing [AudioRate] (Left rate) "WeaklyNonlinear2" [input, reset, ratex, ratey, freq, initx, inity, alpha, xexponent, beta, yexponent] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Werner [AudioRate] input=0 freq=0.5 damp=0.5 feedback=0.5 drive=0 oversample=1+-}+werner :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+werner rate input freq damp feedback drive oversample = mkUgen Nothing [AudioRate] (Left rate) "Werner" [input, freq, damp, feedback, drive, oversample] Nothing 1 (Special 0) NoId++{- | Pulse counter with floating point steps++ WrapSummer [ControlRate,AudioRate] trig=0 step=1 min=0 max=1 reset=0 resetval=0+-}+wrapSummer :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+wrapSummer rate trig_ step min_ max_ reset resetval = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "WrapSummer" [trig_, step, min_, max_, reset, resetval] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ ZOsc [ControlRate,AudioRate] freq=100 formantfreq=91 shape=0.5 mode=0.5+-}+zOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+zOsc rate freq formantfreq shape mode = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "ZOsc" [freq, formantfreq, shape, mode] Nothing 1 (Special 0) NoId
+ Sound/Sc3/Ugen/Bindings/Hw.hs view
@@ -0,0 +1,77 @@+-- | Hand-written bindings.+module Sound.Sc3.Ugen.Bindings.Hw where++import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import qualified Sound.Sc3.Ugen.Bindings.Hw.Construct as C+import Sound.Sc3.Ugen.Types+import qualified Sound.Sc3.Ugen.Util as Util++{- | Zero local buffer.++ClearBuf does not copy the buffer number through so this is an Mrg node.+-}+clearBuf :: Ugen -> Ugen+clearBuf b = Util.mrg2 b (C.mkOsc ir "ClearBuf" [b] 1)++-- | Demand rate weighted random sequence generator.+dwrandId :: ID i => i -> Ugen -> Ugen -> Ugen -> Ugen+dwrandId z repeats weights list_ =+  let n = mceDegree_err list_+      weights' = mceExtend n weights+      inp = repeats : constant n : weights'+  in mkUgen Nothing [dr] (Left dr) "Dwrand" inp (Just [list_]) 1 (Special 0) (Util.toUid z)++dwrandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dwrandM = liftUid3 dwrandId++dwrand :: Ugen -> Ugen -> Ugen -> Ugen+dwrand = liftUnsafe3 dwrandM++-- | Variant on 'envGen' without enumeration types.+envGen_ll :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+envGen_ll rate gate_ levelScale levelBias timeScale doneAction envelope_ = mkUgen Nothing [kr, ar] (Left rate) "EnvGen" [gate_, levelScale, levelBias, timeScale, doneAction] (Just [envelope_]) 1 (Special 0) NoId++-- | Outputs signal for @FFT@ chains, without performing FFT.+fftTrigger :: Ugen -> Ugen -> Ugen -> Ugen+fftTrigger b h p = C.mkOsc kr "FFTTrigger" [b, h, p] 1++-- | Pack demand-rate FFT bin streams into an FFT chain.+packFFT :: Ugen -> Int -> Int -> Int -> Ugen -> Ugen -> Ugen+packFFT b sz from to z mp =+  let n = constant (mceDegree_err mp)+  in C.mkOscMCE kr "PackFFT" [b, constant sz, constant from, constant to, z, n] mp 1++-- | Poll value of input Ugen when triggered.+poll :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+poll trig_ in_ trigid label_ =+  let q = Util.unpackLabel True label_+  in C.mkFilter "Poll" ([trig_, in_, trigid] ++ q) 0++-- | FFT onset detector.+pv_HainsworthFoote :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_HainsworthFoote buf h f thr wt = C.mkOsc ar "PV_HainsworthFoote" [buf, h, f, thr, wt] 1++{- | FFT feature detector for onset detection.++buffer, propsc=0.25, prophfe=0.25, prophfc=0.25, propsf=0.25, threshold=1.0, waittime=0.04+-}+pv_JensenAndersen :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_JensenAndersen buffer propsc prophfe prophfc propsf threshold waittime = C.mkOsc ar "PV_JensenAndersen" [buffer, propsc, prophfe, prophfc, propsf, threshold, waittime] 1++{- | Ascii string to length prefixed list of constant Ugens.++> string_to_ugens "/label" == map fromIntegral [6,47,108,97,98,101,108]+-}+string_to_ugens :: String -> [Ugen]+string_to_ugens nm = fromIntegral (length nm) : map (fromIntegral . fromEnum) nm++-- | Send a reply message from the server back to all registered clients.+sendReply :: Ugen -> Ugen -> String -> [Ugen] -> Ugen+sendReply i k n v = C.mkFilter "SendReply" ([i, k] ++ string_to_ugens n ++ v) 0++-- | Unpack a single value (magnitude or phase) from an FFT chain+unpack1FFT :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+unpack1FFT buf size index_ which = C.mkOsc dr "Unpack1FFT" [buf, size, index_, which] 1
+ Sound/Sc3/Ugen/Bindings/Hw/Construct.hs view
@@ -0,0 +1,83 @@+-- | For hand-writing Ugens.+module Sound.Sc3.Ugen.Bindings.Hw.Construct where++import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Types++-- | Oscillator constructor with constrained set of operating 'Rate's.+mk_osc :: [Rate] -> UgenId -> Rate -> String -> [Ugen] -> Int -> Ugen+mk_osc rs z r c i o =+  if r `elem` rs+    then mkUgen Nothing rs (Left r) c i Nothing o (Special 0) z+    else error ("mk_osc: rate restricted: " ++ show (r, rs, c))++-- | Oscillator constructor with 'all_rates'.+mkOsc :: Rate -> String -> [Ugen] -> Int -> Ugen+mkOsc = mk_osc all_rates no_id++-- | Oscillator constructor, rate restricted variant.+mkOscR :: [Rate] -> Rate -> String -> [Ugen] -> Int -> Ugen+mkOscR rs = mk_osc rs no_id++-- | Rate restricted oscillator constructor, setting identifier.+mkOscIdR :: [Rate] -> UgenId -> Rate -> String -> [Ugen] -> Int -> Ugen+mkOscIdR = mk_osc++-- | Oscillator constructor, setting identifier.+mkOscId :: UgenId -> Rate -> String -> [Ugen] -> Int -> Ugen+mkOscId = mk_osc all_rates++-- | Provided 'UgenId' variant of 'mkOscMCE'.+mk_osc_mce :: UgenId -> Rate -> String -> [Ugen] -> Ugen -> Int -> Ugen+mk_osc_mce z r c i j =+  let i' = i ++ mceChannels j+  in mk_osc all_rates z r c i'++-- | Variant oscillator constructor with MCE collapsing input.+mkOscMCE :: Rate -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkOscMCE = mk_osc_mce no_id++-- | Variant oscillator constructor with MCE collapsing input.+mkOscMCEId :: UgenId -> Rate -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkOscMCEId = mk_osc_mce++-- | Rate constrained filter 'Ugen' constructor.+mk_filter :: [Rate] -> [Int] -> UgenId -> String -> [Ugen] -> Int -> Ugen+mk_filter rs ix z c i o = mkUgen Nothing rs (Right ix) c i Nothing o (Special 0) z++-- | Filter Ugen constructor.+mkFilterIdR :: [Rate] -> UgenId -> String -> [Ugen] -> Int -> Ugen+mkFilterIdR rs z nm i = mk_filter rs [0 .. length i - 1] z nm i++-- | Filter Ugen constructor.+mkFilterR :: [Rate] -> String -> [Ugen] -> Int -> Ugen+mkFilterR rs = mkFilterIdR rs no_id++-- | Filter 'Ugen' constructor.+mkFilter :: String -> [Ugen] -> Int -> Ugen+mkFilter = mkFilterR all_rates++-- | Filter Ugen constructor.+mkFilterId :: UgenId -> String -> [Ugen] -> Int -> Ugen+mkFilterId = mkFilterIdR all_rates++-- | Provided 'UgenId' filter with 'mce' input.+mk_filter_mce :: [Rate] -> UgenId -> String -> [Ugen] -> Ugen -> Int -> Ugen+mk_filter_mce rs z c i j = mkFilterIdR rs z c (i ++ mceChannels j)++-- | Variant filter constructor with MCE collapsing input.+mkFilterMCER :: [Rate] -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkFilterMCER rs = mk_filter_mce rs no_id++-- | Variant filter constructor with MCE collapsing input.+mkFilterMCE :: String -> [Ugen] -> Ugen -> Int -> Ugen+mkFilterMCE = mk_filter_mce all_rates no_id++-- | Variant filter constructor with MCE collapsing input.+mkFilterMCEId :: UgenId -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkFilterMCEId = mk_filter_mce all_rates++-- | Information unit generators are very specialized.+mkInfo :: String -> Ugen+mkInfo name = mkOsc InitialisationRate name [] 1
+ Sound/Sc3/Ugen/Bindings/Hw/External.hs view
@@ -0,0 +1,6 @@+-- | Bindings to unit generators not distributed with SuperCollider proper.+module Sound.Sc3.Ugen.Bindings.Hw.External (module U) where++import Sound.Sc3.Ugen.Bindings.Hw.External.F0 as U+import Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins as U+import Sound.Sc3.Ugen.Bindings.Hw.External.Zita as U
+ Sound/Sc3/Ugen/Bindings/Hw/External/F0.hs view
@@ -0,0 +1,26 @@+-- | F0 Ugens (f0plugins)+module Sound.Sc3.Ugen.Bindings.Hw.External.F0 where++import Sound.Sc3.Common.Rate+import qualified Sound.Sc3.Ugen.Bindings.Hw.Construct as C+import Sound.Sc3.Ugen.Ugen++-- | Emulation of the sound generation hardware of the Atari TIA chip.+atari2600 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atari2600 audc0 audc1 audf0 audf1 audv0 audv1 rate = C.mkOsc ar "Atari2600" [audc0, audc1, audf0, audf1, audv0, audv1, rate] 1++-- | POKEY Chip Sound Simulator+mzPokey :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+mzPokey f1 c1 f2 c2 f3 c3 f4 c4 ctl = C.mkOsc ar "MZPokey" [f1, c1, f2, c2, f3, c3, f4, c4, ctl] 1++-- | A phasor that can loop.+redPhasor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor rate trig rate_ start end loop loopstart loopend = C.mkOsc rate "RedPhasor" [trig, rate_, start, end, loop, loopstart, loopend] 1++-- | A phasor that can loop.+redPhasor2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor2 rate trig rate_ start end loop loopstart loopend = C.mkOsc rate "RedPhasor2" [trig, rate_, start, end, loop, loopstart, loopend] 1++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Ugen/Bindings/Hw/External/Sc3_Plugins.hs view
@@ -0,0 +1,69 @@+-- | Bindings to unit generators in sc3-plugins.+module Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins where++import Sound.Sc3.Common.Rate++import qualified Sound.Sc3.Ugen.Bindings.Db.External as X+import qualified Sound.Sc3.Ugen.Bindings.Hw.Construct as C+import Sound.Sc3.Ugen.Types+import qualified Sound.Sc3.Ugen.Util as Util++-- | Convert frequency value to value appropriate for Ay tone inputs.+ayFreqToTone :: Fractional a => a -> a+ayFreqToTone f = 110300 / (f - 0.5)++-- | Ladspa plugins inside SuperCollider.+ladspa :: Int -> Rate -> Ugen -> [Ugen] -> Ugen+ladspa nc rt k z = C.mkOsc rt "LADSPA" (constant nc : k : z) nc++-- | Lookup index of Stk instrument by name.+stkAt :: (Num t, Enum t) => String -> t+stkAt nm =+  let nm_seq =+        [ "Clarinet"+        , "BlowHole"+        , "Saxofony"+        , "Flute"+        , "Brass"+        , "BlowBotl"+        , "Bowed"+        , "Plucked"+        , "StifKarp"+        , "Sitar"+        , "Mandolin"+        , "Rhodey"+        , "Wurley"+        , "TubeBell"+        , "HevyMetl"+        , "PercFlut"+        , "BeeThree"+        , "FMVoices"+        , "VoicForm"+        , "Moog"+        , "Simple"+        , "Drummer"+        , "BandedWG"+        , "Shakers"+        , "ModalBar"+        , "Mesh2D"+        , "Resonate"+        , "Whistle"+        ]+      tbl = zip nm_seq [0 ..]+  in case lookup nm tbl of+      Just ix -> ix+      Nothing -> error "stkAt: unknown instr"++-- | freq=220, gate=1, onamp=1, offamp=1, bowpressure=64, bowposition=64, vibfreq=64, vibgain=64, loudness=64+stkBowedI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBowedI rt freq gate_ onamp offamp bowpressure bowposition vibfreq vibgain loudness =+  let args = mce [2, bowpressure, 4, bowposition, 11, vibfreq, 1, vibgain, 128, loudness]+  in X.stkInst rt (stkAt "Bowed") freq gate_ onamp offamp args++{- | Wrapping Synthesis toolkit.++ StkGlobals [ar] showWarnings=0.0 printErrors=0.0 rawfilepath=0.0+-}+stkGlobals :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+stkGlobals rate showWarnings printErrors rawfilepath =+  mkUgen Nothing [ar] (Left rate) "StkGlobals" ([showWarnings, printErrors] ++ Util.unpackLabel False rawfilepath) Nothing 1 (Special 0) NoId
+ Sound/Sc3/Ugen/Bindings/Hw/External/Wavelets.hs view
@@ -0,0 +1,30 @@+-- | Wavelet unit generators (Nick Collins).+module Sound.Sc3.Ugen.Bindings.Hw.External.Wavelets where++import Sound.Sc3.Common.Rate+import Sound.Sc3.Ugen.Bindings.Hw.Construct+import Sound.Sc3.Ugen.Ugen++-- | Forward wavelet transform.+dwt :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwt buf i h wnt a wns wlt = mkOsc kr "DWT" [buf, i, h, wnt, a, wns, wlt] 1++-- | Inverse of 'dwt'.+idwt :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+idwt buf wnt wns wlt = mkOsc ar "IDWT" [buf, wnt, wns, wlt] 1++-- | Pass wavelets above a threshold, ie. 'pv_MagAbove'.+wt_MagAbove :: Ugen -> Ugen -> Ugen+wt_MagAbove buf thr = mkOsc kr "WT_MagAbove" [buf, thr] 1++-- | Pass wavelets with /scale/ above threshold.+wt_FilterScale :: Ugen -> Ugen -> Ugen+wt_FilterScale buf wp = mkOsc kr "WT_FilterScale" [buf, wp] 1++-- | Pass wavelets with /time/ above threshold.+wt_TimeWipe :: Ugen -> Ugen -> Ugen+wt_TimeWipe buf wp = mkOsc kr "WT_TimeWipe" [buf, wp] 1++-- | Product in /W/ domain, ie. 'pv_Mul'.+wt_Mul :: Ugen -> Ugen -> Ugen+wt_Mul ba bb = mkOsc kr "WT_Mul" [ba, bb] 1
+ Sound/Sc3/Ugen/Bindings/Hw/External/Zita.hs view
@@ -0,0 +1,29 @@+{- | Zita Ugen definitions.++See hsc3/ext/faust to build the SC3 plugin.+-}+module Sound.Sc3.Ugen.Bindings.Hw.External.Zita where++import Sound.Sc3.Common.Rate+import Sound.Sc3.Ugen.Bindings.Hw.Construct+import Sound.Sc3.Ugen.Ugen++-- | Parameter (name,value) pairs.+zitaRev_param :: Num n => [(String, n, (n, n, String))]+zitaRev_param =+  [ ("in_delay", 60, (20, 100, "lin")) -- ms+  , ("lf_x", 200, (50, 1000, "exp"))+  , ("low_rt60", 3, (1, 8, "exp"))+  , ("mid_rt60", 2, (1, 8, "exp"))+  , ("hf_damping", 6000, (1500, 24000, "exp"))+  , ("eq1_freq", 315, (40, 2500, "exp"))+  , ("eq1_level", 0, (-15, 15, "lin"))+  , ("eq2_freq", 1500, (160, 10000, "exp"))+  , ("eq2_level", 0, (-15, 15, "lin"))+  , ("dry_wet_mix", 0, (0, 1, "lin"))+  , ("level", -20, (-9, 9, "lin"))+  ]++-- | ZitaRev binding.+zitaRev :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+zitaRev in1 in2 in_delay lf_x low_rt60 mid_rt60 hf_damping eq1_freq eq1_level eq2_freq eq2_level dry_wet_mix level = mkFilterR [ar] "FaustZitaRev" [in1, in2, in_delay, lf_x, low_rt60, mid_rt60, hf_damping, eq1_freq, eq1_level, eq2_freq, eq2_level, dry_wet_mix, level] 2
+ Sound/Sc3/Ugen/Bracketed.hs view
@@ -0,0 +1,109 @@+{- | Bracketed Ugens.++ScSynth is controlled by sending instructions in the form of Open Sound Control (Osc) messages.+One family of messages allocate, set and free Buffers.+Ugen graphs that utilise Buffers don't contain the messages to manage them.+These messages are ordinarily written and sent outside of the graph context.++The bracketUgen function attaches a pair of Osc message sequences to a Ugen value.+The first sequence is to be sent before the graph the Ugen belongs to is started, the other after it has ended.+The messages are stored in the Ugen type, but are not written to the SynthDef file representing the Ugen graph.+The scsynthPlayAt function reads and sends Ugen bracket messages, in addition to the Ugen graph itself.++The functions defined here return Ugen values with brackets attached to them.+-}+module Sound.Sc3.Ugen.Bracketed where++import Sound.Sc3.Common.Enum {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Common.SoundFile {- hsc3 -}++import Sound.Sc3.Ugen.Bindings.Db {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++import Sound.Sc3.Server.Command.Plain {- hsc3 -}+import Sound.Sc3.Server.Enum {- hsc3 -}++{- | sfNc is the number of channels at a sound file.+     readChan is a list of channels indexed to read.+     Returns a channel count, either sfNc or the length of readChan.+     If readChan in empty returns sfNc, else returns the length of readChan.+     This function checks that requested channels are in range.+-}+readChanToNc :: Int -> [Int] -> Int+readChanToNc sfNc readChan =+  if null readChan+    then sfNc+    else+      if maximum readChan < sfNc+        then length readChan+        else error "readChanToNc: channel error"++{- | diskIn or vDiskIn with brackets to 1. allocate and read and then 2. close and free buffer.+     If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+     Ignoring the brackets, this is equivalent to writing a diskIn or vDiskIn Ugen,+     with the number of channels given by readChan or derived from the named file.+     If readChan is empty all channels are read.+-}+sndfileDiskIn :: (String, Buffer_Id, [Int]) -> FilePath -> Maybe Ugen -> Loop Ugen -> Ugen+sndfileDiskIn (ctlName, bufId, readChan) sndFileName maybeRate loop =+  let fileName = sfResolve sndFileName+      (sfNc, _sr, _nf) = sfInfo fileName+      bufSize = 65536+      buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+      bufNc = readChanToNc sfNc readChan+  in bracketUgen+      (maybe (diskIn bufNc buf loop) (\rate -> vDiskIn bufNc buf rate loop 0) maybeRate)+      ( [b_alloc bufId bufSize bufNc, b_readChannel bufId fileName 0 (-1) 0 True readChan]+      , [b_close bufId, b_free bufId]+      )++-- | diskIn form of sndfileDiskIn+sndfileIn :: (String, Buffer_Id, [Int]) -> FilePath -> Loop Ugen -> Ugen+sndfileIn opt sndFileName loop = sndfileDiskIn opt sndFileName Nothing loop++-- | vDiskIn form of sndfileDiskIn+sndfileVarIn :: (String, Buffer_Id, [Int]) -> FilePath -> Ugen -> Loop Ugen -> Ugen+sndfileVarIn opt sndFileName rate loop = sndfileDiskIn opt sndFileName (Just rate) loop++{- | Returns Buffer_Id as a bracketed buffer identifier Ugen,+     along with basic sound file information: numberOfChannels, sampleRate, numberOfFrames.+     If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+     The brackets will 1. allocate and read and then 2. free the buffer.+     Ignoring the brackets, and the sample rate and frame count, this is equivalent to declaring a buffer identifier.+     If readChan is empty all channels are read.+-}+sndfileRead :: (String, Buffer_Id, [Int]) -> FilePath -> (Ugen, Int, Ugen, Ugen)+sndfileRead (ctlName, bufId, readChan) sndFileName =+  let fileName = sfResolve sndFileName+      (sfNc, sfSr, sfNf) = sfInfo fileName+      buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+      bufNc = readChanToNc sfNc readChan+  in (bracketUgen buf ([b_allocReadChannel bufId fileName 0 0 readChan], [b_free bufId]), bufNc, constant sfSr, constant sfNf)++{- | Bracketed b_gen sine1+     If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+-}+bGenSine1 :: (String, Buffer_Id, Int) -> [B_Gen] -> [Double] -> Ugen+bGenSine1 (ctlName, bufId, numFrames) flags param =+  let buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+      bufNc = 1+  in bracketUgen buf ([b_alloc bufId numFrames bufNc, b_gen_sine1 bufId flags param], [b_free bufId])++-- | bGenSine1 with standard wavetable flags (normalise and wavetable and clear).+bGenSine1Tbl :: (String, Buffer_Id, Int) -> [Double] -> Ugen+bGenSine1Tbl opt = bGenSine1 opt [Normalise, Wavetable, Clear]++{- | Bracketed b_gen sine1+     If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+-}+bGenCheby :: (String, Buffer_Id, Int) -> [B_Gen] -> [Double] -> Ugen+bGenCheby (ctlName, bufId, numFrames) flags param =+  let buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+      bufNc = 1+  in bracketUgen buf ([b_alloc bufId numFrames bufNc, b_gen_cheby bufId flags param], [b_free bufId])++-- | bGenCheby with standard wavetable flags (normalise and wavetable and clear).+bGenChebyTbl :: (String, Buffer_Id, Int) -> [Double] -> Ugen+bGenChebyTbl opt = bGenCheby opt [Normalise, Wavetable, Clear]
+ Sound/Sc3/Ugen/Brackets.hs view
@@ -0,0 +1,24 @@+-- | Brackets+module Sound.Sc3.Ugen.Brackets where++import Data.Bifunctor {- base -}++import qualified Sound.Osc.Packet as Osc {- hosc -}++{- | Brackets are two sets of Open Sound Control messages that can be associated with a Ugen.+The first is to be run prior to the graph being executed, the other after it has ended.+-}+type Brackets = ([Osc.Message], [Osc.Message])++-- | No messages.+emptyBrackets :: Brackets+emptyBrackets = ([], [])++{- | Combine a sequence of Brackets into one Bracket.++>>> f = Data.Bifunctor.bimap concat concat . unzip+>>> f [(['a'],['A']),(['b'],['B'])]+("ab","AB")+-}+concatBrackets :: [Brackets] -> Brackets+concatBrackets = bimap concat concat . unzip
+ Sound/Sc3/Ugen/Constant.hs view
@@ -0,0 +1,32 @@+-- | Constant+module Sound.Sc3.Ugen.Constant where++import Sound.Sc3.Ugen.Brackets {- hsc3 -}++{- | Constants.+Constants may have brackets.+This allows for buffer allocation and deallocation to be associated with a buffer identifier.++>>> Constant 3 emptyBrackets == Constant 3 emptyBrackets+True++>>> Constant 3 emptyBrackets > Constant 1 emptyBrackets+True+-}+data Constant = Constant+  { constantValue :: Double+  , constantBrackets :: Brackets+  }+  deriving (Ord, Eq, Read, Show)++-- | Get fractional part of a double.+fractionPart :: Double -> Double+fractionPart = snd . (properFraction :: Double -> (Integer, Double))++{- | Is integer?++>>> constantIsInteger (Constant 1 emptyBrackets)+True+-}+constantIsInteger :: Constant -> Bool+constantIsInteger (Constant n _) = fractionPart n == 0
+ Sound/Sc3/Ugen/Control.hs view
@@ -0,0 +1,98 @@+-- | Control+module Sound.Sc3.Ugen.Control where++import Text.Printf {- base -}++import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Ugen.Brackets {- hsc3 -}++-- * Control Group++{- | Controls may form part of a control group.+There are presently three types of groups.+Ranges controls have two values (minima, maxima) and are ordinarily drawn as a range slider.+Array controls have n values [e1 .. eN] and are ordinarily drawn as a multislider.+Xy controls have two values (x, y) and are ordinarily drawn as a two dimensional slider.+-}+data Control_Group+  = Control_Range+  | Control_Array Int+  | Control_Xy+  deriving (Ord, Eq, Read, Show)++-- | The number of elements in a control group.+control_group_degree :: Control_Group -> Int+control_group_degree grp =+  case grp of+    Control_Range -> 2+    Control_Array n -> n+    Control_Xy -> 2++{- | Grouped controls have names that have equal prefixes and identifying suffixes.+     Range controls have two elements, minima and maxima, suffixes are [ and ].+     Array controls have n elements and have zero-indexed numerical suffixes.+     Xy controls have two elements, X and Y coordinates, suffixes are X and Y.+-}+control_group_suffixes :: Control_Group -> [String]+control_group_suffixes grp =+  case grp of+    Control_Range -> ["[", "]"]+    Control_Array n -> map (printf "%02d") [0 .. n - 1]+    Control_Xy -> ["X", "Y"]++-- * Control Meta++-- | Control meta-data.+data Control_Meta n = Control_Meta+  { ctl_min :: n+  -- ^ Minimum+  , ctl_max :: n+  -- ^ Maximum+  , ctl_warp :: String+  -- ^ @(0,1)@ @(min,max)@ transfer function.+  , ctl_step :: n+  -- ^ The step to increment & decrement by.+  , ctl_units :: String+  -- ^ Unit of measure (ie hz, ms etc.).+  , controlGroup :: Maybe Control_Group+  -- ^ Control group.+  }+  deriving (Ord, Eq, Read, Show)++-- * Control Meta (T)++-- | 3-tuple form of 'Control_Meta' data.+type Control_Meta_T3 n = (n, n, String)++-- | Lift 'Control_Meta_T3' to 'Control_Meta' allowing type coercion.+control_meta_t3 :: Num m => (n -> m) -> Control_Meta_T3 n -> Control_Meta m+control_meta_t3 f (l, r, w) = Control_Meta (f l) (f r) w 0 "" Nothing++-- | 5-tuple form of 'Control_Meta' data.+type Control_Meta_T5 n = (n, n, String, n, String)++-- | Lift 'Control_Meta_T5' to 'Control_Meta' allowing type coercion.+control_meta_t5 :: (n -> m) -> Control_Meta_T5 n -> Control_Meta m+control_meta_t5 f (l, r, w, stp, u) = Control_Meta (f l) (f r) w (f stp) u Nothing++-- * Control++{- | Control inputs.+It is an unchecked invariant that controls with equal names within a Ugen graph must be equal in all other respects.+-}+data Control = Control+  { controlOperatingRate :: Rate+  , controlIndex :: Maybe Int+  , controlName :: String+  , controlDefault :: Double+  , controlTriggered :: Bool+  , controlMeta :: Maybe (Control_Meta Double)+  , controlBrackets :: Brackets+  }+  deriving (Ord, Eq, Read, Show)++{-+-- | Control type+data CVarTy = CVarInit | CVarControl | CVarTrigger deriving (Eq,Read,Show)+CVar CVarTy String Double -- ^ Control input (named)+-}
+ Sound/Sc3/Ugen/Enum.hs view
@@ -0,0 +1,16 @@+-- | Data types for enumerated and non signal unit generator inputs.+module Sound.Sc3.Ugen.Enum where++import Sound.Sc3.Common.Enum {- hsc3 -}+import Sound.Sc3.Common.Envelope {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}++-- | Type specialised envelope curve.+type EnvCurve = Envelope_Curve Ugen++-- | Lift to Ugen.+from_buffer :: Buffer Ugen -> Ugen+from_buffer b =+  case b of+    Buffer_Id i -> constant i+    Buffer u -> u
+ Sound/Sc3/Ugen/Envelope.hs view
@@ -0,0 +1,47 @@+-- | Envelope / Ugen.+module Sound.Sc3.Ugen.Envelope where++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Bindings+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++{- | Trapezoidal envelope generator.++> import Sound.Sc3.Plot+> plotEnvelope [envTrapezoid 0.99 0.5 1 1,envTrapezoid 0.5 0.75 0.65 0.35]+-}+envTrapezoid :: OrdE t => t -> t -> t -> t -> Envelope t+envTrapezoid = envTrapezoid_f (less_than_or_equal_to, greater_than_or_equal_to)++-- | 'latch' 1 of 'impulse' 0.+first_zero_then_one :: Rate -> Ugen+first_zero_then_one rt = latch 1 (impulse rt 0 0)++-- | 'env_circle_z' of k-rate 'first_zero_thereafter_one'.+env_circle_u :: Ugen -> Envelope_Curve Ugen -> Envelope Ugen -> Envelope Ugen+env_circle_u = env_circle_z (first_zero_then_one ControlRate)++-- | Singleton fade envelope.+envGate :: Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Envelope_Curve Ugen -> Ugen+envGate level gate_ fadeTime doneAction curve =+  let startVal = fadeTime `less_than_or_equal_to` 0+      e = Envelope [startVal, 1, 0] [1, 1] [curve] (Just 1) Nothing 0+  in envGen ControlRate gate_ level 0 fadeTime doneAction e++{- | Variant with default values for all inputs.  @gate@ and+@fadeTime@ are 'control's, @doneAction@ is 'RemoveSynth', @curve@+is 'EnvSin'.+-}+envGate_def :: Ugen+envGate_def =+  let level = 1+      gate_ = control_m ControlRate "gate" 1 (0, 1, "gate")+      fadeTime = control_m ControlRate "fadeTime" 0.02 (0, 10, "lin")+      doneAction = RemoveSynth+      curve = EnvSin+  in envGate level gate_ fadeTime doneAction curve
+ Sound/Sc3/Ugen/Event.hs view
@@ -0,0 +1,235 @@+-- | Continous controller event and Ctl systems for external control interfaces.+module Sound.Sc3.Ugen.Event where++import Data.List {- base -}++import Data.List.Split {- split -}++import Sound.Sc3.Common.Math {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Ugen.Bindings.Composite {- hsc3 -}+import Sound.Sc3.Ugen.Bindings.Db {- hsc3 -}+import Sound.Sc3.Ugen.Types {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++-- * Cc Event++{- | (v, w, x, y, z, o, rx, ry, p, px, _)++     v = voice, w = gate, z = force/pressure,+     o = orientation/angle, r = radius, p = pitch+-}+type CcEvent t = (Int, t, t, t, t, t, t, t, t, t, t)++-- | Translate list to Event.+cc_event_from_list :: Num t => Int -> [t] -> CcEvent t+cc_event_from_list v l =+  case l of+    [w, x, y, z, o, rx, ry, p, px, py] -> (v, w, x, y, z, o, rx, ry, p, px, py)+    _ -> error "cc_event_from_list?"++{- | (ccEventAddr, ccEventIncr, ccEventZero)++ccEventAddr = k0 = index of control bus zero for event system,+ccEventIncr = stp = voice index increment,+ccEventZero = c0 = offset for event voices at current server+-}+type CcEventMeta t = (t, t, t)++ccEventMetaDefault :: Num n => CcEventMeta n+ccEventMetaDefault = (13000, 10, 0)++ccEventMetaControls :: CcEventMeta Int -> CcEventMeta Ugen+ccEventMetaControls (p, q, r) =+  let k nm i = control kr nm (fromIntegral i)+  in (k "ccEventAddr" p, k "ccEventIncr" q, k "ccEventZero" r)++-- | c = event number (zero indexed)+ccEventAddr :: (Ugen, Ugen, Ugen) -> Int -> CcEvent Ugen+ccEventAddr (k0, stp, c0) c =+  let u = in' 10 kr (k0 + ((c0 + fromIntegral c) * stp))+  in cc_event_from_list c (mceChannels u)++-- | c0 = index of voice (channel) zero for event set, n = number of voices (channels)+ccEventVoicerAddr :: CcEventMeta Ugen -> Int -> (CcEvent Ugen -> Ugen) -> Ugen+ccEventVoicerAddr m n f = mce (map (\c -> f (ccEventAddr m c)) [0 .. n - 1])++-- | 'eventVoicerAddr' with default (addr, inct, zero).+ccEventVoicer :: Int -> (CcEvent Ugen -> Ugen) -> Ugen+ccEventVoicer = ccEventVoicerAddr ccEventMetaDefault++-- | Synonym for ccEventVoicer.+voicer :: Int -> (CcEvent Ugen -> Ugen) -> Ugen+voicer = ccEventVoicer++-- | 'eventVoicerAddr' with 'control' inputs for /eventAddr/, /eventIncr/ and /eventZero/.+ccEventVoicerParam :: Int -> (CcEvent Ugen -> Ugen) -> Ugen+ccEventVoicerParam = ccEventVoicerAddr (ccEventMetaControls ccEventMetaDefault)++{- | Given /w|g/ and /p/ fields of an 'CcEvent' derive a 'gateReset' from g+and a trigger derived from monitoring /w|g/ and /p/ for changed values.+-}+ccEventGateReset :: Ugen -> Ugen -> (Ugen, Ugen)+ccEventGateReset g p =+  let tr = changed p 0.01 + changed g 0.01+  in (gateReset g tr, tr)++-- * Ctl++-- | Sequence of 8 continous controller inputs in range (0-1).+type Ctl8 = (Ugen, Ugen, Ugen, Ugen, Ugen, Ugen, Ugen, Ugen)++-- | k0 = index of control bus zero+ctl8At :: Int -> Ctl8+ctl8At k0 =+  let u = in' 8 kr (constant k0)+  in case mceChannels u of+      [cc0, cc1, cc2, cc3, cc4, cc5, cc6, cc7] -> (cc0, cc1, cc2, cc3, cc4, cc5, cc6, cc7)+      _ -> error "ctl8At?"++-- | 'ctlVoicerAddr' with 'control' inputs for /CtlAddr/ and /CtlZero/.+ctl8Voicer :: Int -> (Int -> Ctl8 -> Ugen) -> Ugen+ctl8Voicer n f = mce (map (\c -> f c (ctl8At (11000 + (8 * c)))) [0 .. n - 1])++-- | Sequence of 16 continous controller inputs arranged as two Ctl8 sequences.+type Ctl16 = (Ctl8, Ctl8)++-- | 'ctl16VoicerAddr' with 'control' inputs for /CtlAddr/ and /CtlZero/.+ctl16Voicer :: Int -> (Int -> Ctl16 -> Ugen) -> Ugen+ctl16Voicer n f = mce (map (\c -> let i = 11000 + (16 * c) in f c (ctl8At i, ctl8At (i + 8))) [0 .. n - 1])++-- * Names++-- | Control Specificier.  (name,default,(minValue,maxValue,warpName))+type ControlSpec t = (String, t, (t, t, String))++control_spec_name :: ControlSpec t -> String+control_spec_name (name, _, _) = name++-- | Comma separated, no spaces.+control_spec_parse :: String -> ControlSpec Double+control_spec_parse str =+  case splitOn "," str of+    [cnmdef, lhs, rhs, wrp] -> case splitOn ":" cnmdef of+      [cnm, def] -> (cnm, read def, (read lhs, read rhs, wrp))+      _ -> error ("control_spec_parse: " ++ cnmdef)+    _ -> error ("control_spec_parse: " ++ str)++{- | Semicolon separated, no spaces.++>>> control_spec_seq_parse "freq:220,110,440,exp;amp:0.1,0,1,amp;pan:0,-1,1,lin"+[("freq",220.0,(110.0,440.0,"exp")),("amp",0.1,(0.0,1.0,"amp")),("pan",0.0,(-1.0,1.0,"lin"))]+-}+control_spec_seq_parse :: String -> [ControlSpec Double]+control_spec_seq_parse = map control_spec_parse . splitOn ";"++-- | Comma separated, 6 decimal places, no spaces.+control_spec_print :: ControlSpec Double -> String+control_spec_print (cnm, def, (lhs, rhs, wrp)) = intercalate "," [concat [cnm, ":", double_pp 6 def], double_pp 6 lhs, double_pp 6 rhs, wrp]++{- | Semicolon separated, no spaces.++>>> control_spec_seq_print (control_spec_seq_parse "freq:220,220,440,exp;amp:0.1,0,1,amp;pan:0,-1,1,lin")+"freq:220.0,220.0,440.0,exp;amp:0.1,0.0,1.0,amp;pan:0.0,-1.0,1.0,lin"+-}+control_spec_seq_print :: [ControlSpec Double] -> String+control_spec_seq_print = intercalate ";" . map control_spec_print++control_spec_to_control :: ControlSpec Double -> Control+control_spec_to_control (cnm, def, (lhs, rhs, wrp)) =+  let grp = if last cnm `elem` "[]" then Just Control_Range else Nothing+  in Control ControlRate Nothing cnm def False (Just (Control_Meta lhs rhs wrp 0 "" grp)) emptyBrackets++{- | See SCClassLibrary/Common/Control/Spec:ControlSpec.initClass++"ControlSpec defines the range and curve of a control"++This list adds default values.+-}+sc3_control_spec :: Fractional t => [ControlSpec t]+sc3_control_spec =+  [ ("amp", 0.1, (0, 1, "amp"))+  , ("beats", 1, (0, 20, "lin"))+  , ("bipolar", 0, (-1, 1, "lin"))+  , ("boostcut", 0, (-20, 20, "lin"))+  , ("db", -12, (-180, 0, "db"))+  , ("delay", 0.01, (0.0001, 1, "exp"))+  , ("detune", 0, (-20, 20, "lin"))+  , ("freq", 440, (20, 20000, "exp"))+  , ("lofreq", 20, (0.1, 100, "exp"))+  , ("midfreq", 440, (25, 4200, "exp"))+  , ("midi", 64, (0, 127, "lin"))+  , ("midinote", 64, (0, 127, "lin"))+  , ("midivelocity", 64, (1, 127, "lin"))+  , ("pan", 0, (-1, 1, "lin"))+  , ("phase", 0, (0, 6.28318, "lin"))+  , ("rate", 1, (0.125, 8, "exp"))+  , ("rq", 0.1, (0.001, 2, "exp"))+  , ("unipolar", 0, (0, 1, "lin"))+  , ("widefreq", 440, (0.1, 20000, "exp"))+  ]++{- | See Kyma X Revealed, p.403++"The following EventValue names are associated with initial ranges+other than (0,1). EventValue names are not case-sensitive."++This list adds curve specifiers as strings and default values.++>>> Data.List.intersect (map control_spec_name sc3_control_spec) (map control_spec_name kyma_event_value_ranges)+["beats","boostcut","freq","rate"]++>>> let f i = filter ((== i) . control_spec_name)+>>> let c (p,q) = (f p sc3_control_spec, f q kyma_event_value_ranges)+>>> c ("lofreq","freqlow")+([("lofreq",20.0,(0.1,100.0,"exp"))],[("freqlow",120.0,(0.0,1000.0,"exp"))])++>>> c ("midfreq","freqmid")+([("midfreq",440.0,(25.0,4200.0,"exp"))],[("freqmid",1200.0,(1000.0,8000.0,"exp"))])++>>> find ((==) "freqhigh" . control_spec_name) kyma_event_value_ranges+Just ("freqhigh",12000.0,(8000.0,24000.0,"exp"))+-}+kyma_event_value_ranges :: Fractional t => [ControlSpec t]+kyma_event_value_ranges =+  [ ("angle", 0, (-0.5, 1.5, "lin"))+  , ("beats", 1, (1, 16, "lin"))+  , ("boostcut", 0, (-12, 12, "lin"))+  , ("bpm", 60, (0, 2000, "lin"))+  , ("centervalue", 0, (-1, 1, "lin"))+  , ("coef", 0, (-1, 1, "lin"))+  , ("cutoff", 440, (0, 10000, "exp"))+  , ("cycles", 1, (0, 100, "lin"))+  , ("dcoffset", 0, (-1, 1, "lin"))+  , ("direction", 0, (-1, 1, "lin"))+  , ("distance", 0, (-2, 2, "lin"))+  , ("fmntshift", 1, (0.75, 1.25, "lin"))+  , ("freq", 440, (0, 10000, "exp"))+  , ("freqhigh", 12000, (8000, 24000, "exp")) -- sampleRate / 2+  , ("freqjitter", 0, (0, 1, "lin"))+  , ("freqlow", 120, (0, 1000, "exp"))+  , ("freqmid", 1200, (1000, 8000, "exp"))+  , ("gain", 0.1, (0, 10, "amp"))+  , ("gaindb", -12, (-128, 128, "lin"))+  , ("interval", 0, (-24, 24, "lin"))+  , ("keynumber", 64, (0, 127, "lin"))+  , ("logfreq", 20, (0, 127, "lin"))+  , ("looplength", 0, (-1, 1, "lin"))+  , ("offset", 0, (-1, 1, "lin"))+  , ("onduration", 0.1, (0, 30, "lin"))+  , ("panner", 0, (-0.5, 1.5, "lin"))+  , ("pitch", 64, (0, 127, "lin"))+  , ("q", 0.1, (0, 10, "lin"))+  , ("radius", 1, (-2, 2, "lin"))+  , ("rate", 1, (0, 2, "lin"))+  , ("ratio", 1, (0, 100, "lin"))+  , ("scale", 0, (-2, 2, "lin"))+  , ("smallInterval", 0, (0, 12, "lin"))+  , ("steps", 1, (1, 128, "lin"))+  , ("swing", 0, (0, 0.5, "lin"))+  , ("threshdb", -12, (-60, 0, "lin"))+  , ("timeconstant", 1, (0.0001, 5, "lin"))+  , ("timeindex", 0, (-1, 1, "lin"))+  , ("tune", 0, (-1, 1, "lin"))+  , ("upinterval", 0, (0, 24, "lin"))+  ]
+ Sound/Sc3/Ugen/Graph.hs view
@@ -0,0 +1,617 @@+{- | 'U_Graph' and related types.++The Ugen type is recursive, inputs to Ugens are Ugens.++This makes writing Ugen graphs simple, but manipulating them awkward.++Ugen equality is structural, and can be slow to determine for some Ugen graph structures.++A U_Node is a non-recursive notation for a Ugen, all U_Nodes have unique identifiers.++A U_Graph is constructed by a stateful traversal of a Ugen.++A U_Graph is represented as a partioned (by type) set of U_Nodes, edges are implicit.+-}+module Sound.Sc3.Ugen.Graph where++import Data.Function {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Safe {- safe -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}++import qualified Sound.Sc3.Ugen.Analysis as Analysis {- hsc3 -}+import Sound.Sc3.Ugen.Types {- hsc3 -}+import qualified Sound.Sc3.Ugen.Util as Util {- hsc3 -}++-- * Types++-- | Port index.+type Port_Index = Int++{- | Type to represent the left hand side of an edge in a unit generator graph.+C = constant, K = control, U = ugen.+-}+data From_Port+  = From_Port_C {from_port_nid :: Uid.Id}+  | From_Port_K {from_port_nid :: Uid.Id, from_port_kt :: Rate.K_Type}+  | From_Port_U {from_port_nid :: Uid.Id, from_port_idx :: Maybe Port_Index}+  deriving (Eq, Show)++-- | A destination port.+data To_Port = To_Port {to_port_nid :: Uid.Id, to_port_idx :: Port_Index}+  deriving (Eq, Show)++-- | A connection from 'From_Port' to 'To_Port'.+type U_Edge = (From_Port, To_Port)++{- | Sum-type to represent nodes in unit generator graph.+  _C = constant, _K = control, _U = ugen, _P = proxy.+-}+data U_Node+  = U_Node_C+      { u_node_id :: Uid.Id+      , u_node_c_value :: Sample+      }+  | U_Node_K+      { u_node_id :: Uid.Id+      , u_node_k_rate :: Rate.Rate+      , u_node_k_index :: Maybe Int+      , u_node_k_name :: String+      , u_node_k_default :: Sample+      , u_node_k_type :: Rate.K_Type+      , u_node_k_meta :: Maybe (Control_Meta Sample)+      }+  | U_Node_U+      { u_node_id :: Uid.Id+      , u_node_u_rate :: Rate.Rate+      , u_node_u_name :: String+      , u_node_u_inputs :: [From_Port]+      , u_node_u_outputs :: [Output]+      , u_node_u_special :: Special+      , u_node_u_ugenid :: UgenId+      }+  | U_Node_P+      { u_node_id :: Uid.Id+      , u_node_p_id :: Uid.Id+      , u_node_p_index :: Port_Index+      , u_node_p_rate :: Rate.Rate+      }+  deriving (Eq, Show)++u_node_is_c, u_node_is_k, u_node_is_u :: U_Node -> Bool+u_node_is_c n = case n of U_Node_C {} -> True; _ -> False+u_node_is_k n = case n of U_Node_K {} -> True; _ -> False+u_node_is_u n = case n of U_Node_U {} -> True; _ -> False++-- | Convert from U_Node_K to Control (ie. discard index).+u_node_k_to_control :: U_Node -> Control+u_node_k_to_control nd =+  case nd of+    U_Node_K _ rt ix nm df ty mt -> Control rt ix nm df (ty == Rate.K_TriggerRate) mt emptyBrackets+    _ -> error "u_node_k_to_control?"++-- | Derive "user" name for U_Node+u_node_user_name :: U_Node -> String+u_node_user_name n = ugen_user_name (u_node_u_name n) (u_node_u_special n)++-- | Type to represent a unit generator graph.+data U_Graph = U_Graph+  { ug_next_id :: Uid.Id+  , ug_constants :: [U_Node]+  , ug_controls :: [U_Node]+  , ug_ugens :: [U_Node]+  }+  deriving (Show)++-- * Ports++-- | Get 'port_idx' for 'From_Port_U', else @0@.+port_idx_or_zero :: From_Port -> Port_Index+port_idx_or_zero p =+  case p of+    From_Port_U _ (Just x) -> x+    _ -> 0++-- | Is 'From_Port' 'From_Port_U'.+is_from_port_u :: From_Port -> Bool+is_from_port_u p =+  case p of+    From_Port_U _ _ -> True+    _ -> False++-- * Nodes++-- | Is 'U_Node' a /constant/.+is_u_node_c :: U_Node -> Bool+is_u_node_c n =+  case n of+    U_Node_C _ _ -> True+    _ -> False++-- | Predicate to determine if 'U_Node' is a constant with indicated /value/.+is_u_node_c_of :: Sample -> U_Node -> Bool+is_u_node_c_of x n =+  case n of+    U_Node_C _ y -> x == y+    _ -> error "is_u_node_c_of: non U_Node_C"++-- | Is 'U_Node' a /control/.+is_u_node_k :: U_Node -> Bool+is_u_node_k n =+  case n of+    U_Node_K {} -> True+    _ -> False++{- | Predicate to determine if 'U_Node' is a control with indicated+/name/.  Names must be unique.+-}+is_u_node_k_of :: String -> U_Node -> Bool+is_u_node_k_of x n =+  case n of+    U_Node_K _ _ _ y _ _ _ -> x == y+    _ -> error "is_u_node_k_of"++-- | Is 'U_Node' a /Ugen/.+is_u_node_u :: U_Node -> Bool+is_u_node_u n =+  case n of+    U_Node_U {} -> True+    _ -> False++-- | Compare 'U_Node_K' values 'on' 'u_node_k_type'.+u_node_k_cmp :: U_Node -> U_Node -> Ordering+u_node_k_cmp = compare `on` u_node_k_type++-- | Sort by 'u_node_id'.+u_node_sort :: [U_Node] -> [U_Node]+u_node_sort = sortBy (compare `on` u_node_id)++-- | Equality test, error if not U_Node_K.+u_node_k_eq :: U_Node -> U_Node -> Bool+u_node_k_eq p q =+  if is_u_node_k p && is_u_node_k q+    then p == q+    else error "u_node_k_eq? not U_Node_K"++{- | 'Rate' of 'U_Node', ie. 'InitialisationRate' for constants. See through 'U_Node_P'.+      Not used at hsc3 but used by hsc3-dot &etc.+-}+u_node_rate :: U_Node -> Rate.Rate+u_node_rate n =+  case n of+    U_Node_C {} -> Rate.InitialisationRate+    U_Node_K {} -> u_node_k_rate n+    U_Node_U {} -> u_node_u_rate n+    U_Node_P {} -> u_node_p_rate n++-- | Generate a label for 'U_Node' using the /type/ and the 'u_node_id'.+u_node_label :: U_Node -> String+u_node_label nd =+  case nd of+    U_Node_C n _ -> "c_" ++ show n+    U_Node_K n _ _ _ _ _ _ -> "k_" ++ show n+    U_Node_U n _ _ _ _ _ _ -> "u_" ++ show n+    U_Node_P n _ _ _ -> "p_" ++ show n++-- | Calculate all in edges for a 'U_Node_U'.+u_node_in_edges :: U_Node -> [U_Edge]+u_node_in_edges n =+  case n of+    U_Node_U x _ _ i _ _ _ -> zip i (map (To_Port x) [0 ..])+    _ -> error "u_node_in_edges: non U_Node_U input node"++-- | Transform 'U_Node' to 'From_Port'.+u_node_from_port :: U_Node -> From_Port+u_node_from_port d =+  case d of+    U_Node_C n _ -> From_Port_C n+    U_Node_K n _ _ _ _ t _ -> From_Port_K n t+    U_Node_U n _ _ _ o _ _ ->+      case o of+        [_] -> From_Port_U n Nothing+        _ -> error (show ("u_node_from_port: non unary U_Node_U", d))+    U_Node_P _ u p _ -> From_Port_U u (Just p)++-- | If controls have been given indices they must be coherent.+u_node_sort_controls :: [U_Node] -> [U_Node]+u_node_sort_controls c =+  let u_node_k_ix n = fromMaybe maxBound (u_node_k_index n)+      cmp = compare `on` u_node_k_ix+      c' = sortBy cmp c+      coheres z = maybe True (== z) . u_node_k_index+      coherent = and (zipWith coheres [0 ..] c')+  in if coherent then c' else error (show ("u_node_sort_controls: incoherent", c))++-- | Determine 'K_Type' of a /control/ Ugen at 'U_Node_U', or not.+u_node_ktype :: U_Node -> Maybe Rate.K_Type+u_node_ktype n =+  case (u_node_u_name n, u_node_u_rate n) of+    ("Control", Rate.InitialisationRate) -> Just Rate.K_InitialisationRate+    ("Control", Rate.ControlRate) -> Just Rate.K_ControlRate+    ("TrigControl", Rate.ControlRate) -> Just Rate.K_TriggerRate+    ("AudioControl", Rate.AudioRate) -> Just Rate.K_AudioRate+    _ -> Nothing++-- | Is 'U_Node' a control Ugen?+u_node_is_control :: U_Node -> Bool+u_node_is_control n =+  let cs = ["AudioControl", "Control", "TrigControl"]+  in case n of+      U_Node_U _ _ s _ _ _ _ -> s `elem` cs+      _ -> False++-- | Is 'U_Node' an /implicit/ control Ugen?+u_node_is_implicit_control :: U_Node -> Bool+u_node_is_implicit_control n = u_node_is_control n && u_node_id n == -1++-- | Is U_Node implicit?+u_node_is_implicit :: U_Node -> Bool+u_node_is_implicit n = u_node_u_name n == "MaxLocalBufs" || u_node_is_implicit_control n++-- | Zero if no local buffers, or if maxLocalBufs is given.+u_node_localbuf_count :: [U_Node] -> Int+u_node_localbuf_count us =+  case find ((==) "MaxLocalBufs" . u_node_u_name) us of+    Nothing -> length (filter ((==) "LocalBuf" . u_node_u_name) us)+    Just _ -> 0++{- | Controls are a special case.  We need to know not the overall+index but the index in relation to controls of the same type.+-}+u_node_fetch_k :: Uid.Id -> Rate.K_Type -> [U_Node] -> Int+u_node_fetch_k z t =+  let recur i ns =+        case ns of+          [] -> error "u_node_fetch_k"+          n : ns' ->+            if z == u_node_id n+              then i+              else+                if t == u_node_k_type n+                  then recur (i + 1) ns'+                  else recur i ns'+  in recur 0++-- | All the elements of a U_Node_U, except the u_node_id.+type U_Node_NoId = (Rate.Rate, String, [From_Port], [Output], Special, UgenId)++-- | Predicate to locate primitive, names must be unique.+u_node_eq_noid :: U_Node_NoId -> U_Node -> Bool+u_node_eq_noid x nd =+  case nd of+    U_Node_U _ r n i o s d -> (r, n, i, o, s, d) == x+    _ -> error "u_node_eq_noid"++-- | Make map associating 'K_Type' with Ugen index.+u_node_mk_ktype_map :: [U_Node] -> [(Rate.K_Type, Int)]+u_node_mk_ktype_map =+  let f (i, n) = let g ty = (ty, i) in fmap g (u_node_ktype n)+  in mapMaybe f . zip [0 ..]++-- * Nodes (Implicit)++-- | 4-tuple to count 'K_Type's, ie. (InitialisationRate,ControlRate,TriggerRate,AudioRate).+type U_NODE_KS_COUNT = (Int, Int, Int, Int)++-- | Count the number of /controls/ of each 'K_Type'.+u_node_ks_count :: [U_Node] -> U_NODE_KS_COUNT+u_node_ks_count =+  let recur r ns =+        let (i, k, t, a) = r+        in case ns of+            [] -> r+            n : ns' ->+              let r' = case u_node_k_type n of+                    Rate.K_InitialisationRate -> (i + 1, k, t, a)+                    Rate.K_ControlRate -> (i, k + 1, t, a)+                    Rate.K_TriggerRate -> (i, k, t + 1, a)+                    Rate.K_AudioRate -> (i, k, t, a + 1)+              in recur r' ns'+  in recur (0, 0, 0, 0)++{- | Construct implicit /control/ unit generator 'U_Nodes'.+Unit generators are only constructed for instances of control types that are present.+The special-index holds the accumulated offset where multiple Control Ugens (at different rates) are present.+-}+u_node_mk_implicit_ctl :: [U_Node] -> [U_Node]+u_node_mk_implicit_ctl ks =+  let (ni, nk, nt, na) = u_node_ks_count ks+      mk_n t n o =+        let (nm, r) = case t of+              Rate.K_InitialisationRate -> ("Control", Rate.InitialisationRate)+              Rate.K_ControlRate -> ("Control", Rate.ControlRate)+              Rate.K_TriggerRate -> ("TrigControl", Rate.ControlRate)+              Rate.K_AudioRate -> ("AudioControl", Rate.AudioRate)+            i = replicate n r+        in if n == 0+            then Nothing+            else Just (U_Node_U (-1) r nm [] i (Special o) no_id)+  in catMaybes+      [ mk_n Rate.K_InitialisationRate ni 0+      , mk_n Rate.K_ControlRate nk ni+      , mk_n Rate.K_TriggerRate nt (ni + nk)+      , mk_n Rate.K_AudioRate na (ni + nk + nt)+      ]++-- * Edges++-- | List of 'From_Port_U' at /e/ with multiple out edges.+u_edge_multiple_out_edges :: [U_Edge] -> [From_Port]+u_edge_multiple_out_edges e =+  let p = filter is_from_port_u (map fst e)+      p' = group (sortBy (compare `on` from_port_nid) p)+  in map (Safe.headNote "u_edge_multiple_out_edges") (filter ((> 1) . length) p')++-- * Graph++-- | Calculate all edges of a 'U_Graph'.+ug_edges :: U_Graph -> [U_Edge]+ug_edges = concatMap u_node_in_edges . ug_ugens++-- | The empty 'U_Graph'.+ug_empty_graph :: U_Graph+ug_empty_graph = U_Graph 0 [] [] []++-- | Find the maximum 'Uid.Id' used at 'U_Graph'.  It is an error if this is not 'ug_next_id'.+ug_maximum_id :: U_Graph -> Uid.Id+ug_maximum_id (U_Graph z c k u) =+  let z' = maximum (map u_node_id (c ++ k ++ u))+  in if z' /= z+      then error (show ("ug_maximum_id: not ug_next_id?", z, z'))+      else z++-- | Find 'U_Node' with indicated 'Uid.Id'.+ug_find_node :: U_Graph -> Uid.Id -> Maybe U_Node+ug_find_node (U_Graph _ cs ks us) n =+  let f x = u_node_id x == n+  in find f (cs ++ ks ++ us)++-- | Locate 'U_Node' of 'From_Port' in 'U_Graph'.+ug_from_port_node :: U_Graph -> From_Port -> Maybe U_Node+ug_from_port_node g fp = ug_find_node g (from_port_nid fp)++-- | Erroring variant.+ug_from_port_node_err :: U_Graph -> From_Port -> U_Node+ug_from_port_node_err g fp =+  let e = error "ug_from_port_node_err"+  in fromMaybe e (ug_from_port_node g fp)++-- * Graph (Construct from Ugen)++-- | Insert a constant 'U_Node' into the 'U_Graph'.+ug_push_c :: Sample -> U_Graph -> (U_Node, U_Graph)+ug_push_c x g =+  let n = U_Node_C (ug_next_id g) x+  in ( n+     , g+        { ug_constants = n : ug_constants g+        , ug_next_id = ug_next_id g + 1+        }+     )++{- | Either find existing 'Constant' 'U_Node', or insert a new 'U_Node'.+     Brackets are discarded.+-}+ug_mk_node_c :: Constant -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_c (Constant x _b) g =+  let y = find (is_u_node_c_of x) (ug_constants g)+  in maybe (ug_push_c x g) (\y' -> (y', g)) y++-- | Insert a control node into the 'U_Graph'.+ug_push_k :: Control -> U_Graph -> (U_Node, U_Graph)+ug_push_k (Control r ix nm d tr meta _brk) g =+  let n = U_Node_K (ug_next_id g) r ix nm d (Rate.ktype r tr) meta+  in ( n+     , g+        { ug_controls = n : ug_controls g+        , ug_next_id = ug_next_id g + 1+        }+     )++-- | Either find existing 'Control' 'U_Node', or insert a new 'U_Node'.+ug_mk_node_k :: Control -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_k c g =+  let nm = controlName c+      y = find (is_u_node_k_of nm) (ug_controls g)+  in maybe (ug_push_k c g) (\y' -> (y', g)) y++-- | Insert a /primitive/ 'U_Node_U' into the 'U_Graph'.+ug_push_u :: U_Node_NoId -> U_Graph -> (U_Node, U_Graph)+ug_push_u (r, nm, i, o, s, d) g =+  let n = U_Node_U (ug_next_id g) r nm i o s d+  in ( n+     , g+        { ug_ugens = n : ug_ugens g+        , ug_next_id = ug_next_id g + 1+        }+     )++-- | Recursively traverse set of Ugen calling 'ug_mk_node'.+ug_mk_node_rec :: [Ugen] -> [U_Node] -> U_Graph -> ([U_Node], U_Graph)+ug_mk_node_rec u n g =+  case u of+    [] -> (reverse n, g)+    x : xs ->+      let (y, g') = ug_mk_node x g+      in ug_mk_node_rec xs (y : n) g'++{- | Run 'ug_mk_node_rec' at inputs and either find existing primitive node or insert a new one.+     Brackets are discarded.+-}+ug_mk_node_u :: Primitive Ugen -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_u (Primitive r nm i o s d _b) g =+  let (i', g') = ug_mk_node_rec i [] g+      i'' = map u_node_from_port i'+      u = (r, nm, i'', o, s, d)+      y = find (u_node_eq_noid u) (ug_ugens g')+  in maybe (ug_push_u u g') (\y' -> (y', g')) y++-- | Proxies do not get stored in the graph.  Proxies are always of U nodes.+ug_mk_node_p :: U_Node -> Port_Index -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_p n p g =+  let z = ug_next_id g+  in (U_Node_P z (u_node_id n) p (u_node_u_rate n), g {ug_next_id = z + 1})++{- | Transform 'Ugen' into 'U_Graph', appending to existing 'U_Graph'.+  Allow rhs of Mrg node to be Mce (splice all nodes into graph).+-}+ug_mk_node :: Ugen -> U_Graph -> (U_Node, U_Graph)+ug_mk_node u g =+  case u of+    Constant_U c -> ug_mk_node_c c g+    Control_U k -> ug_mk_node_k k g+    Label_U _ -> error (show ("ug_mk_node: label", u))+    Primitive_U p -> ug_mk_node_u p g+    Proxy_U p ->+      let (n, g') = ug_mk_node_u (proxySource p) g+      in ug_mk_node_p n (proxyIndex p) g'+    Mrg_U m ->+      let f g' l = case l of+            [] -> g'+            n : l' -> let (_, g'') = ug_mk_node n g' in f g'' l'+      in ug_mk_node (mrgLeft m) (f g (mceChannels (mrgRight m)))+    Mce_U _ -> error (show ("ug_mk_node: mce", u))++-- * Implicit++-- | Add implicit /control/ Ugens to 'U_Graph'.+ug_add_implicit_ctl :: U_Graph -> U_Graph+ug_add_implicit_ctl g =+  let (U_Graph z cs ks us) = g+      ks' = sortBy u_node_k_cmp ks+      im = if null ks' then [] else u_node_mk_implicit_ctl ks'+      us' = im ++ us+  in U_Graph z cs ks' us'++-- | Add implicit 'maxLocalBufs' if not present.+ug_add_implicit_buf :: U_Graph -> U_Graph+ug_add_implicit_buf g =+  case u_node_localbuf_count (ug_ugens g) of+    0 -> g+    n ->+      let (c, g') = ug_mk_node_c (Constant (fromIntegral n) ([], [])) g+          p = u_node_from_port c+          u = U_Node_U (-1) Rate.InitialisationRate "MaxLocalBufs" [p] [] (Special 0) no_id+      in g' {ug_ugens = u : ug_ugens g'}++-- | 'ug_add_implicit_buf' and 'ug_add_implicit_ctl'.+ug_add_implicit :: U_Graph -> U_Graph+ug_add_implicit = ug_add_implicit_buf . ug_add_implicit_ctl++-- | Remove implicit Ugens from 'U_Graph'+ug_remove_implicit :: U_Graph -> U_Graph+ug_remove_implicit g =+  let u = filter (not . u_node_is_implicit) (ug_ugens g)+  in g {ug_ugens = u}++-- * Graph (Queries)++-- | Descendents at 'U_Graph' of 'U_Node'.+u_node_descendents :: U_Graph -> U_Node -> [U_Node]+u_node_descendents g n =+  let e = ug_edges g+      c = filter ((== u_node_id n) . from_port_nid . fst) e+      f (To_Port k _) = k+  in mapMaybe (ug_find_node g . f . snd) c++-- * PV edge accounting++-- | List @PV@ 'U_Node's at 'U_Graph' with multiple out edges.+ug_pv_multiple_out_edges :: U_Graph -> [U_Node]+ug_pv_multiple_out_edges g =+  let e = ug_edges g+      p = u_edge_multiple_out_edges e+      n = mapMaybe (ug_find_node g . from_port_nid) p+  in filter (Analysis.primitive_is_pv_rate . u_node_u_name) n++{- | Error string if graph has an invalid @PV@ subgraph, ie. multiple out edges+at @PV@ node not connecting to @Unpack1FFT@ & @PackFFT@, else Nothing.+-}+ug_pv_check :: U_Graph -> Maybe String+ug_pv_check g =+  case ug_pv_multiple_out_edges g of+    [] -> Nothing+    n ->+      let d = concatMap (map u_node_u_name . u_node_descendents g) n+      in if any Analysis.primitive_is_pv_rate d || any (`elem` ["IFFT"]) d+          then Just (show ("PV: multiple out edges, see pv_Split", map u_node_u_name n, d))+          else Nothing++-- | Variant that runs 'error' as required.+ug_pv_validate :: U_Graph -> U_Graph+ug_pv_validate g = maybe g error (ug_pv_check g)++-- * Ugen to U_Graph++{- | Transform a unit generator into a graph.+     'ug_mk_node' begins with an empty graph,+     then reverses the resulting 'Ugen' list and sorts the 'Control' list,+     and finally adds implicit nodes and validates PV sub-graphs.++> import Sound.Sc3 {\- hsc3 -\}+> ugen_to_graph (out 0 (pan2 (sinOsc ar 440 0) 0.5 0.1))+-}+ugen_to_graph_direct :: Ugen -> U_Graph+ugen_to_graph_direct u =+  let (_, g) = ug_mk_node (Util.prepare_root u) ug_empty_graph+      g' =+        g+          { ug_ugens = reverse (ug_ugens g)+          , ug_controls = u_node_sort_controls (ug_controls g)+          }+  in ug_pv_validate (ug_add_implicit g')++{-+ugen_to_graph_netlist :: Ugen -> U_Graph+ugen_to_graph_netlist u =+    let g = netlist_to_u_graph (ugenNetlist (Util.prepare_root u))+        g' = g {ug_ugens = reverse (ug_ugens g)+               ,ug_controls = u_node_sort_controls (ug_controls g)}+    in ug_pv_validate (ug_add_implicit g')+-}++ugen_to_graph :: Ugen -> U_Graph+ugen_to_graph = ugen_to_graph_direct++-- * Stat++-- | Simple statistical analysis of a unit generator graph.+ug_stat_ln :: U_Graph -> [String]+ug_stat_ln s =+  let cs = ug_constants s+      ks = ug_controls s+      us = ug_ugens s+      hist pp_f =+        let h (x : xs) = (x, length (x : xs))+            h [] = error "graph_stat_ln"+        in unwords . map ((\(p, q) -> pp_f p ++ "×" ++ show q) . h) . group . sort+  in [ "number of constants       : " ++ show (length cs)+     , "number of controls        : " ++ show (length ks)+     , "control rates             : " ++ hist show (map u_node_k_rate ks)+     , "control names             : " ++ unwords (map u_node_k_name ks)+     , "number of unit generators : " ++ show (length us)+     , "unit generator rates      : " ++ hist Rate.rateAbbrev (map u_node_u_rate us)+     , "unit generator set        : " ++ hist id (map u_node_user_name us)+     , "unit generator sequence   : " ++ unwords (map u_node_user_name us)+     ]++-- | 'unlines' of 'ug_stat_ln'.+ug_stat :: U_Graph -> String+ug_stat = unlines . ug_stat_ln++-- * Indices++{- | Find indices of all instances of the named Ugen at 'Graph'.+The index is required when using 'Sound.Sc3.Server.Command.u_cmd'.+-}+ug_ugen_indices :: (Num n, Enum n) => String -> U_Graph -> [n]+ug_ugen_indices nm =+  let f (k, nd) =+        case nd of+          U_Node_U _ _ nm' _ _ _ _ -> if nm == nm' then Just k else Nothing+          _ -> Nothing+  in mapMaybe f . zip [0 ..] . ug_ugens
+ Sound/Sc3/Ugen/Graph/Reconstruct.hs view
@@ -0,0 +1,150 @@+-- | A disassembler for Ugen graphs.+module Sound.Sc3.Ugen.Graph.Reconstruct where++import Data.Char {- base -}+import Data.List {- base -}+import Text.Printf {- base -}++import qualified Sound.Sc3.Common.Math.Operator as Operator+import qualified Sound.Sc3.Common.Rate as Rate+import qualified Sound.Sc3.Ugen.Graph as Graph+import qualified Sound.Sc3.Ugen.Types as Types+import qualified Sound.Sc3.Ugen.Util as Util++-- | Generate label for 'Graph.From_Port'+from_port_label :: Char -> Graph.From_Port -> String+from_port_label jn fp =+  case fp of+    Graph.From_Port_C n -> printf "c_%d" n+    Graph.From_Port_K n _ -> printf "k_%d" n+    Graph.From_Port_U n Nothing -> printf "u_%d" n+    Graph.From_Port_U n (Just i) -> printf "u_%d%co_%d" n jn i++-- | Any name that does not begin with a letter is considered an operator.+is_operator_name :: String -> Bool+is_operator_name nm =+  case nm of+    c : _ -> not (isLetter c)+    _ -> False++parenthesise_operator :: String -> String+parenthesise_operator nm =+  if is_operator_name nm+    then printf "(%s)" nm+    else nm++reconstruct_graph :: Graph.U_Graph -> ([String], String)+reconstruct_graph g =+  let (Graph.U_Graph _ c k u) = g+      ls =+        concat+          [ map reconstruct_c_str (Graph.u_node_sort c)+          , map reconstruct_k_str (Graph.u_node_sort k)+          , concatMap reconstruct_u_str u+          ]+  in (filter (not . null) ls, reconstruct_mrg_str u)++reconstruct_graph_module :: String -> Graph.U_Graph -> [String]+reconstruct_graph_module nm gr =+  let imp =+        [ "import Sound.Sc3 {- hsc3 -}"+        , "import Sound.Sc3.Common.Base {- hsc3 -}"+        , "import Sound.Sc3.Ugen.Plain {- hsc3 -}"+        ]+  in case reconstruct_graph gr of+      (b0 : bnd, res) ->+        let hs = ("  let " ++ b0) : map ("      " ++) bnd ++ ["  in " ++ res]+            pre = [nm ++ " :: Ugen", nm ++ " ="]+        in (imp ++ pre ++ hs)+      _ -> error "reconstruct_graph_module"++{- | Generate a reconstruction of a 'Graph'.++> import Sound.Sc3+> import Sound.Sc3.Ugen.Graph+> import Sound.Sc3.Ugen.Graph.Reconstruct++> let k = control kr "bus" 0+> let o = sinOsc ar 440 0 + whiteNoiseId 'α' ar+> let u = out k (pan2 (o * 0.1) 0 1)+> let m = mrg [u,out 1 (impulse ar 1 0 * 0.1)]+> putStrLn (reconstruct_graph_str "anon" (ugen_to_graph m))+-}+reconstruct_graph_str :: String -> Graph.U_Graph -> String+reconstruct_graph_str nm = unlines . reconstruct_graph_module nm++reconstruct_c_str :: Graph.U_Node -> String+reconstruct_c_str u =+  let l = Graph.u_node_label u+      c = Graph.u_node_c_value u+  in printf "%s = constant (%f::Sample)" l c++reconstruct_c_ugen :: Graph.U_Node -> Types.Ugen+reconstruct_c_ugen u = Types.constant (Graph.u_node_c_value u)++-- | Discards index.+reconstruct_k_rnd :: Graph.U_Node -> (Rate.Rate, String, Types.Sample)+reconstruct_k_rnd u =+  let r = Graph.u_node_k_rate u+      n = Graph.u_node_k_name u+      d = Graph.u_node_k_default u+  in (r, n, d)++reconstruct_k_str :: Graph.U_Node -> String+reconstruct_k_str u =+  let l = Graph.u_node_label u+      (r, n, d) = reconstruct_k_rnd u+  in printf "%s = control %s \"%s\" %f" l (show r) n d++reconstruct_k_ugen :: Graph.U_Node -> Types.Ugen+reconstruct_k_ugen u =+  let (r, n, d) = reconstruct_k_rnd u+  in Util.control_f64 r Nothing n d++ugen_qname :: String -> Types.Special -> (String, String)+ugen_qname nm (Types.Special n) =+  case nm of+    "UnaryOpUGen" -> ("uop Cs", Operator.unaryName n)+    "BinaryOpUGen" -> ("binop Cs", Operator.binaryName n)+    _ -> ("ugen", nm)++reconstruct_mce_str :: Graph.U_Node -> String+reconstruct_mce_str u =+  let o = length (Graph.u_node_u_outputs u)+      l = Graph.u_node_label u+      p = map (printf "%s_o_%d" l) [0 .. o - 1]+      p' = intercalate "," p+  in if o <= 1+      then ""+      else printf "[%s] = mceChannels %s" p' l++reconstruct_u_str :: Graph.U_Node -> [String]+reconstruct_u_str u =+  let l = Graph.u_node_label u+      r = Graph.u_node_u_rate u+      i = Graph.u_node_u_inputs u+      i_s = unwords (map (from_port_label '_') i)+      i_l = intercalate "," (map (from_port_label '_') i)+      s = Graph.u_node_u_special u+      (q, n) = ugen_qname (Graph.u_node_u_name u) s+      z = Graph.u_node_id u+      o = length (Graph.u_node_u_outputs u)+      u_s = printf "%s = ugen \"%s\" %s [%s] %d" l n (show r) i_l o+      nd_s =+        let t = "%s = nondet \"%s\" (Uid %d) %s [%s] %d"+        in printf t l n z (show r) i_l o+      c = case q of+        "ugen" -> if Graph.u_node_u_ugenid u == Types.NoId then u_s else nd_s+        _ -> printf "%s = %s \"%s\" %s %s" l q n (show r) i_s+      m = reconstruct_mce_str u+  in if Graph.u_node_is_implicit_control u+      then []+      else if null m then [c] else [c, m]++reconstruct_mrg_str :: [Graph.U_Node] -> String+reconstruct_mrg_str u =+  let zero_out n = not (Graph.u_node_is_implicit_control n) && null (Graph.u_node_u_outputs n)+  in case map Graph.u_node_label (filter zero_out u) of+      [] -> error "reconstruct_mrg_str: nil input?"+      [o] -> printf "%s" o+      o -> printf "mrg [%s]" (intercalate "," o)
+ Sound/Sc3/Ugen/Graph/Transform.hs view
@@ -0,0 +1,83 @@+-- | Transformations over 'Graph' structure.+module Sound.Sc3.Ugen.Graph.Transform where++import Data.Either {- base -}+import Data.List {- base -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}+import Sound.Sc3.Ugen.Graph++-- * Lift constants++{- | Transform 'U_Node_C' to 'U_Node_K', 'id' for other 'U_Node' types.++> let k = U_Node_K 8 ControlRate Nothing "k_8" 0.1 K_ControlRate Nothing+> node_k_eq k (snd (constant_to_control 8 (U_Node_C 0 0.1)))+-}+constant_to_control :: Uid.Id -> U_Node -> (Uid.Id, U_Node)+constant_to_control z n =+  case n of+    U_Node_C _ k -> (z + 1, U_Node_K z Rate.ControlRate Nothing ("k_" ++ show z) k Rate.K_ControlRate Nothing)+    _ -> (z, n)++-- | If the 'From_Port' is a /constant/ generate a /control/ 'U_Node', else retain 'From_Port'.+c_lift_from_port :: U_Graph -> Uid.Id -> From_Port -> (Uid.Id, Either From_Port U_Node)+c_lift_from_port g z fp =+  case fp of+    From_Port_C _ ->+      let n = ug_from_port_node_err g fp+          (z', n') = constant_to_control z n+      in (z', Right n')+    _ -> (z, Left fp)++{- | Lift a set of 'U_NodeU' /inputs/ from constants to controls.  The+result triple gives the incremented 'Uid.Id', the transformed+'From_Port' list, and the list of newly minted control 'U_Node's.+-}+c_lift_inputs :: U_Graph -> Uid.Id -> [From_Port] -> (Uid.Id, [From_Port], [U_Node])+c_lift_inputs g z i =+  let (z', r) = mapAccumL (c_lift_from_port g) z i+      f e = case e of+        Left fp -> fp+        Right n -> u_node_from_port n+      r' = map f r+  in (z', r', rights r)++-- | Lift inputs at 'U_Node_U' as required.+c_lift_ugen :: U_Graph -> Uid.Id -> U_Node -> (Uid.Id, U_Node, [U_Node])+c_lift_ugen g z n =+  case n of+    U_Node_U {} ->+      let i = u_node_u_inputs n+          (z', i', k) = c_lift_inputs g z i+      in (z', n {u_node_u_inputs = i'}, k)+    _ -> error "c_lift_ugen"++-- | 'c_lift_ugen' at list of 'U_Node_U'.+c_lift_ugens :: U_Graph -> Uid.Id -> [U_Node] -> (Uid.Id, [U_Node], [U_Node])+c_lift_ugens g =+  let recur (k, r) z u =+        case u of+          [] -> (z, k, reverse r)+          n : u' ->+            let (z', n', k') = c_lift_ugen g z n+            in recur (k ++ k', n' : r) z' u'+  in recur ([], [])++{- | Lift constants to controls.++> import Sound.Sc3 {\- hsc3 -\}+> import Sound.Sc3.Ugen.Dot {\- hsc3-dot -\}++> let u = out 0 (sinOsc AR 440 0 * 0.1)+> let g = ugen_to_graph u+> draw g+> draw (lift_constants g)+-}+lift_constants :: U_Graph -> U_Graph+lift_constants g =+  let (U_Graph z _ k u) = ug_remove_implicit g+      (z', k', u') = c_lift_ugens g z u+      g' = U_Graph z' [] (nubBy u_node_k_eq (k ++ k')) u'+  in ug_add_implicit g'
+ Sound/Sc3/Ugen/Help/Graph.hs view
@@ -0,0 +1,87 @@+-- | Standard SC3 graphs, referenced in documentation.+module Sound.Sc3.Ugen.Help.Graph where++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Bindings+import Sound.Sc3.Ugen.Mce+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++-- | The SC3 /default/ instrument 'Ugen' graph.+default_ugen_graph :: Ugen+default_ugen_graph =+  let f = control kr "freq" 440+      a = control kr "amp" 0.1+      p = control kr "pan" 0+      g = control kr "gate" 1+      o = control kr "out" 0+      e = linen g 0.01 0.7 0.3 RemoveSynth+      f3 = mce [f, f + randId 'α' (-0.4) 0, f + randId 'β' 0 0.4]+      l = xLine kr (randId 'γ' 4000 5000) (randId 'δ' 2500 3200) 1 DoNothing+      z = lpf (mix (varSaw ar f3 0 0.3 * 0.3)) l * e+  in out o (pan2 z p a)++-- | A /Gabor/ grain, envelope is by 'lfGauss'.+gabor_grain_ugen_graph :: Ugen+gabor_grain_ugen_graph =+  let o = control ir "out" 0+      f = control ir "freq" 440+      d = control ir "sustain" 1+      l = control ir "pan" 0+      a = control ir "amp" 0.1+      w = control ir "width" 0.25+      e = lfGauss ar d w 0 NoLoop RemoveSynth+      s = fSinOsc ar f (0.5 * pi) * e+  in offsetOut o (pan2 s l a)++-- | A /sine/ grain, envelope is by 'envGen' of 'envSine'.+sine_grain_ugen_graph :: Ugen+sine_grain_ugen_graph =+  let o = control ir "out" 0+      f = control ir "freq" 440+      d = control ir "sustain" 1+      l = control ir "pan" 0+      a = control ir "amp" 0.1+      w = control ir "width" 0.25+      e = envGen ar 1 1 0 1 RemoveSynth (envSine (d * w) 1)+      s = fSinOsc ar f (0.5 * pi) * e+  in offsetOut o (pan2 s l a)++{- | Trivial file playback instrument.++If /use_gate/ is 'True' there is a /gate/ parameter and the synth+ends either when the sound file ends or the gate closes, else there+is a /sustain/ parameter to indicate the duration.  In both cases a+linear envelope with a decay time of /decay/ is applied.++The /rdelay/ parameter sets the maximum pre-delay time (in+seconds), each instance is randomly pre-delayed between zero and+the indicated time.  The /ramplitude/ parameter sets the maximum+amplitude offset of the /amp/ parameter, each instance is randomly+amplified between zero and the indicated value.+-}+default_sampler_ugen_graph :: Bool -> Ugen+default_sampler_ugen_graph use_gate =+  let b = control kr "bufnum" 0+      l = control kr "pan" 0+      a = control kr "amp" 0.1+      r = control kr "rate" 1+      m = control kr "rdelay" 0+      v = control kr "ramplitude" 0+      w = control kr "attack" 0+      y = control kr "decay" 0.5+      r' = bufRateScale kr b * r+      p = playBuf 1 ar b r' 1 0 NoLoop RemoveSynth+      e =+        if use_gate+          then+            let g = control kr "gate" 1+            in envGen kr g 1 0 1 RemoveSynth (envAsr w 1 y EnvSin)+          else+            let s = control kr "sustain" 1+            in envGen kr 1 1 0 1 RemoveSynth (envLinen w s y 1)+      d = delayC (p * e) m (randId 'α' 0 m)+  in out 0 (pan2 d l (a + randId 'β' 0 v))
+ Sound/Sc3/Ugen/Hs.hs view
@@ -0,0 +1,392 @@+-- | Haskell implementations of Sc3 Ugens.+module Sound.Sc3.Ugen.Hs where++import Data.List {- base -}++import qualified Safe {- safe -}+import qualified System.Random as R {- random -}++import Sound.Sc3.Common.Base+import Sound.Sc3.Common.Math+import qualified Sound.Sc3.Common.Math.Filter as Filter++-- | F = function, St = state+type F_St0 st o = st -> (o, st)++type F_St1 st i o = (i, st) -> (o, st)++-- | U = uniform+type F_U2 n = n -> n -> n++type F_U3 n = n -> n -> n -> n+type F_U4 n = n -> n -> n -> n -> n+type F_U5 n = n -> n -> n -> n -> n -> n+type F_U6 n = n -> n -> n -> n -> n -> n -> n+type F_U7 n = n -> n -> n -> n -> n -> n -> n -> n+type F_U8 n = n -> n -> n -> n -> n -> n -> n -> n -> n+type F_U9 n = n -> n -> n -> n -> n -> n -> n -> n -> n -> n++-- | T = tuple (see Base for T2-T4)+type T5 n = (n, n, n, n, n)++type T6 n = (n, n, n, n, n, n)+type T7 n = (n, n, n, n, n, n, n)+type T8 n = (n, n, n, n, n, n, n, n)+type T9 n = (n, n, n, n, n, n, n, n, n)++-- | avg = average+avg2 :: Fractional n => F_U2 n+avg2 p q = (p + q) / 2++avg3 :: Fractional n => F_U3 n+avg3 p q r = (p + q + r) / 3++avg4 :: Fractional n => F_U4 n+avg4 p q r s = (p + q + r + s) / 4++avg5 :: Fractional n => F_U5 n+avg5 p q r s t = (p + q + r + s + t) / 5++avg9 :: Fractional n => F_U9 n+avg9 p q r s t u v w x = (p + q + r + s + t + u + v + w + x) / 9++{- | fir = finite impulse response++>>> l_apply_f_st1 (fir1 (\x z1 -> (x + z1) / 2)) 0 [0 .. 5]+[0.0,0.5,1.5,2.5,3.5,4.5]+-}+fir1 :: F_U2 n -> F_St1 n n n+fir1 f (n, z0) = (f n z0, n)++{- | fir = finite impulse response++>>> l_apply_f_st1 (fir2 (\x x1 x2 -> (x + x1 + x2) / 2)) (0,0) [0 .. 5]+[0.0,0.5,1.5,3.0,4.5,6.0]+-}+fir2 :: F_U3 n -> F_St1 (T2 n) n n+fir2 f (n, (z1, z0)) = (f n z0 z1, (z0, n))++fir3 :: F_U4 n -> F_St1 (T3 n) n n+fir3 f (n, (z2, z1, z0)) = (f n z0 z1 z2, (z1, z0, n))++fir4 :: F_U5 n -> F_St1 (T4 n) n n+fir4 f (n, (z3, z2, z1, z0)) = (f n z0 z1 z2 z3, (z2, z1, z0, n))++fir8 :: F_U9 n -> F_St1 (T8 n) n n+fir8 f (n, (z7, z6, z5, z4, z3, z2, z1, z0)) = (f n z0 z1 z2 z3 z4 z5 z6 z7, (z6, z5, z4, z4, z2, z1, z0, n))++{- | iir = infinite impulse response++>> l_apply_f_st1 (iir1 (\x y1 -> x + y1)) 0 (replicate 10 1)+[1,2,3,4,5,6,7,8,9,10]+-}+iir1 :: F_U2 n -> F_St1 n n n+iir1 f (n, y0) = let r = f n y0 in (r, r)++{- | Two place iir++>>> l_apply_f_st1 (iir2 (\x y1 y2 -> x + y1 + y2)) (0,0) (replicate 10 1)+[1,2,4,7,12,20,33,54,88,143]++>>> map (+1) [0+0,1+0,2+1,4+2,7+4,12+7,20+12,33+20,54+33,88+54] -- https://oeis.org/A000071+[1,2,4,7,12,20,33,54,88,143]+-}+iir2 :: F_U3 n -> F_St1 (T2 n) n n+iir2 f (n, (y1, y0)) = let r = f n y0 y1 in (r, (y0, r))++-- | ff = feed-forward, fb = feed-back+iir2_ff_fb :: (n -> n -> n -> T2 n) -> F_St1 (T2 n) n n+iir2_ff_fb f (n, (y1, y0)) = let (r, y0') = f n y0 y1 in (r, (y0, y0'))++biquad :: F_U5 n -> F_St1 (T4 n) n n+biquad f (n, (x1, x0, y1, y0)) = let r = f n x0 x1 y0 y1 in (r, (x0, n, y0, r))++-- | sos = second order section+sos_f :: Num n => T5 n -> F_U5 n+sos_f (a0, a1, a2, b1, b2) x x1 x2 y1 y2 = a0 * x + a1 * x1 + a2 * x2 - b1 * y1 - b2 * y2++sos :: Num n => T5 n -> F_St1 (T4 n) n n+sos p = biquad (sos_f p)++-- | hp = high pass+hpz1 :: Fractional n => F_St1 n n n+hpz1 = fir1 (\n z0 -> 0.5 * (n - z0))++hpz2 :: Fractional n => F_St1 (T2 n) n n+hpz2 = fir2 (\n z0 z1 -> 0.25 * (n - (2 * z0) + z1))++-- | lp = low pass+lpz1 :: Fractional n => F_St1 n n n+lpz1 = fir1 avg2++lpz2 :: Fractional n => F_St1 (T2 n) n n+lpz2 = fir2 (\n z0 z1 -> 0.25 * (n + (2 * z0) + z1))++-- | bp = band pass+bpz2 :: Fractional n => F_St1 (T2 n) n n+bpz2 = fir2 (\n _z0 z1 -> 0.5 * (n - z1))++-- | br = band reject+brz2 :: Fractional n => F_St1 (T2 n) n n+brz2 = fir2 (\n _z0 z1 -> 0.5 * (n + z1))++-- | mavg = moving average+mavg5 :: Fractional n => F_St1 (T4 n) n n+mavg5 = fir4 avg5++mavg9 :: Fractional n => F_St1 (T8 n) n n+mavg9 = fir8 avg9++{- | Sample rate (SR) to radians per sample (RPS).++>>> sr_to_rps 44100 == 0.00014247585730565955+True+-}+sr_to_rps :: Floating n => n -> n+sr_to_rps sr = two_pi / sr++-- | resonz iir2_ff_fb function.  param are for 'Filter.resonz_coef'.+resonz_f :: Floating n => T3 n -> (n -> n -> n -> T2 n)+resonz_f param x y1 y2 =+  let (a0, b1, b2) = Filter.resonz_coef param+      y0 = x + b1 * y1 + b2 * y2+  in (a0 * (y0 - y2), y0)++-- | ir = initialization rate+resonz_ir :: Floating n => T3 n -> F_St1 (T2 n) n n+resonz_ir p = iir2_ff_fb (resonz_f p)++-- | rlpf = resonant low pass filter+rlpf_f :: Floating n => (n -> n -> n) -> T3 n -> F_U3 n+rlpf_f max_f param x y1 y2 =+  let (a0, b1, b2) = Filter.rlpf_coef max_f param+  in a0 * x + b1 * y1 + b2 * y2++rlpf_ir :: (Floating n, Ord n) => T3 n -> F_St1 (T2 n) n n+rlpf_ir p = iir2 (rlpf_f max p)++bw_hpf_ir :: Floating n => T2 n -> F_St1 (T4 n) n n+bw_hpf_ir (sample_rate, f) = sos (Filter.bw_lpf_or_hpf_coef True sample_rate f)++bw_lpf_ir :: Floating n => T2 n -> F_St1 (T4 n) n n+bw_lpf_ir (sample_rate, f) = sos (Filter.bw_lpf_or_hpf_coef False sample_rate f)++white_noise :: (R.RandomGen g, Fractional n, R.Random n) => F_St0 g n+white_noise = R.randomR (-1.0, 1.0)++brown_noise_f :: (Fractional n, Ord n) => n -> n -> n+brown_noise_f x y1 =+  let z = x + y1+  in if z > 1.0 then 2.0 - z else if z < (-1.0) then (-2.0) - z else z++brown_noise :: (R.RandomGen g, Fractional n, R.Random n, Ord n) => F_St0 (g, n) n+brown_noise (g, y1) =+  let (n, g') = white_noise g+      r = brown_noise_f (n / 8.0) y1+  in (r, (g', r))++-- | <http://musicdsp.org/files/pink.txt>+pk_pinking_filter_f :: Fractional a => (a, a, a, a, a, a, a) -> a -> (a, (a, a, a, a, a, a, a))+pk_pinking_filter_f (b0, b1, b2, b3, b4, b5, b6) w =+  let b0' = 0.99886 * b0 + w * 0.0555179+      b1' = 0.99332 * b1 + w * 0.0750759+      b2' = 0.96900 * b2 + w * 0.1538520+      b3' = 0.86650 * b3 + w * 0.3104856+      b4' = 0.55000 * b4 + w * 0.5329522+      b5' = -0.7616 * b5 - w * 0.0168980+      p = b0 + b1 + b2 + b3 + b4 + b5 + b6 + w * 0.5362+      b6' = w * 0.115926+  in (p, (b0', b1', b2', b3', b4', b5', b6'))++-- | <http://musicdsp.org/files/pink.txt>+pk_pinking_filter_economy_f :: Fractional a => (a, a, a) -> a -> (a, (a, a, a))+pk_pinking_filter_economy_f (b0, b1, b2) w =+  let b0' = 0.99765 * b0 + w * 0.0990460+      b1' = 0.96300 * b1 + w * 0.2965164+      b2' = 0.57000 * b2 + w * 1.0526913+      p = b0 + b1 + b2 + w * 0.1848+  in (p, (b0', b1', b2'))++-- | dt must not be zero.+decay_f :: Floating a => a -> a -> a -> a -> a+decay_f sr dt x y1 =+  let b1 = exp (log 0.001 / (dt * sr))+  in x + b1 * y1++{- | Given time /dt/ in frames construct 'iir1' 'lag' function.+  dt must not be zero.+-}+lag_f_frames :: Floating a => a -> a -> a -> a+lag_f_frames dt x y1 = let b1 = exp (log 0.001 / dt) in x + b1 * (y1 - x)++-- | 'lag_f_frames' with /dt/ in seconds.+lag_f :: Floating a => a -> a -> a -> a -> a+lag_f sr dt = lag_f_frames (dt * sr)++lag :: Floating t => t -> F_St1 t (t, t) t+lag sr ((i, t), st) = let r = lag_f sr t i st in (r, r)++slope :: Num t => t -> F_St1 t t t+slope sr = fir1 (\n z0 -> (n - z0) * sr)++latch :: F_St1 t (t, Bool) t+latch ((n, b), y1) = let r = if b then n else y1 in (r, r)++as_trig :: (Fractional t, Ord t) => F_St1 t t Bool+as_trig (n, y1) = (y1 <= 0.0 && n > 0.0, n)++phasor :: RealFrac t => F_St1 t (Bool, t, t, t, t) t+phasor ((trig, rate, start, end, resetPos), ph) =+  let r = if trig then resetPos else sc3_wrap (ph + rate) start end+  in (ph, r)++-- > Sound.Sc3.Plot.plot_fn_r1_ln (\x -> mod_dif x 0 1) (0,4)+mod_dif :: RealFrac a => a -> a -> a -> a+mod_dif i j m =+  let d = absdif i j `sc3_mod` m+      h = m * 0.5+  in h - absdif d h++{-+-- > Sound.Sc3.Plot.plot_fn_r1_ln (\x -> modDif x 0 1) (0,4)+modDif :: BinaryOp a => a -> a -> a -> a+modDif i j m =+  let d = absDif i j `modE` m+      h = m * 0.5+  in h - absDif d h+-}++-- | * List Processing+l_apply_f_st0 :: F_St0 st o -> st -> [o]+l_apply_f_st0 f st = let (r, st') = f st in r : l_apply_f_st0 f st'++{- | White noise++>>> take 4 (l_white_noise 'α')+[0.9687553280469108,0.808159221997721,-0.8993330152164296,0.23197278942699834]+-}+l_white_noise :: (Enum e, Fractional n, R.Random n) => e -> [n]+l_white_noise e = l_apply_f_st0 white_noise (R.mkStdGen (fromEnum e))++{- | Brown noise++>>> take 4 (l_brown_noise 'α')+[0.12109441600586385,0.22211431875557897,0.10969769185352526,0.13869429053190005]+-}+l_brown_noise :: (Enum e, Fractional n, Ord n, R.Random n) => e -> [n]+l_brown_noise e = l_apply_f_st0 brown_noise (R.mkStdGen (fromEnum e), 0.0)++l_apply_f_st1 :: F_St1 st i o -> st -> [i] -> [o]+l_apply_f_st1 f st xs =+  case xs of+    [] -> []+    x : xs' -> let (r, st') = f (x, st) in r : l_apply_f_st1 f st' xs'++l_lag :: Floating t => t -> [t] -> [t] -> [t]+l_lag sr i t = l_apply_f_st1 (lag sr) 0 (zip i t)++l_slope :: Floating t => t -> [t] -> [t]+l_slope sr = l_apply_f_st1 (slope sr) 0++{- | Phasor++>>> let rp = repeat+>>> take 10 (l_phasor (rp False) (rp 1) (rp 0) (rp 4) (rp 0))+[0.0,1.0,2.0,3.0,0.0,1.0,2.0,3.0,0.0,1.0]+-}+l_phasor :: RealFrac n => [Bool] -> [n] -> [n] -> [n] -> [n] -> [n]+l_phasor trig rate start end resetPos =+  let i = zip5 trig rate start end resetPos+  in l_apply_f_st1 phasor (Safe.headNote "l_phasor" start) i++l_phasor_osc :: RealFrac n => n -> n -> [n] -> [n]+l_phasor_osc sr k f =+  let rp = repeat+  in l_phasor (rp False) (map (cps_to_incr sr k) f) (rp 0) (rp k) (rp 0)++l_sin_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]+l_sin_osc sr f = map sin (l_phasor_osc sr two_pi f)++l_cos_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]+l_cos_osc sr f = map cos (l_phasor_osc sr two_pi f)++l_hpz1 :: Fractional n => [n] -> [n]+l_hpz1 = l_apply_f_st1 hpz1 0++l_hpz2 :: Fractional n => [n] -> [n]+l_hpz2 = l_apply_f_st1 hpz2 (0, 0)++l_lpz1 :: Fractional n => [n] -> [n]+l_lpz1 = l_apply_f_st1 lpz1 0++l_lpz2 :: Fractional n => [n] -> [n]+l_lpz2 = l_apply_f_st1 lpz2 (0, 0)++l_bpz2 :: Fractional n => [n] -> [n]+l_bpz2 = l_apply_f_st1 bpz2 (0, 0)++l_brz2 :: Fractional n => [n] -> [n]+l_brz2 = l_apply_f_st1 brz2 (0, 0)++l_bw_hpf :: Floating n => T2 n -> [n] -> [n]+l_bw_hpf p = l_apply_f_st1 (bw_hpf_ir p) (0, 0, 0, 0)++l_bw_lpf :: Floating n => T2 n -> [n] -> [n]+l_bw_lpf p = l_apply_f_st1 (bw_lpf_ir p) (0, 0, 0, 0)++l_resonz_ir :: Floating n => T3 n -> [n] -> [n]+l_resonz_ir p = l_apply_f_st1 (resonz_ir p) (0, 0)++l_rlpf_ir :: (Floating n, Ord n) => T3 n -> [n] -> [n]+l_rlpf_ir p = l_apply_f_st1 (rlpf_ir p) (0, 0)++l_mavg5 :: Fractional n => [n] -> [n]+l_mavg5 = l_apply_f_st1 mavg5 (0, 0, 0, 0)++l_mavg9 :: Fractional n => [n] -> [n]+l_mavg9 = l_apply_f_st1 mavg9 (0, 0, 0, 0, 0, 0, 0, 0)++{-++import Sound.Sc3.Plot {- hsc3-plot -}+import Sound.Sc3.Plot.FFT {- hsc3-plot -}++let n = take 4096 (l_white_noise 'α')+let plotTable1 = plot_p1_ln . return++plotTable1 n+plotTable1 (take 4096 (l_brown_noise 'α'))++plotTable1 (l_lpz1 n)+plotTable1 (l_lpz2 n)+plotTable1 (l_hpz1 n)+plotTable1 (l_hpz2 n)++plotTable1 (rfft_pure n)+plotTable1 (rfft_pure (l_lpz1 n))+plotTable1 (rfft_pure (l_lpz2 n))+plotTable1 (rfft_pure (l_hpz1 n))+plotTable1 (rfft_pure (l_hpz2 n))+plotTable1 (rfft_pure (l_bpz2 n))+plotTable1 (rfft_pure (l_brz2 n))+plotTable1 (rfft_pure (l_bw_lpf (44100,9000) n))+plotTable1 (rfft_pure (l_bw_hpf (44100,9000) n))+plotTable1 (rfft_pure (l_resonz_ir (sr_to_rps 44100,440,0.1) n))+plotTable1 (rfft_pure (l_rlpf_ir (sr_to_rps 44100,1200,0.1) n))++import Sound.Sc3.Common.Math {- hsc3 -}++plot_fft1_mnn 44100 (rfft_pure (l_bw_lpf (44100,midi_to_cps 60) n))+plot_fft1_mnn 44100 (rfft_pure (l_resonz_ir (sr_to_rps 44100,midi_to_cps 69,0.1) n))+plot_fft1_mnn 44100 (rfft_pure (l_rlpf_ir (sr_to_rps 44100,midi_to_cps 86,0.1) n))++plotTable1 (l_mavg9 (rfft_pure n))+plotTable1 (l_mavg9 (rfft_pure (l_lpz2 n)))+plotTable1 (l_mavg9 (rfft_pure (l_hpz2 n)))+plotTable1 (l_mavg9 (rfft_pure (l_bpz2 n)))+plotTable1 (l_mavg9 (l_mavg9 (l_mavg9 (l_mavg9 (rfft_pure (l_brz2 n))))))++plotTable1 (take 512 (l_sin_osc 48000 (repeat 440)))+plotTable1 (take 512 (l_cos_osc 48000 (repeat 440)))++-}
+ Sound/Sc3/Ugen/Label.hs view
@@ -0,0 +1,4 @@+-- | Label.+module Sound.Sc3.Ugen.Label where++newtype Label = Label {ugenLabel :: String} deriving (Ord, Eq, Read, Show)
+ Sound/Sc3/Ugen/Math.hs view
@@ -0,0 +1,35 @@+-- | Ugen math+module Sound.Sc3.Ugen.Math where++import qualified Sound.Sc3.Common.Math as Math+import qualified Sound.Sc3.Common.Math.Operator as Operator+import qualified Sound.Sc3.Common.Uid as Uid++import qualified Sound.Sc3.Ugen.Bindings.Db as Bindings+import qualified Sound.Sc3.Ugen.Ugen as Ugen++-- | Pseudo-infinite constant Ugen.+dinf :: Ugen.Ugen+dinf = Ugen.constant (9e8 :: Ugen.Sample)++-- | 'Ugen' form of 'ceilingE'.+ceil :: Ugen.Ugen -> Ugen.Ugen+ceil = Operator.ceilingE++-- | Midi note number and velocity data is in (0, 127).  This maps (0,1) to (0,100), i.e. is it (* 100).+unitMidi :: Num t => t -> t+unitMidi = (*) 100++{- | midiCps of (0,1) scaled to (0,100).+     To make control signal data uniform, all control signals are in (0, 1).+-}+unitCps :: Operator.UnaryOp t => t -> t+unitCps = Operator.midiCps . (* 100)++-- | Optimised Ugen sum function.+sum_opt :: [Ugen.Ugen] -> Ugen.Ugen+sum_opt = Math.sum_opt_f Bindings.sum3 Bindings.sum4++-- | Apply the Ugen processor /f/ /k/ times in sequence to /i/, ie. for k=4 /f (f (f (f i)))/.+useqId :: (Uid.ID z, Enum z) => z -> Int -> (z -> Ugen.Ugen -> Ugen.Ugen) -> Ugen.Ugen -> Ugen.Ugen+useqId z k f i = if k <= 0 then i else useqId (succ z) (k - 1) f (f z i)
+ Sound/Sc3/Ugen/Math/Composite.hs view
@@ -0,0 +1,32 @@+-- | Non-primitve math Ugens.+module Sound.Sc3.Ugen.Math.Composite where++import Sound.Sc3.Common.Math.Operator++import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++-- | Select /q/ or /r/ by /p/, ie. @if p == 1 then q else if p == 0 then r@.+ugen_if :: Num a => a -> a -> a -> a+ugen_if p q r = (p * q) + ((1 - p) * r)++{- | Separate input into integral and fractional parts.++>>> ugen_integral_and_fractional_parts 1.5 == mce2 1 0.5+True+-}+ugen_integral_and_fractional_parts :: Ugen -> Ugen+ugen_integral_and_fractional_parts n =+  let gt_eq_0 = let n' = floorE n in mce2 n' (n - n')+      lt_0 = let n' = ceilingE n in mce2 n' (n - n')+  in ugen_if (n `greater_than_or_equal_to` 0) gt_eq_0 lt_0++{- | Fractional midi into integral midi and cents detune.++>>> ugen_fmidi_to_midi_detune 60.5 == mce2 60 50+True+-}+ugen_fmidi_to_midi_detune :: Ugen -> Ugen+ugen_fmidi_to_midi_detune mnn =+  let (n, c) = unmce2 (ugen_integral_and_fractional_parts mnn)+  in mce2 n (c * 100)
+ Sound/Sc3/Ugen/Mce.hs view
@@ -0,0 +1,85 @@+-- | Multiple channel expansion+module Sound.Sc3.Ugen.Mce where++import Control.Monad {- base -}+import Data.List {- base -}++import qualified Data.List.Split as Split {- split -}++import Sound.Sc3.Common.Uid {- hsc3 -}+import qualified Sound.Sc3.Ugen.Math as Math {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}++-- | Construct a list of Ugens by applying f to consecutive identifiers (from z) and indices (from 0).+listFillId :: (Integral n, ID z, Enum z) => z -> Int -> (z -> n -> Ugen) -> [Ugen]+listFillId z n f = zipWith f [z ..] [0 .. fromIntegral n - 1]++-- | Construct a list of Ugens by applying f at consecutive indices (from 0).+listFillM :: (Uid m, Integral n) => Int -> (n -> m Ugen) -> m [Ugen]+listFillM n f = mapM f [0 .. fromIntegral n - 1]++-- | Construct a list of Ugens by applying f at consecutive indices (from 0).+listFill :: Integral n => Int -> (n -> Ugen) -> [Ugen]+listFill n f = map f [0 .. fromIntegral n - 1]++-- | 'mce' of 'replicate'+mceConst :: Int -> Ugen -> Ugen+mceConst n = mce . replicate n++-- | 'mce' of 'map' /f/ of 'id_seq' /n/.+mceGenId :: ID z => (Id -> Ugen) -> Int -> z -> Ugen+mceGenId f n = mce . map f . id_seq n++-- | Applicative variant of mceGenId.+mceGenM :: Applicative f => f Ugen -> Int -> f Ugen+mceGenM f n = fmap mce (replicateM n f)++-- | Count 'mce' channels.+mceSize :: Ugen -> Ugen+mceSize = constant . length . mceChannels++-- | Mix divided by number of inputs.+mceMean :: Ugen -> Ugen+mceMean e = let p = mceChannels e in Math.sum_opt p / constant (length p)++-- | Construct an Mce array of Ugens.+mceFill :: Integral n => Int -> (n -> Ugen) -> Ugen+mceFill n = mce . listFill n++-- | 'mce' of 'listFillId'+mceFillId :: (Integral n, ID z, Enum z) => z -> Int -> (z -> n -> Ugen) -> Ugen+mceFillId z n = mce . listFillId z n++-- | Type specialised mceFill+mceFillInt :: Int -> (Int -> Ugen) -> Ugen+mceFillInt = mceFill++-- | Collapse possible mce by summing.+mix :: Ugen -> Ugen+mix = Math.sum_opt . mceChannels++-- | Mix variant, sum to n channels.+mixTo :: Int -> Ugen -> Ugen+mixTo n u =+  let xs = transpose (Split.chunksOf n (mceChannels u))+  in mce (map Math.sum_opt xs)++-- | 'mix' of 'mceFill'+mixFill :: Integral n => Int -> (n -> Ugen) -> Ugen+mixFill n = mix . mceFill n++-- | Type specialised mixFill+mixFillInt :: Int -> (Int -> Ugen) -> Ugen+mixFillInt = mixFill++-- | Type specialised mixFill+mixFillUgen :: Int -> (Ugen -> Ugen) -> Ugen+mixFillUgen = mixFill++-- | 'mix' of 'mceFillId'+mixFillId :: (Integral n, ID z, Enum z) => z -> Int -> (z -> n -> Ugen) -> Ugen+mixFillId z n = mix . mceFillId z n++-- | Monad variant on mixFill.+mixFillM :: (Integral n, Monad m) => Int -> (n -> m Ugen) -> m Ugen+mixFillM n f = fmap Math.sum_opt (mapM f [0 .. fromIntegral n - 1])
+ Sound/Sc3/Ugen/Mrg.hs view
@@ -0,0 +1,8 @@+-- | Multiple root graph (Mrg)+module Sound.Sc3.Ugen.Mrg where++data Mrg t = Mrg+  { mrgLeft :: t+  , mrgRight :: t+  }+  deriving (Ord, Eq, Read, Show)
+ Sound/Sc3/Ugen/Name.hs view
@@ -0,0 +1,97 @@+{- | Functions to normalise Ugen names.++@Sc3@ Ugen names are capitalised at word boundaries.+@hsc3@ cannot use these names for Ugen constructor functions.+Haskell names are given by lower-casing until the first word edge.+Lisp names are given by lower-casing everything and adding hyphens before edges.+-}+module Sound.Sc3.Ugen.Name where++import Data.Char {- base -}++import Sound.Sc3.Common.Base {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}++{-+import qualified Sound.Sc3.Common.Base {- hsc3 -}++is_uc_or_num :: Char -> Bool+is_uc_or_num c = isUpper c || isDigit c++is_lc_or_num :: Char -> Bool+is_lc_or_num c = isLower c || isDigit c+-}++{- | Find all Sc3 name edges. Edges occur at non lower-case letters.+  This rule is very simple but is coherent and predictable and works well for .hs names.+-}+sc3_name_edges_plain :: String -> [Bool]+sc3_name_edges_plain = map (not . isLower)++{- | Find non-initial Sc3 name edges.++>>> sc3_name_edges "SinOsc"+[False,False,False,True,False,False]++>>> sc3_name_edges "FFT"+[False,False,False]++>>> sc3_name_edges "DFM1"+[False,False,False,False]++>>> sc3_name_edges "PV_Add"+[False,False,False,True,False,False]++>>> sc3_name_edges "A2K"+[False,False,False]++>>> sc3_name_edges "Lag2UD"+[False,False,False,True,True,True]++>>> sc3_name_edges "PeakEQ"+[False,False,False,False,True,True]+-}+sc3_name_edges :: String -> [Bool]+sc3_name_edges s =+  let (p, q) = span (== True) (sc3_name_edges_plain s)+      n = length p+  in if n < 2 || null q+      then replicate n False ++ q+      else replicate (n - 1) False ++ [True] ++ q++{- | Convert from ScLang (class) name to Haskell (function) name.++>>> let f = unwords . map sc3_name_to_hs_name . words+>>> f "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF"+"sinOsc lfSaw fft pv_Add allpassN bHiPass binaryOpUGen hpz1 rlpf"++>>> f "TGrains DFM1 FBSineC A2K Lag2UD IIRFilter FMGrainB Pan2 PeakEQ RIRandN"+"tGrains dfm1 fbSineC a2k lag2UD iirFilter fmGrainB pan2 peakEQ riRandN"+-}+sc3_name_to_hs_name :: String -> String+sc3_name_to_hs_name s =+  let f (c, e) = if e then toUpper c else c+  in zipWith (curry f) (map toLower s) (sc3_name_edges s)++{- | Convert from Sc3 name to Lisp style name.++>>> let f = unwords . map sc3_name_to_lisp_name . words+>>> f "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF TGrains DFM1 BPeakEQ Pan2 RIRandN"+"sin-osc lf-saw fft pv-add allpass-n b-hi-pass binary-op-u-gen hpz1 rlpf t-grains dfm1 b-peak-e-q pan-2 ri-rand-n"+-}+sc3_name_to_lisp_name :: String -> String+sc3_name_to_lisp_name s =+  let f (c, e) = if e then ['-', c] else if c == '_' then [] else [c]+  in concatMap f (zip (map toLower s) (sc3_name_edges s))++{- | Sc3 Ugen /names/ are given with rate suffixes if oscillators, without if filters.++>>> map sc3_ugen_name_sep (words "SinOsc.ar LPF *")+[Just ("SinOsc",Just AudioRate),Just ("LPF",Nothing),Just ("*",Nothing)]+-}+sc3_ugen_name_sep :: String -> Maybe (String, Maybe Rate)+sc3_ugen_name_sep u =+  case string_split_at_char '.' u of+    [nm, rt] -> Just (nm, rate_parse (map toUpper rt))+    [nm] -> Just (nm, Nothing)+    _ -> Nothing
+ Sound/Sc3/Ugen/Optimise.hs view
@@ -0,0 +1,149 @@+-- | Optimisations of Ugen graphs.+module Sound.Sc3.Ugen.Optimise where++import System.Random {- random -}++import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate++import qualified Sound.Sc3.Ugen.Bindings.Db as Bindings {- hsc3 -}+import Sound.Sc3.Ugen.Types+import Sound.Sc3.Ugen.Util++-- | Constant form of 'rand' Ugen.+c_rand :: Random a => Int -> a -> a -> a+c_rand z l r = fst (randomR (l, r) (mkStdGen z))++-- | Constant form of 'iRand' Ugen.+c_irand :: (Num b, RealFrac a, Random a) => Int -> a -> a -> b+c_irand z l r = fromInteger (round (c_rand z l r))++{- | 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 (randId 'a' 220 440) 0 * 0.1+> draw (u + ugen_optimise_ir_rand u)+-}+ugen_optimise_ir_rand :: Ugen -> Ugen+ugen_optimise_ir_rand =+  let f u =+        case u of+          Primitive_U p ->+            case p of+              Primitive+                InitialisationRate+                "Rand"+                [ Constant_U (Constant l ([], []))+                  , Constant_U (Constant r ([], []))+                  ]+                [InitialisationRate]+                _+                (Uid z)+                ([], []) -> Constant_U (Constant (c_rand z l r) ([], []))+              Primitive+                InitialisationRate+                "IRand"+                [ Constant_U (Constant l ([], []))+                  , Constant_U (Constant r ([], []))+                  ]+                [InitialisationRate]+                _+                (Uid z)+                ([], []) -> Constant_U (Constant (c_irand z l r) ([], []))+              _ -> u+          _ -> u+  in ugenTraverse (const False) f++{- | 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+True++>>> u 5 ==** u 5 == u 1+True++>>> u 5 >** u 4 == u 1+True++>>> u 5 <=** u 5 == u 1+True++>>> abs (u (-1)) == u 1+True++>>> u 5 / u 2 == u 2.5+True++>>> min (u 2) (u 3) == u 2+True++>>> max (u 1) (u 3) == u 3+True++> let u = lfPulse ar (2 ** randId 'α' (-9) 1) 0 0.5+> let u' = ugen_optimise_ir_rand u+> draw (mix (mce [u,u',ugen_optimise_const_operator u']))++> ugen_optimise_const_operator (Bindings.mulAdd 3 1 0) == 3+-}+ugen_optimise_const_operator :: Ugen -> Ugen+ugen_optimise_const_operator =+  let f u =+        case u of+          Primitive_U p ->+            case p of+              Primitive+                _+                "BinaryOpUGen"+                [ Constant_U (Constant l ([], []))+                  , Constant_U (Constant r ([], []))+                  ]+                [_]+                (Special z)+                _+                ([], []) -> case binop_special_hs z of+                  Just fn -> Constant_U (Constant (fn l r) ([], []))+                  _ -> u+              Primitive+                _+                "UnaryOpUGen"+                [Constant_U (Constant i ([], []))]+                [_]+                (Special z)+                _+                ([], []) -> case uop_special_hs z of+                  Just fn -> Constant_U (Constant (fn i) ([], []))+                  _ -> u+              Primitive _ "MulAdd" [i, m, a] [_] _ _ ([], []) -> mulAddOptimised i m a+              _ -> u+          _ -> u+  in ugenTraverse (const False) f++-- | 'u_constant' of 'ugen_optimise_ir_rand'.+constant_opt :: Ugen -> Maybe Sample+constant_opt = u_constant . ugen_optimise_ir_rand++{- | Constant optimising MulAdd.++> mulAddOptimised (sinOsc ar 440 0) 1 0 == sinOsc ar 440 0+> mulAddOptimised (sinOsc ar 440 0) 0.1 0 == sinOsc ar 440 0 * 0.1+> mulAddOptimised (sinOsc ar 440 0) 1 1 == sinOsc ar 440 0 + 1+> mulAddOptimised (sinOsc ar 440 0) 0.1 1 == mulAdd (sinOsc ar 440 0) 0.1 1+-}+mulAddOptimised :: Ugen -> Ugen -> Ugen -> Ugen+mulAddOptimised u m a =+  case (is_constant_of 1 m, is_constant_of 0 a) of+    (True, True) -> u+    (False, True) -> u * m+    (True, False) -> u + a+    (False, False) -> Bindings.mulAdd u m a
+ Sound/Sc3/Ugen/Plain.hs view
@@ -0,0 +1,60 @@+{- | Plain notation for SuperCollider Ugen graphs.++> s = ugen "SinOsc" ar [440,0] 1+> m = binop Ci "*" ar s 0.1+> o = ugen "Out" ar [0,m] 0+> map Sound.Sc3.Ugen.Pp.ugen_concise_pp [s, m, o]+["SinOsc","*","Out"]+-}+module Sound.Sc3.Ugen.Plain where++import Sound.Sc3.Common.Base+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Types++-- | Variant of 'mkUgen'.+mk_plain :: Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen+mk_plain rt nm inp = mkUgen Nothing all_rates (Left rt) nm inp Nothing++{- | Construct unary operator.++> uop Ci "Neg" ar 1+-}+uop :: Case_Rule -> String -> Rate -> Ugen -> Ugen+uop cr nm r p =+  case unaryIndex cr nm of+    Just s -> mk_plain r "UnaryOpUGen" [p] 1 (Special s) NoId+    Nothing -> error "uop"++{- | Construct binary operator.++>>> binop Ci "*" ar 1 2 == binop Ci "Mul" ar 1 2+True++> binop Cs "*" ar (ugen "SinOsc" ar [440,0] 1) 0.1 == sinOsc ar 440 0 * 0.1+True+-}+binop :: Case_Rule -> String -> Rate -> Ugen -> Ugen -> Ugen+binop cr nm r p q =+  case binaryIndex cr nm of+    Just s -> mk_plain r "BinaryOpUGen" [p, q] 1 (Special s) NoId+    Nothing -> error "binop"++{- | Construct deterministic Ugen.++> let o = ugen "SinOsc" ar [440,0] 1+> o == sinOsc ar 440 0+> ugen "Out" ar [0, o] 0 == out 0 (sinOsc ar 440 0)+-}+ugen :: String -> Rate -> [Ugen] -> Int -> Ugen+ugen nm r i nc = mk_plain r nm i nc (Special 0) NoId++{- | Construct non-deterministic Ugen.++> import Sound.Sc3.Common.Uid+> binop Ci "*" ar (nondet "WhiteNoise" (Uid (fromEnum 'α')) ar [] 1) 0.05+-}+nondet :: String -> UgenId -> Rate -> [Ugen] -> Int -> Ugen+nondet nm z r i nc = mk_plain r nm i nc (Special 0) z
+ Sound/Sc3/Ugen/Pp.hs view
@@ -0,0 +1,32 @@+-- | 'Ugen' pretty-printer.+module Sound.Sc3.Ugen.Pp where++import Data.List {- split -}++import Sound.Sc3.Common.Math+import Sound.Sc3.Common.Mce++import Sound.Sc3.Ugen.Types++{- | Print constants and labels directly,+     primitives as un-adorned names,+     mce as [p,q],+     mrg as p&q,+     contols as nm=def,+     proxies as u@n.+     Brackets are not printed.+-}+ugen_concise_pp :: Ugen -> String+ugen_concise_pp u =+  let bracketed (l, r) x = l : x ++ [r]+      prim_pp (Primitive _ nm _ _ sp _ _) = ugen_user_name nm sp+      k = 5+  in case u of+      Constant_U (Constant n _) -> real_pp k n+      Control_U (Control _ _ nm def _ _ _) -> nm ++ "=" ++ real_pp k def+      Label_U (Label s) -> bracketed ('"', '"') s+      Primitive_U p -> prim_pp p+      Proxy_U (Proxy p n) -> prim_pp p ++ "@" ++ show n+      Mce_U (Mce_Scalar s) -> ugen_concise_pp s+      Mce_U (Mce_Vector v) -> bracketed ('[', ']') (concat (intersperse "," (map (ugen_concise_pp . mce_scalar_value) v))) -- hugs+      Mrg_U (Mrg l r) -> unwords [ugen_concise_pp l, "&", ugen_concise_pp r]
+ Sound/Sc3/Ugen/Primitive.hs view
@@ -0,0 +1,32 @@+-- | SuperCollider Ugen primitive.+module Sound.Sc3.Ugen.Primitive where++import Sound.Sc3.Common.Rate {- hsc3 -}++import Sound.Sc3.Ugen.Brackets {- hsc3 -}++-- | Identifier used to distinguish otherwise equal non-deterministic nodes.+data UgenId = NoId | Uid Int deriving (Ord, Eq, Read, Show)++-- | Alias of 'NoId', the 'UgenId' used for deterministic Ugens.+no_id :: UgenId+no_id = NoId++-- | Unit generator output descriptor.+type Output = Rate++-- | Selector for unary and binary operators.+newtype Special = Special Int+  deriving (Ord, Eq, Read, Show)++-- | Sc Ugen primitive.+data Primitive t = Primitive+  { ugenRate :: Rate+  , ugenName :: String+  , ugenInputs :: [t]+  , ugenOutputs :: [Output]+  , ugenSpecial :: Special+  , ugenId :: UgenId+  , primitiveBrackets :: Brackets+  }+  deriving (Ord, Eq, Read, Show)
+ Sound/Sc3/Ugen/Proxy.hs view
@@ -0,0 +1,15 @@+-- | Proxy indicating an output port at a multi-channel Primitive.+module Sound.Sc3.Ugen.Proxy where++import Sound.Sc3.Common.Rate {- hsc3 -}++import Sound.Sc3.Ugen.Primitive {- hsc3 -}++data Proxy t = Proxy+  { proxySource :: Primitive t+  , proxyIndex :: Int+  }+  deriving (Ord, Eq, Read, Show)++proxyRate :: Proxy t -> Rate+proxyRate = ugenRate . proxySource
+ Sound/Sc3/Ugen/Types.hs view
@@ -0,0 +1,11 @@+-- | Composite module of all Ugen related types.+module Sound.Sc3.Ugen.Types (module M) where++import Sound.Sc3.Ugen.Brackets as M+import Sound.Sc3.Ugen.Constant as M+import Sound.Sc3.Ugen.Control as M+import Sound.Sc3.Ugen.Label as M+import Sound.Sc3.Ugen.Mrg as M+import Sound.Sc3.Ugen.Primitive as M+import Sound.Sc3.Ugen.Proxy as M+import Sound.Sc3.Ugen.Ugen as M
+ Sound/Sc3/Ugen/Ugen.hs view
@@ -0,0 +1,753 @@+-- | Unit generator (Ugen) type and instances.+module Sound.Sc3.Ugen.Ugen where++import Data.Bits {- base -}+import qualified Data.Fixed as Fixed {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import qualified System.Random as Random {- random -}++import qualified Sound.Sc3.Common.Math as Math+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Mce+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Brackets+import Sound.Sc3.Ugen.Constant+import Sound.Sc3.Ugen.Control+import Sound.Sc3.Ugen.Label+import Sound.Sc3.Ugen.Mrg+import Sound.Sc3.Ugen.Primitive+import Sound.Sc3.Ugen.Proxy++-- * Basic types++{- | Sc3 samples are 32-bit 'Float'.+hsc3 uses 64-bit 'Double'.+If 'Ugen' values are used more generally (ie. see hsc3-forth) 'Float' may be too imprecise, i.e. for representing time stamps.+-}+type Sample = Double++-- | Union type of Unit Generator forms.+data Ugen+  = Constant_U Constant+  | Control_U Control+  | Label_U Label+  | Primitive_U (Primitive Ugen)+  | Proxy_U (Proxy Ugen)+  | Mce_U (Mce Ugen)+  | Mrg_U (Mrg Ugen)+  deriving (Eq, Read, Show)++-- * Name++{- | Lookup operator name for operator Ugens, else Ugen name.++>>> map (\k -> ugen_user_name "BinaryOpUGen" (Special k)) [0, 2, 4, 9, 12, 17, 25]+["+","*","/",">","Min","Lcm","**"]+-}+ugen_user_name :: String -> Special -> String+ugen_user_name nm (Special n) = fromMaybe nm (ugen_operator_name nm n)++-- * Instances++instance EqE Ugen where+  equal_to = mkBinaryOperator OpEq Math.sc3_eq+  not_equal_to = mkBinaryOperator OpNe Math.sc3_neq++instance OrdE Ugen where+  less_than = mkBinaryOperator OpLt Math.sc3_lt+  less_than_or_equal_to = mkBinaryOperator OpLe Math.sc3_lte+  greater_than = mkBinaryOperator OpGt Math.sc3_gt+  greater_than_or_equal_to = mkBinaryOperator OpGe Math.sc3_gte++-- | 'Ugen' form or 'Math.sc3_round_to'.+roundTo :: Ugen -> Ugen -> Ugen+roundTo = mkBinaryOperator OpRoundTo Math.sc3_round_to++instance RealFracE Ugen where+  properFractionE = error "Ugen.properFractionE"+  truncateE = error "Ugen.truncateE"+  roundE i = roundTo i 1+  ceilingE = mkUnaryOperator OpCeil ceilingE+  floorE = mkUnaryOperator OpFloor floorE++instance UnaryOp Ugen where+  ampDb = mkUnaryOperator OpAmpDb ampDb+  asFloat = mkUnaryOperator OpAsFloat asFloat+  asInt = mkUnaryOperator OpAsInt asInt+  cpsMidi = mkUnaryOperator OpCpsMidi cpsMidi+  cpsOct = mkUnaryOperator OpCpsOct cpsOct+  cubed = mkUnaryOperator OpCubed cubed+  dbAmp = mkUnaryOperator OpDbAmp dbAmp+  distort = mkUnaryOperator OpDistort distort+  frac = mkUnaryOperator OpFrac frac+  isNil = mkUnaryOperator OpIsNil isNil+  log10 = mkUnaryOperator OpLog10 log10+  log2 = mkUnaryOperator OpLog2 log2+  midiCps = mkUnaryOperator OpMidiCps midiCps+  midiRatio = mkUnaryOperator OpMidiRatio midiRatio+  notE = mkUnaryOperator OpNot notE+  notNil = mkUnaryOperator OpNotNil notNil+  octCps = mkUnaryOperator OpOctCps octCps+  ramp_ = mkUnaryOperator OpRamp_ ramp_+  ratioMidi = mkUnaryOperator OpRatioMidi ratioMidi+  softClip = mkUnaryOperator OpSoftClip softClip+  squared = mkUnaryOperator OpSquared squared++instance BinaryOp Ugen where+  iDiv = mkBinaryOperator OpIdiv iDiv+  modE = mkBinaryOperator OpMod Fixed.mod'+  lcmE = mkBinaryOperator OpLcm lcmE+  gcdE = mkBinaryOperator OpGcd gcdE+  roundUp = mkBinaryOperator OpRoundUp roundUp+  trunc = mkBinaryOperator OpTrunc trunc+  atan2E = mkBinaryOperator OpAtan2 atan2E+  hypot = mkBinaryOperator OpHypot hypot+  hypotx = mkBinaryOperator OpHypotx hypotx+  fill = mkBinaryOperator OpFill fill+  ring1 = mkBinaryOperator OpRing1 ring1+  ring2 = mkBinaryOperator OpRing2 ring2+  ring3 = mkBinaryOperator OpRing3 ring3+  ring4 = mkBinaryOperator OpRing4 ring4+  difSqr = mkBinaryOperator OpDifSqr difSqr+  sumSqr = mkBinaryOperator OpSumSqr sumSqr+  sqrSum = mkBinaryOperator OpSqrSum sqrSum+  sqrDif = mkBinaryOperator OpSqrDif sqrDif+  absDif = mkBinaryOperator OpAbsDif absDif+  thresh = mkBinaryOperator OpThresh thresh+  amClip = mkBinaryOperator OpAmClip amClip+  scaleNeg = mkBinaryOperator OpScaleNeg scaleNeg+  clip2 = mkBinaryOperator OpClip2 clip2+  excess = mkBinaryOperator OpExcess excess+  fold2 = mkBinaryOperator OpFold2 fold2+  wrap2 = mkBinaryOperator OpWrap2 wrap2+  firstArg = mkBinaryOperator OpFirstArg firstArg+  randRange = mkBinaryOperator OpRandRange randRange+  exprandRange = mkBinaryOperator OpExpRandRange exprandRange++-- instance MulAdd Ugen where mul_add = mulAdd++-- * Parser++-- | 'constant' of 'parse_double'.+parse_constant :: String -> Maybe Ugen+parse_constant = fmap constant . Math.parse_double++-- * Accessors++-- | See into 'Constant_U'.+un_constant :: Ugen -> Maybe Constant+un_constant u =+  case u of+    Constant_U c -> Just c+    _ -> Nothing++-- | Value of 'Constant_U' 'Constant'.+u_constant :: Ugen -> Maybe Sample+u_constant = fmap constantValue . un_constant++-- | Erroring variant.+u_constant_err :: Ugen -> Sample+u_constant_err = fromMaybe (error "u_constant") . u_constant++-- * Mrg++-- | Multiple root graph constructor.+mrg :: [Ugen] -> Ugen+mrg u =+  case u of+    [] -> error "mrg: []"+    [x] -> x+    (x : xs) -> Mrg_U (Mrg x (mrg xs))++-- | See into 'Mrg_U', follows leftmost rule until arriving at non-Mrg node.+mrg_leftmost :: Ugen -> Ugen+mrg_leftmost u =+  case u of+    Mrg_U m -> mrg_leftmost (mrgLeft m)+    _ -> u++-- * Predicates++-- | Constant node predicate.+isConstant :: Ugen -> Bool+isConstant = isJust . un_constant++-- | True if input is a sink 'Ugen', ie. has no outputs.  Sees into Mrg.+isSink :: Ugen -> Bool+isSink u =+  case mrg_leftmost u of+    Primitive_U p -> null (ugenOutputs p)+    Mce_U m -> all isSink (mce_to_list m)+    _ -> False++-- | See into 'Proxy_U'.+un_proxy :: Ugen -> Maybe (Proxy Ugen)+un_proxy u =+  case u of+    Proxy_U p -> Just p+    _ -> Nothing++-- | Is 'Ugen' a 'Proxy'?+isProxy :: Ugen -> Bool+isProxy = isJust . un_proxy++-- | Get Primitive from Ugen if Ugen is a Primitive.+ugenPrimitive :: Ugen -> Maybe (Primitive Ugen)+ugenPrimitive u =+  case u of+    Primitive_U p -> Just p+    _ -> Nothing++-- | Is 'Ugen' a 'Primitive'?+isPrimitive :: Ugen -> Bool+isPrimitive = isJust . ugenPrimitive++-- * Mce++-- | Multiple channel expansion node constructor.+mce :: [Ugen] -> Ugen+mce xs =+  case xs of+    [] -> error "mce: []"+    [x] -> Mce_U (Mce_Scalar x)+    _ -> Mce_U (mce_from_list xs)++-- | Type specified 'mce_to_list'.+mceProxies :: Mce Ugen -> [Ugen]+mceProxies = mce_to_list++-- | Multiple channel expansion node ('Mce_U') predicate.  Sees into Mrg.+isMce :: Ugen -> Bool+isMce u =+  case mrg_leftmost u of+    Mce_U _ -> True+    _ -> False++{- | Output channels of Ugen as a list.+If required, preserves the RHS of an Mrg node in channel 0.+See also: mceChannel+-}+mceChannels :: Ugen -> [Ugen]+mceChannels u =+  case u of+    Mce_U m -> mce_to_list m+    Mrg_U (Mrg x y) ->+      case mceChannels x of+        r : rs -> Mrg_U (Mrg r y) : rs+        _ -> error "mceChannels"+    _ -> [u]++-- | Number of channels to expand to.  This function sees into Mrg, and is defined only for Mce nodes.+mceDegree :: Ugen -> Maybe Int+mceDegree u =+  case mrg_leftmost u of+    Mce_U m -> Just (length (mceProxies m))+    _ -> Nothing++-- | Erroring variant.+mceDegree_err :: Ugen -> Int+mceDegree_err = fromMaybe (error "mceDegree: not mce") . mceDegree++-- | Extend Ugen to specified degree.  Follows "leftmost" rule for Mrg nodes.+mceExtend :: Int -> Ugen -> [Ugen]+mceExtend n u =+  case u of+    Mce_U m -> mceProxies (mce_extend n m)+    Mrg_U (Mrg x y) ->+      case mceExtend n x of+        r : rs -> Mrg_U (Mrg r y) : rs+        _ -> error "mceExtend"+    _ -> replicate n u++-- | Is Mce required, ie. are any input values Mce?+mceRequired :: [Ugen] -> Bool+mceRequired = any isMce++{- | Apply Mce transform to a list of inputs.+The transform extends each input so all are of equal length, and then transposes the matrix.++>>> mceInputTransform [mce [1, 2],mce [3, 4]] == Just [[1,3],[2,4]]+True++>>> mceInputTransform [mce [1, 2],mce [3, 4], mce [5, 6, 7]] == Just [[1,3,5],[2,4,6],[1,3,7]]+True++>>> mceInputTransform [mce [mce [1, 2], mce [3, 4]], mce [5, 6]] == Just [[mce [1, 2],5],[mce [3, 4],6]]+True+-}+mceInputTransform :: [Ugen] -> Maybe [[Ugen]]+mceInputTransform i =+  if mceRequired i+    then+      let n = maximum (map mceDegree_err (filter isMce i))+      in Just (transpose (map (mceExtend n) i))+    else Nothing++-- | Build a Ugen after Mce transformation of inputs.+mceBuild :: ([Ugen] -> Ugen) -> [Ugen] -> Ugen+mceBuild f i =+  case mceInputTransform i of+    Nothing -> f i+    Just i' -> let xs = map (mceBuild f) i' in Mce_U (mce_from_list xs)++{- | True if Mce is an immediate proxy for a multiple-out Primitive.+This is useful when disassembling graphs, ie. ugen_graph_forth_pp at hsc3-db.+It's also useful when editing a Primitive after it is constructed, as in bracketUgen.+-}+mce_is_direct_proxy :: Mce Ugen -> Bool+mce_is_direct_proxy m =+  case m of+    Mce_Scalar _ -> False+    Mce_Vector _ ->+      let p = map un_proxy (mce_to_list m)+          p' = catMaybes p+      in all isJust p+          && length (nub (map proxySource p')) == 1+          && map proxyIndex p' `isPrefixOf` [0 ..]++-- * Bracketed++{- | Attach Brackets (initialisation and cleanup message sequences) to Ugen.+     For simplicity and clarity, brackets can only be attached to Primitive, Constant and Control nodes.+     This will look into the direct (immediate) proxies of a Primitive.+-}+bracketUgen :: Ugen -> Brackets -> Ugen+bracketUgen u (pre, post) =+  let err = error "bracketUgen: only Constants or Primitive Ugens or immediate proxies may have brackets"+      rw_proxy pxy =+        case pxy of+          Proxy_U (Proxy p pix) ->+            let (lhs, rhs) = primitiveBrackets p in Proxy_U (Proxy (p {primitiveBrackets = (lhs ++ pre, rhs ++ post)}) pix)+          _ -> err+  in case u of+      Constant_U c -> let (lhs, rhs) = constantBrackets c in Constant_U (c {constantBrackets = (lhs ++ pre, rhs ++ post)})+      Control_U c -> let (lhs, rhs) = controlBrackets c in Control_U (c {controlBrackets = (lhs ++ pre, rhs ++ post)})+      Primitive_U p -> let (lhs, rhs) = primitiveBrackets p in Primitive_U (p {primitiveBrackets = (lhs ++ pre, rhs ++ post)})+      Mce_U m ->+        if mce_is_direct_proxy m+          then Mce_U (mce_map rw_proxy m)+          else err+      _ -> err++-- | Retrieve Brackets from Ugen.+ugenBrackets :: Ugen -> Brackets+ugenBrackets u =+  case u of+    Constant_U c -> constantBrackets c+    Control_U c -> controlBrackets c+    Primitive_U p -> primitiveBrackets p+    _ -> emptyBrackets++-- * Validators++-- | Ensure input 'Ugen' is valid, ie. not a sink.+checkInput :: Ugen -> Ugen+checkInput u =+  if isSink u+    then error ("checkInput: " ++ show u)+    else u++-- * Constructors++-- | Constant value node constructor.+constant :: Real n => n -> Ugen+constant = Constant_U . flip Constant emptyBrackets . realToFrac++-- | Type specialised 'constant'.+int_to_ugen :: Int -> Ugen+int_to_ugen = constant++-- | Type specialised 'constant'.+float_to_ugen :: Float -> Ugen+float_to_ugen = constant++-- | Type specialised 'constant'.+double_to_ugen :: Double -> Ugen+double_to_ugen = constant++-- | Unit generator proxy node constructor.+proxy :: Ugen -> Int -> Ugen+proxy u n =+  case u of+    Primitive_U p -> Proxy_U (Proxy p n)+    _ -> error "proxy: not primitive?"++-- | Determine the rate of a Ugen.+rateOf :: Ugen -> Rate+rateOf u =+  case u of+    Constant_U _ -> InitialisationRate+    Control_U c -> controlOperatingRate c+    Label_U _ -> InitialisationRate+    Primitive_U p -> ugenRate p+    Proxy_U p -> ugenRate (proxySource p)+    Mce_U _ -> maximum (map rateOf (mceChannels u))+    Mrg_U m -> rateOf (mrgLeft m)++-- | Apply proxy transformation if required.+proxify :: Ugen -> Ugen+proxify u =+  case u of+    Mce_U m -> mce (map proxify (mce_to_list m))+    Mrg_U m -> mrg [proxify (mrgLeft m), mrgRight m]+    Primitive_U p ->+      let o = ugenOutputs p+      in case o of+          _ : _ : _ -> mce (map (proxy u) [0 .. length o - 1])+          _ -> u+    Constant_U _ -> u+    _ -> error "proxify: illegal ugen"++{- | Filters with DemandRate inputs run at ControlRate.+This is a little unfortunate, it'd be nicer if the rate in this circumstance could be given.+-}+mk_ugen_select_rate :: String -> [Ugen] -> [Rate] -> Either Rate [Int] -> Rate+mk_ugen_select_rate nm h rs r =+  let at_note note list index = if index < 0 || index >= length list then error note else list !! index -- hugs...+      is_right e = case e of Right _ -> True; _ -> False -- hugs...+      r' = either id (maximum . map (rateOf . at_note ("mkUgen: " ++ nm) h)) r+  in if is_right r && r' == DemandRate && DemandRate `notElem` rs+      then if ControlRate `elem` rs then ControlRate else error "mkUgen: DemandRate input to non-ControlRate filter"+      else+        if r' `elem` rs || r' == DemandRate+          then r'+          else error ("mkUgen: rate restricted: " ++ show (r, r', rs, nm))++{- | Construct proxied and multiple channel expanded Ugen.++cf = constant function, rs = rate set, r = rate, nm = name, i = inputs, i_mce = list of Mce inputs, o = outputs.+-}+mkUgen ::+  Maybe ([Sample] -> Sample) ->+  [Rate] ->+  Either Rate [Int] ->+  String ->+  [Ugen] ->+  Maybe [Ugen] ->+  Int ->+  Special ->+  UgenId ->+  Ugen+mkUgen cf rs r nm i i_mce o s z =+  let i' = maybe i ((i ++) . concatMap mceChannels) i_mce+      f h =+        let r' = mk_ugen_select_rate nm h rs r+            o' = replicate o r'+            u = Primitive_U (Primitive r' nm h o' s z emptyBrackets)+        in case cf of+            Just cf' ->+              if all isConstant h+                then constant (cf' (mapMaybe u_constant h))+                else u+            Nothing -> u+  in proxify (mceBuild f (map checkInput i'))++-- * Operators++-- | Operator Ugen constructor.+mkOperator :: ([Sample] -> Sample) -> String -> [Ugen] -> Int -> Ugen+mkOperator f c i s =+  let ix = [0 .. length i - 1]+  in mkUgen (Just f) all_rates (Right ix) c i Nothing 1 (Special s) NoId++-- | Unary math constructor.+mkUnaryOperator :: Sc3_Unary_Op -> (Sample -> Sample) -> Ugen -> Ugen+mkUnaryOperator i f a =+  let g [x] = f x+      g _ = error "mkUnaryOperator: non unary input"+  in mkOperator g "UnaryOpUGen" [a] (fromEnum i)++{- | Binary math constructor with constant optimisation.++>>> constant 2 * constant 3 == constant 6+True++>>> let o = mkUgen Nothing [AudioRate] (Left AudioRate) "SinOsc" [constant 440, constant 0] Nothing 1 (Special 0) (Uid 0)+>>> o * 1 == o && 1 * o == o && o * 2 /= o+True++>>> o + 0 == o && 0 + o == o && o + 1 /= o+True++>>> o - 0 == o && 0 - o /= o+True++>>> o / 1 == o && 1 / o /= o+True++>>> o ** 1 == o && o ** 2 /= o+True+-}+mkBinaryOperator_optimise_constants ::+  Sc3_Binary_Op ->+  (Sample -> Sample -> Sample) ->+  (Either Sample Sample -> Bool) ->+  Ugen ->+  Ugen ->+  Ugen+mkBinaryOperator_optimise_constants i f o a b =+  let g [x, y] = f x y+      g _ = error "mkBinaryOperator: non binary input"+      r = case (a, b) of+        (Constant_U (Constant a' ([], [])), _) ->+          if o (Left a') then Just b else Nothing+        (_, Constant_U (Constant b' ([], []))) ->+          if o (Right b') then Just a else Nothing+        _ -> Nothing+  in fromMaybe (mkOperator g "BinaryOpUGen" [a, b] (fromEnum i)) r++-- | Plain (non-optimised) binary math constructor.+mkBinaryOperator :: Sc3_Binary_Op -> (Sample -> Sample -> Sample) -> Ugen -> Ugen -> Ugen+mkBinaryOperator i f a b =+  let g [x, y] = f x y+      g _ = error "mkBinaryOperator: non binary input"+  in mkOperator g "BinaryOpUGen" [a, b] (fromEnum i)++-- * Numeric instances++-- | Is /u/ the primitive for the named Ugen.+is_primitive_for :: String -> Ugen -> Bool+is_primitive_for k u =+  case u of+    Primitive_U (Primitive _ nm [_, _] [_] _ _ _) -> nm == k+    _ -> False++-- | Is /u/ the primitive for the named Ugen.+is_constant_of :: Sample -> Ugen -> Bool+is_constant_of k u =+  case u of+    Constant_U c -> constantValue c == k+    _ -> False++-- | Is /u/ a binary math operator with SPECIAL of /k/.+is_math_binop :: Int -> Ugen -> Bool+is_math_binop k u =+  case u of+    Primitive_U (Primitive _ "BinaryOpUGen" [_, _] [_] (Special s) NoId _) -> s == k+    _ -> False++-- | Is /u/ an ADD operator?+is_add_operator :: Ugen -> Bool+is_add_operator = is_math_binop 0++assert_is_add_operator :: String -> Ugen -> Ugen+assert_is_add_operator msg u = if is_add_operator u then u else error ("assert_is_add_operator: " ++ msg)++-- | Is /u/ an MUL operator?+is_mul_operator :: Ugen -> Bool+is_mul_operator = is_math_binop 2++{- | MulAdd re-writer, applicable only directly at add operator Ugen.+The MulAdd Ugen is very sensitive to input rates.+Add=AudioRate with In|Mul=InitialisationRate|Const will crash scsynth.+This only considers primitives that do not have bracketing messages.+-}+mul_add_optimise_direct :: Ugen -> Ugen+mul_add_optimise_direct u =+  let reorder (i, j, k) =+        let (ri, rj, rk) = (rateOf i, rateOf j, rateOf k)+        in if rk > max ri rj+            then Nothing+            else Just (max (max ri rj) rk, if rj > ri then (j, i, k) else (i, j, k))+  in case assert_is_add_operator "MUL-ADD" u of+      Primitive_U+        (Primitive _ _ [Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 2) NoId ([], [])), k] [_] _ NoId ([], [])) ->+          case reorder (i, j, k) of+            Just (rt, (p, q, r)) -> Primitive_U (Primitive rt "MulAdd" [p, q, r] [rt] (Special 0) NoId ([], []))+            Nothing -> u+      Primitive_U+        (Primitive _ _ [k, Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 2) NoId ([], []))] [_] _ NoId ([], [])) ->+          case reorder (i, j, k) of+            Just (rt, (p, q, r)) -> Primitive_U (Primitive rt "MulAdd" [p, q, r] [rt] (Special 0) NoId ([], []))+            Nothing -> u+      _ -> u++{- | MulAdd optimiser, applicable at any Ugen (ie. checks /u/ is an ADD ugen)++> import Sound.Sc3+> g1 = sinOsc ar 440 0 * 0.1 + control ir "x" 0.05+> g2 = sinOsc ar 440 0 * control ir "x" 0.1 + 0.05+> g3 = control ir "x" 0.1 * sinOsc ar 440 0 + 0.05+> g4 = 0.05 + sinOsc ar 440 0 * 0.1+-}+mul_add_optimise :: Ugen -> Ugen+mul_add_optimise u = if is_add_operator u then mul_add_optimise_direct u else u++{- | Sum3 re-writer, applicable only directly at add operator Ugen.+     This only considers nodes that have no bracketing messages.+-}+sum3_optimise_direct :: Ugen -> Ugen+sum3_optimise_direct u =+  case assert_is_add_operator "SUM3" u of+    Primitive_U (Primitive r _ [Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 0) NoId ([], [])), k] [_] _ NoId ([], [])) ->+      Primitive_U (Primitive r "Sum3" [i, j, k] [r] (Special 0) NoId ([], []))+    Primitive_U (Primitive r _ [k, Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 0) NoId ([], []))] [_] _ NoId ([], [])) ->+      Primitive_U (Primitive r "Sum3" [i, j, k] [r] (Special 0) NoId ([], []))+    _ -> u++-- | /Sum3/ optimiser, applicable at any /u/ (ie. checks if /u/ is an ADD operator).+sum3_optimise :: Ugen -> Ugen+sum3_optimise u = if is_add_operator u then sum3_optimise_direct u else u++-- | 'sum3_optimise' of 'mul_add_optimise'.+add_optimise :: Ugen -> Ugen+add_optimise = sum3_optimise . mul_add_optimise++-- | Unit generators are numbers.+instance Num Ugen where+  negate = mkUnaryOperator OpNeg negate+  (+) =+    fmap add_optimise+      . mkBinaryOperator_optimise_constants OpAdd (+) (`elem` [Left 0, Right 0])+  (-) = mkBinaryOperator_optimise_constants OpSub (-) (Right 0 ==)+  (*) = mkBinaryOperator_optimise_constants OpMul (*) (`elem` [Left 1, Right 1])+  abs = mkUnaryOperator OpAbs abs+  signum = mkUnaryOperator OpSign signum+  fromInteger = Constant_U . flip Constant ([], []) . fromInteger++-- | Unit generators are fractional.+instance Fractional Ugen where+  recip = mkUnaryOperator OpRecip recip+  (/) = mkBinaryOperator_optimise_constants OpFdiv (/) (Right 1 ==)+  fromRational = Constant_U . flip Constant ([], []) . fromRational++-- | Unit generators are floating point.+instance Floating Ugen where+  pi = Constant_U (Constant pi ([], []))+  exp = mkUnaryOperator OpExp exp+  log = mkUnaryOperator OpLog log+  sqrt = mkUnaryOperator OpSqrt sqrt+  (**) = mkBinaryOperator_optimise_constants OpPow (**) (Right 1 ==)+  logBase a b = log b / log a+  sin = mkUnaryOperator OpSin sin+  cos = mkUnaryOperator OpCos cos+  tan = mkUnaryOperator OpTan tan+  asin = mkUnaryOperator OpArcSin asin+  acos = mkUnaryOperator OpArcCos acos+  atan = mkUnaryOperator OpArcTan atan+  sinh = mkUnaryOperator OpSinh sinh+  cosh = mkUnaryOperator OpCosh cosh+  tanh = mkUnaryOperator OpTanh tanh+  asinh x = log (sqrt (x * x + 1) + x)+  acosh x = log (sqrt (x * x - 1) + x)+  atanh x = (log (1 + x) - log (1 - x)) / 2++-- | Unit generators are real.+instance Real Ugen where+  toRational (Constant_U (Constant n ([], []))) = toRational n+  toRational _ = error "Ugen.toRational: only un-bracketed constants considered"++-- | Unit generators are integral.+instance Integral Ugen where+  quot = mkBinaryOperator OpIdiv (error "Ugen.quot")+  rem = mkBinaryOperator OpMod (error "Ugen.rem")+  quotRem a b = (quot a b, rem a b)+  div = mkBinaryOperator OpIdiv (error "Ugen.div")+  mod = mkBinaryOperator OpMod (error "Ugen.mod")+  toInteger (Constant_U (Constant n ([], []))) = floor n+  toInteger _ = error "Ugen.toInteger: only un-bracketed constants considered"++instance RealFrac Ugen where+  properFraction = error "Ugen.properFraction, see properFractionE"+  round = error "Ugen.round, see roundE"+  ceiling = error "Ugen.ceiling, see ceilingE"+  floor = error "Ugen.floor, see floorE"++{- | Unit generators are orderable (when 'Constants').++>>> constant 2 > constant 1+True+-}+instance Ord Ugen where+  (Constant_U a) < (Constant_U b) = a < b+  _ < _ = error "Ugen.<, see <*"+  (Constant_U a) <= (Constant_U b) = a <= b+  _ <= _ = error "Ugen.<= at, see <=*"+  (Constant_U a) > (Constant_U b) = a > b+  _ > _ = error "Ugen.>, see >*"+  (Constant_U a) >= (Constant_U b) = a >= b+  _ >= _ = error "Ugen.>=, see >=*"+  min = mkBinaryOperator OpMin min+  max = mkBinaryOperator OpMax max++-- | Unit generators are enumerable.+instance Enum Ugen where+  succ u = u + 1+  pred u = u - 1+  toEnum n = Constant_U (Constant (fromIntegral n) ([], []))+  fromEnum (Constant_U (Constant n ([], []))) = truncate n+  fromEnum _ = error "Ugen.fromEnum: non-constant"+  enumFrom = iterate (+ 1)+  enumFromThen n m = iterate (+ (m - n)) n+  enumFromTo n m = takeWhile (<= m + 1 / 2) (enumFrom n)+  enumFromThenTo n n' m =+    let p = if n' >= n then (>=) else (<=)+    in takeWhile (p (m + (n' - n) / 2)) (enumFromThen n n')++{- | Unit generators are stochastic.+Only un-bracketed constant values are considered.+-}+instance Random.Random Ugen where+  randomR (Constant_U (Constant l ([], [])), Constant_U (Constant r ([], []))) g =+    let (n, g') = Random.randomR (l, r) g+    in (Constant_U (Constant n ([], [])), g')+  randomR _ _ = error "Ugen.randomR: non constant (l,r)"+  random = Random.randomR (-1.0, 1.0)++-- * Bitwise++-- | 'Operator.OpBitAnd'+bitAnd :: Ugen -> Ugen -> Ugen+bitAnd = mkBinaryOperator OpBitAnd undefined++-- | 'Operator.OpBitOr'+bitOr :: Ugen -> Ugen -> Ugen+bitOr = mkBinaryOperator OpBitOr undefined++-- | 'OpBitXor'+bitXOr :: Ugen -> Ugen -> Ugen+bitXOr = mkBinaryOperator OpBitXor undefined++-- | 'OpBitNot'+bitNot :: Ugen -> Ugen+bitNot = mkUnaryOperator OpBitNot undefined++-- | 'OpShiftLeft'+shiftLeft :: Ugen -> Ugen -> Ugen+shiftLeft = mkBinaryOperator OpShiftLeft undefined++-- | 'OpShiftRight'+shiftRight :: Ugen -> Ugen -> Ugen+shiftRight = mkBinaryOperator OpShiftRight undefined++-- | 'OpUnsignedShift'+unsignedShift :: Ugen -> Ugen -> Ugen+unsignedShift = mkBinaryOperator OpUnsignedShift undefined++-- | Ugens are bit patterns.+instance Bits Ugen where+  (.&.) = bitAnd+  (.|.) = bitOr+  xor = bitXOr+  complement = bitNot+  shiftL p q = shiftLeft p (constant q)+  shiftR p q = shiftRight p (constant q)+  rotate = error "Ugen.rotate"+  bitSize = error "Ugen.bitSize"+  bit = error "Ugen.bit"+  testBit = error "Ugen.testBit"+  popCount = error "Ugen.popCount" -- hugs...+  bitSizeMaybe = error "Ugen.bitSizeMaybe" -- hugs...+  isSigned _ = True++{-+import qualified GHC.Exts as Exts {- base -}++instance Exts.IsList Ugen where+  type Item Ugen = Ugen+  fromList = mce+  toList = mceChannels+-}
+ Sound/Sc3/Ugen/Util.hs view
@@ -0,0 +1,341 @@+-- | Utility function over Ugen data structure.+module Sound.Sc3.Ugen.Util where++import qualified Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Data.List.Split as Split {- split -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}+import qualified Sound.Sc3.Common.Envelope as Envelope {- hsc3 -}+import qualified Sound.Sc3.Common.Mce as Mce {- hsc3 -}+import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}++import Sound.Sc3.Ugen.Brackets {- hsc3 -}+import Sound.Sc3.Ugen.Control {- hsc3 -}+import Sound.Sc3.Ugen.Label {- hsc3 -}+import Sound.Sc3.Ugen.Mrg {- hsc3 -}+import Sound.Sc3.Ugen.Primitive {- hsc3 -}+import Sound.Sc3.Ugen.Proxy {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}++-- | 'Uid' of 'resolveID'.+toUid :: Uid.ID a => a -> UgenId+toUid = Uid . Uid.resolveID++-- * Ugen graph functions++-- | Depth first traversal of graph at `u', stopping at `halt_f', else applying `map_f' to each node.+ugenTraverse :: (Ugen -> Bool) -> (Ugen -> Ugen) -> Ugen -> Ugen+ugenTraverse halt_f map_f u =+  if halt_f u+    then u+    else+      let recur = ugenTraverse halt_f map_f+      in case u of+          Primitive_U p ->+            let i = ugenInputs p+            in map_f (Primitive_U (p {ugenInputs = map recur i}))+          Proxy_U (Proxy p ix) ->+            let i = ugenInputs p+            in map_f (Proxy_U (Proxy (p {ugenInputs = map recur i}) ix))+          Mce_U m -> map_f (mce (map recur (mceProxies m)))+          Mrg_U (Mrg l r) -> map_f (Mrg_U (Mrg (recur l) (recur r)))+          _ -> map_f u++{- | Right fold of Ugen graph.++> import qualified Sound.Sc3.Ugen.Pp as Pp+> let pp = Pp.ugen_concise_pp+> map pp (ugenFoldr (:) [] (sinOsc ar 440 0 * 0.1))+["*","SinOsc","440","0","0.1"]++> map pp (ugenFoldr (:) [] (pan2 (sinOsc ar 440 0) 0.25 0.1))+["[Pan2@0,Pan2@1]","Pan2@0","SinOsc","440","0","0.25","0.1","Pan2@1","SinOsc","440","0","0.25","0.1"]+-}+ugenFoldr :: (Ugen -> a -> a) -> a -> Ugen -> a+ugenFoldr f st u =+  let recur = flip (ugenFoldr f)+  in case u of+      Primitive_U p -> f u (foldr recur st (ugenInputs p))+      Proxy_U (Proxy p _) -> f u (foldr recur st (ugenInputs p)) -- ...+      Mce_U m -> f u (foldr recur st (mceProxies m))+      Mrg_U (Mrg l r) -> f u (f l (f r st))+      _ -> f u st++-- | Fold over Ugen and collect all bracketing messages from all Primitive nodes.+ugenCollectBrackets :: Ugen -> Brackets+ugenCollectBrackets =+  concatBrackets+    . map ugenBrackets+    . nub+    . ugenFoldr (:) []++-- | Are there any brackets at Ugen.+ugenHasAnyBrackets :: Ugen -> Bool+ugenHasAnyBrackets = (/= ([], [])) . ugenCollectBrackets++-- * Unit generator node constructors++-- | Control input node constructor.+control_f64 :: Rate.Rate -> Maybe Int -> String -> Sample -> Ugen+control_f64 r ix nm d = Control_U (Control r ix nm d False Nothing emptyBrackets)++{- | 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 'trigControl'.+-}+control :: Rate.Rate -> String -> Double -> Ugen+control r = control_f64 r Nothing++-- | Variant of 'control' with meta data.+control_m :: Rate.Rate -> String -> Double -> Control_Meta_T3 Double -> Ugen+control_m rt nm df meta =+  let m = control_meta_t3 id meta+  in Control_U (Control rt Nothing nm df False (Just m) emptyBrackets)++-- | Generate group of two controls.  Names are generated according to 'control_group_suffixes'+control_pair :: Control_Group -> Rate.Rate -> String -> (Double, Double) -> Control_Meta_T3 Double -> (Ugen, Ugen)+control_pair grp rt nm (df1, df2) meta =+  let m = (control_meta_t3 id meta) {controlGroup = Just grp}+  in case control_group_suffixes grp of+      [lhs, rhs] ->+        ( Control_U (Control rt Nothing (nm ++ lhs) df1 False (Just m) emptyBrackets)+        , Control_U (Control rt Nothing (nm ++ rhs) df2 False (Just m) emptyBrackets)+        )+      _ -> error "control_pair"++-- | Generate range controls.  Names are generated according to 'control_group_suffixes'+control_rng :: Rate.Rate -> String -> (Double, Double) -> Control_Meta_T3 Double -> (Ugen, Ugen)+control_rng = control_pair Control_Range++-- | Triggered (kr) control input node constructor.+trigControl_f64 :: Maybe Int -> String -> Sample -> Ugen+trigControl_f64 ix nm d = Control_U (Control Rate.ControlRate ix nm d True Nothing emptyBrackets)++-- | Triggered (kr) control input node constructor.+trigControl :: String -> Double -> Ugen+trigControl = trigControl_f64 Nothing++-- | Set indices at a list of controls.+control_set :: [Ugen] -> [Ugen]+control_set =+  let f ix u = case u of+        Control_U c -> Control_U (c {controlIndex = Just ix})+        _ -> error "control_set: non control input?"+  in zipWith f [0 ..]++-- * Multiple channel expansion++mce1 :: Ugen -> Ugen+mce1 = mce . return++-- | Multiple channel expansion for two inputs.+mce2 :: Ugen -> Ugen -> Ugen+mce2 x y = mce [x, y]++-- | Extract two channels from possible Mce, if there is only one channel it is duplicated.+mce2c :: Ugen -> (Ugen, Ugen)+mce2c u =+  case mceChannels u of+    [] -> error "mce2c"+    [p] -> (p, p)+    p : q : _ -> (p, q)++-- | Variant of 'mce2c' that requires input to have two channels.+unmce2 :: Ugen -> (Ugen, Ugen)+unmce2 = Base.t2_from_list . mceChannels++-- | Multiple channel expansion for two inputs.+mce3 :: Ugen -> Ugen -> Ugen -> Ugen+mce3 x y z = mce [x, y, z]++-- | Variant of 'mce2c' that requires input to have two channels.+unmce3 :: Ugen -> (Ugen, Ugen, Ugen)+unmce3 = Base.t3_from_list . mceChannels++-- | Apply a function to each channel at a unit generator.+mceMap :: (Ugen -> Ugen) -> Ugen -> Ugen+mceMap f u = mce (map f (mceChannels u))++-- | Map with element index.+map_ix :: ((Int, a) -> b) -> [a] -> [b]+map_ix f = zipWith (curry f) [0 ..]++-- | Variant of 'mceMap' with element index.+mce_map_ix :: ((Int, Ugen) -> Ugen) -> Ugen -> Ugen+mce_map_ix f u = mce (map_ix f (mceChannels u))++-- | Apply Ugen list operation on Mce contents.+mceEdit :: ([Ugen] -> [Ugen]) -> Ugen -> Ugen+mceEdit f u =+  case u of+    Mce_U m -> mce (f (mceProxies m))+    _ -> error "mceEdit: non Mce value"++-- | Reverse order of channels at Mce.+mceReverse :: Ugen -> Ugen+mceReverse = mceEdit reverse++-- | Obtain indexed channel at Mce.+mceChannel :: Int -> Ugen -> Ugen+mceChannel n u =+  case u of+    Mce_U m -> mceProxies m !! n+    _ -> if n == 0 then u else error "mceChannel: non Mce value, non ZERO index"++{- | Obtain indexed channel at Mce, indices wrap around.++> map (\ix -> pp (mceChannelWrap ix (mce [1,2,3,4,5]))) [0 .. 9]+["1","2","3","4","5","1","2","3","4","5"]+-}+mceChannelWrap :: Int -> Ugen -> Ugen+mceChannelWrap n u =+  case u of+    Mce_U m -> mceProxies m !! (n `mod` Mce.mce_length m)+    _ -> u++-- | Transpose rows and columns, ie. {{a,b},{c,d}} to {{a,c},{b,d}}.+mceTranspose :: Ugen -> Ugen+mceTranspose = mce . map mce . transpose . map mceChannels . mceChannels++{- | Rotate mce /k/ places to the right, ie. {a,b,c,d} to {d,a,b,c}++>>> mceRotate 1 (mce [1,2,3,4]) == mce [4,1,2,3]+True+-}+mceRotate :: Int -> Ugen -> Ugen+mceRotate k =+  let rotateRight n p = let (b, a) = splitAt (length p - n) p in a ++ b+  in mce . rotateRight k . mceChannels++{- | 'concat' at mce channels of each input, ie. {{a,b},{c,d}} to {a,b,c,d}.++>>> mceConcat (map mce [[1,2],[3,4]]) == mce [1..4]+True+-}+mceConcat :: [Ugen] -> Ugen+mceConcat = mce . concatMap mceChannels++{- | Collect subarrays of mce.++>>> mceClump 2 (mce [1,2,3,4]) == mce2 (mce2 1 2) (mce2 3 4)+True+-}+mceClump :: Int -> Ugen -> Ugen+mceClump k = mce . map mce . Split.chunksOf k . mceChannels++-- | Foldl1 at channels of mce.+mceReduce :: (Ugen -> Ugen -> Ugen) -> Ugen -> Ugen+mceReduce f = foldl1 f . mceChannels++-- | mceReduce of *.+mceProduct :: Ugen -> Ugen+mceProduct = mceReduce (*)++-- * Transform++-- | Given /unmce/ function make halt mce transform.+halt_mce_transform_f :: (a -> [a]) -> [a] -> [a]+halt_mce_transform_f f l =+  let (l', e) = fromMaybe (error "halt_mce_transform: null?") (Base.sep_last l)+  in l' ++ f e++{- | The halt Mce transform, ie. lift channels of last input into list.+This is not used by hsc3, but it is used by hsc3-forth and stsc3.++>>> halt_mce_transform [1,2,mce2 3 4] == [1,2,3,4]+True+-}+halt_mce_transform :: [Ugen] -> [Ugen]+halt_mce_transform = halt_mce_transform_f mceChannels++-- | If the root node of a Ugen graph is /mce/, transform to /mrg/.+prepare_root :: Ugen -> Ugen+prepare_root u =+  case u of+    Mce_U m -> mrg (mceProxies m)+    Mrg_U m -> mrg2 (prepare_root (mrgLeft m)) (prepare_root (mrgRight m))+    _ -> u++-- * Multiple root graphs++-- | Multiple root graph node constructor (left input is output)+mrg2 :: Ugen -> Ugen -> Ugen+mrg2 u = Mrg_U . Mrg u++-- * Labels++-- | Lift a 'String' to a Ugen label (ie. for 'poll').+label :: String -> Ugen+label = Label_U . Label++{- | Unpack a label to a length prefixed list of 'Constant's.  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.++> unpackLabel False (label "/tmp")+-}+unpackLabel :: Bool -> Ugen -> [Ugen]+unpackLabel length_prefix u =+  case u of+    Label_U (Label s) ->+      let q = fromEnum '?'+          f c = if Data.Char.isAscii c then fromEnum c else q+          s' = map (fromIntegral . f) s+      in if length_prefix then fromIntegral (length s) : s' else s'+    Mce_U m ->+      let x = map (unpackLabel length_prefix) (mceProxies m)+      in if Base.equal_length_p x+          then map mce (transpose x)+          else error (show ("unpackLabel: mce length /=", x))+    _ -> error (show ("unpackLabel: non-label", u))++-- * Envelope++-- | 'mce' of 'Envelope.envelope_sc3_array'.+envelope_to_ugen :: Envelope.Envelope Ugen -> Ugen+envelope_to_ugen =+  let err = error "envGen: bad Envelope"+  in mce . fromMaybe err . Envelope.envelope_sc3_array++-- | 'mce' of 'Envelope.envelope_sc3_ienvgen_array'.+envelope_to_ienvgen_ugen :: Envelope.Envelope Ugen -> Ugen+envelope_to_ienvgen_ugen =+  let err = error "envGen: bad Envelope"+  in mce . fromMaybe err . Envelope.envelope_sc3_ienvgen_array++-- * Rate Flow++-- | Traverse graph rewriting audio rate nodes as control rate.+rewriteUgenRates :: (Rate.Rate -> Bool) -> Rate.Rate -> Ugen -> Ugen+rewriteUgenRates sel_f set_rt =+  let f u = case u of+        Primitive_U (Primitive rt nm i o s z b) -> Primitive_U (Primitive (if sel_f rt then set_rt else rt) nm i o s z b)+        _ -> u+  in ugenTraverse (const False) f -- requires endRewrite node (see rsc3-arf)++-- | Traverse graph rewriting audio rate nodes as control rate.+rewriteToControlRate :: Ugen -> Ugen+rewriteToControlRate = rewriteUgenRates (== Rate.AudioRate) Rate.ControlRate++-- | Traverse graph rewriting all nodes as demand rate.+rewriteToDemandRate :: Ugen -> Ugen+rewriteToDemandRate = rewriteUgenRates (const True) Rate.DemandRate++-- | Traverse graph rewriting audio and control nodes as initialisation rate.+rewriteToInitialisationRate :: Ugen -> Ugen+rewriteToInitialisationRate = rewriteUgenRates (`elem` [Rate.ControlRate, Rate.AudioRate]) Rate.InitialisationRate++-- | Select rewriting function given 'Rate.Rate'.+rewriteToRate :: Rate.Rate -> Ugen -> Ugen+rewriteToRate rt =+  case rt of+    Rate.ControlRate -> rewriteToControlRate+    Rate.DemandRate -> rewriteToDemandRate+    Rate.InitialisationRate -> rewriteToInitialisationRate+    Rate.AudioRate -> error "rewriteToRate: AudioRate?"
emacs/hsc3.el view
@@ -1,26 +1,43 @@-;; Indentation and font locking is courtesy `haskell' mode.-;; Inter-process communication is courtesy `comint' and `inf-haskell'.-;; Symbol at point acquisition is courtesy `thingatpt'.-;; Directory search facilities are courtesy `find-lisp'.+;;; hsc3.el --- Haskell SuperCollider -(require 'scheme)+;;; Commentary:++; Indentation and font locking is courtesy `haskell' mode (debian=haskell-mode).+; Inter-process communication is courtesy `comint'.+; Symbol at point acquisition is courtesy `thingatpt'.+; Directory search facilities are courtesy `find-lisp'.++(require 'haskell) (require 'comint) (require 'thingatpt) (require 'find-lisp)-(require 'inf-haskell) -(defvar hsc3-help-directory-  nil-  "*The directory containing the help files (default=nil).")+;;; Code: -(defvar hsc3-literate-p-  t-  "*Flag to indicate if we are in literate mode (default=t).")+(defcustom hsc3-buffer "*hsc3*"+  "The name of the hsc3 haskell process buffer."+  :type 'string) -(make-variable-buffer-local 'hsc3-literate-p)+(defcustom hsc3-interpreter (list "ghci")+  "The name of the haskell interpreter (default=\"ghci\")."+  :type '(repeat string)) +(defvar hsc3-directory nil+  "The hsc3 directory (default=nil).")++(defvar sc3-help-directory nil+  "The directory containing the Sc3 RTF help files (default=nil).++These can be fetched from the SuperCollider archives by typing:++git checkout 2495f4f61c0955001169d28142543aabbe1bedcb build/old_rtf_help.tar.gz")++(defcustom hsc3-auto-import-modules nil+  "Flag to decide if the hsc3 standard module set is imported on startup (default=nil)."+  :type 'boolean)+ (defun hsc3-chunk-string (n s)-  "Split a string into chunks of 'n' characters."+  "Split the string S into chunks of N characters."   (let* ((l (length s))          (m (min l n))          (c (substring s 0 m)))@@ -28,183 +45,404 @@         (list c)       (cons c (hsc3-chunk-string n (substring s n)))))) -(defun hsc3-send-string (s)-  (if (comint-check-proc inferior-haskell-buffer)+(defun hsc3-send-line (s)+  "Send the string S, with newline appended, to haskell."+  (if (comint-check-proc hsc3-buffer)       (let ((cs (hsc3-chunk-string 64 (concat s "\n"))))         (mapcar-         (lambda (c) (comint-send-string inferior-haskell-buffer c))+         (lambda (c) (comint-send-string hsc3-buffer c))          cs))-    (error "no hsc3 process running?")))+    (error "No hsc3 process?"))) -(defun hsc3-quit-haskell ()-  "Quit haskell."-  (interactive)-  (hsc3-send-string ":quit"))+(defun hsc3-send-layout-block (s)+  "Send the string S to haskell using ghci layout block notation."+  (hsc3-send-line (mapconcat 'identity (list ":{" s ":}") "\n"))) -(defun hsc3-unlit (s)-  "Remove bird literate marks and preceding comment marker"-   (replace-regexp-in-string "^[> ]* ?" "" s))+(defun hsc3-send-text (str)+  "If the string STR spans multiple lines `hsc3-send-layout-block' else `hsc3-send-line'."+  (if (string-match "\n" str)+      (hsc3-send-layout-block str)+    (hsc3-send-line str))) +(defun hsc3-send-text-fn (fn str)+  "Send string STR with haskell function FN applied using the $ operator.+If STR has a newline the layout is adjusted accordingly."+  (hsc3-send-text+   (if (string-match "\n" str)+       (concat fn " $\n" str)+     (concat fn " $ " str))))++(defun hsc3-send-quit ()+  "Send :quit instruction to haskell."+  (interactive)+  (hsc3-send-line ":quit"))+ (defun hsc3-uncomment (s)-  "Remove initial comment and Bird-literate markers if present."+  "Remove initial comment and Bird-literate markers from the string S if present."    (replace-regexp-in-string "^[- ]*[> ]*" "" s)) +(defun hsc3-find-files (dir rgx)+  "Find files at DIR matching RGX."+  (mapc (lambda (filename)+          (find-file-other-window filename))+        (find-lisp-find-files dir rgx)))+ (defun hsc3-help ()   "Lookup up the name at point in the hsc3 help files."   (interactive)-  (mapc (lambda (filename)-	  (find-file-other-window filename))-	(find-lisp-find-files hsc3-help-directory-			      (concat "^"-				      (thing-at-point 'symbol)-				      "\\.help\\.l?hs$"))))+  (let ((rgx (concat "^" (thing-at-point 'symbol) "\\.help\\.l?hs$")))+    (hsc3-find-files (concat hsc3-directory "Help/") rgx))) -(defun hsc3-sc3-ugen-help ()-  "Lookup up the UGen name at point in the SC3 help files."+(defun hsc3-sc3-help ()+  "Lookup up the name at point in the Sc3 (RTF) help files."   (interactive)-  (hsc3-send-string+  (let ((rgx (concat "^" (thing-at-point 'symbol) "\\\(.help\\\)?.rtf$")))+    (hsc3-find-files sc3-help-directory rgx)))++(defun hsc3-sc3-help-scdoc ()+  "Lookup up the Ugen name at point in the Sc3 (SCDOC) help files."+  (interactive)+  (hsc3-send-line    (format-    "Sound.SC3.viewSC3Help (Sound.SC3.toSC3Name \"%s\")"+    "Sound.Sc3.Common.Help.sc3_scdoc_help_open False (Sound.Sc3.Common.Help.sc3_scdoc_help_path (Sound.Sc3.Ugen.Db.ugen_sc3_name \"%s\"))"     (thing-at-point 'symbol)))) -(defun hsc3-sc3-server-help ()-  "Lookup up the Server Command name at point in the SC3 help files."+(defun hsc3-ugen-summary ()+  "Lookup up the Ugen at point in hsc3-db."   (interactive)-  (hsc3-send-string-   (format "Sound.SC3.Server.Help.viewServerHelp \"%s\""-           (thing-at-point 'symbol))))+  (hsc3-send-line+   (format "Sound.Sc3.Ugen.Db.Pp.ugen_summary_wr \"%s\"" (thing-at-point 'symbol)))) -(defun hsc3-ugen-summary ()-  "Lookup up the UGen at point in hsc3-db"+(defun hsc3-ugen-default-param ()+  "Insert the default Ugen parameters (arguments) for the Ugen before <point>."   (interactive)-  (hsc3-send-string-      (format "Sound.SC3.UGen.DB.ugenSummary \"%s\""-              (thing-at-point 'symbol))))+  (let ((p (format "hsc3-help ugen exemplar hs %s" (thing-at-point 'symbol))))+    (insert " ")+    (insert (hsc3-remove-trailing-newline (shell-command-to-string p))))) -(defun hsc3-remove-trailing-newline (s)-  (replace-regexp-in-string "\n\\'" "" s))+(defun hsc3-ugen-control-param ()+  "Insert control Ugen parameters (arguments) for the Ugen before <point>."+  (interactive)+  (let ((p (format "hsc3-help ugen exemplar hs/control %s" (thing-at-point 'symbol))))+    (insert (hsc3-remove-trailing-newline (shell-command-to-string p))))) +(defun hsc3-ugen-control-param-let ()+  "Insert control Ugen parameters (arguments) for the Ugen before <point>."+  (interactive)+  (let ((p (format "hsc3-help ugen exemplar hs/control/let %s" (thing-at-point 'symbol))))+    (insert (hsc3-remove-trailing-newline (shell-command-to-string p)))))++(defun hsc3-remove-trailing-newline (str)+  "Delete trailing newlines from STR."+  (replace-regexp-in-string "\n\\'" "" str))+ (defun hsc3-cd ()   "Change directory at ghci to current value of 'default-directory'."   (interactive)-  (hsc3-send-string (format ":cd %s" default-directory)))+  (hsc3-send-line (format ":cd %s" default-directory))) -(defun hsc3-load-buffer ()-  "Load the current buffer."+(defun hsc3-load-current-file ()+  "Send :load and the current buffer file name to haskell."   (interactive)   (save-buffer)   (hsc3-see-haskell)-  (hsc3-send-string (format ":load \"%s\"" buffer-file-name)))+  (hsc3-send-line (format ":load \"%s\"" buffer-file-name))) -(defun hsc3-run-line ()-  "Send the current line to the interpreter."+(defun hsc3-current-line ()+  "Get current line."+  (buffer-substring-no-properties+   (line-beginning-position)+   (line-end-position)))++(defun hsc3-send-current-line ()+  "Send the current line to haskell."   (interactive)-  (let* ((s (buffer-substring (line-beginning-position)-			      (line-end-position)))-	 (s* (if hsc3-literate-p-		 (hsc3-unlit s)-	       (hsc3-uncomment s))))-    (hsc3-send-string s*)))+  (hsc3-send-line (hsc3-uncomment (hsc3-current-line)))) -(defun hsc3-run-main ()-  "Run current main."+(defun hsc3-send-main ()+  "Send main to haskell."   (interactive)-  (hsc3-send-string "main"))+  (hsc3-send-line "main")) +(defun hsc3-set-region-to-paragraph ()+  "Set the mark at the start and point at the end of the current paragraph."+  (interactive)+  (backward-paragraph)+  (push-mark nil t t)+  (forward-paragraph))++(defun hsc3-region-string ()+  "Get current region as string."+  (buffer-substring-no-properties (region-beginning) (region-end)))++(defun hsc3-send-region ()+  "Send region text to interpreter."+  (interactive)+  (hsc3-send-text (hsc3-region-string)))++(defun hsc3-send-region-fn (fn)+  "Send region text with haskell function FN to be applied."+  (hsc3-send-text-fn fn (hsc3-region-string)))++(defun hsc3-play-region-at (k)+  "Play region at scsynth.  The (one-indexed) prefix agument K indicates which server to send to."+  (interactive "p")+  (hsc3-send-region-fn+   (format+    "Sound.Sc3.auditionAt (\"%s\",%d + %d) Sound.Sc3.def_play_opt"+    (hsc3-server-host) (hsc3-server-port) k)))++(defun hsc3-play-region ()+  "Play region at scsynth."+  (interactive)+  (hsc3-send-region-fn "Sound.Sc3.audition"))++(defun hsc3-play ()+  "Play at scsynth."+  (interactive)+  (hsc3-set-region-to-paragraph)+  (hsc3-play-region))++(defun hsc3-play-region-stateful ()+  "Play region at scsynth using stateful interface."+  (interactive)+  (hsc3-send-region-fn "Sound.Sc3.scSynthPlay scSynth"))++(defcustom hsc3-draw-command "draw"+  "*The un-qualified name of the draw function to use at `hsc3-draw-region'."+  :type 'string)++(defun hsc3-draw-region ()+  "Draw region Ugen graph."+  (interactive)+  (hsc3-send-region-fn (format "Sound.Sc3.Ugen.Dot.%s $ wrapOut Nothing " hsc3-draw-command)))++(defun hsc3-draw ()+  "Draw Ugen graph."+  (interactive)+  (hsc3-set-region-to-paragraph)+  (hsc3-draw-region))++(defun hsc3-dump-ugens-region ()+  "Print region Ugen graph."+  (interactive)+  (hsc3-send-region-fn "Sound.Sc3.ugen_dump_ugens $ wrapOut Nothing"))++(defun hsc3-ui-region ()+  "UI for region Ugen graph."+  (interactive)+  (let ((str (hsc3-region-string)))+    (hsc3-send-region-fn "Sound.Sc3.UI.SCLang.Control.ugen_ui_run \"ui\" 1")))++(defun hsc3-ui-comment ()+  "UI for description in comment line."+  (interactive)+  (hsc3-send-line+   (format+    "Sound.Sc3.UI.SCLang.Control.control_text_ui_run \"ui\" 1 \"%s\""+    (hsc3-current-line))))++(defun hsc3-pp-html-region ()+  "HTML pretty-printer and viewer for region Ugen graph."+  (interactive)+  (let ((str (hsc3-region-string)))+    (hsc3-send-region-fn "Sound.Sc3.UI.HTML.ugen_graph_pp_html_wv")))++(defun hsc3-pp-forth ()+  "Forth PP."+  (interactive)+  (hsc3-send-region-fn "Sound.Sc3.Ugen.Db.Pp.ugen_graph_forth_pp (False,False)"))++(defun hsc3-pp-smalltalk ()+  "Pretty print Ugen as Smalltalk."+  (interactive)+  (hsc3-send-region-fn "Sound.Sc3.Ugen.Db.Pp.Graph.ugen_graph_smalltalk_pp"))+ (defun hsc3-id-rewrite-region ()+  "Run hsc3-id-rewrite on region."   (interactive)-  (shell-command-on-region-   (region-beginning)-   (region-end)-   "hsc3-id-rewrite"-   nil-   t))+  (shell-command-on-region (region-beginning) (region-end) "hsc3-rw id-rewrite" nil t)) -(defun hsc3-id-rewrite ()+(defun hsc3-id-rewrite-buffer ()+  "Run hsc3-id-rewrite on buffer."   (interactive)-  (shell-command-on-region (point-min) (point-max) "hsc3-id-rewrite" nil t))+  (shell-command-on-region (point-min) (point-max) "hsc3-rw id-rewrite" nil t)) -(defun hsc3-interrupt-haskell ()-  "Interrupt haskell interpreter"+(defun hsc3-uparam-rewrite ()+  "Rewrite uparam notation inplace."   (interactive)-  (if (comint-check-proc inferior-haskell-buffer)-      (with-current-buffer inferior-haskell-buffer-        (interrupt-process (get-buffer-process (current-buffer))))-    (error "no haskell interpreter process running?")))+  (shell-command-on-region (region-beginning) (region-end) "hsc3-rw uparam expand" nil t)) +(defun hsc3-server-protocol ()+  "The protocol that scsynth is listening at."+  (or (getenv "ScProtocol") "Udp"))++(defun hsc3-server-host ()+  "The host that scsynth is listening at."+  (or (getenv "ScHostname") "127.0.0.1"))++(defun hsc3-server-port ()+  "The port that scsynth is listening at."+  (read (or (getenv "ScPort") "57110")))++(defun hsc3-with-sc3 (txt)+  "Sound.Sc3.withSc3 at `hsc3-server-host' and `hsc3-server-port' of the string TXT."+  (hsc3-send-line+   (format "Sound.Sc3.withSc3At (%s,\"%s\",%d) %s" (hsc3-server-protocol) (hsc3-server-host) (hsc3-server-port) txt)))+ (defun hsc3-reset-scsynth ()-  "Reset scsynth"+  "Send Sc3 reset instruction to haskell."   (interactive)-  (hsc3-send-string "Sound.SC3.withSC3 Sound.SC3.reset"))+  (hsc3-with-sc3 "Sound.Sc3.reset")) +;;(hsc3-send-line "Sound.Sc3.scsynthReset scsynth")++(defun hsc3-start-haskell ()+  "Start the hsc3 haskell process.++If `hsc3-interpreter' is not already a subprocess it is+started and a new window is created to display the results of+evaluating hsc3 expressions.  Input and output is via `hsc3-buffer'."+  (interactive)+  (if (comint-check-proc hsc3-buffer)+      (hsc3-see-haskell)+    (apply+     'make-comint+     "hsc3"+     (car hsc3-interpreter)+     nil+     (cdr hsc3-interpreter))+    (hsc3-set-prompt)+    (if hsc3-auto-import-modules+        (hsc3-import-standard-modules))+    (hsc3-see-haskell)))++(defun hsc3-interrupt-haskell ()+  "Interupt haskell."+  (interactive)+  (interrupt-process hsc3-buffer comint-ptyp))+ (defun hsc3-stop ()-  "Interrupt haskell interpreter & reset scsynth"+  "Interrupt haskell & reset scsynth."   (interactive)   (progn     (hsc3-interrupt-haskell)     (sleep-for 0.15)     (hsc3-reset-scsynth))) -(defun hsc3-status-scsynth ()-  "Status"+(defun hsc3-server-status ()+  "Send serverStatus request to haskell."   (interactive)-  (hsc3-send-string-   "Sound.SC3.withSC3 Sound.SC3.serverStatus >>= mapM putStrLn"))+  (hsc3-with-sc3 "Sound.Sc3.serverStatus >>= mapM putStrLn"))  (defun hsc3-quit-scsynth ()-  "Quit"+  "Quit."   (interactive)-  (hsc3-send-string-   "Sound.SC3.withSC3 (Sound.SC3.send Sound.SC3.quit)"))+  (hsc3-with-sc3 "(Sound.Osc.sendMessage Sound.Sc3.quit)")) -(defun hsc3-update-hsc3-tags ()-  "Update hsc3 TAGS file, must be run from hsc3 directory."+(defcustom hsc3-seq-degree 2+  "Number of scsynth processes to address at -seq operations (default=2)."+  :type 'integer)++(defun hsc3-server-status-seq ()+  "Send serverStatus request to haskell."   (interactive)-  (if (and (executable-find "hasktags") (file-exists-p "hsc3.cabal"))-      (call-process-shell-command-       "find Sound . -name '*.*hs' | xargs hasktags -e"-       nil-       nil)-    (error "no hasktags binary or not at hsc3 directory?")))+  (hsc3-send-line+   (format+    "Sound.Sc3.withSc3AtSeq (\"%s\",%d) %d Sound.Sc3.serverStatus >>= mapM putStrLn . concat"+    (hsc3-server-host) (hsc3-server-port) hsc3-seq-degree))) -(defun hsc3-audition-graph ()-  "Audition the UGen graph at point."+(defun hsc3-play-region-seq ()+  "Sound.Sc3.auditionAtSeq of `hsc3-seq-degree'."   (interactive)-  (hsc3-send-string-   (concat "Sound.SC3.audition " (thing-at-point 'symbol))))+  (hsc3-send-region-fn+   (format+    "Sound.Sc3.auditionAtSeq (\"%s\",%d) def_play_opt %d"+    (hsc3-server-host) (hsc3-server-port) hsc3-seq-degree))) -(defun hsc3-audition-graph-m ()-  "Audition the (monadic) UGen graph at point."+(defun hsc3-reset-scsynth-seq ()+  "Send Sc3 reset instruction to haskell."   (interactive)-  (hsc3-send-string-   (concat "Sound.SC3.audition =<<" (thing-at-point 'symbol))))+  (hsc3-send-line+   (format+    "Sound.Sc3.withSc3AtSeq_ (\"%s\",%d) %d Sound.Sc3.reset"+    (hsc3-server-host) (hsc3-server-port) hsc3-seq-degree))) -(defun hsc3-draw-graph ()-  "Draw the UGen graph at point."+(defun hsc3-dmenu-ugen-core ()+  "Run dmenu to select a core Sc3 Ugen."   (interactive)-  (hsc3-send-string-   (concat "Sound.SC3.UGen.Dot.draw " (thing-at-point 'symbol))))+  (insert (shell-command-to-string "hsc3-db dmenu ugen core"))) -(defun hsc3-draw-graph-m ()-  "Draw the (monadic) UGen graph at point."+(defun hsc3-dmenu-ugen-ext ()+  "Run dmenu to select an external Sc3 Ugen."   (interactive)-  (hsc3-send-string-   (concat "Sound.SC3.UGen.Dot.draw =<<" (thing-at-point 'symbol))))+  (insert (shell-command-to-string "hsc3-db dmenu ugen external"))) +(defun hsc3-dmenu-ugen-all ()+  "Run dmenu to select an Sc3 Ugen."+  (interactive)+  (insert (shell-command-to-string "hsc3-db dmenu ugen all")))++(defun hsc3-xmenu-ugen-core ()+  "Run xmenu to select a core Sc3 Ugen."+  (interactive)+  (insert (shell-command-to-string "hsc3-db xmenu core")))++(defun hsc3-xmenu-ugen-ext ()+  "Run xmenu to select an external Sc3 Ugen."+  (interactive)+  (insert (shell-command-to-string "hsc3-db xmenu external")))++(defun hsc3-xmenu-ugen-all ()+  "Run xmenu to select an Sc3 Ugen."+  (interactive)+  (insert+   (shell-command-to-string+    "cat ~/sw/hsc3-db/lib/xmenu/ugen-core-tree.text \+         ~/sw/hsc3-db/lib/xmenu/nil.text \+         ~/sw/hsc3-db/lib/xmenu/ugen-ext-tree.text | xmenu")))++(defun hsc3-load-file (fn)+  "Load file FN as string."+  (with-temp-buffer+    (insert-file-contents fn)+    (buffer-substring-no-properties+       (point-min)+       (point-max))))++(defun hsc3-unload-all-modules ()+  "Unload all modules and delete all bindings at ghci.++   :load without any arguments unloads all the currently loaded modules and bindings"+  (interactive)+  (hsc3-send-line ":load"))++(defun hsc3-import-standard-modules ()+  "Send standard set of hsc3 and related module imports to haskell."+  (interactive)+  (mapc+   'hsc3-send-line+   (split-string (hsc3-load-file (concat hsc3-directory "lib/hsc3-std-imports.hs")) "\n")))++(defun hsc3-init-scsynth ()+  "Initialise the scsynth interpreter variable."+  (interactive)+  (hsc3-send-line "scSynth <- Sound.Sc3.Server.ScSynth.newScSynth"))+ (defun hsc3-set-prompt ()-  "Set ghci prompt to hsc3."+  "Set ghci prompt to hsc3> and the continuation prompt to nil."   (interactive)-  (hsc3-send-string ":set prompt \"hsc3> \""))+  (hsc3-send-line ":set prompt \"hsc3> \"")+  (hsc3-send-line ":set prompt-cont \"\""))  (defun hsc3-see-haskell ()  "Show haskell output."  (interactive)- (let* ((p (inferior-haskell-process))-        (b (process-buffer p)))-   (hsc3-set-prompt)+  (if (not (comint-check-proc hsc3-buffer))+      (hsc3-start-haskell)    (delete-other-windows)    (split-window-vertically)-   (with-current-buffer b+   (with-current-buffer hsc3-buffer      (let ((window (display-buffer (current-buffer))))        (goto-char (point-max))        (save-selected-window@@ -214,68 +452,60 @@   "Haskell SuperCollider keymap.")  (defun hsc3-mode-keybindings (map)-  "Haskell SuperCollider keybindings."-  (define-key map [?\C-c ?<] 'hsc3-load-buffer)-  (define-key map [?\C-c ?>] 'hsc3-see-haskell)-  (define-key map [?\C-c ?\C-c] 'hsc3-run-line)-  (define-key map [?\C-c ?\C-h] 'hsc3-help)-  (define-key map [?\C-c ?\C-a] 'hsc3-audition-graph)-  (define-key map [?\C-c ?\M-a] 'hsc3-audition-graph-m)-  (define-key map [?\C-c ?\C-g] 'hsc3-draw-graph)-  (define-key map [?\C-c ?\M-g] 'hsc3-draw-graph-m)-  (define-key map [?\C-c ?\C-j] 'hsc3-sc3-ugen-help)-  (define-key map [?\C-c ?\C-/] 'hsc3-sc3-server-help)-  (define-key map [?\C-c ?i] 'hsc3-interrupt-haskell)-  (define-key map [?\C-c ?\C-k] 'hsc3-reset-scsynth)-  (define-key map [?\C-c ?\C-m] 'hsc3-run-main)-  (define-key map [?\C-c ?\C-p] 'hsc3-status-scsynth)-  (define-key map [?\C-c ?\C-q] 'hsc3-quit-haskell)-  (define-key map [?\C-c ?\C-0] 'hsc3-quit-scsynth)-  (define-key map [?\C-c ?\C-.] 'hsc3-stop)-  (define-key map [?\C-c ?\C-u] 'hsc3-ugen-summary))+  "Add Haskell SuperCollider keybindings to MAP."+  (define-key map (kbd "C-c <") 'hsc3-load-current-file)+  (define-key map (kbd "C-c >") 'hsc3-see-haskell)+  (define-key map (kbd "C-c C-c") 'hsc3-send-current-line)+  (define-key map (kbd "C-c C-h") 'hsc3-help)+  (define-key map (kbd "C-c C-r") 'hsc3-send-region)+  (define-key map (kbd "C-c C-a") 'hsc3-play)+  (define-key map (kbd "C-c C-S-a") 'hsc3-play-region-seq)+  (define-key map (kbd "C-c C-g") 'hsc3-draw)+  (define-key map (kbd "C-c C-d") 'hsc3-dump-ugens-region)+  (define-key map (kbd "C-c C-v") 'hsc3-ui-region)+  (define-key map (kbd "C-c C-f") 'hsc3-ui-comment)+  (define-key map (kbd "C-c C-j") 'hsc3-sc3-help)+  (define-key map (kbd "C-c C-i") 'hsc3-interrupt-haskell)+  (define-key map (kbd "C-c C-k") 'hsc3-reset-scsynth)+  (define-key map (kbd "C-c C-S-k") 'hsc3-reset-scsynth-seq)+  (define-key map (kbd "C-c C-m") 'hsc3-send-main)+  (define-key map (kbd "C-c C-p") 'hsc3-server-status)+  (define-key map (kbd "C-c C-S-p") 'hsc3-server-status-seq)+  (define-key map (kbd "C-c C-q") 'hsc3-send-quit)+  (define-key map (kbd "C-c C-.") 'hsc3-stop)+  (define-key map (kbd "C-c C-s") 'hsc3-dmenu-ugen-all)+  (define-key map (kbd "C-c C-S-s") 'hsc3-xmenu-ugen-all)+  (define-key map (kbd "C-c C-u") 'hsc3-ugen-summary))  (defun hsc3-mode-menu (map)-  "Haskell SuperCollider menu."-  (define-key map [menu-bar hsc3]-    (cons "Haskell-SuperCollider" (make-sparse-keymap "Haskell-SuperCollider")))-  (define-key map [menu-bar hsc3 help]-    (cons "Help" (make-sparse-keymap "Help")))-  (define-key map [menu-bar hsc3 help hsc3]-    '("Haskell SuperCollider help" . hsc3-help))-  (define-key map [menu-bar hsc3 help ugen]-    '("UGen parameter summary" . hsc3-ugen-summary))-  (define-key map [menu-bar hsc3 help sc3-server]-    '("SuperCollider Server Command help" . hsc3-sc3-server-help))-  (define-key map [menu-bar hsc3 help sc3-ugen]-    '("SuperCollider UGen help" . hsc3-sc3-ugen-help))-  (define-key map [menu-bar hsc3 expression]-    (cons "Expression" (make-sparse-keymap "Expression")))-  (define-key map [menu-bar hsc3 expression stop]-    '("Stop (interrupt and reset)" . hsc3-stop))-  (define-key map [menu-bar hsc3 expression change-directory]-    '("Change directory" . hsc3-cd))-  (define-key map [menu-bar hsc3 expression load-buffer]-    '("Load buffer" . hsc3-load-buffer))-  (define-key map [menu-bar hsc3 expression run-main]-    '("Run main" . hsc3-run-main))-  (define-key map [menu-bar hsc3 expression run-line]-    '("Run line" . hsc3-run-line))-  (define-key map [menu-bar hsc3 scsynth]-    (cons "SCSynth" (make-sparse-keymap "SCSynth")))-  (define-key map [menu-bar hsc3 scsynth quit]-    '("Quit scsynth" . hsc3-quit-scsynth))-  (define-key map [menu-bar hsc3 scsynth status]-    '("Display status" . hsc3-status-scsynth))-  (define-key map [menu-bar hsc3 scsynth reset]-    '("Reset scsynth" . hsc3-reset-scsynth))-  (define-key map [menu-bar hsc3 haskell]-    (cons "Haskell" (make-sparse-keymap "Haskell")))-  (define-key map [menu-bar hsc3 haskell quit-haskell]-    '("Quit haskell" . hsc3-quit-haskell))-  (define-key map [menu-bar hsc3 haskell interrupt-haskell]-    '("Interrupt haskell" . hsc3-interrupt-haskell))-  (define-key map [menu-bar hsc3 haskell see-haskell]-    '("See haskell" . hsc3-see-haskell)))+  "Add Haskell SuperCollider Menu to MAP."+  (define-key map [menu-bar hsc3] (cons "Haskell-SuperCollider" (make-sparse-keymap "Haskell-SuperCollider")))+  (define-key map [menu-bar hsc3 help] (cons "Help" (make-sparse-keymap "Help")))+  (define-key map [menu-bar hsc3 help hsc3] '("HSc3 Help" . hsc3-help))+  (define-key map [menu-bar hsc3 help ugen] '("Ugen Summary" . hsc3-ugen-summary))+  (define-key map [menu-bar hsc3 help sc3-ugen] '("Sc3 Help" . hsc3-sc3-ugen-help))+  (define-key map [menu-bar hsc3 expression] (cons "Expression" (make-sparse-keymap "Expression")))+  (define-key map [menu-bar hsc3 expression stop] '("Stop (interrupt and reset)" . hsc3-stop))+  (define-key map [menu-bar hsc3 expression change-directory] '("Change directory" . hsc3-cd))+  (define-key map [menu-bar hsc3 expression import-standard-modules] '("Import standard modules" . hsc3-import-standard-modules))+  (define-key map [menu-bar hsc3 expression server-status] '("Print server status" . hsc3-server-status))+  (define-key map [menu-bar hsc3 expression send-main] '("Send main" . hsc3-send-main))+  (define-key map [menu-bar hsc3 expression send-region] '("Send region" . hsc3-send-region))+  (define-key map [menu-bar hsc3 expression send-current-line] '("Send current line" . hsc3-send-current-line))+  (define-key map [menu-bar hsc3 expression id-rewrite-region] '("ID-rewrite region" . hsc3-id-rewrite-region))+  (define-key map [menu-bar hsc3 expression load-current-file] '("Load current file" . hsc3-load-current-file))+  (define-key map [menu-bar hsc3 expression dmenu-ugen] '("Ugen dmenu" . hsc3-dmenu-ugen-all))+  (define-key map [menu-bar hsc3 expression xmenu-ugen] '("Ugen xmenu" . hsc3-xmenu-ugen-all))+  (define-key map [menu-bar hsc3 expression draw-region] '("Draw region" . hsc3-draw-region))+  (define-key map [menu-bar hsc3 expression play-region] '("Play region" . hsc3-play-region))+  (define-key map [menu-bar hsc3 scsynth] (cons "ScSynth" (make-sparse-keymap "ScSynth")))+  (define-key map [menu-bar hsc3 scsynth quit] '("Quit scsynth" . hsc3-quit-scsynth))+  (define-key map [menu-bar hsc3 scsynth status] '("Display status" . hsc3-status-scsynth))+  (define-key map [menu-bar hsc3 scsynth reset] '("Reset scsynth" . hsc3-reset-scsynth))+  (define-key map [menu-bar hsc3 haskell] (cons "Haskell" (make-sparse-keymap "Haskell")))+  (define-key map [menu-bar hsc3 haskell quit-haskell] '("Quit haskell" . hsc3-quit-haskell))+  (define-key map [menu-bar hsc3 haskell interrupt-haskell] '("Interrupt haskell" . hsc3-interrupt-haskell))+  (define-key map [menu-bar hsc3 haskell see-haskell] '("See haskell" . hsc3-see-haskell)))  (if hsc3-mode-map     ()@@ -285,146 +515,14 @@     (setq hsc3-mode-map map)))  (define-derived-mode-  literate-hsc3-mode   hsc3-mode-  "Literate Haskell SuperCollider"-  "Major mode for interacting with an inferior haskell process."-  (setq hsc3-literate-p t)-  (setq haskell-literate 'bird)-  (turn-on-font-lock))--(add-to-list 'auto-mode-alist '("\\.lhs$" . literate-hsc3-mode))--(define-derived-mode-  hsc3-mode   haskell-mode   "Haskell SuperCollider"-  "Major mode for interacting with an inferior haskell process."-  (setq hsc3-literate-p nil)+  "Major mode for interacting with an inferior hsc3 process."   (turn-on-font-lock))  (add-to-list 'auto-mode-alist '("\\.hs$" . hsc3-mode))  (provide 'hsc3) -;; (require 'haskell-interactive-mode)-;; (require 'haskell-process)--;; (defun hsc3-send-string (s)-;;   (haskell-process-send-string (haskell-interactive-process) s))--;; (defun hsc3-send-string-and-print (s)-;;   (haskell-process-show-repl-response s))--;; (defun hsc3-interrupt-haskell ()-;;   (haskell-process-interrupt))--;; (defun hsc3-see-haskell ()-;;   "Show haskell output."-;;   (interactive)-;;   (haskell-interactive-bring))--;; (require 'sclang)--;; (define-key map [?\C-c ?\C-e] 'hsc3-run-multiple-lines)-;; (define-key map [?\C-c ?\M-e] 'hsc3-run-multiple-lines-sclang)-;; (define-key map [?\C-c ?\C-r] 'hsc3-run-consecutive-lines)-;; (define-key map [?\C-c ?\C-f] 'hsc3-run-layout-block)-;; (define-key map [?\C-c ?\M-f] 'hsc3-sc3-forth-pp)-;; (define-key map [?\C-c ?\M-m] 'hsc3-load-main)-;; (define-key map [?\C-c ?\C-,] 'hsc3-ugen-default-param)--;; (define-key map [menu-bar hsc3 expression gen-default-param]-;;   '("Insert default parameters" . hsc3-ugen-default-param))-;; (define-key map [menu-bar hsc3 expression run-layout-block]-;;   '("Run layout block" . hsc3-run-layout-block))-;; (define-key map [menu-bar hsc3 expression run-consecutive-lines]-;;   '("Run consecutive lines" . hsc3-run-consecutive-lines))-;; (define-key map [menu-bar hsc3 expression run-multiple-lines]-;;   '("Run multiple lines" . hsc3-run-multiple-lines))--;; (defun hsc3-wait ()-;;   "Wait for prompt after sending command."-;;   (interactive)-;;   (inferior-haskell-wait-for-prompt (inferior-haskell-process)))--;; (defun hsc3-request-type ()-;;   "Ask ghci for the type of the name at point."-;;   (interactive)-;;   (hsc3-send-string (concat ":t " (thing-at-point 'symbol))))--;; (defun hsc3-load-main ()-;;   "Load current buffer and run main."-;;   (interactive)-;;   (hsc3-load-buffer)-;;   (hsc3-run-main))--;; (defun hsc3-ugen-default-param ()-;;   "Insert the default UGen parameters for the UGen before <point>."-;;   (interactive)-;;   (let ((p (format "hsc3-default-param %s" (thing-at-point 'symbol))))-;;     (insert " ")-;;     (insert (hsc3-remove-trailing-newline (shell-command-to-string p)))))--;; (defun hsc3-sc3-forth-pp () "Forth PP" (interactive)-;;   (hsc3-send-string-;;    (format "Sound.SC3.UGen.DB.PP.ugen_graph_forth_pp False %s" (thing-at-point 'symbol))))--;; (defun hsc3-region-string ()-;;   "Get region as string (no properties)"-;;   (buffer-substring-no-properties-;;    (region-beginning)-;;    (region-end)))--;; (defun hsc3-gen-param ()-;;   "Rewrite an SC3 argument list as control definitions."-;;   (interactive)-;;   (hsc3-send-string-;;    (concat "putStrLn $ Sound.SC3.RW.PSynth.rewrite_param_list \"" (hsc3-region-string) "\"")))--;; (defun hsc3-local-dot ()-;;   "Copy '/tmp/hsc3.dot' to 'buffer-name' .dot."-;;   (interactive)-;;   (let ((nm (concat (file-name-sans-extension (buffer-name)) ".dot")))-;;     (copy-file "/tmp/hsc3.dot" nm t)))--;; (defun hsc3-concat (l)-;;   (apply #'concat l))--;; (defun hsc3-remove-non-literates (s)-;;   "Remove non-bird literate lines"-;;   (replace-regexp-in-string "^[^>]*$" "" s))--;; (defun hsc3-region-string-unlit ()-;;   "The current region (unlit, uncomment)."-;;   (let* ((s (hsc3-region-string)))-;;     (if hsc3-literate-p-;;         (hsc3-unlit (hsc3-remove-non-literates s))-;;       (hsc3-concat (mapcar 'hsc3-uncomment (split-string s "\n"))))))--;; (defun hsc3-region-string-one-line ()-;;   "Replace newlines with spaces in `hsc3-region-string'."-;;   (replace-regexp-in-string "\n" " " (hsc3-region-string-unlit)))--;; (defun hsc3-run-multiple-lines ()-;;   "Send the current region to the haskell interpreter as a single line."-;;   (interactive)-;;   (hsc3-send-string (hsc3-region-string-one-line)))--;; (defun hsc3-run-multiple-lines-sclang ()-;;   "Send the current region to the sclang interpreter as a single line."-;;   (interactive)-;;   (sclang-eval-string (hsc3-region-string-one-line) t))--;; (defun hsc3-run-consecutive-lines ()-;;   "Send the current region to the interpreter one line at a time."-;;   (interactive)-;;   (mapcar 'hsc3-send-string-;;           (split-string (hsc3-region-string) "\n")))--;; (defun hsc3-run-layout-block ()-;;   "Variant of `hsc3-run-consecutive-lines' with ghci layout quoting."-;;   (interactive)-;;   (hsc3-send-string ":{")-;;   (hsc3-send-string (hsc3-region-string))-;;   (hsc3-send-string ":}"))+;;; hsc3.el ends here
hsc3.cabal view
@@ -1,27 +1,22 @@+cabal-version:     2.4 Name:              hsc3-Version:           0.16+Version:           0.21 Synopsis:          Haskell SuperCollider-Description:       Haskell client for the SuperCollider synthesis server,-                   <http://audiosynth.com/>.-                   .-                   For installation and configuration see the Tutorial at-                   <http://rd.slavepianos.org/t/hsc3-texts>.-License:           GPL+Description:       Library for communicating with the SuperCollider synthesiser+License:           GPL-3.0-only Category:          Sound-Copyright:         (c) Rohan Drape and others, 2005-2017+Copyright:         (c) Rohan Drape and others, 2005-2024 Author:            Rohan Drape-Maintainer:        rd@slavepianos.org+Maintainer:        rd@rohandrape.net Stability:         Experimental-Homepage:          http://rd.slavepianos.org/t/hsc3-Tested-With:       GHC == 8.0.1+Homepage:          http://rohandrape.net/t/hsc3+Tested-With:       GHC == 9.10.1 Build-Type:        Simple-Cabal-Version:     >= 1.8 -Data-files:        README+Data-files:        README.md                    emacs/hsc3.el-                   Help/Server/*.help.lhs-                   Help/UGen/ix.md-                   Help/UGen/*.help.lhs+                   Help/**/*.hs+                   lib/*.hs  Library   Build-Depends:   array,@@ -29,12 +24,13 @@                    binary,                    bytestring,                    containers,-                   data-default,+                   data-binary-ieee754,                    data-ordlist,                    directory,                    filepath,-                   hashable,-                   hosc == 0.16.*,+                   hosc == 0.21.*,+                   mtl,+                   murmur-hash,                    network,                    process,                    random,@@ -42,91 +38,108 @@                    split >= 0.2,                    transformers,                    vector-  GHC-Options:     -Wall -fwarn-tabs-  Exposed-modules: Sound.SC3-                   Sound.SC3.Common-                   Sound.SC3.Common.Buffer-                   Sound.SC3.Common.Buffer.Array-                   Sound.SC3.Common.Buffer.Gen-                   Sound.SC3.Common.Buffer.Vector-                   Sound.SC3.Common.Envelope-                   Sound.SC3.Common.Math-                   Sound.SC3.Common.Math.Interpolate-                   Sound.SC3.Common.Math.Window-                   Sound.SC3.Common.Monad-                   Sound.SC3.Common.Monad.Operators-                   Sound.SC3.Common.Prelude-                   Sound.SC3.FD-                   Sound.SC3.Server-                   Sound.SC3.Server.Command-                   Sound.SC3.Server.Command.Completion-                   Sound.SC3.Server.Command.Enum-                   Sound.SC3.Server.Command.Generic-                   Sound.SC3.Server.Command.Plain-                   Sound.SC3.Server.Enum-                   Sound.SC3.Server.Graphdef-                   Sound.SC3.Server.Graphdef.Graph-                   Sound.SC3.Server.Graphdef.Read-                   Sound.SC3.Server.FD-                   Sound.SC3.Server.Help-                   Sound.SC3.Server.Monad-                   Sound.SC3.Server.NRT-                   Sound.SC3.Server.NRT.Edit-                   Sound.SC3.Server.Recorder-                   Sound.SC3.Server.Status-                   Sound.SC3.Server.Synthdef-                   Sound.SC3.Server.Transport.FD-                   Sound.SC3.Server.Transport.Monad-                   Sound.SC3.UGen-                   Sound.SC3.UGen.Analysis-                   Sound.SC3.UGen.Bindings-                   Sound.SC3.UGen.Bindings.Composite-                   Sound.SC3.UGen.Bindings.DB-                   Sound.SC3.UGen.Bindings.HW-                   Sound.SC3.UGen.Bindings.Monad-                   --Sound.SC3.UGen.Bindings.HW.Analysis-                   --Sound.SC3.UGen.Bindings.HW.Buffer-                   --Sound.SC3.UGen.Bindings.HW.Chaos-                   Sound.SC3.UGen.Bindings.HW.Construct-                   --Sound.SC3.UGen.Bindings.HW.Demand-                   --Sound.SC3.UGen.Bindings.HW.DiskIO-                   Sound.SC3.UGen.Bindings.HW.External-                   Sound.SC3.UGen.Bindings.HW.External.F0-                   Sound.SC3.UGen.Bindings.HW.External.SC3_Plugins-                   Sound.SC3.UGen.Bindings.HW.External.Wavelets-                   Sound.SC3.UGen.Bindings.HW.External.Zita-                   --Sound.SC3.UGen.Bindings.HW.FFT-                   --Sound.SC3.UGen.Bindings.HW.Filter-                   --Sound.SC3.UGen.Bindings.HW.Granular-                   --Sound.SC3.UGen.Bindings.HW.IO-                   --Sound.SC3.UGen.Bindings.HW.Information-                   --Sound.SC3.UGen.Bindings.HW.MachineListening-                   --Sound.SC3.UGen.Bindings.HW.Noise-                   --Sound.SC3.UGen.Bindings.HW.Oscillator-                   --Sound.SC3.UGen.Bindings.HW.Panner-                   Sound.SC3.UGen.Enum-                   Sound.SC3.UGen.Envelope-                   Sound.SC3.UGen.Graph-                   Sound.SC3.UGen.Graph.Reconstruct-                   Sound.SC3.UGen.Graph.Transform-                   Sound.SC3.UGen.Help-                   Sound.SC3.UGen.Help.Graph-                   Sound.SC3.UGen.HS-                   Sound.SC3.UGen.Identifier-                   Sound.SC3.UGen.Math-                   Sound.SC3.UGen.Math.Composite-                   Sound.SC3.UGen.MCE-                   Sound.SC3.UGen.Name-                   Sound.SC3.UGen.Operator-                   Sound.SC3.UGen.Optimise-                   Sound.SC3.UGen.Plain-                   Sound.SC3.UGen.PP-                   Sound.SC3.UGen.Protect-                   Sound.SC3.UGen.Rate-                   Sound.SC3.UGen.Type-                   Sound.SC3.UGen.UGen-                   Sound.SC3.UGen.UId+  Default-Language:Haskell2010+  GHC-Options:     -Wall -Wno-x-partial -Wno-incomplete-uni-patterns+  Exposed-modules: Sound.Sc3+                   Sound.Sc3.Common+                   Sound.Sc3.Common.Base+                   Sound.Sc3.Common.Base.System+                   Sound.Sc3.Common.Buffer+                   Sound.Sc3.Common.Buffer.Array+                   Sound.Sc3.Common.Buffer.Gen+                   Sound.Sc3.Common.Buffer.Vector+                   Sound.Sc3.Common.Context+                   Sound.Sc3.Common.Enum+                   Sound.Sc3.Common.Envelope+                   Sound.Sc3.Common.Help+                   Sound.Sc3.Common.Help.Sc2+                   Sound.Sc3.Common.Math+                   Sound.Sc3.Common.Math.Filter+                   Sound.Sc3.Common.Math.Filter.Beq+                   Sound.Sc3.Common.Math.Interpolate+                   Sound.Sc3.Common.Math.Noise+                   Sound.Sc3.Common.Math.Operator+                   Sound.Sc3.Common.Math.Warp+                   Sound.Sc3.Common.Math.Window+                   Sound.Sc3.Common.Mce+                   Sound.Sc3.Common.Monad+                   Sound.Sc3.Common.Monad.Operators+                   Sound.Sc3.Common.Rate+                   Sound.Sc3.Common.Random+                   Sound.Sc3.Common.SoundFile+                   Sound.Sc3.Common.Uid+                   Sound.Sc3.Common.Unsafe+                   Sound.Sc3.Fd+                   Sound.Sc3.Server+                   Sound.Sc3.Server.Command+                   Sound.Sc3.Server.Command.Completion+                   Sound.Sc3.Server.Command.Enum+                   Sound.Sc3.Server.Command.Generic+                   Sound.Sc3.Server.Command.Plain+                   Sound.Sc3.Server.Command.Plain.Completion+                   Sound.Sc3.Server.Enum+                   Sound.Sc3.Server.Graphdef+                   Sound.Sc3.Server.Graphdef.Binary+                   Sound.Sc3.Server.Graphdef.Graph+                   Sound.Sc3.Server.Graphdef.Io+                   Sound.Sc3.Server.Graphdef.Read+                   Sound.Sc3.Server.Graphdef.Text+                   Sound.Sc3.Server.Fd+                   Sound.Sc3.Server.Monad+                   Sound.Sc3.Server.Nrt+                   Sound.Sc3.Server.Nrt.Edit+                   Sound.Sc3.Server.Nrt.Render+                   Sound.Sc3.Server.Nrt.Stat+                   Sound.Sc3.Server.Nrt.Ugen+                   Sound.Sc3.Server.Options+                   Sound.Sc3.Server.Param+                   Sound.Sc3.Server.Recorder+                   Sound.Sc3.Server.Scsynth+                   Sound.Sc3.Server.Status+                   Sound.Sc3.Server.Synthdef+                   Sound.Sc3.Server.Transport.Fd+                   Sound.Sc3.Server.Transport.Monad+                   Sound.Sc3.Ugen+                   Sound.Sc3.Ugen.Analysis+                   Sound.Sc3.Ugen.Bindings+                   Sound.Sc3.Ugen.Bindings.Composite+                   Sound.Sc3.Ugen.Bindings.Composite.External+                   Sound.Sc3.Ugen.Bindings.Db+                   Sound.Sc3.Ugen.Bindings.Db.External+                   Sound.Sc3.Ugen.Bindings.Hw+                   Sound.Sc3.Ugen.Bindings.Hw.Construct+                   Sound.Sc3.Ugen.Bindings.Hw.External+                   Sound.Sc3.Ugen.Bindings.Hw.External.F0+                   Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins+                   Sound.Sc3.Ugen.Bindings.Hw.External.Wavelets+                   Sound.Sc3.Ugen.Bindings.Hw.External.Zita+                   Sound.Sc3.Ugen.Bracketed+                   Sound.Sc3.Ugen.Brackets+                   Sound.Sc3.Ugen.Constant+                   Sound.Sc3.Ugen.Control+                   Sound.Sc3.Ugen.Enum+                   Sound.Sc3.Ugen.Envelope+                   Sound.Sc3.Ugen.Event+                   Sound.Sc3.Ugen.Graph+                   Sound.Sc3.Ugen.Graph.Reconstruct+                   Sound.Sc3.Ugen.Graph.Transform+                   Sound.Sc3.Ugen.Help.Graph+                   Sound.Sc3.Ugen.Hs+                   Sound.Sc3.Ugen.Label+                   Sound.Sc3.Ugen.Math+                   Sound.Sc3.Ugen.Math.Composite+                   Sound.Sc3.Ugen.Mce+                   Sound.Sc3.Ugen.Mrg+                   Sound.Sc3.Ugen.Name+                   Sound.Sc3.Ugen.Optimise+                   Sound.Sc3.Ugen.Plain+                   Sound.Sc3.Ugen.Pp+                   Sound.Sc3.Ugen.Primitive+                   Sound.Sc3.Ugen.Proxy+                   Sound.Sc3.Ugen.Types+                   Sound.Sc3.Ugen.Ugen+                   Sound.Sc3.Ugen.Util  Source-Repository  head-  Type:            darcs-  Location:        http://rd.slavepianos.org/sw/hsc3/+  Type:            git+  Location:        https://gitlab.com/rd--/hsc3
+ lib/hsc3-min-imports.hs view
@@ -0,0 +1,6 @@+import Prelude {- base -}+import Control.Monad {- base -}+import Data.Bits {- base -}+import Data.Function {- base -}+import Data.List {- base -}+import Sound.Sc3 {- hsc3 -}
+ lib/hsc3-std-extensions.hs view
@@ -0,0 +1,2 @@+{-# Language OverloadedLists #-}+{-# Language FlexibleContexts #-}
+ lib/hsc3-std-imports.hs view
@@ -0,0 +1,21 @@+import Prelude {- base -}+import Control.Monad {- base -}+import Data.Bits {- base -}+import Data.Function {- base -}+import Data.List {- base -}+import System.Random {- random -}+import Sound.Osc {- hosc -}+import Sound.Sc3 {- hsc3 -}+import Sound.Sc3.Common.Base {- hsc3 -}+import qualified Sound.Sc3.Common.Buffer.Gen as Gen {- hsc3 -}+import qualified Sound.Sc3.Common.Math.Filter.Beq {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Db.External as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Composite.External as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Hw.External.Zita as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Protect as Protect {- hsc3-rw -}+import qualified Sound.Sc3.Ui.Html as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Plot as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Qarma as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Sclang as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Sclang.Control as Ui {- hsc3-ui -}