I am currently working on a project where I’m attempting to pass values from an array to a synth. I’ve created a simple example, but I’m encountering some issues.
Below is a simplified version of the code:
// Define the synth
SynthDef(\sineSynth, {|out = 0, freq = 300, amp = 0.5|
var src;
src = SinOsc.ar(freq);
Out.ar(out, src * amp);
}).add;
// Example array with key-value pairs
~arrayA = [
[0.2, [\freq, 700]],
[0.4, [\freq, 500, \amp, 0.2]],
[0.5, [\freq, 900]],
[0.7, [\freq, 600, \amp, 0.7]],
];
~synthA = Synth(\sineSynth, [\out, 0]);
// Attempting to set parameters from the array
~synthA.set(~arrayA.[0].[1])
The goal here is to pass frequency (\freq
) and amplitude (\amp
) values etc from the array to the synth. However, the current implementation doesn’t work
I would greatly appreciate any insights or suggestions on how to properly pass values from the array to the synth.