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 specificationsArrayRef = specificationsArrayRef.multichannelExpandRef(2);
25 ^this.multiNewList(['audio', freqscale,
26 freqoffset, specificationsArrayRef] )
28 *new1 { arg rate, freqscale, freqoffset, arrayRef;
29 var specs, freqs, amps, phases;
30 # freqs, amps, phases = arrayRef.dereference;
32 amps ?? {Array.fill(freqs.size,1.0)},
33 phases ?? {Array.fill(freqs.size,0.0)}
36 ^super.new.rate_(rate).addToSynth.init([freqscale,freqoffset] ++ specs);
39 // store the inputs as an array
42 argNamesInputsOffset { ^2 }
46 *ar { arg specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
47 specificationsArrayRef = specificationsArrayRef.multichannelExpandRef(2);
48 ^this.multiNewList(['audio', input, freqscale,
49 freqoffset, decayscale, specificationsArrayRef] )
51 *new1 { arg rate, input, freqscale, freqoffset, decayscale, arrayRef;
52 var specs, freqs, amps, times;
53 # freqs, amps, times = arrayRef.dereference;
55 amps ?? {Array.fill(freqs.size,1.0)},
56 times ?? {Array.fill(freqs.size,1.0)}
59 ^super.new.rate_(rate).addToSynth.init([input,freqscale,freqoffset,decayscale] ++ specs);
62 // store the inputs as an array
65 argNamesInputsOffset { ^2 }
70 *ar { arg specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
71 ^this.multiNew(\audio, specificationsArrayRef, input, freqscale, freqoffset, decayscale)
74 *kr { arg specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
75 ^this.multiNew(\control, specificationsArrayRef, input, freqscale, freqoffset, decayscale)
78 *new1 { arg rate, specificationsArrayRef, input, freqscale = 1.0, freqoffset = 0.0, decayscale = 1.0;
79 var spec = specificationsArrayRef.value;
80 var selector = this.methodSelectorForRate(rate);
81 ^Ringz.perform(selector,
83 spec[0] ? #[440.0] * freqscale + freqoffset,
84 spec[2] ? #[1.0] * decayscale,
92 *ar { arg specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
93 ^this.multiNew(\audio, specificationsArrayRef, freqscale, freqoffset);
96 *kr { arg specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
97 ^this.multiNew(\control, specificationsArrayRef, freqscale, freqoffset);
100 *new1 { arg rate, specificationsArrayRef, freqscale = 1.0, freqoffset = 0.0;
101 var spec = specificationsArrayRef.value;
102 var selector = this.methodSelectorForRate(rate);
103 ^SinOsc.perform(selector,
104 spec[0] ? #[440.0] * freqscale + freqoffset,
113 *ar { arg freq=440.0, numharm = 200.0, mul = 1.0, add = 0.0;
114 ^this.multiNew('audio', freq, numharm).madd(mul, add)
116 *kr { arg freq=440.0, numharm = 200.0, mul = 1.0, add = 0.0;
117 ^this.multiNew('control', freq, numharm).madd(mul, add)
122 *ar { arg freq=440.0, mul = 1.0, add = 0.0;
123 ^this.multiNew('audio', freq).madd(mul, add)
125 *kr { arg freq=440.0, mul = 1.0, add = 0.0;
126 ^this.multiNew('control', freq).madd(mul, add)
131 *ar { arg freq=440.0, width = 0.5, mul = 1.0, add = 0.0;
132 ^this.multiNew('audio', freq, width).madd(mul, add)
134 *kr { arg freq=440.0, width = 0.5, mul = 1.0, add = 0.0;
135 ^this.multiNew('control', freq, width).madd(mul, add)