rsc3/doc/examples/process/_scm/scritto.scm

81 lines
3.2 KiB
Scheme
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
; scritto (rd)
(define putnam
'((sA ((800 1150 2900 3900 4950) (0 -6 -32 -20 -50) (80 90 120 130 140)))
(sE ((350 2000 2800 3600 4950) (0 -20 -15 -40 -56) (60 100 120 150 200)))
(sI ((270 2140 2950 3900 4950) (0 -12 -26 -26 -44) (60 90 100 120 120)))
(sO ((450 800 2830 3800 4950) (0 -11 -22 -22 -50) (70 80 100 130 135)))
(sU ((325 700 2700 3800 4950) (0 -16 -35 -40 -60) (50 60 170 180 200)))
(aA ((800 1150 2800 3500 4950) (0 -4 -20 -36 -60) (80 90 120 130 140)))
(aE ((400 1600 2700 3300 4950) (0 -24 -30 -35 -60) (60 80 120 150 200)))
(aI ((350 1700 2700 3700 4950) (0 -20 -30 -36 -60) (50 100 120 150 200)))
(aO ((450 800 2830 3500 4950) (0 -9 -16 -28 -55) (70 80 100 130 135)))
(aU ((325 700 2530 3500 4950) (0 -12 -30 -40 -64) (50 60 170 180 200)))
(ctA ((660 1120 2750 3000 3350) (0 -6 -23 -24 -38) (80 90 120 130 140)))
(ctE ((440 1800 2700 3000 3300) (0 -14 -18 -20 -20) (70 80 100 120 120)))
(ctI ((270 1850 2900 3350 3590) (0 -24 -24 -36 -36) (40 90 100 120 120)))
(ctO ((430 820 2700 3000 3300) (0 -10 -26 -22 -34) (40 80 100 120 120)))
(ctU ((370 630 2750 3000 3400) (0 -20 -23 -30 -34) (40 60 100 120 120)))
(tA ((650 1080 2650 2900 3250) (0 -6 -7 -8 -22) (80 90 120 130 140)))
(tE ((400 1700 2600 3200 3580) (0 -14 -12 -14 -20) (70 80 100 120 120)))
(tI ((290 1870 2800 3250 3540) (0 -15 -18 -20 -30) (40 90 100 120 120)))
(tO ((400 800 2600 2800 3000) (0 -10 -12 -12 -26) (40 80 100 120 120)))
(tU ((350 600 2700 2900 3300) (0 -20 -17 -14 -26) (40 60 100 120 120)))
(bA ((600 1040 2250 2450 2750) (0 -7 -9 -9 -20) (60 70 110 120 130)))
(bE ((400 1620 2400 2800 3100) (0 -12 -9 -12 -18) (40 80 100 120 120)))
(bI ((250 1750 2600 3050 3340) (0 -30 -16 -22 -28) (60 90 100 120 120)))
(bO ((400 750 2400 2600 2900) (0 -11 -21 -20 -40) (40 80 100 120 120)))
(bU ((350 600 2400 2675 2950) (0 -20 -32 -28 -36) (40 80 100 120 120)))))
(define vFilter
(lambda (in freq ampl bw)
(Mul
(Resonz in freq (Fdiv bw freq))
(DbAmp ampl))))
(define voiceTr
(lambda (i t fr amr bwr)
(Mix
(vFilter
i
(Mul (CtlIn 5 0) (TRand (Sub 1 fr) (Add 1 fr) t))
(Mul (CtlIn 5 5) (TRand (Sub 1 amr) (Add 1 amr) t))
(Mul (CtlIn 5 10) (TRand (Sub 1 bwr) (Add 1 bwr) t))))))
(define scritto
(lambda (rt)
(let* ((t (Impulse (MulAdd (LFNoise2 3) 12 12) 0))
(n (TIRand 30 52 t))
(i (lambda (d)
(Mul3
(Decay2 (PulseDivider t d 0) 0.01 (TRand 0.005 rt t))
(Blip (MidiCps n) (TRand 16 32 t))
12.0)))
(x (MouseX 0 1 0 0.1))
(y (MouseY 0 1 0 0.1)))
(Mrg2
(Clip2
(Mce2
(voiceTr (i 1) t (Mul x 1.05) (Mul x 1.25) (Mul x 0.05))
(voiceTr (i 2) t (Mul y 0.05) (Mul y 0.75) (Mul y 1.00)))
1)
(SendTrig t 0 n)))))
(define updater
(lambda (fd)
(let* ((v (s:l-choose putnam))
(data (list-ref v 1))
(freq (list-ref data 0))
(ampl (list-ref data 1))
(bw (list-ref data 2)))
(begin
(sendMessage fd (c_setn1 0 freq))
(sendMessage fd (c_setn1 5 ampl))
(sendMessage fd (c_setn1 10 bw))))))
(define scritto-x (scritto (MouseX 0.0125 0.35 0 0.1)))
(withSc3 updater)
(audition (Out 0 scritto-x))