Hi,
How could I coerce an input signal to a given scale? I've worked out
how to do it for a scale with all equal ratios - e.g. a whole-tone
scale in this example:
(
{
var in, realPitch, desiredPitch, shiftVal, shifted, out;
in = AudioIn.ar(2);
realPitch = ZeroCrossing.ar(in);
desiredPitch = realPitch.cpsmidi.round(2).midicps;
shiftVal = desiredPitch/realPitch;
out = PitchShift.ar(in, pitchRatio:shiftVal);
}.play;
)
But for a scale where the ratios aren't all the same...?
Thanks in advance for any tips on this one -
Dan
In sc2 I had a class for this (KeyToDegree) and you could autotune a song with use of this and the Pitch ugen. I have thought about writing a ugen in sc3 for this, but haven't had the time yet.
There is methods for this on the sclang side (keyToDegree and nearestInScale) that I have added, but this doesn't help as much. If you don't want to write the ugen, you could send the values over to sclang for processing.
I've attached the (sc2) pseudo-UGen code, but I guess it is not of much help, and might be slightly incorrect.
Attachment:
KeyToDegree.sit
Description: Binary data
-- .