# Tessella Studio — User & Technical Manual

> **“The generative studio in your browser.”**  
> A 4-track generative virtual synthesizer, live sound-design lab, and WebAssembly DSP studio — with full Web MIDI and Akai MPC integration.

---

> *Online edition for the public site, https://stephenwil.github.io/tessella-showcase/.*

## Table of Contents

- [Part I — User Manual (Start Here)](#part-i--user-manual-start-here)
  - [1. Welcome to Tessella (Plain-English Basics)](#1-welcome-to-tessella-plain-english-basics)
  - [2. 5-Minute Quickstart](#2-5-minute-quickstart)
  - [3. Anatomy of the Virtual Panel & Keyboard Shortcuts](#3-anatomy-of-the-virtual-panel--keyboard-shortcuts)
  - [4. The 5 Sound Engines (What Makes the Sound)](#4-the-5-sound-engines-what-makes-the-sound)
  - [5. The 13 Generative Engines (What Writes the Notes)](#5-the-13-generative-engines-what-writes-the-notes)
  - [6. Scales, Evolution, Sound Shaping & Live Mixing](#6-scales-evolution-sound-shaping--live-mixing)
  - [7. Studio Tools: Visualizer, WAV Recorder, Presets & Sound Editor](#7-studio-tools-visualizer-wav-recorder-presets--sound-editor)
- [Part II — MIDI & Akai MPC Integration Guide](#part-ii--midi--akai-mpc-integration-guide)
  - [8. How MIDI Works (Beginner Primer)](#8-how-midi-works-beginner-primer)
  - [9. Full Bidirectional MIDI & MPC Capability Matrix](#9-full-bidirectional-midi--mpc-capability-matrix)
  - [10. Connecting Your Akai MPC to Tessella](#10-connecting-your-akai-mpc-to-tessella)
  - [11. Workflow 1 — Playing Tessella Live from MPC Pads (Built-In `QNT MPC` Mode)](#11-workflow-1--playing-tessella-live-from-mpc-pads-built-in-qnt-mpc-mode)
  - [12. Workflow 2 — Sequencing Tessella & Mapping MPC Q-Link Knobs](#12-workflow-2--sequencing-tessella--mapping-mpc-q-link-knobs)
  - [13. Workflow 3 — Sampling Tessella Into Your MPC (4-Track Stems ZIP & Audio)](#13-workflow-3--sampling-tessella-into-your-mpc-4-track-stems-zip--audio)
  - [14. Workflow 4 — Full Bidirectional Clock Sync & Driving Your MPC from Tessella](#14-workflow-4--full-bidirectional-clock-sync--driving-your-mpc-from-tessella)
- [Part III — Technical Reference Manual](#part-iii--technical-reference-manual)
  - [15. System & DSP Architecture](#15-system--dsp-architecture)
  - [16. Complete MIDI CC, RPN & NRPN Reference](#16-complete-midi-cc-rpn--nrpn-reference)
  - [17. Virtual Panel Encoder MIDI Protocol (CC 20–27)](#17-virtual-panel-encoder-midi-protocol-cc-2027)
  - [18. Project Formats (`.tsp`, DX7 `.syx`) & Local Storage](#18-project-formats-tsp-dx7-syx--local-storage)

---
# Part I — User Manual (Start Here)

## 1. Welcome to Tessella (Plain-English Basics)

If you are brand new to synthesizers, generative music, or MIDI, welcome — you do **not** need music theory training or external hardware to make music in Tessella.

In Latin, a *tessella* is a single tile in a mosaic. In **Tessella Studio**, four independent musical tracks interlock like mosaic tiles to create evolving songs, rhythms, melodies, and ambient textures right inside your web browser.

Here are the **seven core concepts** in plain English:

| Concept | Plain-English Meaning |
|---|---|
| **Track (T1 – T4)** | Think of Tessella as a 4-piece band. Track 1 might play drums, Track 2 a bassline, Track 3 chords, and Track 4 a sparkling melody. All four play at the same time. |
| **Sound Engine** | The "instrument" a track plays (e.g., an 80s electric piano/bell, a warm analogue pad, a plucked string, or an 808/909 drum kit). |
| **Generator (`GEN`)** | A smart musical autopilot that invents melodies or drum rhythms for a track in real time — like an infinite collaborator that never plays a wrong note. |
| **Scale & Quantizer (`SCL`)** | A musical safety net. Pick a scale (like Minor or Japanese Hirajoshi), and every note Tessella generates — or that you play on keys/pads — automatically stays in key. |
| **Envelope (`ENV`) & `LFO`** | Tools that shape how a sound behaves over time. An **Envelope** controls how fast a note fades in (*Attack*) and rings out (*Release*). An **LFO** gently wobbles pitch or brightness like vibrato or a slow filter sweep. |
| **MIDI** | A digital language musical gear uses to talk to each other. MIDI does **not** carry audio; it carries *instructions* like *"Play note C3 softly"* or *"Turn knob #1 halfway up."* |
| **WAV Recording** | Capturing the actual audio coming out of Tessella as a lossless stereo `.wav` file that you can drop straight into an Akai MPC, DAW, or audio player. |

---

## 2. 5-Minute Quickstart

1. **Open Tessella Studio**
   - Open <https://stephenwil.github.io/tessella-showcase/> in Chrome, Edge or Firefox.
   - Click **Launch Virtual Synthesizer** (goes to `/sim/`).
2. **Wake Up Audio & Load a Piece**
   - Browsers mute audio until you click once. Scroll down to **Presets & Demos (11)** and click **Play** on **`STILL TIDE`** (ambient drone) or **`KOTO GARDEN`** (generative Japanese plucks) — or click the virtual **`PLAY`** button directly on the synthesizer panel.
3. **Explore the 4 Tracks**
   - Turn the **`ALGORITHM`** knob (or press **Left / Right Arrow** keys) to switch between Tracks **T1**, **T2**, **T3**, and **T4**.
   - Drag **`KNOB 1`** through **`KNOB 4`** vertically (up/down) to hear the sound transform live.
4. **Mute & Solo Like a DJ**
   - Press **`GLO`** (keyboard `6`) to open the live Mixer.
   - Click the first 4 black keys to mute/unmute Tracks 1–4, or hold the white keys to solo a track!
5. **Change the Sound or Vibe**
   - Turn **`PRESETS`** to audition a completely different instrument sound on the active track.
   - Press **`SEQ`** (keyboard `0`) to see the track's **Generator** screen and twist **`KNOB 2`–`KNOB 4`** to change how busy, sparse, or unpredictable the pattern is.
6. **Record Your Jam**
   - Click **`● Record WAV`** in the top studio bar while Tessella is playing. Click **`■ Stop & Save`** when finished — your browser immediately downloads a studio-quality 16-bit / 44.1 kHz `.wav` file ready for your Akai MPC or DAW.

---

## 3. Anatomy of the Virtual Panel & Keyboard Shortcuts

Tessella's virtual faceplate mirrors a compact tactile synthesizer layout:

### Top Controls (7 Encoders + Master Volume)
- **`SELECT`** (Left of screen): Scrolls through pages within the current mode (e.g., switching between `MIXER`, `PERF`, `MIDI IN`, etc. inside `GLO`), or adjusts **Tempo** when on the `GLO` Quick Mixer.
- **`ALGORITHM`** (Right of screen): Switches the active Track (**T1 → T2 → T3 → T4**). *(Can be swapped with `PRESETS` via `HOME` hold → `TRACK KNOB`.)*
- **`PRESETS`**: Browses instrument sounds/patches for the active track.
- **`KNOB 1` – `KNOB 4`**: The four main sound & generator parameters shown across the bottom of the OLED display. Drag vertically with your mouse/touchscreen, or hover and scroll your mouse wheel.
- **`MASTER`**: Overall output volume knob.

### Mode Buttons (Two Rows of 6 + Octave Shift)
| Row 1 (Sound & Global) | Function | Row 2 (Perform & Sequence) | Function |
|---|---|---|---|
| **`FX`** | Per-track Insert FX & global Send FX (Reverb, Echo, Filter, Chorus, etc.) | **`HOME`** | Main overview & live scope; **Hold `HOME`** for the System & MIDI Menu |
| **`SCL`** | Scale, Root note, and Quantizer (`QNT` — including `MPC` pad mode!) | **`SAVE`** | Load / Save projects to memory slots (A, B, C, D) |
| **`ENV`** | Amplitude & Filter Envelopes (Attack, Decay, Sustain, Release) | **`ARP`** | Arpeggiator settings (turn held notes/chords into rhythmic patterns) |
| **`LFO`** | Low-Frequency Oscillators & Modulation routes | **`SEQ`** | Generative engine (`GEN`) & Step Sequencer (`STEP`) pages |
| **`EDIT`** | Deep Sound Engine editor (FM operators, oscillators, filter, drum tuning) | **`PLAY`** | Start / Stop playback |
| **`GLO`** | Live Mixer, `PERF` macros, `PIECE`/`CHAIN` song form, `MIDI IN`, `MIDI OUT` | **`REC`** | Record live playing into `STEP` or capture knob `MOTION` |

- **`OCT-` / `OCT+`**: Shift the keyboard octave down/up. Many screens also have a **secondary "sheet" layer** accessed by holding **`OCT+`** or **`OCT-`** while turning a knob.

### Complete Computer Keyboard Cheatsheet

You can play Tessella right from your computer keyboard without touching the mouse:

| Computer Keys | Tessella Control |
|---|---|
| **`Z X C V B N M , . /`** | Lower white piano keys (`F3` – `A4`) |
| **`S D F  H J  L ; '`** | Lower black piano keys (`F#3` – `A#4`) |
| **`Q W E R T Y U I O`** | Upper chromatic keys (`B4` – `G5`) |
| **`1 2 3 4 5 6`** | Row 1 buttons: **`FX`**, **`SCL`**, **`ENV`**, **`LFO`**, **`EDIT`**, **`GLO`** |
| **`7 8 9 0 - =`** | Row 2 buttons: **`HOME`**, **`SAVE`**, **`ARP`**, **`SEQ`**, **`PLAY`**, **`REC`** |
| **`[` / `]`** | **`OCT-`** / **`OCT+`** |
| **`↑` / `↓`** | Turn **`SELECT`** encoder (next/previous page) |
| **`←` / `→`** | Turn **`ALGORITHM`** encoder (switch Track T1–T4) |

---

## 4. The 5 Sound Engines (What Makes the Sound)

Every one of Tessella's 4 tracks can run any of **five built-in synthesis engines**. Browse sounds with the **`PRESETS`** knob or edit them deeply with **`EDIT`**.

| Engine | Best For | Plain-English Description |
|---|---|---|
| **`FM6`** | Bells, electric pianos, glassy keys, synthwave leads, metallic bass | A classic 6-operator FM synthesizer (inspired by the Yamaha DX7) with 32 algorithms, MODERN / MARK I / OPL modes, and full DX7 `.syx` patch compatibility. |
| **`ORACLE`** | Warm pads, lush strings, brass, punchy analogue bass, sync leads | A classic polyphonic analogue-style synth with two oscillators (A & B), noise, a resonant 4-pole low-pass filter, and **POLY MOD** cross-modulation. |
| **`TRIO`** | Thick basses, simple leads, fifth drones, chiptune-style stacks | Three-oscillator synth with selectable waveforms, musical interval offsets (`INT2`, `INT3`), and rich detuning. |
| **`PHYS`** | Plucks, marimbas, bells, bowed pads, resonant drums, koto | Physical modeling synthesis simulating real vibrating objects: **MODAL** (bars/bells), **STRNG** (plucked/bowed strings), **MEMB** (drum heads), and **SYMP** (sympathetic strings). |
| **`DRUM`** | Punchy electronic beats & percussion | Synthesized **808** and **909** drum kits with 8 dedicated lanes: Kick (`BD`), Snare (`SD`), Clap (`CP`), Closed Hat (`CH`), Open Hat (`OH`), Toms (`TM`), Rimshot (`RS`), and Cowbell (`CB`). |

> **Beginner Tip on Brightness (`CUTOFF`):** On `ORACLE` and `TRIO`, turning brightness moves a classic analogue filter. On `FM6`, it controls the modulator operators' level (`MLVL`) so the tone shifts from mellow sine to glassy shimmer. If you want a resonant DJ-style low-pass sweep on *any* track (including `FM6` or `DRUM`), add the **`FILTER`** insert effect on the **`FX`** page!

![Tessella's 5 Sound Engines — signal flow, presets, voice budget and engine contract](manual/sound_engines_infographic.png)

> **Interactive Infographic:** [Open the Sound Engines Infographic](manual/sound_engines_infographic.html) full-size for crisp SVG diagrams, voice-budget tooltips and light/dark themes.

---

## 5. The 13 Generative Engines (What Writes the Notes)

Press **`SEQ`** to open a track's **`GEN`** (Generator) page. Turn **`KNOB 1`** (`MODE`) to pick between classic manual **`STEP`** sequencing or any of **13 live generative algorithms**:

| Mode | Knobs 2 / 3 / 4 | Musical Character & When to Use It |
|---|---|---|
| **`STEP`** | Pattern / Length / Div | Classic 16/32-step sequencer. Great for writing exact basslines, melodies, or drum grids (or recording live from keys/MPC). |
| **`TURING`** | `LENGTH`, `PROB`, `SPAN` | Inspired by the Eurorack *Turing Machine*. Loops a melody; at `PROB = 0%` it locks forever, at `10–30%` it slowly mutates, at `100%` it invents a new melody every pass. |
| **`EUCLID`** | `STEPS`, `PULSE`, `ROT` | **Euclidean rhythms** — evenly spreads *N* hits across *M* steps (the mathematical basis of Afro-Cuban, techno, and world grooves). Instant hypnotic basslines and hats. |
| **`MARKOV`** | `LEAP`, `DENS`, `SPAN` | A musical "random walk" across scale notes. Low `LEAP` creates smooth, flowing melodies; high `LEAP` jumps dramatically across octaves. |
| **`MORPH`** | `POS`, `SNP A`, `SNP B` | Smoothly crossfades (`POS`) between two rhythmic snapshots (`SNP A` and `SNP B`) — great for building tension. |
| **`ATLAS`** | `X`, `Y`, `DENS` | Inspired by Mutable Instruments *Grids*. A 2D drum-beat map! Twist `X` and `Y` to morph seamlessly across dozens of breakbeat, techno, and dub drum grooves on a **`DRUM`** track. |
| **`BOUNCE` / `FALL`** | `SPEED`, `ANGLE`, `BALLS` | Visual physics synth: 1–4 balls bounce inside a box and play notes when hitting walls. Turn `BALLS` past 4 for **`FALL`** (drifting leaves blown by `WIND`) — magical for ambient pads and chimes. |
| **`AWAKE`** | `LEN A`, `LEN B`, `PROB` | Inspired by Monome Norns *Awake*. Two loops of different lengths play against each other so the melody shifts phase and rarely repeats the same way twice. |
| **`POLY`** | `RHY`, `DIVISION`, `SPAN` | Polyrhythm engine: four independent rhythmic dividers (e.g., `/3` against `/4` against `/5`) triggering four notes. |
| **`QUAD`** | `DIR`, `PROB`, `LINK` | A shared 4×4 musical grid where all four tracks can step through linked rows at different speeds. |
| **`CONSTL`** | `Y`, `DENS`, `SPEED` | Inspired by *Constellation*. A starship flies through a starfield; stars crossing the crosshair trigger notes. Great for shimmering arps and cinematic textures. |
| **`SERIES`** | `START`, `INTV`, `LOOP` | Per Nørgård's mathematical *Infinity Series* — self-similar, fractal melodies that unfold endlessly without sounding random. |
| **`CHORD`** | `PROG`, `BARS`, `HIT` | Generates full chord progressions (`POP`, `50S`, `2-5-1`, `CIRCLE`, `DRONE`, `WALK`, `USER`) as held pads, rhythmic beats, or dub `OFFBEAT` stabs. Other tracks can even follow its chords! |
| **`ANSWER`** | `VARY`, `ECHO`, `FADE` | **Call & Response.** Play a short phrase on the keys (or your Akai MPC!) and pause — Tessella listens and plays back evolving variations that drift and echo. |

---

## 6. Scales, Evolution, Sound Shaping & Live Mixing

### Staying in Key (`SCL`)
Press **`SCL`** (keyboard `2`) to pick your song's **Root Note** (e.g., `D`, `E`, `C`), **Scale** (Minor, Major, Dorian, Pentatonic, Hirajoshi `HIRA`, Kumoi, etc.), and **Quantizer (`QNT`)**:
- **`SNAP`**: Snaps incoming notes to the nearest scale note.
- **`WHITE`**: Maps white keys directly up the scale.
- **`CHRD`**: Snaps every track to the active chord played by a `CHORD` track — instant harmonic cohesion!
- **`MPC`**: Dedicated Akai MPC 16-pad scale layout (covered in detail in [Section 11](#11-workflow-1--playing-tessella-live-from-mpc-pads-built-in-qnt-mpc-mode)).

### Musical Keys for Beginners: Home Note + Note Family
A **key** tells you two things: which note feels like **home** (the *tonic* or root), and which **scale** supplies the notes that tend to fit around it. For example, **C major** has C as home and uses the notes C, D, E, F, G, A, and B. A key is not a single keyboard key, and it does not set the tempo or instrument.

The C-major scale follows this spacing pattern. **W** means a whole tone (two semitones); **H** means a half tone (one semitone):

| Note | C | D | E | F | G | A | B | C |
|---|---|---|---|---|---|---|---|---|
| Gap to next note | W | W | H | W | W | W | H | — |
| Role | Home |  |  |  |  |  | Pulls toward home | Home |

Chords are small groups of notes from the scale. In C major, a familiar progression is **I–IV–V–I**:

| Degree | Chord | Notes | Common feeling |
|---|---|---|---|
| I | C major | C–E–G | Home; settled |
| IV | F major | F–A–C | Moves outward |
| V | G major | G–B–D | Builds tension; often leads home |
| I | C major | C–E–G | Returns home |

**Try hearing the pull:** play C–D–E–F–G–A–B, then C. Ending on C often feels settled; stopping on B can make you expect the next C. This is one way a key's sense of home can be heard.

**Major and minor keys can share notes but have different homes.** C major and A minor use the same seven natural notes, but C is home in C major while A is home in A minor. The key alone does not guarantee a happy or sad mood; rhythm, chords, instrument sounds, and note choices all contribute.

In Tessella, choose a track's **Root** and **Scale** on `SCL`. **Key Link** shares the key across linked melodic tracks. `QNT` modes such as `SNAP`, `WHITE`, and `CHRD`, along with the `CHORD` and `HARM` tools, can use that scale or harmony; ordinary `STEP` notes are not necessarily changed unless a suitable quantizer or harmony feature is active.

### Long-Form Evolution (`EVOLVE` & `FORM` / `GLO`)
Tessella isn't just a 1-bar loop box:
- **`EVOLVE`** (inside `SEQ` pages): Gently drifts generator notes, accents, or rests over time.
- **`GLO → PIECE` / `CHAIN` / `ENTRIES`**: Creates automatic song structures (intros, builds, breakdowns, and AABA sections) where tracks fade in and out over minutes.
- **`GLO → MIXER` (Quick Performance View)**:
  - **Black keys**: Mute / Unmute Tracks 1–4.
  - **White keys**: Momentary Solo while held (`D4` holds the generator line, `E4` triggers a drum/pattern `FILL`, `F4` taps tempo).
  - **`KNOB 1`–`4`**: Track volume levels.
  - **`SELECT`**: Master Tempo (BPM).

### Effects (`FX`)
Every track has **Insert FX** (such as resonant `FILTER`, saturation/drive, bitcrush) plus **3 Global Send FX** (typically lush Reverb, Stereo Echo/Delay, and Chorus/Modulation). Use the `FX` page to dial in how much of each track feeds the delay and reverb.

---

## 7. Studio Tools: Visualizer, WAV Recorder, Presets & Sound Editor

Tessella Studio wraps the synthesis engine in a dedicated browser workstation:

### Real-Time Audio Visualizer
Located below the synthesizer faceplate:
- **Modes**: **`Dual Split`** (waveform + frequency bars side-by-side), **`Oscilloscope`** (time-domain waveform), and **`Spectrum FFT`** (real-time harmonic analyzer).
- **Gain**: `0.5x`, `1.0x`, `2.0x`, or `4.0x` zoom for quiet ambient pads.
- **Freeze**: Pauses the display so you can inspect a waveform or harmonic spectrum.
- **Stereo Peak Meters**: Left/Right level bars with **`CLIP`** overload indicators.

### 1-Click Lossless WAV & 4-Track Stems (ZIP) Recorder
- Located in the studio toolbar below the OLED bar, with two recording modes:
  - **`Stereo WAV`**: Click **`● Record to WAV`** to capture the full stereo master mix (with global reverb/echo) as a lossless **16-bit / 44.1 kHz Stereo PCM `.wav`**.
  - **`4-Track Stems (ZIP)`**: Select **`4-Track Stems (ZIP)`** and click **`● Record 4-Track Stems`** to capture **5 sample-accurately synchronized WAV files** in one lossless `.zip` archive:
    - `00_MASTER_MIX.wav` — Full stereo master mix (with global FX sends)
    - `01_T1_<ENGINE>.wav` — Isolated Track 1 stem (pre-master, 16-bit / 44.1 kHz PCM)
    - `02_T2_<ENGINE>.wav` — Isolated Track 2 stem
    - `03_T3_<ENGINE>.wav` — Isolated Track 3 stem
    - `04_T4_<ENGINE>.wav` — Isolated Track 4 stem
- Zero compression, zero sample drift, and natively compatible with Akai MPC samplers and all DAWs.

### Designer Shells & OLED Optics
- **14 Designer Shells**: Switch the entire studio aesthetic (color palettes and faceplate styles) using the **Shell** swatches below the panel.
- **7 OLED Phosphor Tints**: **`Amber 590nm`**, **`Matrix Green`**, **`Ice Cyan`**, **`Pure White`**, **`Neon Pink`**, **`Shell Match`**, and **`Classic RGB`**, plus toggles for **Phosphor Glow** and **CRT Scanlines** (saved automatically in your browser).

### Preset & Demo Library (11 Pieces)
Scroll to **`Presets & Demos (11)`** to load into Slots A–D or audition in 1 click:
- **3 Original Studio Pieces**: `IRON COMET` (arcade shoot-'em-up, FM brass, played as a SONG), `SOFT LANTERN` (lullaby), `AFTERGLOW SIGNAL` (cinematic squelch dance).
- **8 Classic Demos**: `STILL TIDE`, `KOTO GARDEN`, `LOW HARBOUR`, and more.

### Sharing Your Songs (Links, Files & the Showcase)
Three ways to pass a song on, from lightest to heaviest:
- **🔗 Share link** (under the panel, next to *Save as file*): copies a link that holds your **whole song as it is right now**, unsaved edits included (about 1.5 KB of text). Whoever opens it gets a **▶ Switch on & Play** button and hears your song, then can change it and send their own link back. Nothing is uploaded: the song travels inside the link (after `#song=`), which browsers never send to a server.
- **Save as file**: the same song as a `.tsp` file (a few dozen KB) for backups, email, or the Sound Editor. *Load a file* brings it back into any slot.
- **Record WAV / 4-Track Stems**: the sound itself, for SoundCloud, video, or your MPC / DAW.

The **Showcase** (`/showcase/`) plays any of these: the built-in tunes, a dropped `.tsp`, or a pasted share link (**🔗 Open a Share Link**). Its **🔗 Share** and **🎛 Remix in Studio** buttons carry the playing song with them. Built-in tunes also have short links: `/sim/?tune=koto-garden`.

### Sound Editor & Preset Librarian (`/editor/`)
A big-screen editor for the song playing in the Studio. Open the **Virtual Synthesizer** and press **Switch on**, then open **⚡ Web Editor** (or the Hub's Sound Editor card): it connects to the Studio by itself (**Connect to Studio** if not), and every change plays at once. Both tabs must be in the same browser; close or reload the Studio and the editor waits, then reconnects when you switch on again.
- Every sound parameter of each track, grouped (ENV, LFO, the engine's EDIT page, FX sends, scales), plus engine and preset choice.
- Visually inspect and edit FM6 operator ratios, envelopes, and algorithms.
- Import classic **Yamaha DX7 `.syx`** SysEx patch banks directly into Tessella!
- Manage, organize, and back up `.tsp` project files.

---

# Part II — MIDI & Akai MPC Integration Guide

This section is written specifically for pairing **Tessella** with an **Akai MPC** (MPC One / One+, MPC Live / Live II, MPC X / X SE, MPC Key 37 / 61, or MPC Studio / MPC Software) — even if you've never configured MIDI before.

## 8. How MIDI Works (Beginner Primer)

Think of MIDI like **sheet music sent over a cable**, while Audio is the **actual sound**:

- **MIDI Cable (USB or 5-pin DIN):** Sends notes (*"Pad A01 pressed hard"*), knob twists (*"Q-Link 1 turned to 80"*), and pitch bends. You will **not** hear audio through a MIDI cable alone.
- **MIDI Channels (1 to 16):** Like 16 TV channels sharing one cable. By default, Tessella listens on **Channels 1, 2, 3, and 4** — one channel for each of Tessella's 4 tracks!
- **MIDI CC (Continuous Controller, 0 to 127):** Every knob or slider on your MPC (like **Q-Links**) sends a numbered **CC** message (from `0` to `127`) with a value from `0` (all the way left) to `127` (all the way right).

---

## 9. Full Bidirectional MIDI & MPC Capability Matrix

Tessella Studio features a complete bidirectional Web MIDI & Sync bridge (`MIDI & MPC SYNC` bar directly below the recorder):

| Feature | Status | Details |
|---|---|---|
| **MPC → Tessella: Notes & Pads (Web MIDI IN)** | ✅ **Live** | Play all 4 Tessella tracks from MPC pads, MPC MIDI tracks, or an external keyboard (velocity, pitch bend, mod wheel, sustain, aftertouch). |
| **Built-In `QNT MPC` Pad Scale Mode** | ✅ **Live** | Dedicated Akai MPC 16-pad scale quantizer (`SCL → QNT = MPC`) built directly into the engine. |
| **MPC Q-Links → Tessella Knobs (CC & MIDI LEARN)** | ✅ **Live** | Control filters, FM brightness, FX sends, generator knobs, or virtual panel encoders (`CC 20–27`). |
| **External MIDI Clock Sync (`0xF8` / Start / Stop)** | ✅ **Live** | Tick **`Ext Clock Sync (MPC/DAW)`** in the `MIDI & MPC SYNC` bar so your Akai MPC drives Tessella's Start, Stop, Continue, Song Position (`0xF2`), and BPM lock automatically! |
| **Tessella → MPC: Web MIDI OUT (Generators + Keys)** | ✅ **Live** | Tick **`MIDI Out`** and choose your MPC MIDI port + **`Notes: ALL`** so Tessella's **13 generative engines** (`TURING`, `EUCLID`, `ATLAS`, `BOUNCE`, `CHORD`, etc.) directly play your Akai MPC drum kits, Keygroups, and plugin synths! |
| **Tessella → MPC: Master Clock Out (`24 PPQN`)** | ✅ **Live** | Tick **`Clock Out (24 PPQN)`** to send MIDI Start, Stop, and 24 PPQN Clock from Tessella to lock your Akai MPC to Tessella's tempo. |
| **Tessella → MPC: 4-Track Stems WAV ZIP** | ✅ **Live** | 1-click export of **5 synchronized 16-bit / 44.1 kHz PCM `.wav` files** (Master Mix + isolated Tracks 1–4) ready to drop straight into MPC Drum Programs, Audio Tracks, and Keygroups! |

---

## 10. Connecting Your Akai MPC to Tessella

### Step 1: Use a Web MIDI-Capable Browser
Open Tessella in **Google Chrome**, **Microsoft Edge**, or **Brave** (Safari and Firefox have limited or disabled Web MIDI support).  
Open the Studio at <https://stephenwil.github.io/tessella-showcase/sim/>.

### Step 2: Connect the MPC Physically
Choose whichever matches your setup:
- **Option A — 5-Pin MIDI DIN to USB (Easiest for Standalone MPC):**  
  Connect a USB-MIDI interface cable from your MPC's **`MIDI OUT`** (5-pin DIN) into a USB port on the computer running Tessella. *(Works with zero mode switching on the MPC!)*
- **Option B — Direct USB Cable (MPC in Controller Mode / MPC Software / USB-MIDI):**  
  Connect the MPC's USB-B/USB-C port to your computer. On MPC Studio or MPC Software (or standalone MPCs running over a USB-MIDI bridge), route an MPC MIDI Track's output port to your computer's virtual MIDI port (e.g., ALSA/PipeWire `Midi Through` on Linux, IAC Driver on macOS, or loopMIDI on Windows).

### Step 3: Enable Web MIDI in Tessella
1. Scroll just below the Tessella panel to the **MIDI controls** bar.
2. Check the **`MIDI in`** checkbox. Your browser will ask permission to access MIDI devices — click **Allow**.
3. Tessella automatically connects to **all** available MIDI input ports and displays the connected device name(s).

### Step 4: Set Track Routing Inside Tessella (`GLO → MIDI IN`)
1. Press **`GLO`** (keyboard `6`).
2. Turn **`SELECT`** (or press **`↑`/`↓`**) until the screen shows **`MIDI IN`**.
3. Check **`ROUT`**:
   - **`CH1-4`** *(Recommended for MPC multi-track sequencing)*: MPC MIDI Channel 1 plays Track 1, Channel 2 plays Track 2, Channel 3 plays Track 3, and Channel 4 plays Track 4.
   - **`SEL`** *(Best for casual single-track jamming)*: Whatever MIDI channel your MPC sends always plays whichever Tessella track is currently selected on screen.
4. Optional **`DRUM`** channel: Leave **`OFF`** to address a `DRUM` track by its normal track number (`1–4`), or set it to **`10`** if you prefer General MIDI Channel 10 for drums.
5. Make sure **`MIDI CC IN`** is **`ON`** (hold **`HOME`** → scroll to **`MIDI CC IN`**) so Q-Link knob automation reaches Tessella.

---

## 11. Workflow 1 — Playing Tessella Live from MPC Pads (Built-In `QNT MPC` Mode)

Tessella has a **hidden gem** built right into its scale quantizer: a dedicated **`MPC`** mode specifically designed for playing melodic instruments from an Akai MPC's 16 velocity-sensitive pads!

### How to Enable `QNT MPC`
1. Select the Tessella track you want to play (e.g., an `FM6` bell, `ORACLE` pad, or `PHYS` koto).
2. Press **`SCL`** (keyboard `2`).
3. Pick your **Root** and **Scale** (for example: Root `D`, Scale `MINOR` or `HIRA`).
4. Set **`QNT`** (Quantizer) to **`MPC`**.
5. Set **`DEGREE`** (a special setting that only appears when `QNT = MPC`) to choose which scale degree sits on the second pad (`1` = Root note).

### How Your MPC Pads Map in `QNT MPC` Mode
- On your MPC, create a **MIDI Track** pointing to your MIDI Out port and the Tessella track's channel (e.g., Channel 1).
- In `QNT MPC` mode, Tessella listens specifically to **MIDI Notes `20` through `35`** (Bank H, pads `H01`–`H16` in MPC's default chromatic pad layout) and maps those 16 pads sequentially up your chosen Tessella scale!
  - Pad 1 (`Note 20`) = lowest scale note
  - Pad 2 (`Note 21`) = Root (when `DEGREE = 1`)
  - Pads 3–16 (`Notes 22–35`) = consecutive notes climbing cleanly up the scale.
- Use Tessella's **`OCT-`** and **`OCT+`** buttons to shift all 16 MPC pads down or up by octaves.

> **Alternative (Using MPC Pad Perform Mode Instead):**  
> If you prefer keeping your MPC on its default **Bank A** (MIDI notes `36–51`) or using the MPC's own **Pad Perform** screen (Chords / Chromatic / Notes), simply leave Tessella's **`QNT`** set to **`SNAP`** (or **`OFF`**). Every pad note will play normally and optionally snap into Tessella's scale!

---

## 12. Workflow 2 — Sequencing Tessella & Mapping MPC Q-Link Knobs

Turn your Akai MPC into the master brain driving Tessella's 4 sound engines!

### Multi-Track Sequencing (4 Instruments at Once)
1. In Tessella, set **`GLO → MIDI IN → ROUT = CH1-4`**.
2. On any Tessella track you want the MPC to sequence (instead of Tessella's internal generator), set that track's **`SEQ → GEN`** mode to **`STEP`** with an empty pattern — or keep a Tessella generator running on Tracks 1 & 2 while your MPC sequences bass and leads on Tracks 3 & 4!
3. On your Akai MPC, create up to 4 MIDI Tracks:
   - **MPC Track 1 (MIDI Ch 1)** → drives Tessella **T1** (e.g., `DRUM` 808/909 or `FM6` lead)
   - **MPC Track 2 (MIDI Ch 2)** → drives Tessella **T2** (e.g., `TRIO` sub bass)
   - **MPC Track 3 (MIDI Ch 3)** → drives Tessella **T3** (e.g., `ORACLE` warm chords)
   - **MPC Track 4 (MIDI Ch 4)** → drives Tessella **T4** (e.g., `PHYS` plucked melody)
4. **Pro Tip — Call & Response with `ANSWER`:** Set Tessella Track 4's generator to **`ANSWER`**! Play a quick riff on your MPC pads on Channel 4, stop, and Tessella will automatically echo and mutate your riff back to you in key.

### Controlling Tessella Knobs from MPC Q-Links (3 Easy Methods)

You have **three ways** to control Tessella with your MPC's physical **Q-Link** knobs:

#### Method A: MIDI LEARN (Easiest — Zero CC Numbers to Memorize!)
1. In Tessella, **hold `HOME`** to open the System Menu.
2. Scroll to **`MIDI LEARN`** and turn **`KNOB 2`** right (or press `OCT+`). The screen says **`LEARN: A KNOB`**.
3. Turn any knob on any Tessella screen (e.g., Filter Cutoff, FM Brightness, Reverb Send, or Turing `PROB`). The screen asks **`SEND A CC`**.
4. Twist any Q-Link knob on your MPC (set the MPC Q-Link mode to **MIDI / Project MIDI CC**).
5. Done! You can teach Tessella up to **16 custom Q-Link mappings** across any tracks and pages. Press **`OCT-`** when finished.

#### Method B: Fixed Engine & Generator CCs (Recordable in MPC Automation!)
Assign your MPC MIDI Track's Q-Links (or draw automation lanes in the MPC Grid Editor) to Tessella's fixed CCs on that track's MIDI channel:

| MPC Q-Link CC | What It Controls on That Tessella Track |
|---|---|
| **CC 16 / 17 / 18 / 19** | The track's **4 `HOME` Sound Knobs** (the fastest way to sculpt any sound) |
| **CC 74 / CC 71** | **Brightness / Filter Cutoff** (`CC 74`) and **Resonance** (`CC 71`) |
| **CC 73 / 75 / 79 / 72** | Amp Envelope: **Attack** (`73`), **Decay** (`75`), **Sustain** (`79`), **Release** (`72`) |
| **CC 7 / CC 10** | Track **Volume** (`7`) and **Pan** (`10`, center = 64) |
| **CC 91 / 93 / 94** | **FX Sends 1, 2, and 3** (Reverb, Echo, Chorus) |
| **CC 102** | Switch **Generator `MODE`** (`TURING`, `EUCLID`, `ATLAS`, etc.) |
| **CC 103 / 104 / 105** | **Generator `KNOB 2`, `KNOB 3`, `KNOB 4`** (e.g., Turing Length/Prob/Span or Atlas X/Y/Dens) |

#### Method C: Virtual Panel Knob Mode (`#knobson` — Hands-On Synth Control)
1. In Tessella's browser MIDI bar, tick the **`Knobs CC 20–27`** checkbox (`#knobson`) and choose **`abs`** (Absolute 0–127) for standard MPC Q-Links.
2. Now, regardless of MIDI channel, your MPC's Q-Links directly turn Tessella's **7 physical faceplate encoders + Master Volume**:
   - `CC 20`: `SELECT` · `CC 21`: `ALGORITHM` (Track) · `CC 22`: `PRESETS`
   - `CC 23`–`26`: `KNOB 1`–`KNOB 4` (whatever is currently shown on the OLED screen!)
   - `CC 27`: `MASTER` volume.

---

## 13. Workflow 3 — Sampling Tessella Into Your MPC (4-Track Stems ZIP & Audio)

Even without a single MIDI cable, **Tessella + Akai MPC is an incredible hybrid sampling workflow**. Tessella excels at generative melodies, glassy FM textures, polyrhythmic percussion, and evolving ambient beds — and the MPC excels at chopping, resampling, arranging, and performing.

### Path A: 1-Click 4-Track Stems (ZIP) Export (Best for MPC!)
1. Set Tessella's tempo (`GLO` → turn `SELECT`) to match your MPC project BPM (or lock them via MIDI Clock in Section 14!).
2. In the recorder toolbar below the OLED bar, click **`4-Track Stems (ZIP)`**.
3. Click **`● Record 4-Track Stems`**, let 4 or 8 bars play, then click **`■ Stop & Export Stems ZIP`**.
4. Tessella immediately downloads `tessella-stems-YYYYMMDD-HHMMSS.zip` containing **5 sample-accurately aligned 16-bit / 44.1 kHz PCM WAV files**:
   - `00_MASTER_MIX.wav` (Stereo mix with global FX)
   - `01_T1_<ENGINE>.wav` through `04_T4_<ENGINE>.wav` (each individual Tessella track completely isolated!)
5. Unzip onto your MPC's SD card / USB drive (or drag into MPC Software):
   - **Drop each stem onto its own MPC Audio Track** for instant 4-track mixing, muting, and MPC insert FX (Air Flavor Pro, Half Speed, Mother Ducker, etc.)!
   - **Chop individual stems** in **`Sample Edit` → `Chop` → `BPM`** into a **Drum Program** so you can flip just the koto melody or just the drums on your 16 pads.
   - **Build Keygroup Programs**: Record a single sustained `C3` note and load it into an MPC **Keygroup** to play that Tessella synth patch standalone anywhere.

### Path B: Live Audio Sampling Straight Into MPC Inputs
1. Run a stereo cable from your computer's headphone out or audio interface Line Out into your MPC's **1/4" Line Inputs (`In 1/2`)**.
2. Open the MPC **`Sampler`** screen, set Monitor to `IN` (or `AUTO`), and arm Threshold recording.
3. Hit **`PLAY`** on Tessella and twist **`KNOB 1`–`4`** live while the MPC captures your performance directly onto a pad or Audio Track.

---

## 14. Workflow 4 — Full Bidirectional Clock Sync & Driving Your MPC from Tessella

Use the **`MIDI & MPC SYNC`** bar directly beneath Tessella's recorder toolbar for tight two-way hardware sync:

### Mode A: Akai MPC as Master Clock → Tessella Follows Automatically
1. On your Akai MPC, go to **`Preferences` → `MIDI / Sync`** and set **Sync Send** to **`MIDI Clock`** on the MIDI output port connected to your computer.
2. In Tessella's **`MIDI & MPC SYNC`** bar, tick **`Ext Clock Sync (MPC/DAW)`**. The badge switches to **`EXT CLOCK`**.
3. Press **`PLAY START`** on your Akai MPC — Tessella immediately starts in lockstep, tracks your MPC's exact BPM (shown live in the badge), and stops cleanly when you hit **`STOP`** on the MPC!

### Mode B: Tessella's 13 Generators Playing Your Akai MPC (Web MIDI OUT)
Turn Tessella into a **4-track generative MIDI brain** playing your Akai MPC's Drum Programs, Keygroups, and plugin synths (Hype, Jura, Tubesynth, Fabric, etc.)!
1. Connect a MIDI path from your computer back into the MPC's **`MIDI IN`** (via USB-MIDI interface or virtual USB-MIDI port).
2. In Tessella's **`MIDI & MPC SYNC`** bar:
   - Tick **`MIDI Out`**.
   - Select your MPC's MIDI output port from the **Output Port** dropdown.
   - Leave Notes Mode on **`Notes: ALL (Generators + Keys)`**.
   - *(Optional)* Tick **`Clock Out (24 PPQN)`** if you want Tessella to act as Master Clock driving your MPC's tempo (set MPC `Sync Receive = MIDI Clock`).
3. On your Akai MPC, assign your Drum Program or Synth Tracks to listen on **MIDI Channels 1–4** (matching Tessella's Tracks T1–T4, or customize per track on Tessella's `GLO → MIDI OUT` page; you can even set a track's **`SOUND = OFF`** on `GLO → MIDI OUT` + `OCT+` if you only want it to drive your MPC silently!).
4. Hit **`PLAY`** on Tessella — watch the amber MIDI OUT LED blink as `TURING`, `EUCLID`, `ATLAS`, `BOUNCE`, and `CHORD` perform your Akai MPC live!

---

# Part III — Technical Reference Manual

This section documents Tessella's internal DSP architecture, WebAssembly FFI, MIDI protocol tables and file formats. The engine's complete source is published with the site (`source/`).

## 15. System & DSP Architecture

Tessella compiles the core C multi-engine synthesizer DSP engine (stored in `firmware/src/` for upstream source compatibility) via **Emscripten/Clang to WebAssembly** (`docs/webapp/sim/melodee.wasm`) and runs it inside a dedicated high-priority **`AudioWorkletProcessor`** thread (`docs/webapp/sim/worklet.js`).

```
┌─────────────────────────────────────────────────────────────────────────┐
│ Browser Main Thread  (docs/webapp/sim/index.html)                       │
│  • Virtual Panel UI (SVG faceplate, 7 encoders, 14 buttons, 27 keys)    │
│  • 240×240 OLED Canvas + Phosphor Tint & CRT Scanline Compositor        │
│  • Web MIDI API Listener (navigator.requestMIDIAccess -> MIDIInput)     │
│  • Real-Time AnalyserNode Visualizer (Dual Scope / Spectrum FFT / Peak) │
│  • 1-Click PCM WAV Encoder (Float32 stereo -> 16-bit/44.1kHz WAV)       │
└───────────────────────────────┬─────────────────────────────────────────┘
                                │ MessagePort (enc, btn, key, midi, slot,
                                │              frame RGBA, LED masks, PCM)
┌───────────────────────────────▼─────────────────────────────────────────┐
│ AudioWorklet Thread  (docs/webapp/sim/worklet.js)                       │
│  • Instantiates melodee.wasm (44.1 kHz, 128-sample render quantum)      │
│  • Panel Encoder CC 20–27 translator (abs / bin / twos / sign)          │
│  • Calls web_render(128) every ~2.9 ms, copies web_out_l / web_out_r    │
│  • Streams 240×240 RGB565 framebuffer & LED planes back at ~60 Hz       │
└───────────────────────────────┬─────────────────────────────────────────┘
                                │ C ABI / WASM Linear Memory
┌───────────────────────────────▼─────────────────────────────────────────┐
│ WebAssembly DSP Core  (web/sim/sim.c + firmware/src/*.c)                │
│  • 4 Tracks × 5 Engines (FM6, ORACLE, TRIO, PHYS, DRUM)                 │
│  • 13 Generative Engines + STEP/ARP + EVOLVE + FORM/CHAIN               │
│  • Per-track Insert FX + 3 Global Send FX + Master Bus                  │
│  • MIDI Control Engine (midi_control.c, midi_cc.c, midi_learn.c)        │
└─────────────────────────────────────────────────────────────────────────┘
```

### Key Technical Specifications
- **Sample Rate:** `44,100 Hz` stereo float32 internal bus (exported WAVs are 16-bit signed PCM stereo at 44.1 kHz).
- **Render Block Size:** `128` samples per Web Audio quantum (`~2.90 ms` DSP block).
- **UI Tick Rate:** `web_ms()` advances control-rate timers (`CTL`) and renders the `240×240` display framebuffer every `15 ms` (~66 Hz).
- **Zero-Allocation Real-Time Path:** All voices, delay lines, FM operators, and generative states live inside static WASM linear memory; no GC pauses occur in the DSP loop.

---

## 16. Complete MIDI CC, RPN & NRPN Reference

Incoming Web MIDI channel messages (`0x80`–`0xEF`) pass from `docs/webapp/sim/index.html` → `worklet.js` → `web_midi(status, d1, d2)` in `web/sim/sim.c` → `midi_event()` in `firmware/src/midi_control.c` and `midi_cc()` in `firmware/src/midi_cc.c`.

> **Dispatch Precedence:**
> 1. If **Panel Knob Mode (`#knobson`)** is checked in the browser UI, `CC 20–27` are intercepted in `worklet.js` to drive the virtual faceplate encoders and `MASTER` volume (they do *not* reach `midi_cc.c`).
> 2. **MIDI LEARN** (`mlearn_receive()`): Any learned CC (up to 16 slots) intercepts the CC on **any channel** and overrides the fixed CC map, even if `MIDI CC IN` is `OFF`.
> 3. **Fixed Parameter & Engine CCs** (active when `MIDI CC IN` is `ON`, routed per `GLO → MIDI IN → ROUT`):

### Channel Voice & Standard Controllers (`firmware/src/midi_control.c`)

| Message / CC | Function | Notes |
|---|---|---|
| `0x80` / `0x90` | Note Off / Note On | Velocity sensitive; respects `SCL → QNT` (including `MPC` notes `20–35`). |
| `0xD0` | Channel Aftertouch | Routed to modulation matrix (`mod_midi`). |
| `0xE0` | Pitch Bend (14-bit) | Range configurable via RPN 0 (`±0..24` semitones, `0..99` cents). |
| **CC 1** | Mod Wheel (`MODW`) | Modulation matrix & cord source. |
| **CC 5** | Glide (`P_GLIDE`) | Track portamento / glide time. |
| **CC 7** | Track Level (`P_LEVEL`) | Track mixer amplitude. |
| **CC 10** | Track Pan (`P_PAN`) | Centered at `64` (`value - 64`). |
| **CC 11** | Expression (`EXPR`) | Modulation source. |
| **CC 64** | Sustain Pedal | `>= 64` holds notes (ignored on `DRUM` tracks); `< 64` releases pedal-held notes. |
| **CC 71** | Engine Resonance | Engine-mapped macro (filter resonance where supported). |
| **CC 72** | Release (`P_REL`) | Amp release; on `FM6`, scales all 6 operators' native EG Rate 4 (`R4`). |
| **CC 73** | Attack (`P_ATK`) | Amp attack; on `FM6`, scales all 6 operators' native EG Rate 1 (`R1`). |
| **CC 74** | Engine Brightness / Cutoff | Engine-mapped macro (cutoff/brightness where supported). |
| **CC 75** | Decay (`P_DEC`) | Amp decay; on `FM6`, scales all 6 operators' native EG Rate 2 (`R2`). |
| **CC 100 / 101** | RPN LSB / MSB | `RPN 0` (`CC 101=0`, `CC 100=0`) + `CC 6`/`CC 38` sets Pitch Bend range (`0–24` semis, `0–99` cents). |
| **CC 120** | All Sound Off | Immediate 1-block fade kill on target tracks, ignoring sustain pedal. |
| **CC 121** | Reset All Controllers | Resets bend, mod wheel, RPN state, and releases sustain pedal (preserves bend range). |
| **CC 123** | All Notes Off | Releases held notes on channel (honors sustain pedal). |

### Tessella Fixed Engine & Generator CCs (`firmware/src/midi_cc.c`)

| CC Range | Parameter | Scope |
|---|---|---|
| **CC 16 – 19** | Engine **`HOME` Knobs 1–4** | Track (mapped to the active engine's 4 primary timbre macros) |
| **CC 20 – 27** | Engine **`E1` – `E8`** (`EDIT` pages 1 & 2) | Track *(only when browser `#knobson` Panel Knob Mode is OFF)* |
| **CC 76** | `LFO RATE` | Track |
| **CC 77** | `LFO → PITCH` depth | Track |
| **CC 78** | `LFO → FILTER` depth | Track |
| **CC 79** | `SUSTAIN` (`P_SUS`) | Track |
| **CC 91** | `FX SEND 1` | Track |
| **CC 93** | `FX SEND 2` | Track |
| **CC 94** | `FX SEND 3` | Track |
| **CC 102** | Generator **`MODE`** | Track (`0–127` spans all modes in `GEN` page order) |
| **CC 103 – 105** | Generator **`KNOB 2`, `KNOB 3`, `KNOB 4`** | Track (controls active mode's 3 parameters, e.g. Turing `LENGTH`/`PROB`/`SPAN`) |

### Full-Engine NRPN Addressing (7-Bit & 14-Bit Precision)

Every internal parameter in [`docs/PARAMETERS.md`](PARAMETERS.md) (`pid.h`) can be controlled via **NRPN**:
- **`0x000`–`0x0FF`**: Track parameters
- **`0x100`–`0x1FF`**: Project parameters (e.g., Tempo, Send FX — accepted on any mapped track channel)
- **`0x200`+**: Generator parameters

**Encoding Formula:**
1. Send **CC 99 (NRPN MSB)** = `Math.floor(param_id / 128)` (`param_id >> 7`)
2. Send **CC 98 (NRPN LSB)** = `param_id % 128` (`param_id & 0x7F`)
3. Send **CC 6 (Data Entry MSB)** = `0..127` (7-bit value)
4. *(Optional)* Send **CC 38 (Data Entry LSB)** = `0..127` for 14-bit resolution (`(msb << 7) | lsb`).

**Worked Example — Track 1 `TURING PROB` (`0x202` = decimal `514`):**
- `CC 99 = 4` (`514 >> 7`), `CC 98 = 2` (`514 & 127`), `CC 6 = 64` (~50% probability) on MIDI Channel 1.

---

## 17. Virtual Panel Encoder MIDI Protocol (CC 20–27)

When **`#knobson`** is enabled in the browser UI, `docs/webapp/sim/worklet.js` maps **CC 20–27** (on any channel) directly to virtual panel hardware inputs:

| CC | Virtual Panel Control | Engine Role Index (`web_enc`) |
|---|---|---|
| **CC 20** | `SELECT` | `0` |
| **CC 21** | `ALGORITHM` (Track) | `1` |
| **CC 22** | `PRESETS` | `2` |
| **CC 23** | `KNOB 1` | `3` |
| **CC 24** | `KNOB 2` | `4` |
| **CC 25** | `KNOB 3` | `5` |
| **CC 26** | `KNOB 4` | `6` |
| **CC 27** | `MASTER` Volume | `web_master(Math.round(val * 1023 / 127))` |

**Supported Controller Modes (`#knobmode`):**
- **`abs`**: Absolute `0–127` pot/Q-Link (delta computed from previous CC value; first message seeds baseline).
- **`bin`**: Binary offset relative encoder (`64 + n` clockwise, `64 - n` counter-clockwise).
- **`twos`**: Two's complement relative encoder (`1..63` clockwise, `127..65` → `-1..-63` counter-clockwise).
- **`sign`**: Sign-bit relative encoder (`1..63` clockwise, `65..127` → `-(v - 64)` counter-clockwise).

---

## 18. Project Formats (`.tsp`, DX7 `.syx`) & Local Storage

- **`.tsp` (Tessella Project File):** Compact binary snapshot storing all 4 tracks' sound engine choices, patch parameters, generator settings, `STEP` patterns, `FORM`/`CHAIN` song structure, FX settings, scale, tempo, and MIDI routing. Demo `.tsp` files live in `docs/webapp/sim/demos/`.
- **Share links (`/sim/#song=…`):** the same `.tsp` record, deflated (`CompressionStream("deflate-raw")`) and base64url-encoded into the URL fragment by `docs/webapp/sim/share.js` (~1.5 KB for a ~24 KB project). Opening one loads it into Slot A at switch-on; damaged links and anything inflating past 256 KB are refused.
- **`.syx` (Yamaha DX7 SysEx):** Standard 32-voice DX7 bulk dumps (`4104` bytes) or single-voice dumps can be imported into **`FM6`** tracks via the **Sound Editor** (`/editor/`).
- **Browser Persistence (`localStorage`):** Visual preferences (selected shell theme, OLED phosphor tint `tessera-oled-theme`, glow `tessera-oled-glow`, scanlines `tessera-oled-scanlines`) persist across reloads automatically.

---
