Explicitly include a boost "windows" folder even on linux
[supercollider.git] / HelpSource / Classes / Stepper.schelp
blob8a4eb8cad7529fb69c63c4650f2fe8aa34b3bfce
1 class:: Stepper
2 summary:: Pulse counter.
3 related:: Classes/PulseCount
4 categories::  UGens>Triggers
7 Description::
9 Each trigger increments a counter which is output as a signal. The
10 counter wraps between  code::min::  and
11 code::max:: .
14 classmethods::
16 method::ar, kr
18 argument::trig
20 The trigger. Trigger can be any signal. A trigger happens when
21 the signal changes from non-positive to positive.
24 argument::reset
26 Resets the counter to
27 code::resetval::  when
28 triggered.
31 argument::min
33 Minimum value of the counter.
36 argument::max
38 Maximum value of the counter.
41 argument::step
43 Step value each trigger. May be negative.
46 argument::resetval
48 Value to which the counter is reset when it receives a reset
49 trigger. If nil, then this is patched to
51 code::min:: .
54 Examples::
56 code::
58 SynthDef("help-Stepper",{ arg out=0;
59         Out.ar(out,
60                 SinOsc.ar(
61                         Stepper.kr(Impulse.kr(10), 0, 4, 16, 1) * 100,
62                         0, 0.05
63                 )
64         )
65 }).play;
67 SynthDef("help-Stepper",{ arg out=0;
68         Out.ar(out,
69                 SinOsc.ar(
70                         Stepper.kr(Impulse.kr(10), 0, 4, 16, -3) * 100,
71                         0, 0.05
72                 )
73         )
74 }).play;
76 SynthDef("help-Stepper",{ arg out=0;
77         Out.ar(out,
78                 SinOsc.ar(
79                         Stepper.kr(Impulse.kr(10), 0, 4, 16, 4) * 100,
80                         0, 0.05
81                 )
82         )
83 }).play;
86 ///////////////////////////////////////////////////////////////////////////////////
88 // Using Stepper and BufRd for sequencing
91 s.boot;
93 s.sendMsg(\b_alloc, 10, 128);
95 m = #[0,3,5,7,10];
97 a = ({rrand(0,15)}.dup(16).degreeToKey(m) + 36).midicps;
98 s.performList(\sendMsg, \b_setn, 10, 0, a.size, a);
101 SynthDef(\stepper, {
102         var rate, clock, index, freq, ffreq, env, out, rev, lfo;
104         rate = MouseX.kr(1,5,1);
105         clock = Impulse.kr(rate);
106         env = Decay2.kr(clock, 0.002, 2.5);
107         index = Stepper.kr(clock, 0, 0, 15, 1, 0);
108         freq = BufRd.kr(1, 10, index, 1, 1);
109         freq = Lag2.kr(freq) + [0,0.3];
110         ffreq = MouseY.kr(80,1600,1) * (env * 4 + 2);
111         out = Mix.ar(LFPulse.ar(freq * [1, 3/2, 2], 0, 0.3));
112         out = RLPF.ar(out, ffreq, 0.3, env);
113         out = RLPF.ar(out, ffreq, 0.3, env);
114         out = out * 0.02;
116         // echo
117         out = CombL.ar(out, 1, 0.66/rate, 2, 0.8, out);
119         // reverb
120         rev = out;
121         5.do { rev = AllpassN.ar(rev, 0.05, {0.05.rand}.dup, rrand(1.5,2.0)) };
122         out = out + (0.3 * rev);
124         out = LeakDC.ar(out);
126         // flanger
127         lfo = SinOsc.kr(0.2, [0,0.5pi], 0.0024, 0.0025);
128         1.do { out = DelayL.ar(out, 0.1, lfo, 1, out) };
130         // slight bass emphasis
131         out = OnePole.ar(out, 0.9);
133         Out.ar(0, out);
135 }).send(s);
138 s.sendMsg(\s_new, \stepper, 1000, 0, 0);
140 a = ({rrand(0,15)}.dup(16).degreeToKey(m) + 38).midicps;
141 s.performList(\sendMsg, \b_setn, 10, 0, a.size, a);
143 a = a * 2.midiratio; // transpose up 2 semitones
144 s.performList(\sendMsg, \b_setn, 10, 0, a.size, a);
148 a = [ 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 ];
149 s.performList(\sendMsg, \b_setn, 10, 0, a.size, a);
152 s.sendMsg(\n_free, 1000);