SuperCollider CLASSES

OscN

Noninterpolating wavetable oscillator.
Inherits from: PureUGen : UGen : AbstractFunction : Object

Description

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

Class Methods

*ar (bufnum, freq: 440, phase: 0, mul: 1, add: 0)

*kr (bufnum, freq: 440, phase: 0, mul: 1, add: 0)

Arguments:

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.

freq

Frequency in Hertz.

phase

Phase offset or modulator in radians.

mul

Output will be multiplied by this value.

add

This value will be added to the output.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

// 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;