File: OscN.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (145 lines) | stat: -rw-r--r-- 2,568 bytes parent folder | download | duplicates (6)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
class:: OscN
summary:: Noninterpolating wavetable oscillator.
related:: Classes/COsc, Classes/Osc, Classes/VOsc, Classes/VOsc3
categories::  UGens>Generators>Deterministic


Description::

Noninterpolating wavetable lookup oscillator with frequency and phase
modulation inputs. It is usually better to use the interpolating
oscillator  link::Classes/Osc:: .


classmethods::

method::ar, kr

argument::bufnum
Buffer index.  the buffer size must be a power of 2.
The buffer should NOT be filled using Wavetable format (b_gen
commands should set wavetable flag to false. Raw signals (not
converted with asWavetable) can be saved to disk and loaded
into the buffer.


argument::freq
Frequency in Hertz.

argument::phase
Phase offset or modulator in radians.

argument::mul
Output will be multiplied by this value.

argument::add
This value will be added to the output.

Examples::

code::

// compare examples below with interpolating Osc examples.

(
s = Server.local;
b = Buffer.alloc(s,512,1);
b.sine1(1.0/[1,2,3,4,5,6],true,false,true);

SynthDef("help-OscN",{ arg out=0,bufnum=0;
	Out.ar(out,
		OscN.ar(bufnum, 500, 0, 0.5)
	)
}).play(s,[0,0,1,b.bufnum]);

)
b.free;



(
// noninterpolating - there are noticeable artifacts
// modulate freq

s = Server.local;
b = Buffer.alloc(s,512,1);
b.sine1(1.0/[1,2,3,4,5,6].squared,true,false,true);

SynthDef("help-OscN",{ arg out=0,bufnum=0;
	Out.ar(out,
		OscN.ar(bufnum, XLine.kr(2000,200), 0, 0.5)
	)
}).play(s,[\out,0,\bufnum,b.bufnum]);

)
b.free;

(
// sounds very different than the Osc example
s = Server.local;
b = Buffer.alloc(s, 512, 1);
b.sine1([1.0], true, true, true);

SynthDef("help-OscN",{ arg out=0,bufnum=0;
	Out.ar(out,
		OscN.ar(bufnum,
			OscN.ar(bufnum,
				XLine.kr(1,1000,9),
				0,
				200,
				800),
			0,
			0.25)
	)
}).play(s,[\out, 0, \bufnum, b.bufnum]);

)
b.free;

(
// modulate phase
s = Server.local;
b = Buffer.alloc(s, 512, 1);
b.sine1([1.0], true, true, true);

SynthDef("help-OscN",{ arg out=0,bufnum=0;
	Out.ar(out,
		OscN.ar(bufnum,
				800,
				OscN.ar(bufnum,
						XLine.kr(20,8000,10),
						0,
						2pi),
				0.25)
	)
}).play(s,[\out, 0, \bufnum, b.bufnum]);
)
b.free;


(
// change the buffer while its playing
s = Server.local;
b = Buffer.alloc(s, 4096, 1);
b.sine1(1.0/[1,2,3,4,5,6], true, true, true);

SynthDef("help-OscN",{ arg out=0,bufnum=0;
	Out.ar(out,
		OscN.ar(bufnum, [80,80.2], 0, 0.2)
	)
}).play(s,[\out, 0, \bufnum, b.bufnum]);
)

(
Routine({
	var n = 32;
	50.do({
		b.sine1(Array.rand(n,0,1).cubed, true, true, true);
		0.25.wait;
	});
}).play;
)
b.free;

::