Load Coypu into a Pharo image, choose a sound engine, and make sure the two are talking to each other before you write a single pattern.
1. What Coypu is, and is not
Coypu is a package of classes and methods for Pharo designed for live-coding music. It was originally built as a controller for SymbolicSound Kyma over OSC, and today drives any OSC-capable application, MIDI hardware, or the Phausto DSP engine running inside the same image.
Its string-oriented syntax owes a debt to TidalCycles, and the name is a tribute to Kyma's Capytalk dialect — the coypu being a rodent closely related to the capybara.
2. Requirements
| Requirement | Detail |
|---|---|
| Pharo | 11, 12 or 13. Examples here target 13 unless noted |
| Platform | macOS, Windows or Linux |
| A sound engine | At least one of the backends in §4 |
Download Pharo from pharo.org/download. The Pharo Launcher is the easiest way to manage images. If you would rather not assemble anything, the Launcher also offers a Pharo Music image with Coypu and Phausto already installed — see the Phausto install notes.
3. Installing Coypu
3.1 Via Metacello
Open a Playground (Cmd-O W, or Cmd-P in some images), paste this, select it all and evaluate with Cmd-D / Ctrl-D:
Metacello new
baseline: 'Coypu';
repository: 'github://lucretiomsp/coypu:master';
load.
master
Coypu is on master, while Phausto is on main. It is an easy
mix-up and Metacello's error when you get it wrong is not especially clear.
3.2 What comes with it
Coypu's baseline declares two external dependencies, so both arrive automatically:
| Package | Source | Why |
|---|---|---|
| OSC | github://Ducasse/OSC/src | Open Sound Control messaging — how Coypu talks to SuperDirt, Kyma and Pure Data |
| Phausto | github://lucretiomsp/phausto:main/src | The in-image DSP engine, including EcoPhausto and TurboPhausto |
librariesBundle folder next to
your .image file. Until that is in place, Phausto loads but makes no sound —
see Phausto § Installation.
MIDI is not included. For MIDI in and out you also need Pharo-Sound — see §4.3.
4. Choosing a sound engine
Coypu routes everything through a Performer. Choosing a backend means choosing a Performer subclass and handing it to the Performance:
p := Performance uniqueInstance.
p performer: PerformerSuperDirt new.
| Performer | Sends to | Needs |
|---|---|---|
| PerformerPhausto | A Phausto DSP in this image | Phausto's native libraries |
| PerformerSuperDirt | SuperDirt, over OSC | SuperCollider + SuperDirt running |
| PerformerMIDI | External MIDI hardware | Pharo-Sound (PortMidi) |
| PerformerKyma | A Kyma Paca(rana), over OSC | Kyma hardware on the network |
| PerformerLocal | Any local OSC listener | Something listening on the port |
performer: calls muteAll before and after switching, so every
running pattern is removed. Choose your backend first, then build your patterns.
4.1 Phausto — in the image
The shortest path to sound, because nothing external has to be running. Phausto compiles a DSP inside Pharo and Coypu drives it directly.
TurboPhausto start.
tp := TurboPhausto new.
p := Performance uniqueInstance.
p performer: PerformerPhausto new.
p activeDSP: tp.
EcoPhausto is the lighter rack if the full one is slow to compile on your
machine. Both are documented in
Phausto § TurboPhausto.
PerformerPhausto raises “There must be an active DSP for this
performance” if activeDSP: was never set. See §6.
4.2 SuperDirt / SuperCollider
The richest sample library, and the backend most live coders already have. Install SuperCollider, then SuperDirt, and start SuperDirt before you play anything:
"in SuperCollider, not Pharo"
SuperDirt.start;
"then in Pharo"
p := Performance uniqueInstance.
p performer: PerformerSuperDirt new.
Coypu sends OSC to 127.0.0.1 on port 57120, the port
sclang listens on, using the /dirt/play message. Instrument names become
SuperDirt sample folder names, so #bd, #sn and #cp
work out of the box.
4.3 MIDI hardware
Install Pharo-Sound, which wraps PortMidi over uFFI:
Metacello new
baseline: 'PharoSound';
repository: 'github://pharo-contributions/pharo-sound:main';
load.
/src on this one
Pharo-Sound still uses the older Monticello package layout rather than Tonel, so its
repository path has no /src suffix — unlike Coypu's and Phausto's.
Then set the MIDI performer and give it an output device. PerformerMIDI holds
its sender on the class side:
p performer: PerformerMIDI new.
PerformerMIDI midiOut: aMidiSender.
Each Sequencer carries a midiChannel, so route patterns to channels with
midiCh:to:. Coypu also emits MIDI clock and a start message, which means
hardware sequencers and arpeggiators will follow your tempo.
4.4 Kyma
The backend Coypu was originally written for. Coypu resolves the Paca(rana) by its
Bonjour name — something like beslime-51.local — and sends OSC to port
8000, addressing Kyma's Virtual Control Surface:
p performer: PerformerKyma new.
Instrument names map to VCS labels: a Sequencer at #bass drives
/vcs/bassGate/1 and /vcs/bassNote/1. Coypu also sends the tempo
to a BPM label.
4.5 Any other OSC application
PerformerLocal targets a generic OSC listener on localhost — Pure Data,
Max/MSP, ChucK, a browser, anything. Each triggered step sends a gate and a note message
built from the instrument name:
p performer: PerformerLocal new.
A Sequencer at #bass produces /bassNote and
/bassGate, the gate going to 1, waiting the note's duration, then returning to
0. See Phausto & MIDI for the message formats.
5. Verify the install
Smallest possible test. Evaluate line by line:
p := Performance uniqueInstance.
p performer: PerformerSuperDirt new. "or whichever backend you set up"
p freq: 120 bpm.
16 downbeats to: #bd.
p play.
p stop.
Four evenly spaced hits and then silence means Coypu, the Performer and the engine are all connected. If the code runs cleanly but you hear nothing, the problem is between the Performer and the engine rather than in Coypu — work through §6.
You can also confirm the package loaded without making any sound at all:
Rhythm list size. "how many named rhythms are available"
Performance uniqueInstance. "the singleton; should not error"
7. Troubleshooting
Metacello cannot find the baseline
Check the branch: Coypu is master, not main. See §3.1.
Coypu loaded but there is no sound at all
No Performer has been set, so nothing is being sent anywhere. p performer: … —
§4.
“There must be an active DSP for this performance”
You are on PerformerPhausto without an activeDSP:. Start a rack and
assign it — §4.1.
Phausto loaded but every note is silent
The native libraries are missing. They are a separate download and must sit beside your image file — §3.2.
SuperDirt makes no sound although SuperCollider is running
SuperDirt.start must have been evaluated, not just sclang booted. Check the
SuperCollider post window for the line saying SuperDirt is listening on 57120.
My patterns disappeared when I changed backend
Expected: performer: mutes everything on the way in and out. Set the backend
first — §4.
Kyma does not respond
The Paca(rana) is resolved by Bonjour name. Confirm the machine is reachable at its
beslime-NN.local address and that the VCS labels match your instrument names —
§4.4.