Print output values of UGen to the post window

How can I print the output of ugens to the post window? I thought:

{SinOsc.ar(100).postln}.play

but this only prints a SinOsc.

postln runs in the language, it runs only when the synthdef is built. It is very useful for checking the size and shape of multichannel signals.

You are looking for .poll.

J

1 Like

A very important concept in SC is that of calculations that are performed Right Now (whose results are available immediately) vs calculations that are represented in an object structure, but which won’t be performed until later.

postln works only on Right Now values.

It printed SinOsc because the object SinOsc was created Right Now as part of the process of building a SynthDef. But the values – think about the fact that a SinOsc in a synth can run for a few milliseconds or for an hour. These are not Right Now – they’re ongoing, long after the SynthDef was built.

You’d have the same problem trying to post something in a pattern – though there are differences between UGens and patterns, they both create an object structure Right Now, which calculates real values later. So, with UGens, you need poll to print the later-calculated values; with patterns, you need trace instead of postln.

hjh

1 Like