‹ redShift Excerpt Analogue Video In/Out on a Recent MacBook Pro ›

One Reason Why I Love SC

2012-05-08 14:37 supercollider

140 characters...

play{Splay.ar(SinOsc.ar(9,SinOsc.ar(midicps((Sweep.ar(0,(33..3))%128&(Sweep.ar(0,(3..9))%(LFSaw.ar(3)*9+99)))+33),0,pi)))/3}//#SuperCollider

If we run this line in SuperCollider we hear this...

and using Rohan Drape's great sc3-dot quark and swap play{} with draw{} in the line above, this mess gets revealed...

SynthDef diagram
click image for a hi-res version (pdf)

So with a single line of code - short enough to fit in a twitter tweet - we've built this amazingly complex sound synthesis patch. I can not imagine a system with greater code-to-noise ratio than SuperCollider.

And this one is pretty fun to .draw as well...

play{f={|o,i|if(i>0,{SinOsc.ar([i,i+1e-4]**2*f.(o,i-1),f.(o,i-1)*1e-4,f.(o,i-1))},o)};f.(60,6)/60}//#SuperCollider

A heavily recursive patch that looks almost fractal. The pdf file generated from this line of code is 300kB! The number 6 in the code means recursion depth and 60 is the base frequency.

How to install sc3-dot

To use the sc3-dot quark in SuperCollider on a mac you'll need Graphviz (I use 2.28 on my OSX 10.6.8). You also need to make sure the resulting .dot files open automatically in Graphviz and not Photoshop, Word or something. (Get info on a .dot file in Finder and change all filetypes to open with graphiviz. You'll find the .dot files from sc3-dot in your hidden /tmp directory)

Updates: 240129: (thanks Carlo)

To use the sc3-dot quark in SuperCollider on a mac you'll need to install graphviz, preferably via macports sudo port install graphviz or via homebrew brew install graphviz.

Then install the quark from within SuperCollider...

Quarks.install("sc3-dot");

add the following lines to your startup.scd file...

Dot.renderMode= 'pdf';
Dot.pdfViewer= "open -a Preview.app";
Dot.dotCmd= "/opt/local/bin/dot";  //macports
//Dot.dotCmd= "/usr/local/bin/dot";  //homebrew

and finally recompile SuperCollider. Now a command like...

{SinOsc.ar}.draw;

should automatically create a .dot file, convert to .pdf and open using Preview.app.

By default you will find the resulting .dot and .pdf files in the ~/Library/Application Support/SuperCollider/tmp directory.


‹ redShift Excerpt Analogue Video In/Out on a Recent MacBook Pro ›