# Accidentally writing wrong variable

It’s not something I have encountered before, if memory serves me right
A simple structure here ( execute top bottom )
The kick pbind is routed to output 0, 1 beat per measure , tempoclock 121/60
Press play
Now , if accidentally writing the wrong ~variable in the \kik \pbind \output “~ringbus_wrong” instead of “~ringbus_a” , ( or any other wrong name ) we obviously won’t hear anything since there is no “~ringbus_wrong”
While still playing , now again type “0” or the correcet var name in \out , result is that the tempoclock is now ignored and the Pdef play default tempo
Also happens when for example typing a letter (undeclared var ) in on the the Pbind fields nstead of a value .



///////////
~ringbus_a=Bus.audio(s,2)

//..
(
SynthDef(\ringmod,
{
var sig,processed;
sig=In.ar(in,2);
processed=sig*SinOsc.ar(freq=freq,mul:amt);
Out.ar(out,processed)
)

~ringbus_a

(
SynthDef (\kick,
{
arg pitch=50,patt=0.001,pdec=0.325,pcurve=(-50),pamt=100,att=0.001,dec=0.700,noisefreq=100,shamt=4,vol=0.3,out;
var kick,penv,ampenv,noiseosc;
penv=EnvGen.ar(Env([0,1,0],[patt,pdec],[0,pcurve]),doneAction:0);
kick=SinOsc.ar(pitch+(penv*pamt))*0.9;
noiseosc=LPF.ar(WhiteNoise.ar(0.1),noisefreq);
kick=(noiseosc+kick)*EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2)!2;
kick=SineShaper.ar(kick*shamt)*vol;
kick=(HPF.ar(kick,20));
Out.ar(out,kick);
)

(
Pdef(\kik,
Pbind(\instrument,\kick,
\dur,1,
\pitch,Pseq([50,50],inf),
\pdec,1,
\shamt,Pseq([2,2,2,2],inf),
\vol,0.8,
\out,0,
))
)

Pdef(\kik).play(t);
Pdef(\kik).stop;

t=TempoClock(121/60).permanent_(true)


TempoClock.default.tempo = 120/60;
Pdef(\kik).play();


Means you can only have one global tempo though.

Or this

(
Pdef(\kik,
Pbind(\instrument,\kick,
\dur, 1,
\pitch, Pseq([50,50],inf),
\pdec,1,
\shamt, Pseq([2,2,2,2],inf),
\vol, 0.8,
\out, ~ringbuasdw_a ? 0 // here 0 is used if the varible is nil
))
)

1 Like