Tracing Processes:
Filter:
Guides | Debugging

Tracing Processes

Tracing processes in SC

What goes on in a running system? In SC, various methods help to get information about processes on different levels: server side and client side (in sclang).

Tracing sclang processes

In order to know more about objects as they are created by processes like tasks or even simply by evaluating a bit of code, one can insert messages like postln and postcs anywhere in the code.

calculating the sum of n subsequent squares

what happens while we are doing this?

or more in detail:

when posting several values, some more verbose posts can be useful. postf formats a string and inserts values for %-characters. here separate statements are needed.

in some cases, postln will only post part of the data, or a simplified representation.

posts the compile string, i.e. the code needed to recreate the receiver (here the array)

Streams, tasks and routines

in streams, tasks and routines, this works just as well:

for creating a pattern that once it is used posts its values, the message trace can be used (in returns a Ptrace)

in a running stream:

post only a slot of the events

several slots at once:

Tracing server processes

Using postln or post on a UGen will only return the UGen, but not the values it produces in a running synth. The poll message creates a Poll UGen which posts at regular intervals when given a time value or as a response to a trigger (see Poll helpfile)

For demand ugens, poll does not work - these ugens are called by a Demand or Duty UGen at certain intervals. The message dpoll creates a Dpoll ugen that posts when they are called (see Dpoll helpfile)

The scope window can give valuable information about the ongoing sound (see Stethoscope help):

A FreqScope window can be used for observing the spectrum of the output: