mbFlutter.scd 3.21 KB
Newer Older
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
( 
    ~mbFlutterFx.do(_.free);
    ~mbFlutter.do(_.free);
    ~mbFlutterFx = List.new(0);
    4.do{
        ~mbFlutterFx.add(
            FxChain.new(
                fadeInTime: 10,
                level: 6.dbamp,
                fadeOutTime: 10,
                out: ~masterBus,
            );
        );
    };
    ~mbFlutterFx[0].addPar(
        \comb, [\mix, 0.3, \delay, 0.2, \decay, 1, \amp, 1/3],
        \comb, [\mix, 0.3, \delay, 0.5, \decay, 1, \amp, 1/3],
        \comb, [\mix, 0.3, \delay, 0.7, \decay, 1, \amp, 1/3],
    ); 
    ~mbFlutterFx[0].add(\eq, [
        \locut, 120,
22
        \hishelfdb, -6, 
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
23 24 25 26 27 28 29 30
    ]); 
    //--------------------------------------------------------- 
    ~mbFlutterFx[1].add(\jpverb, [
        \revtime, 2,
        \mix, 0.1
    ]); 
    ~mbFlutterFx[1].add(\eq, [
        \locut, 120,
31
        \hishelfdb, -6, 
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
32 33 34 35 36 37 38 39 40
    ]); 
    //--------------------------------------------------------- 
    ~mbFlutterFx[2].add(\greyhole, [
        \delayTime, 0.3,
        \feedback, 0.6,
        \mix, 0.1
    ]); 
    ~mbFlutterFx[2].add(\eq, [
        \locut, 500,
41
        \hishelfdb, -6, 
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
42
    ]); 
Kenneth Flak's avatar
Kenneth Flak committed
43 44
    //--------------------------------------------------------- 

Kenneth Flak's avatar
flutter  
Kenneth Flak committed
45 46 47 48 49 50 51 52 53
    ~mbFlutter = ~mb.collect{|id, idx|
        MBDeltaTrig.new(
            speedlim: 0.5, 
            threshold: 0.05,
            minibeeID: id,
            minAmp: -12,
            maxAmp: -0,
            function: {|dt, minAmp, maxAmp|
                var currentFx;
54 55
                var buf = ~buf[\birdSong][0];
                // var buf = (~buf[\nuggets] ++ ~buf[\birdSong]).choose;
Kenneth Flak's avatar
Kenneth Flak committed
56
                var numFrames = buf.numFrames;
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
57
                var currentPos = numFrames.rand;
Kenneth Flak's avatar
Kenneth Flak committed
58 59 60
                var durFrom = rrand(0.1, 0.2);
                var durTo = rrand(0.1, 0.2);
                var step = durFrom * s.sampleRate;
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
61 62
                var count = 20;
                var len = dt.linlin(0.0, 1.0, step, step * count);
63
                // var pos = 8.collect({rrand(0, numFrames)});
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
64 65 66 67 68
                var pos = (currentPos, currentPos+step..currentPos+len).mod(numFrames); 
                var time = pos[pos.size-1] - pos[0] / s.sampleRate;

                Pbind(
                    \instrument, \playbuf,
Kenneth Flak's avatar
Kenneth Flak committed
69 70
                    \buf, buf,
                    \dur, Pseg(durFrom, durTo, time),
71
                    // \attack, 0,
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
72 73 74
                    \attack, Pkey(\dur) * 0.5,
                    \release, Pkey(\dur) * 1.5,
                    \startPos, Pseq(pos),
75 76
                    \legato, Pwhite(0.1, 0.4),
                    \rate, Pexprand(0.5, 4.0),
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
77 78 79 80 81 82 83 84 85 86 87 88 89
                    \db, dt.linlin(0.0, 1.0, minAmp, maxAmp),
                    \pan, Pseg(Pwhite(0.0, 1.0), Pwhite(0.0, 1.0), time),
                    \out, Pfunc({
                        currentFx = ~mbFlutterFx.choose;
                        currentFx.in
                    }),
                    \group, Pfunc({ 
                        currentFx.group
                    }),
                ).play;
            }
        );
    }; 
90

Kenneth Flak's avatar
flutter  
Kenneth Flak committed
91
)
92 93 94
// (
//     ~mbFlutterFx.do(_.play);
//     ~mbFlutter.do(_.play);
95 96 97 98
//     // ~mbFlutter[0].play;
//     // ~mbFlutter[1].play;
//     // ~mbFlutter[2].play;
//     // ~mbFlutter[3].play;
99 100 101 102 103
// )
// (
//     ~mbFlutterFx.do(_.free);
//     ~mbFlutter.do(_.free);
// )
Kenneth Flak's avatar
flutter  
Kenneth Flak committed
104

105
// s.plotTree;