2 FSinOsc - fixed frequency sine oscillator
4 freq - frequency in cycles per second. Must be a scalar.
5 mul - multiply by signal or scalar
6 add - add to signal or scalar
8 This unit generator uses a very fast algorithm for generating a sine
9 wave at a fixed frequency.
13 *ar { arg freq=440.0, iphase = 0.0, mul = 1.0, add = 0.0;
14 ^this.multiNew('audio', freq, iphase).madd(mul, add)
16 *kr { arg freq=440.0, iphase = 0.0, mul = 1.0, add = 0.0;
17 ^this.multiNew('control', freq, iphase).madd(mul, add)
23 *ar { arg specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
24 ^this.multiNewList(['audio', freqscale,
25 freqoffset, specificationsArrayRef] )
27 *new1 { arg rate, freqscale, freqoffset, arrayRef;
28 var specs, freqs, amps, phases;
29 # freqs, amps, phases = arrayRef.dereference;
31 amps ?? {Array.fill(freqs.size,1.0)},
32 phases ?? {Array.fill(freqs.size,0.0)}
35 ^super.new.rate_(rate).addToSynth.init([freqscale,freqoffset] ++ specs);
38 // store the inputs as an array
41 argNamesInputsOffset { ^2 }
45 *ar { arg specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
46 ^this.multiNewList(['audio', input, freqscale,
47 freqoffset, decayscale, specificationsArrayRef] )
49 *new1 { arg rate, input, freqscale, freqoffset, decayscale, arrayRef;
50 var specs, freqs, amps, times;
51 # freqs, amps, times = arrayRef.dereference;
53 amps ?? {Array.fill(freqs.size,1.0)},
54 times ?? {Array.fill(freqs.size,1.0)}
57 ^super.new.rate_(rate).addToSynth.init([input,freqscale,freqoffset,decayscale] ++ specs);
60 // store the inputs as an array
63 argNamesInputsOffset { ^2 }
68 *ar { arg specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
69 ^this.multiNew(\audio, specificationsArrayRef, input, freqscale, freqoffset, decayscale)
72 *kr { arg specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
73 ^this.multiNew(\control, specificationsArrayRef, input, freqscale, freqoffset, decayscale)
76 *new1 { arg rate, specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
77 var spec = specificationsArrayRef.value;
78 var selector = this.methodSelectorForRate(rate);
79 ^Ringz.perform(selector,
81 spec[0] ? #[440.0] * freqscale + freqoffset,
82 spec[2] ? #[1.0] * decayscale,
90 *ar { arg specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
91 ^this.multiNew(\audio, specificationsArrayRef, freqscale, freqoffset);
94 *kr { arg specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
95 ^this.multiNew(\control, specificationsArrayRef, freqscale, freqoffset);
98 *new1 { arg rate, specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
99 var spec = specificationsArrayRef.value;
100 var selector = this.methodSelectorForRate(rate);
101 ^SinOsc.perform(selector,
102 spec[0] ? #[440.0] * freqscale + freqoffset,
111 *ar { arg freq=440.0, numharm = 200.0, mul = 1.0, add = 0.0;
112 ^this.multiNew('audio', freq, numharm).madd(mul, add)
114 *kr { arg freq=440.0, numharm = 200.0, mul = 1.0, add = 0.0;
115 ^this.multiNew('control', freq, numharm).madd(mul, add)
120 *ar { arg freq=440.0, mul = 1.0, add = 0.0;
121 ^this.multiNew('audio', freq).madd(mul, add)
123 *kr { arg freq=440.0, mul = 1.0, add = 0.0;
124 ^this.multiNew('control', freq).madd(mul, add)
129 *ar { arg freq=440.0, width = 0.5, mul = 1.0, add = 0.0;
130 ^this.multiNew('audio', freq, width).madd(mul, add)
132 *kr { arg freq=440.0, width = 0.5, mul = 1.0, add = 0.0;
133 ^this.multiNew('control', freq, width).madd(mul, add)