View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

Generating triggers on the server with a known, random time between each

Home   How To   Code Pool   Public Library   Theory   Events
Here's a neat trick using LocalIn / LocalOut to generate random triggers.

Dust generates randomly distributed triggers, but you don't know how much time will pass between each trigger. Here, you calculate the time you want and the pulse generator adjusts to it.

I use this trick all the time.

SynthDef(\trigDelta, {
	var	initTrig =,
		delta =, [, Rand(0.5, 1.5)]),
		trig =,
		nextdelta =, 1.5, trig);;, 0, delta);

o = OSCresponderNode(s.addr, '/tr', { |t, r, m|
	"last = %, now = %, delta = %, actual delta = %\n"
		.postf(x, t, m[3], t - x);
	x = t;

x = Main.elapsedTime; a = Synth(\trigDelta);;


Link to this Page