SuperCollider sound generator

Beyond the IDE

As mentioned elsewhere, SuperCollider is a means to an end. Apart from an extensive vocabulary for sound, sclang offers a complete toolset that allows you to create your own interfaces. Listing 3, for example, creates the interface shown in Figure 4.

Figure 4: A simple graphic interface to change pitch and volume of a sine wave.

Listing 3

guiexample.scd

 

This program recycles the sinewave SynthDef seen earlier and, from lines 9 to 31, creates a simple window with three elements – a slider, a knob, and a button – to control the wave. Line 12 creates the window with FlowView, setting the title to Example.

EZSlider in line 13 creates the volume slider, and its parameters set the parent window (i.e., the window that contains it), the values it can take (between 0 and 1), the action it controls (a volume change of x, which is an "object" of the sinewave SynthDef, set in line 22), and the initial value (0.5).

The EZKnob widget in line 14 is virtually the same as EZSlider, except it controls the frequency of x.

The Button widget in line 16 creates a multistate button (with the values "Off" and "On") and starts and stops the sound depending on whether it transitions from one state to the other or vice versa. Finally, line 30 sets the button's initial state; otherwise, the button will not show up in the window.

To run this program, first execute the sinewave SynthDef (place your cursor somewhere within the brackets and press Ctrl+Enter) then the program proper (move to line 10, for example, and press Ctrl+Enter again). At this point, the window will pop up. Press the On/Off button to start and stop the sound, drag the slider to change its volume, or twist the knob to change the pitch.

Quarks and Plugins

Extensions are called Quarks in the SuperCollider lingo. These comprise anything from musical games (e.g., Chordtris, a musical Tetris played with a midi keyboard; Figure 5) to graphical interfaces for live performances.

Figure 5: Chordtris is a Quark (extension) that allows you to play a musical version of Tetris.

SuperCollider comes with its own package manager, also named Quarks (Figure 6). To get a list of Quarks, type Quarks.gui in the SC IDE, press Ctrl+Enter, and click the Update Quarks Listing button in the window. If nothing happens in a reasonable stretch of time, check the SC IDE Post window for errors. It may instruct you to erase a directory, such as /home/[user]/.local/share/SuperCollider/quarks and run Quarks.gui again. After installing or deleting Quarks, you might have to update the libraries and help systems by clicking Language | Recompile Class Library.

Figure 6: SuperCollider comes with its own package manager for extensions (Quarks).

Plugins enhance the environment and add functionality to the language. To download the latest set of plugins from GitHub, use

$ git clone https://github.com/supercollider/sc3-plugins.git

and then compile as you would any source code program.

Conclusion

SuperCollider is not for the faint of heart. As with particle physics, sound creation and manipulation are difficult. Also, SuperCollider is immense, and I have only covered the bare basics in this article. SuperCollider broaches literally everything you will ever need for sound engineering, allowing you to use it at nearly any level of competence.

SuperCollider is useful for educational purposes (plot and scope are great to show students what happens when a sound is being produced), composing, and live performances. If you want to experiment, check out the MouseX and MouseY functions to create a two-dimensional virtual theremin on your screen with a couple of lines of code. Also, see how easy it is to create a Vocoder or to develop your own tools for your personal recording studio.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News