How do I send FFT information of phases and amplitudes to an oscillator bank in SuperCollider? It seems that I've misunderstood something but can't figure out what is wrong in my code:
msg = osc_message_builder.OscMessageBuilder(address = "/s_new 100 1 1 oscBank512")
msg.add_arg(" amplitude ", amplitudes)
msg.add_arg(" phase ",phases)
msg.add_arg(" attackSynth ", 0.1)
msg.add_arg(" releaseSynth", 0.5)
msg = msg.build()
client.send(msg)
So my oscillator bank has 256 SinOscs and I'd want to send that amplitude and phase information for them, they are in those arrays(amplitudes, phases). However python-osc doesn't allow me to do that. It says:
ValueError: arg_type must be one of ('f', 'i', 'b', 's', 'T', 'F')
So how would I construct that OSC message properly? Python-osc tutorial is really minimal and couldn't find any help online. I'd use pyOSC or OSC but pip wasn't able to install them so I'm stuck with python-osc.
SuperCollider code for the oscillator bank:
SynthDef.new(\oscBank512, {
arg attackSynth=0.1, releaseSynth=0.1;
var dmplitudeReceive = \dmplitudeReceive.kr( 0.0!256 );
var phaseReceive = \phaseReceive.kr( 0.0!256 );
var osc1, envelopeSynth, sig, amp, freq, phases, amps,out;
freq = Array.fill(256, {
arg i, j=(22050/256), k=(j/2);
if(i==0){i*j}{(i*j)-k};
});
amp = EnvGen.kr(
envelope: Env.perc(
attackTime: attackSynth,
releaseTime: releaseSynth,
level: 1,
curve: -4),
doneAction: 2);
sig = SinOsc.ar(freq:freq, mul: dmplitudeReceive, phase: phaseReceive);
sig = sig*amp;
sig = Limiter.ar(in:Mix.new(sig), level:1);
Out.ar(0, Pan2.ar(sig));
}).add;
The dmplitudeReceive is named with d on purpose.