Skip to main content
Glama

synthlot

A Web Audio synthesizer with many instruments in one page. Gramlot builds the page, Kajenn serves it, and MCP clients can play it.

Each instrument is one synthesizer with its sound, its knobs and its held notes. The page shows one panel for each instrument. The browser plays the sound. The server holds only the state of the page, in its PageStore.

Start

uv venv && uv pip install -e .
.venv/bin/synthlot

Open http://127.0.0.1:8790/synthlot/pages/. The default port is 8790. Other options go to kajenn serve, for example --port 9000 or --reload.

Sampled sounds

The sampler plays the recorded samples of a SoundFont. To install the MuseScore General samples (MIT license, about 40 MB):

  1. Download MuseScore_General.sf3 and MuseScore_General_License.md from https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/.

  2. In the deployment directory, run:

    .venv/bin/synthlot samples build MuseScore_General.sf3 MuseScore_General_License.md

The command writes samples/musescore: an index, one file for each preset and one Ogg file for each sample. The samples: storage mount of the site reads that folder, and the app serves it at /synthlot/samples/. A deployment can declare samples: as an s3 mount instead. Without the folder, the library has no Sampled section.

Related MCP server: Epistemic DJ

Play

  • The first click or key on the page starts audio: a browser starts audio only after a user gesture. An MCP client can play only after that first click.

  • Click a panel to give it the computer keys. An orange border marks it. A W S E D F T G Y H U J K O L P ; play C4 to E5.

  • Hold Shift to keep notes. Release Shift to release them.

  • Press Z or X to move the instrument one octave down or up.

  • The sound name in the display of a panel opens the sound library as a menu:

    • General MIDI: the 128 General MIDI programs in their 16 families. The oscillators only approximate acoustic instruments and sound effects;

    • Sampled: the General MIDI programs of the installed sample set, with recorded samples. A sampled sound has no Envelope module and no oscillators: its samples bring their own envelope. Its samples load the first time an instrument or a track uses it;

    • Synth: the synthesizer sounds that General MIDI has no program for, such as Init saw, Sub bass and Supersaw;

    • My sounds: the sounds you saved.

  • The sliders icon opens the Design palette. Its toolbar opens a sound, names and saves the sound and adds an oscillator. An instrument has from 1 to 8 oscillators; the × icon removes one. A wider palette shows more oscillators in a row.

  • The Envelope module sets attack, decay, sustain and release. After the attack, the level falls in about decay ms to sustain percent of the peak.

  • Each instrument has its own volume and balance in its Output module.

  • "+ Add instrument" under the panels adds an instrument. The bin icon on a panel removes it.

  • The Recorder is a drawer at the bottom of the page, closed at the start: its handle opens it and its edge sets its height. Its toolbar has five groups:

    • Song: the song name, new song (asks a name) and import of a MIDI file;

    • Transport: Play / Pause, Stop, Record on the selected track, tempo (BPM), beats of a bar, bar and beat. Pause keeps the position; Stop goes back to bar 1. Without tracks, Play and Stop are off; without a selected track, Record is off;

    • Loop: bars, metronome, quantize of the recording;

    • View: zoom of the lanes;

    • Tracks: add a track with a sound of the library.

  • Every track has its own sound, which names the track; a click on the sound opens the sound library. A click on a track selects it (orange outline): the instrument with the focus takes its sound and plays it. A change of its knobs goes back to the track when you select another track. M mutes a track; ⋯ clears its notes or removes it.

  • To record: select a track, press Record. One bar of metronome counts in, then the loop starts. The notes you play go into the selected track; every turn adds the new notes to the old ones.

  • The import reads a MIDI file from your computer. Each part becomes a track with the General MIDI sound of its program, sampled when the sample set is installed; tempo, meter, loop length and song name follow the file. The drum channel is left out: the recorder has no drums yet.

  • A long song scrolls sideways, the track headers stay on the left, and the lanes follow the playhead.

  • The Master block sets the output volume. Its three icons open scope palettes on the output of every instrument: Waveform, Harmonics and Lissajous.

  • Each palette is a window that you can move, resize and close. You can play while it is open.

Each browser window is a separate page with its own instruments.

Chat

The Chat drawer on the right talks with an assistant that plays the page with the same tools as an MCP client: it prepares tracks, designs sounds and starts the transport. Choose Haiku or Sonnet in its Model menu. The assistant needs an Anthropic API key in the environment of the server:

ANTHROPIC_API_KEY=... .venv/bin/synthlot

The reply comes when the model finishes; meanwhile the page keeps playing, and the message shows the tools it calls.

MCP

The MCP endpoint is http://127.0.0.1:8790/synthlot/_meta/mcp (Streamable HTTP). Add this URL to the MCP client as an HTTP server.

Tool

What it does

list_pages

The open pages and their instruments

list_instruments

The instruments of a page: ID, name, sound, oscillators, held notes

list_sounds

The names of the sounds of the library

add_instrument

A new instrument with its panel

remove_instrument

Remove an instrument and its panel

select_sound

Load a sound of the library into an instrument

add_oscillator

Add an oscillator layer to an instrument (at most 8)

remove_oscillator

Remove an oscillator layer; the last one stays

set_knobs

Set sound, oscillator and keyboard knobs

set_master

Set the Master volume

play_notes

Play notes together for a duration, for example ["C4", "E4", "G4"]

set_transport

Set the tempo (BPM) and the meter (beats per bar)

new_song

Start a new song with a name: no tracks

list_tracks

The song: title, loop length and tracks

set_recorder

Set the loop length in bars, the quantize and the metronome

add_track

Add a track with a sound of the library

set_track

Replace the notes of a track: events (beat, length, notes, velocity)

clear_track

Remove the notes of a track

remove_track

Remove a track

play

Start the transport: every track that is not muted plays in a loop

stop

Stop the transport and release the held notes, or release one instrument

Every tool except list_pages takes an optional page argument. Without it, the tool acts on the page opened last. A wrong argument comes back as a tool error with a message the client can correct.

How it works

  • room.py: Room, a Gramlot PageStore with instruments, library, sounds and master.

  • pages/index.py: the page. Its PageStore is a Room. The browser dataBinder declarations carry each change over the PageStore WebSocket, in both directions.

  • pages/index_aux.js: the Logic. Mixer makes one Instrument (a Web Audio chain) for each instrument of the page. Sequencer plays the tracks on the Web Audio clock, 120 ms ahead. Recording writes the notes played on the instrument of the selected track into that track.

  • assistant.py: the assistant of the chat. It runs a model turn on a thread and calls the MCP tools of the application through its MCP engine, on the server loop.

  • application.py: the Kajenn application. It keeps the room of each open page. Each MCP tool is a @route(channel_channels="mcp") and runs in a Kajenn operation of the pages dispatcher, as the PageStore channel does.

The rooms live in the server process. A restart empties them.

Test

uv pip install -e ".[test]"
.venv/bin/python -m pytest

License

Apache-2.0. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers