Horrible crash , hanging supercollider

Just gor a horrible crash console saying too many nodes in tree, resulting in a very nasty loud burst of sound and supercollider froze .
Nothing fancy going on , just a two osc synth and kick , I had some more tabs open with synthdefand pdefs but on of tehm were playing , except the one provided below.
The node tree was perfectly fine , voices were released , the envelopes were set to doneAction 2 .
The only remedie was to detach my sound interface

(
SynthDef (\simple,
{
|att=0.001,dec=0.200,mod=150,pitch=0,filterfreq=400,reso=0.5,vol=0.5,pan=0,pw=0.5,pww=0.8|
var sig,env;

		env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
		sig=Pulse.ar(pitch.midicps,mul:0.5,width:pw)+Pulse.ar((pitch+0.2).midicps,mul:0.5,width:pww);///////I an
		sig=RLPF.ar(sig,filterfreq+(env*mod).clip(40,20000),rq:reso);
		sig=sig*env;
		sig=Pan2.ar(sig,pos:pan);
		Out.ar(0,sig*vol)
}).add
)
////////////////////
(
Pdef(\zxcv,

	Pbind(\instrument,\simple,
	\dur,Pseq([0.25,0.125,0.250,0.125,0.250,0.125],inf),
		\pitch,Pseq([48,51,53,48,53],inf),
		\filterfreq,Pseq([150,150,350,250,200],inf),
	\dec,Pseq([0.125,0.125,0.725,0.7,0.25],inf),
	\att,Pseq([0.001,0.001],inf),
	\reso,Pseq([0.5,0.5,0.5,1,0.5,0.5,0.5],inf),
	\vol,Pseq([0.4,0.5],inf),
	\pan,Pseq([-0.2,1,0,0.3,0.2],inf),
	)
))
/////////////////////////

Pdef(\zxcv).play;
Pdef(\zxcv).stop;
Pdef(\kik).play;
Pdef(\kik).stop;
(
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;
		var kick,penv,ampenv,noiseosc;
		penv=EnvGen.ar(Env([0,1,0],[patt,pdec],[0,pcurve]),doneAction:2);
		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]))!2;
		kick=SineShaper.ar(kick*shamt)*vol;
		kick=HPF.ar(kick,80);
		Out.ar(0,kick);
}).add;
)
////////////
(
Pdef(\kik,
	Pbind(\instrument,\kick,
	\dur,Pseq([0.5,0.5],inf),
		\pitch,Pseq([40,42,39],inf),
		\pdec,0.8,
		\shamt,Pseq([2,2,2,2],inf),
		\vol,0.8,
))
)
///////////

nothing wrong with these (nice sounds btw!)

I bet the problem was other patterns or routines running that you perhaps had forgotten about?

It happened again , all it did was subtracting -12 after the pitch line of the verry first Pbind ( which btw always works
All synthdefs in tab 1 were playing , while reanalyzing the first pbind after adding (-12) to the pitch lane
I had again 2 tabs open , none of them were doing anything , tab 3 was just a collectin of created synthdefs .
It can now be perfectly replicated , the only difference with the fie above is that pbind has -12 .
Analyze first Synthdef \simple
Analyze it’s Pdef \zxcv
Play pdef

(
SynthDef (\simple,
{
|att=0.001,dec=0.200,mod=150,pitch=0,filterfreq=400,reso=0.5,vol=0.5,pan=0,pw=0.5,pww=0.8|
var sig,env;

		env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
		sig=Pulse.ar(pitch.midicps,mul:0.5,width:pw)+Pulse.ar((pitch+0.2).midicps,mul:0.5,width:pww);///////I an
		sig=RLPF.ar(sig,filterfreq+(env*mod).clip(40,20000),rq:reso);
		sig=sig*env;
		sig=Pan2.ar(sig,pos:pan);
		Out.ar(0,sig*vol)
}).add
)
////////////////////
(
Pdef(\zxcv,

	Pbind(\instrument,\simple,
	\dur,Pseq([0.25,0.125,0.250,0.125,0.250,0.125],inf)-12,
		\pitch,Pseq([40,48,40,48,60,59],inf),
		\filterfreq,Pseq([150,150,350,250,200],inf),
	\dec,Pseq([0.125,0.125,0.725,0.7,0.25],inf),
	\att,Pseq([0.001,0.001],inf),
	\reso,Pseq([0.5,0.5,0.5,1,0.5,0.5,0.5],inf),
	\vol,Pseq([0.4,0.5],inf),
	\pan,Pseq([-0.2,1,0,0.3,0.2],inf),
	)
))
/////////////////////////


///
Pdef(\zxcv).play;
Pdef(\zxcv).stop;

//0.12,0.12,0.25,0.12,0.12,0.12,0.12,0.12,0.12,0.12,0.25,0.12,0.25////////
(
SynthDef(\twoop,
{
|fmamt=2,modoffset=24,moatt=0.001,modrel=0.500,ampatt=0.001,amprel=0.800,pitch=48,outt=0.3,pan=0.2|
var mod,modenv,ampenv,carr;

		mod=SinOsc.ar((pitch+modoffset).midicps)*fmamt;
		modenv=EnvGen.ar(Env.perc(moatt,modrel),doneAction:0);
		ampenv=EnvGen.ar(Env.perc(ampatt,amprel),doneAction:2);
		carr=SinOsc.ar(pitch.midicps,(mod*modenv))*ampenv*outt;
		carr=Pan2.ar(carr,pos:pan);
		Out.ar(0,carr);
}).add
);
//////////

(
Pdef(
	\crt,
	Pbind(
		\instrument,
		\twoop,
		\pitch,Pseq([40,48,40,48,60,59],inf)-12,
		\dur,Prand([0.25,  0.25,  0.5,  0.25,   0.25,   0.5],inf),
		\fmamt,Pseq([2,0.5,2,1,2,1,0.5,4],inf),
		\modrel,Prand([0.425,0.525,0.500,0.550,1,0.625,0.500,0.5,2.8],inf),
		\modoffset,Prand([2,1.9,2],inf),
		\pan,-0.3,
	)
)
)
/////0.25,  0.25,  0.25,  0.25,  0.5,  0.25,  0.25,  0.12,  0.12,  0.5,  0.25,  0.50,  0.25,  0.25
(
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;
		var kick,penv,ampenv,noiseosc;
		penv=EnvGen.ar(Env([0,1,0],[patt,pdec],[0,pcurve]),doneAction:2);
		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]))!2;
		kick=SineShaper.ar(kick*shamt)*vol;
		kick=HPF.ar(kick,80);
		Out.ar(0,kick);
}).add;
)
////////////
(
Pdef(\kik,
	Pbind(\instrument,\kick,
	\dur,Pseq([0.5,0.5],inf),
		\pitch,Pseq([40,42,39],inf),
		\pdec,0.8,
		\shamt,Pseq([2,2,2,2],inf),
		\vol,0.8,
))
)
///////////

(
Pdef(\crt).play;////fmsynth
Pdef(\kik).play;
Pdef(\zxcv).play;////////

)


(
Pdef(\crt).stop;
Pdef(\kik).stop;
)
Pdef(\crt).stop;///////////FM
Pdef(\crt).play;
Pdef(\kik).play;
Pdef(\kik).stop;

Pdef(\zxcv).play;////////pdlike
Pdef(\zxcv).stop;

Ok
It seems that I made a mistake , I accidentally put -12 after the duration lane instead of the pitch lane
The result of this is a really nasty outcome and hangs supecollider , which obviously goes berserk with negative \dur timing
perhaps one for the bug reports ?
Anyway I don’t think this bug is related to the one I encountered with node full message .

It is related.

With negative \dur, sclang says “oh there’s something scheduled to do, with a time value from ages ago – have to do it right now!” And then this reschedules even further in the past = catch up, do it right now, forever.

When the scheduled action runs a synth, then you do get hundreds/thousands of synth messages, all being sent right now.

I don’t necessarily agree that it’s a bug. In general, programming languages give you the power to shoot yourself in the foot, and the responsibility to avoid shooting yourself in the foot. I’ve locked up sclang in infinite loops easily hundreds of times, maybe over a thousand in 20 years? (Or worse, had bad floats go into a reverb line while onstage = horrid noise, cmd-dot and reset, while people are watching.) It happens.

hjh

1 Like

I often mistanlingly subtract an integer from a Pseq \dur lane which as mentioned before results in negative dur times and hardcore hangups.
I am trying to circumvent this by adding a clip amount but I don’t get the expected result , the result are still negative values
Suppose this is our \dur lane with -12 subtracting (which is how the mistake most often happens )

([1/4,1/4,1/4,1/4]).clip(0,inf) -12

This is better , but the Pseq does not like the extra parenthesis which are necessary
p.s. , the inf is the max amount of the clip range and not the inf loop mode of Pseq , I guess I could change that

(([1/4,1/4,1/4,1/4])-(12)).clip(0,inf);

(Pseq([1/4, 1/4, 1/4, 1/4]) - 12).clip(0.01, inf)

or

(Pseq([1/4, 1/4, 1/4, 1/4]) - 12).max(0.01)

(An infinite stream of 0 dur will also hang.)

hjh

1 Like