Getting Started

This chapter gives an explanation of the requirements for this guide, as well as some information on how to set them up.

1 Requirements

To interact with SuperCollider, you will need the following software:

1.1 SuperCollider

The SuperCollider package provides scsynth, which is the SuperCollider sound server that we will be using. This is the program that actually produces sound.

1.2 Emacs

Emacs is a well-known text editor. It is specialized for writing Lisp code, and can even be extended using its own dialect of Lisp called Emacs Lisp or Elisp. Emacs is recommended because it has facilities to enhance writing and interacting with Lisp programs. It is possible to use another editor instead, but for the purposes of this guide we are assuming that Emacs is being used.

1.3 SBCL

SBCL is Steel Bank Common Lisp, a compiler of Common Lisp code. It is the program that reads and evaluates your Lisp code. Many other Lisp compilers exist, but SBCL is a good choice to start off with because it is fast and well-supported.

1.4 Slime

Slime is the "Superior Lisp Interaction Mode for Emacs". It is effectively the link between Emacs and the Lisp processs, however it also provides many more advanced features for interacting with a Lisp program.

1.5 Quicklisp

Quicklisp is the de facto Common Lisp library manager. It can be used to install Common Lisp libraries, and will take care of the required dependencies for those libraries for you.

1.6 cl-collider

cl-collider is the Lisp library that provides an interface to SuperCollider.

2 Setting Up

To set up a basic environment for writing Lisp, there are two options you should consider. First, if you're already familiar with Emacs or want to start from scratch, you may prefer simply adapting your current configuration to work with Lisp; see "Vanilla Emacs", below, for more information on that. It should be noted, however, that setting up Emacs and Lisp from scratch is already considered to be a somewhat involved process, and is thus not recommended for people unfamiliar with Emacs.

Instead, if that's the case for you, it's strongly suggested to simply use Portacle. Portacle is effectively a software bundle containing SBCL, Slime, Quicklisp, and Emacs already preconfigured to work together. Using Portacle will generally get you up and running fairly quickly with little additional configuration needed on your end. In our case, the only additional configuration should be installing SuperCollider.

2.1 Portacle

Portacle's official site describes it like so:

Portacle is a complete IDE for Common Lisp that you can take with you on a USB stick. It is multi-platform and can be run on Windows, OS X, and Linux. Since it does not require any complicated installation process, it is set up and running in no time.

It lends itself very well both to absolute beginners of Lisp that just need a good starting point, as well as advanced users that want to minimise the time spent getting everything ready.

If you're using Linux, your distribution's standard package manager may already have a package for Portacle available, and it's recommended you start off by trying that one first. Alternatively, if it doesn't, or if you're on another OS, you can download and install the package from Portacle's official site.

Once you've installed it, you'll want to continue by installing SuperCollider. Again, install it from your OS's official package manager if possible. Otherwise, SuperCollider's official site may have a package that works.

2.2 Vanilla Emacs

It's outside the scope of this guide to give detailed information on how to set all of these programs up, but if you're using a Linux-based operating system, your package manager most likely provides packages for SuperCollider, Emacs, and SBCL for you. Simply installing those packages should suffice.

Your package manager may provide Slime, but if not, it's possible to install it using Emacs' standard package manager. You can run the package manager in Emacs by typing M-x list-packages RET. Then use C-s to search for slime. With your cursor over slime, press i to mark it for installation, and then x to install it.

The Quicklisp site provides a guide on how to install it on Mac OS or Linux. It's a fairly simple process and most of the work is done for you just by running a few commands in the shell.

Since cl-collider is now available in Quicklisp, all you have to do to install it is type the following once Quicklisp is loaded in your Lisp image: (ql:quickload :cl-collider) . This will download and install the library and all of its dependencies, and then make it available for use in your Lisp session.

3 Starting Up

Once you've successfully installed all of the above software, start Emacs, open a new lisp file using C-x C-f FILENAME.lisp RET where FILENAME is the name you want to give to your file. Then, you can start slime using M-x slime RET. If all goes well, you should see a Lisp REPL that looks something like this:

CL-USER>

So far, so good. Position your cursor after the > and then type the following Lisp expressions, one at a time. After each expression, you may see some output before getting a prompt back again.

(ql:quickload :cl-collider)

(in-package :sc-user)

(setf *s* (make-external-server "localhost" :port 4444))

(server-boot *s*)

Once you run that last line, you're ready to make sound!

For reference, here's an example of what it might look like when you run these expressions:

CL-USER> (ql:quickload :cl-collider)
To load "sc":
  Load 1 ASDF system:
    sc
; Loading "cl-collider"
..
(:CL-COLLIDER)
CL-USER> (in-package :sc-user)
#<PACKAGE "SC-USER">
SC-USER> (setf *s* (make-external-server "localhost" :port 4444))
#<SC-SYNTH localhost-127.0.0.1:4444>
SC-USER> (server-boot *s*)
VST_PATH not set, defaulting to /home/user/vst:/usr/local/lib/vst:/usr/lib/vst
Found 278 LADSPA plugins
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 44100.000000, driver's block size = 256
SuperCollider 3 server ready.
Zeroconf: failed to create client: Daemon not running
#<SC-SYNTH localhost-127.0.0.1:4444>
JackDriver: max output latency 11.6 ms
SC-USER> 

…Of course, it may be slightly different for you. As long as you don't get any errors, you should be good to go. In the next chapter, we'll take it for a spin, and make our first sound.

Last updated: 2020-04-22 Wed 15:39