Unable to change PitchShiftPA parameters after creating a SynthDev

Hi all,

I wrote a basic script to test PitchShiftPA. When I take the example code I’m able to change the pitch and formant using input from my mouse but, if I try to do away with the mouse and use synth.set the arguments seem to take no effect.

Example Code
(
x = {
    var in = SoundIn.ar(0);
    PitchShiftPA.ar(
        in,
        Pitch.kr(in)[0], //pitch tracking - we take just the frequency
        MouseX.kr(0.5, 2), //pitchRatio
        MouseY.kr(0.5, 2), //formantRatio
    )
}.play
)
x.free;
My Implementation
(
	SynthDef.new(\Retune,{
		arg pshift = 1, fshift = 1, amp = 1;
    var in = SoundIn.ar(0);
    PitchShiftPA.ar(
        in,
        Pitch.kr(in)[0], //pitch tracking - we take just the frequency
        pshift, //pitchRatio
        fshift, //formantRatio
			Out.ar([0,1],in * amp);
    )
	}).add

	)
	x = Synth.new(\Retune);
	x.set(\pshift, 0.5);

Hi @CasualRei

In your example you’ve put Out.ar as the 5th parameter of the PitchShiftPA (pseudo-)UGen. Thus the in argument inside Out.ar was still getting the signal from SoundIn, not the processed signal from PitchShiftPA.

Here is one way to fix that:

(	
SynthDef.new(\Retune,{
	arg pshift = 1, fshift = 1, amp = 1;
	var in = SoundIn.ar(0);
	// assign signal from PitchShiftPA to a new variable
	var snd = PitchShiftPA.ar( 
		in,
		Pitch.kr(in)[0], //pitch tracking - we take just the frequency
		pshift, //pitchRatio
		fshift, //formantRatio
	);
	// use that variable inside Out.ar
	Out.ar([0,1], snd * amp);
}).add
)

x = Synth.new(\Retune);
x.set(\pshift, 0.5);

Also, PitchShiftPA comes from a quark (that I wrote actually). Your issue turned out to be about general syntax, not the UGen itself, but if that was not the case, the issues about the quarks/extensions might be better asked in the “Issues” section of that extension/ugen repository.

I’m glad PitchShiftPA is getting some use/interest!

Cheers,
Marcin