sclang: ServerShmInterface - try to avoid multiple destructor calls
[supercollider.git] / HelpSource / Classes / Sweep.schelp
blob5c493409fc26b52b9b75441685aea9c2e3a59c2b
1 class:: Sweep
2 summary:: Triggered linear ramp
3 categories::  UGens>Triggers
5 Description::
7 Starts a linear raise by rate/sec from zero when trig input crosses from
8 non-positive to positive.
11 classmethods::
12 private:: categories
14 method::ar, kr
16 argument::trig
18 triggers when trig input crosses from non-positive to positive.
21 argument::rate
23 rate/sec raise rate
26 Examples::
28 code::
29 // using sweep to modulate sine frequency
31 { var trig;
32         trig = Impulse.kr(MouseX.kr(0.5, 20, 1));
33         SinOsc.ar(Sweep.kr(trig, 700) + 500, 0, 0.2)
34 }.play;
38 // using sweep to index into a buffer
39 b = Buffer.read(s, Help.dir +/+ "sounds/a11wlk01.wav");
42 { var trig;
43         trig = Impulse.kr(MouseX.kr(0.5, 10, 1));
44         BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0)))
45 }.play;
48 // backwards, variable offset
50 { var trig, pos, rate;
51         trig = Impulse.kr(MouseX.kr(0.5, 10, 1));
52         rate = BufSampleRate.ir(0);
53         pos = Sweep.ar(trig, rate.neg) + (BufFrames.ir(0) * LFNoise0.kr(0.2));
54         BufRd.ar(1, b, pos)
55 }.play;
58 // raising rate
60 { var trig, rate;
61         trig = Impulse.kr(MouseX.kr(0.5, 10, 1));
62         rate = Sweep.kr(trig, 2) + 0.5;
63         BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0) * rate))
64 }.play;
67 b.free