home/ atoms/ sc-plot-before-play

Using .plot() before .play() lets you see a waveform before committing to audio output

In SuperCollider, any sound-generating function block can be visualized by substituting .plot(seconds) for .play. The argument specifies how many seconds of audio to render and display — { SinOsc.ar(440)!2 }.plot(0.01) shows a few cycles of the sine wave. This is especially important when working with unfamiliar UGens, filter parameters, or mouse-controlled values: plotting reveals the signal’s amplitude and shape without risk to speakers or ears. The cookbook uses both .plot() and .play on the same function to cross-reference the visual waveform with the sonic result.

Examples

// Same function, visual vs audio:
{ SinOsc.ar(440)!2 }.plot(0.01)  // show first 0.01 seconds
{ SinOsc.ar(440)!2 }.play        // hear it

Assessment

Write a SuperCollider snippet that plots two seconds of a sawtooth wave at 220Hz and then plays it. Explain what you expect the plot to show.

“To visualize any sound function block like the one above, switch play for plot. - The argument is the number of seconds of playback to plot.”
corpus · welsh-s-synthesizer-cookbook-figures-in-supercollider-cookbo · chunk 1