From Function to Pdef

Hello everyone,
I would like to ask for advice, to change this simple code, from a function to a synthdef controlled via Pdef or Pbindef.

Do you suggest to use t_trig like arg?
Or to there is another way to control Impulse in sync with patterns ?

c = {arg amp=1.0;

Impulse.ar(
		// it changes 1 time every second, in the range between 1 and 20
	//	so potentially from a quarter note to a 20tuplet

	freq: LFNoise0.kr(1).range(1,20),

/*
- just a way to "cut" the phrases with amp = 0.000
- so you can have phrases "cutted"  every 0.66666666666667 second
		- It's in mutichannel expansion so I'm working on channel Left Only, Right Only or both.

		*/

mul: LFClipNoise.kr(1.5!2).range(0.000,amp));

	}.play;
//c.set(\amp, 0.0)
)

I like the result but I would love to change it to have more control

  1. choose how long the phrases have to dur consequentally the silences/pauses.

  2. choose how many changes there are in a phrase.

  3. choose the way the changes have to behave, to the adjacent number or changes to a random number within the range.

  4. choose the “spatialisation”,
    for now is:
    a or b or ab but without interpolation,
    and it works for my porpose.
    maybe just a Pan2.ar() it could work

Thank you in advance,
to who wants to help me out.

I do not fully understand what you want to achieve (sorry) but here is something that might serve as a source of inspiration:

(
s.waitForBoot({
	var pattern;
	
	SynthDef(\ticking, {
		| out=0, freq=1.0, amp=1.0, pan=0 |
		var sig = Impulse.ar(freq);
		Out.ar(out, Pan2.ar(amp*sig, pan));
	}).add;
	
	s.sync;
	
	pattern = Pmono(
		\ticking,
		\freq, Prand([Pwhite(1,20,3), Pgeom(3.0, 1.2, 10)], 20),
		\amp, Prand([0.1,0.5,1], inf),
		\dur, Pseq([1], inf), // beats, not seconds
		\pan, Prand([-1,0,1], inf),
	);
	
	~player = pattern.play;
	// ~player.stop;
});
)
1 Like

Thank you Shiihs,

to use Pmono without killing the synth all the time it’s a really nice way to solve it!
So changing the amp I could “cut” the phrases, and I also like the Pwhite, Pgeom in the freq, it sounds much more similar to an LFO compared to my solution.

In the end, I tried to make everything a little more metric, to see how it sounds, maybe a little too rigid for my goal, but it gives me more control. I have to keep fix it. I had also considered the possibility of using a solution where I use a sin function * Pwhite()

Event patterns and LFOs | SuperCollider 3.11.2 Help (basislager.org)

Aayway for now I’m here:

(
SynthDef(\imp, { arg out=0, pos =0;
var sig = Impulse.ar(0);
	var pan = Pan2.ar(sig,pos);

	OffsetOut.ar(out,FreeSelf.kr(pan));

}).add;
)

Synth(\imp);



(

var pause = Pseq([Rest(4)],1);

Pdef(\impulses,
	Pbind(\instrument, \imp,
		\dur, 1/Pwrand([
			Pseq((16!16),1),
			Pseq((12!12),1),
			Pseq((9!9),1),
			Pseq((8!8),1),
			Pseq((6!6),1),
			Pseq((4!4),1),
			Pseq((3!3),1),
			Pseq((2!2),1),
			pause,
],[1,1,1,1,1,1,1,1,9].normalizeSum, inf),
	\pos,Pstutter(8,Pxrand([-1,0,1],inf).trace(prefix:"POS: "))
	
)).play;
)