.plotAudio and the practical use case for plotting an audio bus

Dear all,

While updating the following PR,

the following two questions arise:

  • Is .plotAudio necessary?
  • what would be the practical use case for plotting an audio bus?

plotAudio has a [-1, 1] range, which is the best if you want to quickly compare ugen outputs, e.g.

{ SinOsc.ar(440) * 0.1 }.plot
{ SinOsc.ar(440) * 0.1 }.plotAudio

Plotting an audio bus will show you what goes on right now on the bus.

1 Like

Thank you for your kinkd explanation!
I have more questions about plotting a bus:

  1. I am attaching two blocks of code below this post: The first for a private audio bus, and the second for an audio output bus. (I’m using the terms coined by Andrea Valle.) Is there a way to construct the latter in the same way for the private buses using the Bus' class? If I understand correctly, this is not possible because Bus.audio` only creates private busses…

  2. Is there a way to calculate the latency from the time the code is evaluated to the time the sound is produced? I do not think there is a way to do this… However, if users should always find the latency, I think plotting an audio bus or several audio busses is a bit not handy for plotting a cycle of multiple synths… Am I right? (To do this, I usually plot all the synthesis processes as one synth).

(
s.waitForBoot { 
	// var w = Window("parent");
	var busAudio = Bus.audio(s, 2);
	SynthDef(\sinPerc, { |out = 0|
		var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));
		OffsetOut.ar(out, signal ! 2) } ).add;
	s.sync;
	fork{
		s.bind{ 
			Synth(\sinPerc, [\out, busAudio]);
			{ SinOsc.ar * Env.perc.ar * 0.8 }.play(s, busAudio);
		};
	};
	0.135.wait;
	busAudio.plotAudio(1, /*parent: w*/);
	//w.front
}
)
(
s.waitForBoot { 
	//var w = Window("parent");
	SynthDef(\sinPerc, { |out = 0|
		var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));
		OffsetOut.ar(out, signal ! 2) } ).add;
	s.sync;
	fork{
		s.bind{ 
			Synth(\sinPerc);
			{ SinOsc.ar * Env.perc.ar * 0.8 }.play;
		};
	};
	0.135.wait;
	{ In.ar(0, 2) }.plotAudio(1, /*parent: w*/); // is there a way to do same thing using Bus.audio here?
	// w.front
}
)

maybe like this?

(
b = Bus(\audio, 0, 2);
s.bind {
	SynthDef(\sinPerc, { |out = 0|
		var signal = SinOsc.ar * Env.sine(0.1).ar(gate: Impulse.ar(2));
		OffsetOut.ar(out, signal ! 2) } 
	).add;
	s.sync;
	Synth(\sinPerc, [\out, b]);
	b.plot(1);
}
)

Btw. you don’t need to wrap an s.bind in a fork, it does this by itself already.

1 Like