Discussion:
Making a Smoother Loop
RDF107
2014-10-12 06:30:18 UTC
Permalink
Hi,

I am currently reading & using the Arduino Analog port to control the pitch
of my SinOsc. I have placed it in a loop to read the constant change in data
received from the Arduino, but this not making the pitch shift very smooth
at all. Any suggestions as to how I can rewrite this? Thank you.

CODE:

SerialPort.devices; // check SerialPort names
a = FirmataDevice.new('/dev/tty.usbmodem1421'); // if serial port is closed
restart SC
a.reportAnalogPin(0, true); //read A0
a.analogPinAction_({arg num, val;

~bob=[val];
})


(r = Routine{fork {
loop {
b.release;
~bob.postln;
b = {SinOsc.ar(~bob, 0, 1)}.play;
0.3.wait;
}
}
}.play;
); //~bob controlling Synth pitch looping but not smooth





--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Making-a-Smoother-Loop-tp7613942.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
adam4
2014-10-12 20:08:46 UTC
Permalink
whats the problem exactly?, is it a bit jittery or noisy? is it lagging?

what have you got attached to the analogue pin?



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Making-a-Smoother-Loop-tp7613942p7613957.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Dan Zink
2014-10-12 20:09:22 UTC
Permalink
Starting a new synth on every new data point is probably not the smoothest
thing to do. Please try using the same synth, and saving a reference to the
node as demonstrated below. From there, you can add a OnePole filter with
Lag.kr to smooth out the changes. The lagTime variable will adjust how long
it takes to hit within 0.01% or so . Try something like this which I have
not tested:

(r = Routine{
var b = {arg freq = 440, lagTime = 0.1; SinOsc.ar(Lag.kr(freq, lagTime),
0, 1)}.play;
fork {
loop {
b.set(\freq, ~bob);
}
}
}.play;
);
Post by RDF107
Hi,
I am currently reading & using the Arduino Analog port to control the pitch
of my SinOsc. I have placed it in a loop to read the constant change in data
received from the Arduino, but this not making the pitch shift very smooth
at all. Any suggestions as to how I can rewrite this? Thank you.
SerialPort.devices; // check SerialPort names
a = FirmataDevice.new('/dev/tty.usbmodem1421'); // if serial port is closed
restart SC
a.reportAnalogPin(0, true); //read A0
a.analogPinAction_({arg num, val;
~bob=[val];
})
(r = Routine{fork {
loop {
b.release;
~bob.postln;
b = {SinOsc.ar(~bob, 0, 1)}.play;
0.3.wait;
}
}
}.play;
); //~bob controlling Synth pitch looping but not smooth
--
http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Making-a-Smoother-Loop-tp7613942.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Daniel Mayer
2014-10-12 20:17:07 UTC
Permalink
Post by RDF107
(r = Routine{fork {
loop {
b.release;
~bob.postln;
b = {SinOsc.ar(~bob, 0, 1)}.play;
0.3.wait;
}
}
}.play;
); //~bob controlling Synth pitch looping but not smooth
Hi,

what's happening here is that every 0.3 sec
a new synth is compiled and played with the current
init value at *that* time.
What you probably want is a synth which is reading values from a
bus, then value changes on the bus are immediately taken over.
For smoothing you might add a Lag ugen.

Another point: with that kind of sequencing
you get bad timing as synths are played
without latency.
On the hand: if your synth is reading values
from a bus you maybe don't want to do any sequencing
of synths ?
For sequencing & LFO control there's a lot of possible strategies,
you might look at the tutorial file 'Event patterns and LFOs'
from miSCellaneous lib.

Greetings

Daniel

----------------------------------------------------
http://daniel-mayer.at/software_en.htm
----------------------------------------------------






_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Continue reading on narkive:
Loading...