/*******************************************************************************************/
/* this is an example shows how to control pitch of incoming speech
with a slider
*/
/*
*/
/*******************************************************************************************/
PitchShift.ar(in, windowSize, pitchRatio, pitchDispersion, timeDispersion,
mul, add)
A time domain granular pitch shifter.
Grains have a triangular amplitude envelope and an overlap of 4:1.
in - the input signal.
windowSize - the size of the grain window in seconds. This value cannot
be modulated.
pitchRatio - the ratio of the pitch shift. Must be from 0.0 to 4.0.
pitchDispersion - the maximum random deviation of the pitch from the
pitchRatio.
timeDispersion - a random offset of from zero to timeDispersion seconds
is added to the delay
of each grain. Use of some dispersion can alleviate a hard comb filter
effect due to uniform
grain placement. It can also be an effect in itself. timeDispersion
can be no larger than windowSize.
{
var w, a, b, z;
w = GUIWindow.new(" One Slider", Rect.newBy( 249, 106, 172, 135
));
StringView.new( w, Rect.newBy( 16, 12, 131, 29 ), "Line In Pitch
Shifter");
b = SliderView.new( w, Rect.newBy( 18, 78, 128, 24 ), "SliderView",
0, 0, 4, 0.1, 'linear');
a = NumericalView.new( w, Rect.newBy( 18, 48, 128, 23 ), "NumericalView",
0, 0, 4, 0.1, 'linear');
a.action = { b.value = a.value };
b.action = { a.value = b.value };
{
var pitch = 0.2; // 0.2 ... 4
var pan = -1;
z = AudioIn.ar([1,2]);
PitchShift.ar(z, 0.02, ControlIn.kr(a), 0, 0.0001)
}.play;
w.close;
}