/usr/share/SuperCollider/HelpSource/Classes/Sweep.schelp is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | class:: Sweep
summary:: Triggered linear ramp
categories:: UGens>Triggers
Description::
Starts a linear raise by rate/sec from zero when trig input crosses from
non-positive to positive.
classmethods::
private:: categories
method::ar, kr
argument::trig
triggers when trig input crosses from non-positive to positive.
argument::rate
rate/sec raise rate
Examples::
code::
// using sweep to modulate sine frequency
(
{ var trig;
trig = Impulse.kr(MouseX.kr(0.5, 20, 1));
SinOsc.ar(Sweep.kr(trig, 700) + 500, 0, 0.2)
}.play;
)
// using sweep to index into a buffer
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
(
{ var trig;
trig = Impulse.kr(MouseX.kr(0.5, 10, 1));
BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0)))
}.play;
)
// backwards, variable offset
(
{ var trig, pos, rate;
trig = Impulse.kr(MouseX.kr(0.5, 10, 1));
rate = BufSampleRate.ir(0);
pos = Sweep.ar(trig, rate.neg) + (BufFrames.ir(0) * LFNoise0.kr(0.2));
BufRd.ar(1, b, pos)
}.play;
)
// raising rate
(
{ var trig, rate;
trig = Impulse.kr(MouseX.kr(0.5, 10, 1));
rate = Sweep.kr(trig, 2) + 0.5;
BufRd.ar(1, b, Sweep.ar(trig, BufSampleRate.ir(0) * rate))
}.play;
)
b.free
::
Sweep can be used as a resettable link::Classes/Phasor:: or link::Classes/Line:: - one that can start, pause, resume and stop. To get a resettable link::Classes/XLine:: behavior change the code::linlin:: to code::linexp:: in the SynthDef below.
code::
(
SynthDef(\lineReset, {|start= 0, end= 1, dur= 1, t_trig= 1, run= 1|
var phasor= (Sweep.ar(t_trig, 1/dur*run)).linlin(0, 1, start, end, \minmax);
phasor.poll;
Out.ar(0, SinOsc.ar(phasor, 0, 0.2));
}).add;
)
a= Synth(\lineReset, [\start, 400, \end, 800, \dur, 2])
a.set(\t_trig, 1)
a.set(\run, 0)
a.set(\run, 1)
a.set(\t_trig, 1)
a.free
//shorter duration and downwards...
a= Synth(\lineReset, [\start, 1000, \end, 500, \dur, 0.5])
a.set(\t_trig, 1)
a.set(\run, 0)
a.set(\run, 1)
a.set(\t_trig, 1)
a.free
::
|