Forgot a help fix: Drag a dock's title bar, not divider, to reposition
[supercollider.git] / HelpSource / Classes / OscN.schelp
blob54719191f52efd0557eabeca2ae63638c404869a
1 class:: OscN
2 summary:: Noninterpolating wavetable oscillator.
3 related:: Classes/COsc, Classes/Osc, Classes/VOsc, Classes/VOsc3
4 categories::  UGens>Generators>Deterministic
7 Description::
9 Noninterpolating wavetable lookup oscillator with frequency and phase
10 modulation inputs. It is usually better to use the interpolating
11 oscillator  link::Classes/Osc:: .
14 classmethods::
16 method::ar, kr
18 argument::bufnum
19 Buffer index.  the buffer size must be a power of 2.
20 The buffer should NOT be filled using Wavetable format (b_gen
21 commands should set wavetable flag to false. Raw signals (not
22 converted with asWavetable) can be saved to disk and loaded
23 into the buffer.
26 argument::freq
27 Frequency in Hertz.
29 argument::phase
30 Phase offset or modulator in radians.
32 argument::mul
33 Output will be multiplied by this value.
35 argument::add
36 This value will be added to the output.
38 Examples::
40 code::
42 // compare examples below with interpolating Osc examples.
45 s = Server.local;
46 b = Buffer.alloc(s,512,1);
47 b.sine1(1.0/[1,2,3,4,5,6],true,false,true);
49 SynthDef("help-OscN",{ arg out=0,bufnum=0;
50         Out.ar(out,
51                 OscN.ar(bufnum, 500, 0, 0.5)
52         )
53 }).play(s,[0,0,1,b.bufnum]);
56 b.free;
61 // noninterpolating - there are noticeable artifacts
62 // modulate freq
64 s = Server.local;
65 b = Buffer.alloc(s,512,1);
66 b.sine1(1.0/[1,2,3,4,5,6].squared,true,false,true);
68 SynthDef("help-OscN",{ arg out=0,bufnum=0;
69         Out.ar(out,
70                 OscN.ar(bufnum, XLine.kr(2000,200), 0, 0.5)
71         )
72 }).play(s,[\out,0,\bufnum,b.bufnum]);
75 b.free;
78 // sounds very different than the Osc example
79 s = Server.local;
80 b = Buffer.alloc(s, 512, 1);
81 b.sine1([1.0], true, true, true);
83 SynthDef("help-OscN",{ arg out=0,bufnum=0;
84         Out.ar(out,
85                 OscN.ar(bufnum,
86                         OscN.ar(bufnum,
87                                 XLine.kr(1,1000,9),
88                                 0,
89                                 200,
90                                 800),
91                         0,
92                         0.25)
93         )
94 }).play(s,[\out, 0, \bufnum, b.bufnum]);
97 b.free;
100 // modulate phase
101 s = Server.local;
102 b = Buffer.alloc(s, 512, 1);
103 b.sine1([1.0], true, true, true);
105 SynthDef("help-OscN",{ arg out=0,bufnum=0;
106         Out.ar(out,
107                 OscN.ar(bufnum,
108                                 800,
109                                 OscN.ar(bufnum,
110                                                 XLine.kr(20,8000,10),
111                                                 0,
112                                                 2pi),
113                                 0.25)
114         )
115 }).play(s,[\out, 0, \bufnum, b.bufnum]);
117 b.free;
121 // change the buffer while its playing
122 s = Server.local;
123 b = Buffer.alloc(s, 4096, 1);
124 b.sine1(1.0/[1,2,3,4,5,6], true, true, true);
126 SynthDef("help-OscN",{ arg out=0,bufnum=0;
127         Out.ar(out,
128                 OscN.ar(bufnum, [80,80.2], 0, 0.2)
129         )
130 }).play(s,[\out, 0, \bufnum, b.bufnum]);
134 Routine({
135         var n = 32;
136         50.do({
137                 b.sine1(Array.rand(n,0,1).cubed, true, true, true);
138                 0.25.wait;
139         });
140 }).play;
142 b.free;