📜 ⬆️ ⬇️

Introduction to SuperCollider

In this small article I will briefly tell you about what SuperCollider is and demonstrate examples of its use. SuperCollider is an open-source cross-platform client-server application, development environment and programming language for audio synthesis in real (and not only) time. The first release was released in 1996 under the authorship of James McCartney, it was an open-source continuation of his previous research in software audio synthesis. Over time, several more people joined the project. Project website is hosted on sourceforge.net . There are versions for Linux (including ubuntu ppa), Windows, MacOS (the iPhone and Android versions are also being prepared).

Wednesday


Depending on the platform, a native editor (in the case of Windows or Mac) or a plugin for gedit, vim, emacs (Linux) can be used as a development environment. All you need is to deal with key combinations for starting the server and the interpreter. You can also “communicate” with the server using the Open Sound Control (OSC) protocol using other languages, but in my opinion it is more interesting to deal with the “native” language.

Tongue


Initially, the Smalltalk concept was taken as the basis of the language, but over time, according to the authors, the language acquired features of other languages. The result was a very expressive and compact language. Below are a few examples, and a detailed description of the language can be found in the documentation in the “Language Reference” section.
You can write a GUI to your audio experiments - there are many useful templates: sliders, knobs, analyzers, and more. In addition, MIDI, Wiimote, and other human input devices can be used as controllers.
')

Examples


SuperCollider will require a lot of time for deep learning in return, giving ample opportunities for self-expression, etc. By virtue of their diversity I will give the simplest examples. Detailed information can always be found in surround help containing, among other things, several tutorials.

Let's start with a simple “Cint” and go further:

1) Sine wave signal of 200 Hz in one channel (1st - left by default)

{ SinOsc.ar(200) }.play;

SinOsc is the simplest “UGen” (Unit Generator). You can get acquainted with the set of UGens (Unit Generators) in the corresponding help section.

2) Same as stereo

{ SinOsc.ar(200) ! 2 }.play;

3) Stereo, but different phases in each channel

{ Mix2.ar(SinOsc.ar(200, pi/2), SinOsc.ar(200)) }.play;

or, as an example of multichannel expansion (in the example for 4 channels, with phase difference = pi / 4)

{ SinOsc.ar(200, [0, pi/4, pi/2, pi/4*3]) }.play;

4) Moving the signal from one channel to another with a frequency adjustable by the position of the mouse cursor (from 0.1 to 50 Hz) horizontally

{ Pan2.ar(SinOsc.ar(200), SinOsc.kr(MouseX.kr(0.1,50))) }.play;

5) Modulation of the signal frequency and frequency of transfer from one channel to another

{ Pan2.ar(SinOsc.ar(150, add: SinOsc.kr(50, mul: 20)), SinOsc.kr(SinOsc.kr(0.1).abs*10)) }.play;

6) The same, but with a triangular envelope

{ Pan2.ar(SinOsc.ar(150, add: SinOsc.kr(50, mul: 20)), SinOsc.kr(SinOsc.kr(0.1).abs*25), 1) * EnvGen.ar(Env.triangle(20, 1)) }.play;

Now create a synth:

SynthDef(\simple_synth, { |freq = 60, dur = 0.25, amp = 0.8, out|
Out.ar(out, SinOsc.ar(freq)*EnvGen.ar(Env.triangle(dur, amp), doneAction:2) ! 2);
}).add;


and let's play the pattern on it:

Pbind(
\freq, Pseq([ Pseries(50, 10, 50), Pseries(550, -20, 25) ], inf),
\dur, 1/8
).play;


Pbind, Pseq, Pseries are some of their basic elements for creating melodies and rhythmic patterns. Besides these, there are many others (for example, Pfsm for using the finite-state-machine model) that can be combined. Of course, no one forbids writing your patterns using the desired algorithm.

Links


· Project site
· Code samples with the ability to listen
· Documentation
· The SuperCollider Book book (covers all aspects of SC and even more must have )

Total


SuperCollider is suitable for those who lack the classic DAW (digital audio workstation) and who want to get a more flexible tool for creating music, live performances and other audio (and visual) experiments.

Source: https://habr.com/ru/post/123133/


All Articles