Examples
The installed-package examples import clausters from the installed package — no sys.path shim, no target/ directory, no separately built binary for the offline one. Run them after installing the package (see Getting started):
python -m venv .venv && . .venv/bin/activate
pip install ./clients/python # builds + bundles the native libs
-
embedded.py— the same pattern, live from a server running inside the process (Session.embed). Nothing to start: it opens the bundled engine in-process and plays. The batteries-included path. No server process, no socket.python clients/python/examples/embedded.py -
offline_render.py— fully self-contained: renders a short arpeggio to a WAV through the bundled renderer. No server, no audio device.python clients/python/examples/offline_render.py out.wav -
typed_controls.py— also fully self-contained (renders a WAV, no server): aSynthDefwhose controls show the three control types — a laggedfreq(portamento glide), agatetrigger (rate="tr", re-plucking a percussive envelope each set), and adetunedrawn once withrand(anirscalar). ARoutinesetsfreq/gateper note through timetagged bundles. See Building defs.python clients/python/examples/typed_controls.py out.wav -
graph_maths.py— also self-contained (renders a WAV, no server): aSynthDefthat does real per-sample maths —.midicps()for pitch,.distort()for timbre, a comparison-and-.clip2()tremolo — all composing the server's generic operator UGens (S3), bit-identical to the same maths computed off the RT path. See Maths on a UGen graph.python clients/python/examples/graph_maths.py out.wav -
spectral.py— also self-contained (renders a WAV, no server): a frequency-domainfft→pv_brick_wall→ifftchain (S8) that low-passes white noise in the spectral domain, rendered next to the raw noise so the effect is audible. No buffer is allocated; the frame is synth-private scratch on the server. See The frequency-domain chain.python clients/python/examples/spectral.py out.wav -
live_udp.py— the same pattern, live over UDP to a separate, running server. The wheel ships that server as theclausterscommand (or usecargo run --release).clausters # the standalone server, in its own process python clients/python/examples/live_udp.py # in another shell -
transport_sync.py— two independent clients lock to a running server's sample clock and join its shared transport, so aquant-ed routine on each lands on the same bar (sample-aligned). Prints the matching next-bar sample and plays a note on each. See Timing models.python clients/python/examples/transport_sync.py -
osc_responder.py— the client as an OSC hub: anOscFuncrelays incoming/notemessages to a running server as synths, and anOscFuncon/transport.replyre-aligns when a conductor changes the shared transport. Self-feeds a few messages to demonstrate. See Receiving OSC and MIDI.python clients/python/examples/osc_responder.py -
midi_responder.py— aMidiFuncturning a MIDI keyboard into synths on a running server: note-on starts a synth, note-off frees it. Opens a virtual MIDI input port (clausters-in) to wire a source into. Needs thelivecdylib (cargo build --release -p clausters-midi --features live).python clients/python/examples/midi_responder.py -
timeline_transport.py— DAW-style transport over a staticTimeline: captures a pattern into a timeline, edits it, then drives it live with aPlayhead—play,locate(seek),loop, and a songposition. Needs a running server. See Timelines and the playhead.python clients/python/examples/timeline_transport.py -
transport_conductor.py— a conductor's play/stop/locate driving several clients' playheads in lockstep: two followersfollow_transporta running server's shared transport and roll together (sample-exact, since they alsolock_to). Prints their matching song positions. See A DAW-style transport.python clients/python/examples/transport_conductor.py
The first three share their pattern code and differ only in the Server interface — embedded, offline or live — the seam from The client, layer by layer in practice.
The broader catalog of examples (the low-level transports and the raw OSC helpers) lives in the repository-root examples/; those use a sys.path shim so they run straight from a source checkout without an install.
The GUI examples (gui_*.py) drive the clausters GUI host — a separate process (or a browser tab) this client talks to over the same widget protocol. The host itself, including the browser quick-start (the wasm bundle, --ws, and the streamed-meters and fetched-bulk data paths), is documented in the Clausters server book's clients chapter. Two of them close the composition loop: gui_multitrack.py lays out tracks of clips on one shared time axis, and gui_composer.py drives that view from a composition — the arrangement drawn, dragged and re-rendered (see Composition: the arrangement and the multitrack editor, and the step-by-step tutorial Composing a piece, which builds the same piece interactively).