-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path02-getting-started.html
219 lines (201 loc) · 17.5 KB
/
02-getting-started.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 2025-02-07 Fri 19:32 -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Getting Started</title>
<meta name="author" content="modula t. worm" />
<meta name="generator" content="Org Mode" />
<link type='text/css' rel='stylesheet' href='css.css' />
</head>
<body>
<div id="preamble" class="status">
<nav>
<ol class="bar">
<li value="0"><a href="index.html">Contents</a></li>
<li><a href="01-introduction.html">Introduction</a></li>
<li><a href="02-getting-started.html">Getting Started</a></li>
<li><a href="03-make-a-sound.html">Make a Sound</a></li>
<li><a href="04-further-soundmaking.html">Further Soundmaking</a></li>
<li><a href="05-sampling.html">Sampling</a></li>
<li><a href="06-sequencing.html">Sequencing</a></li>
<li><a href="07-effects.html">Effects</a></li>
<li><a href="08-architecture.html">Architecture</a></li>
<li><a href="09-other-libraries.html">Other Libraries</a></li>
</ol>
</nav>
</div>
<div id="content" class="content">
<header>
<h1 class="title">Getting Started</h1>
</header><p>
This chapter gives an explanation of the requirements for this guide, as well as some information on how to set them up.
</p>
<div id="outline-container-org1911244" class="outline-2">
<h2 id="org1911244">Requirements</h2>
<div class="outline-text-2" id="text-org1911244">
<p>
To interact with SuperCollider, you will need the following software:
</p>
</div>
<div id="outline-container-org6161283" class="outline-3">
<h3 id="org6161283">SuperCollider</h3>
<div class="outline-text-3" id="text-org6161283">
<p>
The <a href="https://supercollider.github.io/">SuperCollider</a> package provides scsynth, which is the SuperCollider sound server that we will be using. This is the program that actually produces sound.
</p>
</div>
</div>
<div id="outline-container-orgd7d2327" class="outline-3">
<h3 id="orgd7d2327">Emacs</h3>
<div class="outline-text-3" id="text-orgd7d2327">
<p>
<a href="https://www.gnu.org/software/emacs/">Emacs</a> 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.
</p>
</div>
</div>
<div id="outline-container-org691f2c9" class="outline-3">
<h3 id="org691f2c9">SBCL</h3>
<div class="outline-text-3" id="text-org691f2c9">
<p>
<a href="https://www.sbcl.org/">SBCL</a> 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.
</p>
</div>
</div>
<div id="outline-container-orgf87ec11" class="outline-3">
<h3 id="orgf87ec11">SLIME</h3>
<div class="outline-text-3" id="text-orgf87ec11">
<p>
<a href="https://common-lisp.net/project/slime/">SLIME</a> 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.
</p>
</div>
</div>
<div id="outline-container-orgca08edd" class="outline-3">
<h3 id="orgca08edd">Quicklisp</h3>
<div class="outline-text-3" id="text-orgca08edd">
<p>
<a href="https://www.quicklisp.org/beta/">Quicklisp</a> is the de facto Common Lisp library manager. It can be used to install Common Lisp libraries, and will take care of installing their required dependencies as well.
</p>
</div>
</div>
<div id="outline-container-orga39d0f9" class="outline-3">
<h3 id="orga39d0f9">cl-collider</h3>
<div class="outline-text-3" id="text-orga39d0f9">
<p>
<a href="https://github.com/byulparan/cl-collider">cl-collider</a> is the library providing an interface to interact with SuperCollider from Common Lisp.
</p>
</div>
</div>
</div>
<div id="outline-container-org0f4e119" class="outline-2">
<h2 id="org0f4e119">Setting Up</h2>
<div class="outline-text-2" id="text-org0f4e119">
<p>
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.
</p>
<p>
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.
</p>
</div>
<div id="outline-container-orge857eff" class="outline-3">
<h3 id="orge857eff">Portacle</h3>
<div class="outline-text-3" id="text-orge857eff">
<p>
Portacle's <a href="https://portacle.github.io/">official site</a> describes it like so:
</p>
<blockquote>
<p>
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.
</p>
<p>
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.
</p>
</blockquote>
<p>
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.
</p>
<p>
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 <a href="https://supercollider.github.io/download">official site</a> may have a package that works.
</p>
</div>
</div>
<div id="outline-container-org0105006" class="outline-3">
<h3 id="org0105006">Vanilla Emacs</h3>
<div class="outline-text-3" id="text-org0105006">
<p>
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.
</p>
<p>
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 <code>M-x list-packages RET</code>. Then use <code>C-s</code> to search for <code>slime</code>. With your cursor over <code>slime</code>, press <code>i</code> to mark it for installation, and then <code>x</code> to install it.
</p>
<p>
<a href="https://www.quicklisp.org/beta/">The Quicklisp site</a> provides a guide on how to install it on macOS or Linux, and installation on Windows is similar. It's a fairly simple process and most of the work is done for you just by running a few commands in the shell.
</p>
</div>
</div>
</div>
<div id="outline-container-org462cb23" class="outline-2">
<h2 id="org462cb23">Starting Up</h2>
<div class="outline-text-2" id="text-org462cb23">
<p>
Once you've successfully installed all of the above software, start Emacs, open a new lisp file using <code>C-x C-f FILENAME.lisp RET</code> where FILENAME is the name you want to give to your file. Then, you can start SLIME using <code>M-x slime RET</code>. If all goes well, you should see a Lisp REPL that looks something like this:
</p>
<div class="org-src-container">
<pre class="src src-nil">CL-USER>
</pre>
</div>
<p>
So far, so good. Position your cursor after the <code>></code> 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.
</p>
<div class="org-src-container">
<pre class="src src-lisp"><span class="org-rainbow-delimiters-depth-1">(</span>ql:quickload<span class="org-whitespace-space"> </span><span class="org-builtin">:cl-collider</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-whitespace-space"> </span><span class="org-comment">;</span><span class="org-whitespace-space"> </span><span class="org-comment">Load</span><span class="org-whitespace-space"> </span><span class="org-comment">cl-collider</span><span class="org-whitespace-space"> </span><span class="org-comment">into</span><span class="org-whitespace-space"> </span><span class="org-comment">Lisp,</span><span class="org-whitespace-space"> </span><span class="org-comment">automatically</span><span class="org-whitespace-space"> </span><span class="org-comment">installing</span><span class="org-whitespace-space"> </span><span class="org-comment">it</span><span class="org-whitespace-space"> </span><span class="org-comment">and</span><span class="org-whitespace-space"> </span><span class="org-comment">its</span><span class="org-whitespace-space"> </span><span class="org-comment">dependencies</span><span class="org-whitespace-space"> </span><span class="org-comment">if</span><span class="org-whitespace-space"> </span><span class="org-comment">needed.</span>
<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">in-package</span><span class="org-whitespace-space"> </span><span class="org-builtin">:sc-user</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-whitespace-space"> </span><span class="org-comment">;</span><span class="org-whitespace-space"> </span><span class="org-comment">Enter</span><span class="org-whitespace-space"> </span><span class="org-comment">the</span><span class="org-whitespace-space"> </span><span class="org-comment">sc-user</span><span class="org-whitespace-space"> </span><span class="org-comment">package,</span><span class="org-whitespace-space"> </span><span class="org-comment">which</span><span class="org-whitespace-space"> </span><span class="org-comment">contains</span><span class="org-whitespace-space"> </span><span class="org-comment">the</span><span class="org-whitespace-space"> </span><span class="org-comment">user-facing</span><span class="org-whitespace-space"> </span><span class="org-comment">functions</span><span class="org-whitespace-space"> </span><span class="org-comment">and</span><span class="org-whitespace-space"> </span><span class="org-comment">variables</span><span class="org-whitespace-space"> </span><span class="org-comment">exported</span><span class="org-whitespace-space"> </span><span class="org-comment">by</span><span class="org-whitespace-space"> </span><span class="org-comment">cl-collider.</span>
<span class="org-rainbow-delimiters-depth-1">(</span>setf<span class="org-whitespace-space"> </span>*s*<span class="org-whitespace-space"> </span><span class="org-rainbow-delimiters-depth-2">(</span>make-external-server<span class="org-whitespace-space"> </span><span class="org-string">"localhost"</span><span class="org-whitespace-space"> </span><span class="org-builtin">:port</span><span class="org-whitespace-space"> </span>4444<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-whitespace-space"> </span><span class="org-comment">;</span><span class="org-whitespace-space"> </span><span class="org-comment">Create</span><span class="org-whitespace-space"> </span><span class="org-comment">the</span><span class="org-whitespace-space"> </span><span class="org-comment">SuperCollider</span><span class="org-whitespace-space"> </span><span class="org-comment">server</span><span class="org-whitespace-space"> </span><span class="org-comment">object.</span>
<span class="org-rainbow-delimiters-depth-1">(</span>server-boot<span class="org-whitespace-space"> </span>*s*<span class="org-rainbow-delimiters-depth-1">)</span><span class="org-whitespace-space"> </span><span class="org-comment">;</span><span class="org-whitespace-space"> </span><span class="org-comment">Start</span><span class="org-whitespace-space"> </span><span class="org-comment">the</span><span class="org-whitespace-space"> </span><span class="org-comment">SuperCollider</span><span class="org-whitespace-space"> </span><span class="org-comment">server.</span>
</pre>
</div>
<p>
After the last line finishes executing, you're ready to make sound!
</p>
<p>
For reference, here's an example of what it might look like when you run these expressions:
</p>
<div class="org-src-container">
<pre class="src src-lisp">CL-USER><span class="org-whitespace-space"> </span><span class="org-rainbow-delimiters-depth-1">(</span>ql:quickload<span class="org-whitespace-space"> </span><span class="org-builtin">:cl-collider</span><span class="org-rainbow-delimiters-depth-1">)</span>
To<span class="org-whitespace-space"> </span>load<span class="org-whitespace-space"> </span><span class="org-string">"sc"</span>:
<span class="org-whitespace-space"> </span>Load<span class="org-whitespace-space"> </span>1<span class="org-whitespace-space"> </span>ASDF<span class="org-whitespace-space"> </span>system:
<span class="org-whitespace-space"> </span>sc
<span class="org-comment-delimiter">;</span><span class="org-whitespace-space"> </span><span class="org-comment">Loading</span><span class="org-whitespace-space"> </span><span class="org-comment">"cl-collider"</span>
..
<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-builtin">:CL-COLLIDER</span><span class="org-rainbow-delimiters-depth-1">)</span>
CL-USER><span class="org-whitespace-space"> </span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">in-package</span><span class="org-whitespace-space"> </span><span class="org-builtin">:sc-user</span><span class="org-rainbow-delimiters-depth-1">)</span>
#<PACKAGE<span class="org-whitespace-space"> </span><span class="org-string">"SC-USER"</span>>
SC-USER><span class="org-whitespace-space"> </span><span class="org-rainbow-delimiters-depth-1">(</span>setf<span class="org-whitespace-space"> </span>*s*<span class="org-whitespace-space"> </span><span class="org-rainbow-delimiters-depth-2">(</span>make-external-server<span class="org-whitespace-space"> </span><span class="org-string">"localhost"</span><span class="org-whitespace-space"> </span><span class="org-builtin">:port</span><span class="org-whitespace-space"> </span>4444<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>
#<SC-SYNTH<span class="org-whitespace-space"> </span>localhost-127.0.0.1:4444>
SC-USER><span class="org-whitespace-space"> </span><span class="org-rainbow-delimiters-depth-1">(</span>server-boot<span class="org-whitespace-space"> </span>*s*<span class="org-rainbow-delimiters-depth-1">)</span>
VST_PATH<span class="org-whitespace-space"> </span>not<span class="org-whitespace-space"> </span>set,<span class="org-whitespace-space"> </span>defaulting<span class="org-whitespace-space"> </span>to<span class="org-whitespace-space"> </span>/home/user/vst:/usr/local/lib/vst:/usr/lib/vst
Found<span class="org-whitespace-space"> </span>278<span class="org-whitespace-space"> </span>LADSPA<span class="org-whitespace-space"> </span>plugins
JackDriver:<span class="org-whitespace-space"> </span>client<span class="org-whitespace-space"> </span>name<span class="org-whitespace-space"> </span>is<span class="org-whitespace-space"> </span>'SuperCollider'
SC_AudioDriver:<span class="org-whitespace-space"> </span>sample<span class="org-whitespace-space"> </span>rate<span class="org-whitespace-space"> </span>=<span class="org-whitespace-space"> </span>44100.000000,<span class="org-whitespace-space"> </span>driver's<span class="org-whitespace-space"> </span>block<span class="org-whitespace-space"> </span>size<span class="org-whitespace-space"> </span>=<span class="org-whitespace-space"> </span>256
SuperCollider<span class="org-whitespace-space"> </span>3<span class="org-whitespace-space"> </span>server<span class="org-whitespace-space"> </span>ready.
Zeroconf:<span class="org-whitespace-space"> </span>failed<span class="org-whitespace-space"> </span>to<span class="org-whitespace-space"> </span>create<span class="org-whitespace-space"> </span>client:<span class="org-whitespace-space"> </span>Daemon<span class="org-whitespace-space"> </span>not<span class="org-whitespace-space"> </span>running
#<SC-SYNTH<span class="org-whitespace-space"> </span>localhost-127.0.0.1:4444>
JackDriver:<span class="org-whitespace-space"> </span>max<span class="org-whitespace-space"> </span>output<span class="org-whitespace-space"> </span>latency<span class="org-whitespace-space"> </span>11.6<span class="org-whitespace-space"> </span>ms
SC-USER><span class="org-whitespace-trailing"> </span>
</pre>
</div>
<p>
It's not an issue if the output looks a bit 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.
</p>
<p>
<a href="01-introduction.html">Previous: Introduction</a> / <a href="03-make-a-sound.html">Next: Make a Sound</a>
</p>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="date">Created: 2017-06-13 Tue 02:48. Updated: 2025-02-07 Fri 19:32.</p>
</div>
</body>
</html>