Skip to content

Quickstart

Welcome, Extempore traveller. If you don’t have a favourite text editor or don’t usually build things from source (or don’t know what those things even mean) then these instructions will get you up & running asap.

Non-VSCode editors

This quickstart guide is based on VSCode. If you’d prefer to use another editor (e.g. Emacs, Atom, ST, Vim) then that’s fine as well—these boxes will explain how your setup process will be different.

Here’s the stuff you only need to do once.

VSCode (a.k.a. Visual Studio Code) is freely available on all the operating systems that Extempore runs on (macOS, Windows & Linux). To install VSCode, go to the homepage and hit the big “Download” button (you can’t miss it). Once you’ve installed VSCode, you need to install the VSCode Extempore extension—this tells VSCode how to deal with Extempore code.

Open the Command Palette, type in a few characters of the command Extensions: Install Extensions until it shows up, then hit return. Then, search for “Extempore” and install the extension.

Grab the latest release from the GitHub releases page, unzip it and put it wherever you like (e.g. in your Documents folder). Then set the Extempore: Sharedir VSCode config setting to point at that folder—this lets VSCode start Extempore for you (we’ll do that in the next step).

Here’s the stuff you need to do every time you want to work with Extempore.

You can start Extempore using the Extempore: Start command (again, you can find this command using the command palette). It’ll open up a terminal, cd into your extempore folder, and start the Extempore running. If you see something like this, everything’s working—nice one.

.-. .-. .-.
/ \ / \ / \ e x t e m p o r e
-' '-' '-' '- cyberphysical programming
Extempore 0.11.2, LLVM 22.1.8, arm64-apple-darwin23.6.0 (apple-m1)
Audio: MacBook Pro Speakers, 2 out, 44100 Hz, 1024 frames, 23 ms latency
nREPL server started on port 7888 on host 127.0.0.1 - nrepl://127.0.0.1:7888
Loaded xtmbase in 1.63 s
Ready: connect your editor to nREPL port 7888 (or the legacy server on 7099)

Open (or create) a file ending in .xtm. VSCode finds the running Extempore by itself, through its nREPL server on port 7888, so there’s nothing to connect.

Non-VSCode editors

This quickstart guide is based on VSCode. If you’d prefer to use another editor (e.g. Emacs, Atom, ST, Vim) then that’s fine as well—these boxes will explain how your setup process will be different.

Here’s the stuff you only need to do once.

VSCode (a.k.a. Visual Studio Code) is freely available on all the operating systems that Extempore runs on (macOS, Windows & Linux). To install VSCode, go to the homepage and hit the big “Download” button (you can’t miss it). Once you’ve installed VSCode, you need to install the VSCode Extempore extension—this tells VSCode how to deal with Extempore code.

Open the Command Palette, type in a few characters of the command Extensions: Install Extensions until it shows up, then hit return. Then, search for “Extempore” and install the extension.

Grab the latest release from the GitHub releases page, unzip it and put it wherever you like (e.g. in your Documents folder). Then set the Extempore: Sharedir VSCode config setting to point at that folder—this lets VSCode start Extempore for you (we’ll do that in the next step).

Here’s the stuff you need to do every time you want to work with Extempore.

You can start Extempore using the Extempore: Start command (again, you can find this command using the command palette). It’ll open up a terminal, cd into your extempore folder, and start the Extempore running. If you see something like this, everything’s working—nice one.

.-. .-. .-.
/ \ / \ / \ e x t e m p o r e
-' '-' '-' '- cyberphysical programming
Extempore 0.11.2, LLVM 22.1.8, arm64-apple-darwin23.6.0 (apple-m1)
Audio: MacBook Pro Speakers, 2 out, 44100 Hz, 1024 frames, 23 ms latency
nREPL server started on port 7888 on host 127.0.0.1 - nrepl://127.0.0.1:7888
Loaded xtmbase in 1.63 s
Ready: connect your editor to nREPL port 7888 (or the legacy server on 7099)

Extempore is now just sitting waiting for you to tell it what code to execute. Before you can do this, you first need to connect your text editor to the running Extempore session. In VSCode, you do this with the Extempore Connect command.

Starting primary process
Trying to connect to 'localhost' on port 7099
New Client Connection
Successfully connected to remote process
Loading xtmbase library... done in 1.505913 seconds
New Client Connection

If everything’s gone to plan, you’ll see one more message at the very bottom of the terminal:

Accepted a connection to the primary process

Congrats, you’re connected… and almost there.

Non-VSCode editors

Remember, if you’re not using VSCode, all the concepts are the same, but the names of the commands or the keyboard shortcuts might be different—I’m sure you’ll manage 😉, and you can find the specific details for your editor in the editor support guide.

To evaluate some code, move your cursor into a particular bit of code and hit ctrl+return (cmd+return on macOS). The code should flash, its result should appear at the end of the line, and you should hear anything it plays.

As a quick test, try and evaluate something like:

(println "Hello, World!")

If you can see "Hello, World!" in the terminal, then you’ve just evaluated your first Extempore code! 🙌 🎉 🥳 🙌

Loaded xtmbase in 1.63 s
"Hello, World!"

Try modifying the code and re-evaluating it—the code is live, so you can change and re-evaluate things without having to re-start Extempore.

If you want to stop the Extempore process, just ctrl+c in the terminal where extempore is running to kill it. If you want to start it up again, then go back to step 1. VSCode finds the new Extempore by itself.

Since Extempore has multimedia programming as a core part of its DNA, here’s “Hello, Sine!”—the full version lives at examples/core/hello-sine.xtm.

(bind-func sine:DSP
(lambda (in time chan dat)
(* .1 (cos (* (convert time) .04)))))
;; tell Extempore to use `sine` as the audio output sink
(dsp:set! sine)

If you want to turn it off, just re-define the dsp function to return “silence”:

(bind-func sine:DSP
(lambda (in time chan dat)
0.0))

In the code above we’ve used 0.0, but any constant value will work (because physics).

If you’re more interested in playing “notes” than doing lower-level DSP stuff, then there’s an Extempore library which is designed to get you up and running quickly with a couple of synths & samplers.

Here’s a one-liner example (using Extempore’s built-in pattern language) of how to play an ascending scale loop:

;; need to load this first, but only once
(sys:load "examples/sharedsystem/setup.xtm")
;; then, this will trigger an 8-note "ascending scale" loop starting at middle C
(:> ascending-scale 4 0 (play syn1 @1 80 dur) (scale 4 8))

Feel free to play around with (and re-evaluate) some of the parameters in that ascending-scale and try and figure out how it all fits together, and when you want to go further check out the pattern language guide.

These simple code examples gloss over some subtleties of what’s going on. But hey, if you’ve managed to get started quickly(ish), then this Quickstart page has done its job. To understand the subtleties, well, that’s what the rest of the documentation is for 😊

When you’re chewing on life’s gristle
Don’t grumble, give a whistle
And this’ll help things turn out for the best

Most of the time Extempore will guess the correct audio device, but not always. So if you’re not getting any sound, it could be because Extempore is sending sound output to the wrong audio device.

To print the list of audio devices that Extempore can “see”, open a terminal and type the command ./extempore devices (or ./extempore.exe devices if you’re on Windows) and hit return. On my machine right now it says this, but yours will (almost certainly) be different.

0: DisplayPort (Core Audio, 0 in, 2 out)
1: Studio 24 (Core Audio, 2 in, 2 out)
2: MacBook Pro Microphone (Core Audio, 1 in, 0 out) [default input]
3: MacBook Pro Speakers (Core Audio, 0 in, 2 out) [default output]

If you do want Extempore to use a particular audio device, you can pass either the device index or the device name through an additional option. For example, if you want Extempore to use the MacBook Pro Speakers, either of these would work (again, remember to use ./extempore.exe if you’re on Windows):

./extempore --device 3
./extempore --device "MacBook Pro Speakers"

Glitchy sound? “Audio underflow” warning messages in the terminal?

Section titled “Glitchy sound? “Audio underflow” warning messages in the terminal?”

Especially if you’re using the sharedsystem (e.g. in the “hello scale” example above), it’s actually kindof heavyweight1 (or at least medium-weight) from a CPU use perspective. It loads up 4 analogue synths and a sampler, plus some FX (e.g. global convolution reverb) and tries to distribute them across multiple cores on your machine.

If you’re getting lots of “audio underflow” messages, you’ve got a few options, in order of easiest fixes to most difficult:

  1. don’t run any other software on your machine that you don’t absolutely need for the gig

  2. try starting Extempore with a larger frame size (e.g. ./extempore --frames 8192)

  3. if you don’t need MIDI I/O, just load (sys:load "examples/sharedsystem/audiosetup.xtm") instead of (sys:load "examples/sharedsystem/setup.xtm")

  4. remove some of the dspN (for N = 1..5) functions from the signal chain in examples/sharedsystem/audiosetup.xtm (e.g. if you’re only using syn1 and syn2 you could remove dsp3 from the signal chain, which uses dspmt as the final output sink)

  5. try doing it on a beefier machine (not an option for many people, obviously)

If you go with option #4, remember that you can create a new copy of audiosetup.xtm and modify it to your heart’s content. Even if you’ve just been messing with the original audiosetup.xtm file directly, remember that you can get a “pristine” version at any time from GitHub.

Windows users: if you ever see the error message VCRUNTIME140_1.dll was not found, then you’ll need to download the x64 vc_redist.x64.exe—make sure you get it from the official Windows website, because there are lots of sketchy places on the web which will try and get you to download theirs, and who knows what they’ve done with it?

  1. I mean, it’s still supposed to work on a half-decent laptop—it shouldn’t require a real beast—but if you’re on a particularly old/wheezy machine then even with the below tricks the sharedsystem might not be a good choice. The other examples (e.g. examples/core/fmsynth.xtm) show how to create a lighter-weight DSP chain, and from there you could add only the instruments & effects that you need. ↩