Two osc's interval sequenced from Pseq

Making progress with the pdef, pbind stuff , verry amusing

Here I created a simple 2 osc synth , the frequency is an argument , and it’s sequenced from the pseq \degree
I want the second osc. to be a fifth higher ,
I tried using a midi note number followed by.midicps but then the pseq \degree messes things up
I also don’t understand why the pseq degree only works when the argument in the synthdef is frequency , if I use another name arg name (for pitch freq) , degree doesn’t work .
Is this by convention ?

(
SynthDef (\simple,
{
arg att=0.001,dec=0.200,mod=500,freq=0,filterfreq=400;
var sig,env;

env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
		sig=Pulse.ar(freq,mul:0.5)+Saw.ar(freq+7,mul:0.5);///////I an
sig=RLPF.ar(sig,filterfreq+(env*mod).clip(40,20000),rq:0.2);
sig=sig*env!2;
Out.ar(0,sig)
}).add
)
;

(
Pdef(\qwe,
	Pbind(\instrument,\simple,
		\dur,Pseq ([0.12,0.25,0.12,0.25,0.5,0.25,0.12,0.25],inf),
		\degree,Pseq([-12,-7,-12,-5,0,-7,-12,-5,-9,2],inf),
		\filterfreq,Pseq([800,1000,400,300,2000,100,3000],inf),
		\dec,Pseq([0.125,1.1,0.250,0.064,0.500],inf),

	).play
)
)
/////

try freq * (7.midiratio)

(or freq * 1.5 if you want it in tune :wink: )

in the docs you will find a whole long description of the default Event and how all the keys work.
https://depts.washington.edu/dxscdoc/Help/Classes/Event.html

Strange now the degree is playing octaves instead of pitches

The only way I get it to work is to explicitly write 60.midicps,64.midicps etc… in the pseq for (pitc argument )

(
SynthDef (\simple,
{
arg att=0.001,dec=0.200,mod=500,pitch=70,filterfreq=400;
var sig,env;

env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
		sig=Pulse.ar(pitch,mul:0.5)+Saw.ar(pitch,mul:0.5);///////I an
sig=RLPF.ar(sig,filterfreq+(env*mod).clip(40,20000),rq:0.2);
sig=sig*env!2;
Out.ar(0,sig)
}).add
)
;

(
Pdef(\qwe,
	Pbind(\instrument,\simple,
		\dur,Pseq ([0.25,0.12,0.12,0.25],inf),
		\pitch,Pseq([60.midicps,61.midicps,64.midicps,72.midicps,],inf),
		\filterfreq,Pseq([800,700,1600],inf),
		\dec,Pseq([0.125,0.550],inf),

	).play
)

Found it
just adding .midicps after the array
Pitch
Pseq([60,62,67,60].midicps,inf),

Or just in the Synthdef graph

Hmm assigning a variable to a pdef doesn’t free it

(
SynthDef (\simple,
{
arg att=0.001,dec=0.200,mod=500,punk=0,filterfreq=400,reso=0.5;
var sig,env;

env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
		sig=Pulse.ar((punk).midicps,mul:0.6)+Saw.ar((punk+0.40).midicps,mul:0.9);///////I an
sig=RLPF.ar(sig,filterfreq+(env*mod).clip(40,20000),rq:reso);
sig=sig*env!2*0.5;
Out.ar(0,sig)
}).add
)
;

x=(
Pdef(\qwe,
	Pbind(\instrument,\simple,
		\dur,Pseq ([0.12,0.5,0.12,0.25,0.5,0.25,0.5,0.25],inf),
		\punk,Pseq([60,57,57,60,67,62,55],inf),
		\filterfreq,Pseq([800,1000,400,300,2000,100,3000],inf),
		\dec,Pseq([0.125,1.1,0.250,0.064,2.500],inf),
		\reso,Pseq([0.5,0.2,0.5,0.1,1,0.5,1,1,0.2,0.2,0.5,1,0.2,1,0.2,1,0.5,1],inf);

	).play;
)
)
x.free;
/////

You’re playing the Pbind, not the Pdef.

// not OK
Pdef(\name, Pbind( ... ).play);

// OK
Pdef(\name, Pbind( ... )).play;

Those two statements do not mean the same thing.

As for freq vs pitch, if you’re using the default event prototype, you’ll find most things will go more smoothly if your SynthDef argument is freq, because this is what the default event prototype is designed for.

hjh