linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Osc.schelp
blob53c0fb3c9032cfa45b212f93a46aa2bcbcaa51a1
1 class:: Osc
2 summary:: Interpolating wavetable oscillator.
3 related:: Classes/COsc, Classes/OscN, Classes/VOsc, Classes/VOsc3, Classes/Wavetable
4 categories::  UGens>Generators>Deterministic
7 Description::
9 Linear interpolating wavetable lookup oscillator with frequency and
10 phase modulation inputs.
13 This oscillator requires a buffer to be filled with a wavetable format
14 signal. This preprocesses the Signal into a form which can be used
15 efficiently by the Oscillator. The buffer size must be a power of 2.
18 This can be acheived by creating a Buffer object and sending it one of
19 the "b_gen" messages ( link::Classes/Buffer#-sine1::, link::Classes/Buffer#-sine2::, link::Classes/Buffer#-sine3:: ) with the wavetable flag set
20 to true.
23 This can also be achieved by creating a link::Classes/Signal:: object and sending it
24 the 'asWavetable' message, thereby creating a Wavetable object in the required format. Then, the wavetable data may be transmitted to the server using the link::Classes/Buffer#*sendCollection:: or link::Classes/Buffer#*loadCollection:: methods.
27 classmethods::
29 method::ar, kr
31 argument::bufnum
32 Buffer index.
34 argument::freq
35 Frequency in Hertz.
37 argument::phase
38 Phase offset or modulator in radians.
40 argument::mul
41 Output will be multiplied by this value.
43 argument::add
44 This value will be added to the output.
46 Examples::
48 code::
51 s = Server.local;
52 b = Buffer.alloc(s, 512, 1);
53 b.sine1(1.0/[1,2,3,4,5,6], true, true, true);
55 SynthDef("help-Osc",{ arg out=0,bufnum=0;
56         Out.ar(out,
57                 Osc.ar(bufnum, 200, 0, 0.5)
58         )
59 }).play(s,[\out, 0, \bufnum, b.bufnum]);
63 s = Server.local;
64 b = Buffer.alloc(s, 512, 1);
65 b.sine1(1.0/[1,2,3,4,5,6], true, true, true);
67 SynthDef("help-Osc",{ arg out=0,bufnum=0;
68         Out.ar(out,
69                 Osc.ar(bufnum, XLine.kr(2000,200), 0, 0.5)// modulate freq
70         )
71 }).play(s,[\out, 0, \bufnum, b.bufnum]);
76 s = Server.local;
77 b = Buffer.alloc(s, 512, 1);
78 b.sine1([1.0], true, true, true);
80 SynthDef("help-Osc",{ arg out=0,bufnum=0;
81         Out.ar(out,
82                 Osc.ar(bufnum,
83                         Osc.ar(bufnum,
84                                 XLine.kr(1,1000,9),
85                                 0,
86                                 200,
87                                 800),
88                         0,
89                         0.25)
90         )
91 }).play(s,[\out, 0, \bufnum, b.bufnum]);
96 // modulate phase
97 s = Server.local;
98 b = Buffer.alloc(s, 512, 1);
99 b.sine1([1.0], true, true, true);
101 SynthDef("help-Osc",{ arg out=0,bufnum=0;
102         Out.ar(out,
103                 Osc.ar(bufnum,
104                                 800,
105                                 Osc.ar(bufnum,
106                                                 XLine.kr(20,8000,10),
107                                                 0,
108                                                 2pi),
109                                 0.25)
110         )
111 }).play(s,[\out, 0, \bufnum, b.bufnum]);
117 // change the buffer while its playing
118 s = Server.local;
119 b = Buffer.alloc(s, 4096, 1);
120 b.sine1(1.0/[1,2,3,4,5,6], true, true, true);
122 SynthDef("help-Osc",{ arg out=0,bufnum=0;
123         Out.ar(out,
124                 Osc.ar(bufnum, [80,80.2], 0, 0.2)
125         )
126 }).play(s,[\out, 0, \bufnum, b.bufnum]);
130 fork {
131         var n = 32;
132         50.do {
133                 b.sine1(Array.rand(n,0,1).cubed, true, true, true);
134                 0.25.wait;
135         };