Sound just stops

I have a somewhat complex code which mostly does what it is supposed to. But sometimes, it just goes ‘pop’ and sound stops. The server is still running and the language is still spinning. I have some tasks to generate the material and I inserted lines to print some synthesis parameters. The tasks keep printing outputs, but no sound is coming out. I can stop everything - resulting in another loud ‘pop’ - and then relaunch my code (no need to reboot the server) and then everything is fine. But this error only happens rarely - I can run the code for 10 or 20 minutes without a hitch then suddenly ‘pop’ and its dead. I get no error messages. I’m running jack server (on linux) and don’t see any xruns or other errors associated with this problem.
Any idea how I might be able to trace this? where do I even start looking?
thanks
Oded

If you don’t find the cause (you might want to post the SynthDefs you’re using) you could try if something like the SafetyNet quark prevents the pop and stop.

thanks will check the safety quark. Here are SynthDef that were active the last few times I encountered the problem. Note, though, that I have not changed those Defs in a while and have been invoking them regularly over the last year without a problem. So I doubt either is the direct cause. Some strange interaction perhaps.

//input sound from mic and analyse it
~detune = (441/440).ratiomidi;
~winsize = 16384;
SynthDef(\pnoIn, {|out = 0, soundfile, fftlong, ctrlbus,amp0 = 1, amp1 = 1, thresh = 0.13|
	var src, sig,chain1,chain2,chroma,trig,onsets,spec,ampli,loud,melbands,kalman,frq,hasf;

	src = LeakDC.ar(SoundIn.ar([0,1]));
	sig = Mix.ar([amp0*src[0],amp1*src[1]]);
	chain1 = FFT(LocalBuf(1024), sig, hop: 0.25, wintype: 1);  //for onsets
	chain2 = FFT(fftlong, sig, hop: 0.25, wintype: 1);   //for chroma
	ampli=Amplitude.ar(sig);
	trig = Impulse.kr(8);
	chroma = Chromagram.kr(chain2,fftsize: ~winsize, tuningbase: (24 + ~detune).midicps, octaves: 7, integrationflag: 1,coeff: 0.8);
	spec = SpecCentroid.kr(chain1);
	loud = Loudness.kr(chain1);
	kalman = UKalman.kr(MovingAverage.kr(ampli,100,400),0.01,0.01);
	onsets = Onsets.kr(chain1, thresh, \wphase, floor: 0.01, mingap: 5);  //wphase
	melbands = FluidMelBands.kr(sig,25, windowSize:2048,hopSize:1024);
	SendReply.kr(trig, '/pnodata', chroma++ampli++kalman);  //,loudness,dissonance
	SendReply.kr(onsets, '/onset',[spec,loud]++melbands);
	Out.kr(ctrlbus, onsets);
	Out.ar(out,sig);
	}).add;

//master output
SynthDef(\stout, {arg pno,elec,pnolevel = 0.4,synthlevel = 1, rev=0.7;
	var inst,el;

	inst = pnolevel*In.ar(pno);
	el = Limiter.ar(synthlevel*HPF.ar(In.ar(elec, 2),10));
	Out.ar(0, FreeVerb2.ar(inst+el[0], inst+el[1], 0.3, rev, 0.1))
}).add;

// sound generation
SynthDef(\dwgplucked, { |out=0, freq=440, amp=0.5, gate=1, pos = 0.1, c1=1, c3=20, fB=2,pan=0|
    var env = Env.new([0,1, 1, 0],[0.001,0.006, 0.0005],[5,-5, -8]);
    var inp = amp * LFClipNoise.ar(2000) * EnvGen.ar(env,gate);
    var son = DWGPluckedStiff.ar(freq, amp, gate,pos,c1,c3,inp,0.1,fB);
	DetectSilence.ar(son+Impulse.ar(0), 0.01, doneAction:2);
    Out.ar(out, Pan2.ar(son * 0.02, pan));
}).add;
SynthDef(\filtergliss, { |out=0, freq=440, amp=0.5, gate=1, part = 2, dur=0.4, c3=20, pan=0|
    var fenv,sig,env = Env.new([0,1, 1, 0],[0.001,0.006, 0.0005],[5,-5, -8]);
    var inp = amp * LFClipNoise.ar(2000) * EnvGen.ar(env,gate);
    var son = DWGPlucked.ar(freq, amp, gate,0.1,1,c3,inp);
	//var comp = AmpCompA.ir(freq,150);
	fenv = Env.new([1,0.8,1.5].scramble++[part],[0.1,0.1,0.3].scramble,['sine','sine',3]);
	sig=BPF.ar(son,SinOsc.ar(Rand(3,7),0,0.02*freq,freq)*EnvGen.ar(fenv,timeScale: dur),Line.kr(0.07,0.03,dur));
    DetectSilence.ar(son+Impulse.ar(0), 0.001, doneAction:2);
    Out.ar(out, Pan2.ar(sig, pan));
}).add;

thanks

I used to have occasional NaN values from DWGPlucked.

Recently I get frequent NaN values from it, so much that I’ve basically retired my waveguide harp instrument (I don’t use it in performances anymore :cry: ).

I don’t know why this UGen became riskier, without any code changes that I know of.

The workaround would be to trap bad values in the SynthDef. I can post that example later.

EDIT: Add, after the DWG units:

son = Select.ar(CheckBadValues.ar(son) > 0, [son, DC.ar(0)]);

This should block bad values.

hjh

thanks. out of curiosity - did you find a reasonable alternative to your harp instrument?

Is there an issue for this?

I didn’t look very hard :laughing: – just moved on instead. I should double check it though and make sure to block bad values before anything that has an infinite impulse response.

These are sc3-plugins UGens – are we fixing anything there? I thought that was basically a dead zone for maintenance (not officially so, but in practice).

hjh