Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Buffer Plotter
name
code content
s.boot; ( var bufferSize = s.sampleRate * 1; // Buffer size is fixed. s.sampleRate * seconds makes sense. if( ~plotterIn == nil, { ~plotterIn = Bus.audio( s, 2 ) } ); // Declare a global channel for the plotter input, stereo if( ~plotterBuffer != nil, { ~plotterBuffer.free } ); // Reset the buffer if existant ~plotterBuffer = Buffer.alloc( s, bufferSize, 2 ); // Create our buffer, stereo SynthDef( \toBuffer, { // A simple routing synth | bufNum | var in = In.ar( ~plotterIn, 2 ); // Takes an input RecordBuf.ar( in, bufNum, loop: 0, doneAction: 2 ); // And outputs it in our buffer } ).add; ) ( // Demo Synth SynthDef( \demoSynth, { | out = 0, freq = 220 | var snd = SinOsc.ar( freq!2 ); snd = snd * EnvGen.kr( Env.perc( 0.1, 0.9 ), doneAction: 2 ); Out.ar( out, snd ); } ).add ) ( Synth( \toBuffer, [ \bufNum, ~plotterBuffer ] ); // Trigger the buffer synth Synth( \demoSynth, [ \out, ~plotterIn, \freq, 110 ] ); // Then our favorite synth ) // You will need to wait the bufferSize length before plotting it ! ~plotterBuffer.plot // Finally print the result if( ~plotterBuffer != nil, { ~plotterBuffer.free } ); // Free the buffer if existant
code description
This is a setup that allows you to plot a Synth() output, using a buffer. See https://scsynth.org/t/what-is-the-best-way-to-plot-a-synth/5160 .
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change