Hello guys,
I am an absolute newbie, so forgive me for my bad coding!
I am trying to use an external sensor to control my patch.
The datas arrived well in SC since I see them in the Post window: ~sensor.postln;
I am having issues to insert in the following patch:
Thanks
//open serial port
~port =SerialPort.new("/dev/ttyACM0",9600);
// read sensor
(
~charArray=[];
~getValues=Routine({
var ascii;
{
ascii = ~port.read.asAscii;
if (ascii == $e ,{
~sensor= ~charArray.collect(_.digit).convertDigits;
~charArray = [];
});
}.loop;
}).play;
)
// post sensor output
~sensor.postln;
// SYNTH FOR SOUND
(
{inf.do(
{ var noise,freq,band,pitch,out,amp=1;
noise = Dust.ar(LFNoise1.kr(10).exprange(10,200));
band = MouseY.kr(0.0001,0.01);
pitch = ~sensor.linlin(0,1000,40,1000);
freq = [300,400,500,600,700,800,900,1000,1200,1400,1800,2000,2600,3200,4800,5400];
out = Out.ar ([0,1], Mix.ar(BBandPass.ar(noise, freq * pitch, band)) * amp)
}.play;
100.wait;
)}.fork
)