Hi Everyone,
I´ve a 3d array with frequency and amplitude values. These values have to be read by a synth so that with those data it processes a signal.
In other words, the synth has to read each row of the array and add the signals with the frequency and amplitude values of each cell. For example:
myarray = [f1,a1] [f2,a2], [f3,a3]
[f4,a4] [f5,a5], [f6,a6]
[f7,a7] [f8,a8] [f9,a9]
And my SynthDef is
Synthdef.new(\sinth{
arg freq, amp;
var sig;
sig = SinOsc.ar(freq, mul:amp);
Out.ar (0,sig);
}).add;
n = number of row
For (i = 0 to i=2)
var freqi, ampi;
freqi = myarray[n-1] [i] [0];
ampi = myarray[n-1] [i] [1];
xi = Synth.new (\sinth,[\freq, freqi],[\amp, ampi]);
end
How can I do this in SC? I´m a beginner. I need to do Additive Synthesis with the values of the row.
Thank u for your help…
(
var f1,f2,f3,f4,f5,f6,f7,f8,f9,a1,a2,a3,a4,a5,a6,a7,a8,a9;
f1 = 10;
f2 = 40;
f3 = 100;
f4 = 50;
f5 = 150;
f6 = 250;
f7 = 400;
f8 = 60;
f9 = 80;
a1 = a4 = a7 = 0.75;
a2 = a5 = a8 = 0.5;
a3 = a7 = a9 = 0.23;
y = Array.fillND([3, 3, 2]).debug("start y");
y[0][0][0] = f1;
y[0][0][1] = a1;
y[0][1][0] = f2;
y[0][1][1] = a2;
y[0][2][0] = f3;
y[0][2][1] = a3;
y[1][0][0] = f4;
y[1][0][1] = a4;
y[1][1][0] = f5;
y[1][1][1] = a5;
y[1][2][0] = f6;
y[1][2][1] = a6;
y[2][0][0] = f7;
y[2][0][1] = a7;
y[2][1][0] = f8;
y[2][1][1] = a8;
y[2][2][0] = f9;
y[2][2][1] = a9;
y.debug("new y");
)
(
SynthDef.new(\wow, {
arg freq = 60, amp = 0.1, gate = 1, wowrelease = 3;
var chorus, source, filtermod, env, snd;
chorus = Lag.kr(freq, 2) * LFNoise2.kr([0.4, 0.5, 0.7, 1, 2, 5, 10]).range
(1, 1.02);
source = LFSaw.ar(chorus) * 0.5;
filtermod = SinOsc.kr(1/16).range(1, 10);
env = Env.asr(1, amp, wowrelease).kr(2, gate);
snd = LPF.ar(in: source, freq: freq * filtermod, mul: env);
Out.ar(0, Splay.ar(snd))
}).add;
)
´´´