Hello, I currently have an Arduino 1 with a trimmer (soon to be conductive cord sensor) to control certain parameters from the voice. The Arduino and the serial port to SC are working ok, and I can hear some shifting in the pitch according to the trimmer, but after some seconds, all I hear is a pop sound on my headphone. I assume it has to do with timing and lagging issues but I am unsure how to solve them.
My mic is currently on a Focusrite on one port, and the Arduino on another.
(
~port= SerialPort.new(
“/dev/cu.usbmodem141401”,
9600
);
)(
~string= String.new;
Tdef(\readValues, {
{
~ascii = ~port.read;
if (~ascii.notNil) {
~ascii = ~ascii.asAscii;case {~ascii.isDecDigit or: { ~ascii.isPunct } } {~string = ~string.add(~ascii)} {~ascii.asAscii.isPunct} {~intArray = ~intArray.add(~ascii.asAscii)} {~ascii.asAscii.isAlpha} { ~val = ~string.asFloat; ~string= String.new; } } }.loop;
}).play;
)~val;
(
~mic= {
|in=0, out=0, amp=0.3, pan=0.7, ratio=0.0, dispP = 0.0, dispT = 0.0, mix = 0.7, mul = 1|
var sig, delay, pitchshift;
sig=SoundIn.ar(in!2);
pitchshift = PitchShift.ar(sig, 0.2, ratio, dispP, dispT, mul);
sig = XFade2.ar(sig, pitchshift,mix);
Out.ar(out, Pan2.ar(sig, pan));
}.play;
)(
Tdef(\filterSweep, {
{
~mic.set(\dispP, ~val.linexp(0.0, 1.0, -1, 0.5));
0.01.wait;
}.loop;
}).play
)
Is there any work around this? It seems to work if it wasn’t for that big issue
Thanks!