packages feed

hsc3-graphs-0.11: src/crotale-sine.hs

-- crotale-sine (rd)

import Sound.SC3.ID
import Sound.SC3.Lang.Pattern.ID

crotale_sine :: UGen
crotale_sine =
    let (cf,ca) = crotale_data
        g = control KR "gate" 1
        m = control KR "m" 1
        e = let p = envASR 1 1 1 (EnvNum (-4))
            in envGen KR g 1 0 1 RemoveSynth p
        fn m' f' a' =
            let f = constant f'
                a = constant a'
                r0 = rand (f+0) 0 (2 * pi)
                r1 = rand (f+1) 0.1 0.3
                r2 = rand (f+2) 0.025 0.1
                r3 = rand (f+3) 0 (2 * pi)
                o = sinOsc AR (f * midiRatio (m' - 12)) r0
                e' = e * sinOsc KR r1 0 * a
            in pan2 o (sinOsc KR r2 r3) e'
    in sum (zipWith (fn m) cf ca) * 0.1

main :: IO ()
main = do
  let s = synthdef "crotale-sine" (out 0 crotale_sine)
  audition (s,pbind [("m",pwhitei 'a' 0 12 inf)
                    ,("dur",pxrand 'b' [1,2,3] inf)
                    ,("sustain",6)])

crotale_data :: ([Double],[Double])
crotale_data =
    ([35.45676040649414
     ,128.59849548339844
     ,346.9721984863281
     ,483.5544128417969
     ,1049.2449951171875
     ,1564.0279541015625
     ,1756.3399658203125
     ,3391.666015625
     ,3451.802001953125
     ,3497.261962890625
     ,3596.89794921875
     ,3696.739013671875
     ,3835.235107421875
     ,3845.955078125
     ,4254.85107421875
     ,4407.533203125
     ,4415.26416015625
     ,4552.865234375
     ,5538.076171875
     ,5637.73681640625
     ,5690.2978515625
     ,5728.0068359375
     ,5764.27685546875
     ,5824.4189453125
     ,6377.60498046875
     ,6544.35009765625
     ,6807.14404296875
     ,6994.97021484375
     ,7026.84619140625
     ,7144.5859375
     ,7269.61279296875
     ,7393.6708984375
     ,7897.259765625
     ,8040.4580078125
     ,8157.77099609375
     ,8225.01953125
     ,9126.150390625
     ,9488.529296875
     ,9916.408203125
     ,10155.599609375
     ,11715.9599609375
     ,12111.830078125
     ,12339.990234375
     ,12417.669921875
     ,12459.2802734375
     ,12618.330078125
     ,13116.490234375
     ,13201.1298828125
     ,13297.830078125
     ,13533.75]
    ,[0.0012827360769733787
     ,0.0008040848188102245
     ,0.017361238598823547
     ,0.004835359752178192
     ,0.004413491114974022
     ,0.004110544919967651
     ,0.0003338181704748422
     ,0.0036140112206339836
     ,0.006919348146766424
     ,0.0003224937245249748
     ,0.0006031467346474528
     ,0.06686479598283768
     ,0.000605064386036247
     ,0.003602313343435526
     ,0.0002835785271599889
     ,0.015243238769471645
     ,0.020536603406071663
     ,0.016677580773830414
     ,0.0009245267719961703
     ,0.20205098390579224
     ,0.0012542791664600372
     ,0.012705927714705467
     ,0.0002523190632928163
     ,0.0004866079252678901
     ,0.0006429700297303498
     ,0.0007763264584355056
     ,0.2081160992383957
     ,0.0024918108247220516
     ,0.00193469924852252
     ,0.005231771152466536
     ,0.0069242212921381
     ,0.001203975174576044
     ,0.2050020843744278
     ,0.04060448706150055
     ,0.0038344631902873516
     ,0.002189427148550749
     ,0.18056060373783112
     ,0.002192433224990964
     ,0.006516554858535528
     ,0.009982921183109283
     ,0.004745401442050934
     ,0.046154771000146866
     ,0.000510294979903847
     ,0.0018905038014054298
     ,0.0019782145973294973
     ,0.006729386281222105
     ,0.0023426134139299393
     ,0.0024002245627343655
     ,0.03515550494194031
     ,0.0014084168942645192])