> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sampler.meiji.industries/llms.txt
> Use this file to discover all available pages before exploring further.

# MIDI Implementation

> Complete reference for MIDI mappable actions, control identification, mapping behavior, monitor coverage, and transport response.

# MIDI implementation

Meiji Sampler's MIDI surface covers control mapping, a live monitor, and optional transport response.

## Control identification

Each MIDI control is uniquely identified by three properties:

| Property     | Range      | Description              |
| ------------ | ---------- | ------------------------ |
| Channel      | 1-16       | MIDI channel             |
| Message type | CC or Note | ControlChange or NoteOn  |
| Number       | 0-127      | CC number or note number |

A CC on channel 1 number 60 and a Note on channel 1 number 60 are treated as two separate controls.

## Mapping behavior

Mappings are one-to-one in both directions:

* One control maps to at most one action.
* One action maps to at most one control.

When you move a control that already has a mapping, MIDI Learn returns to the Listening list, selects that mapping row, and briefly shows `already mapped`. Press `Enter` on the selected row to edit that control's assignment. When you pick an action that is already mapped to a different control, MIDI Learn also selects the existing mapping row instead of replacing it.

Mappings are persisted in the settings file and survive app restarts.

After assigning a trigger action, MIDI Learn preselects the next matching trigger target for the next unmapped control:

| Last assigned action | Next preselected action |
| -------------------- | ----------------------- |
| Pad N trigger        | Pad N+1 trigger         |
| Loop N trigger       | Loop N+1 trigger        |
| Scene N trigger      | Scene N+1 trigger       |
| Pad X Chop N trigger | Pad X Chop N+1 trigger  |

Pad, loop, scene, and chop indices stop at the final display slot, `0`. Non-trigger actions keep the exact last assigned action as the next preselected action.

## Mappable actions

### Transport

| Action         | Description                                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Play/Stop      | Follow the focused row's `Space` behavior. Pads stops pad or preview audio first, Loops starts cued or armed transport unless loops are already playing, and Scenes uses the selected scene's play/cue/stop flow. |
| Record/Overdub | Toggle recording or punch into overdub on the currently selected loop slot.                                                                                                                                       |

### Pads

| Action         | Description                                                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| Pad 1-0        | Trigger the pad sample and select the channel. If no sample is assigned, the channel is selected but no source-selection modal opens. |
| Pad N Chop 1-0 | Trigger a specific chop slice on the pad. Enters chop mode and plays from the chop marker.                                            |

Pad slots use display numbering 1-9 then 0 (matching the keyboard number row).

### Loops

| Action           | Description                                                                                                                                                                                       |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Loop 1-0 Trigger | Same behavior as pressing the slot's number key on the loops row. Empty slots arm, idle stopped slots cue, idle cued slots stop, playing slots queue `STOP+`, and `STOP+` slots stop immediately. |
| Loop 1-0 Mute    | Toggle mute on the loop slot. If any layers are muted, unmutes all first.                                                                                                                         |
| Loop 1-0 Solo    | Toggle solo on the loop slot. If already soloed, un-solos all.                                                                                                                                    |
| Loop 1-0 Undo    | Undo the most recent loop edit. Note: undo is global, not scoped to the targeted slot. The slot number controls which slot gets UI focus.                                                         |
| Loop 1-0 Clear   | Clear all recorded content from the loop slot.                                                                                                                                                    |

### Scenes

| Action            | Description                                                                             |
| ----------------- | --------------------------------------------------------------------------------------- |
| Scene 1-0 Trigger | Activate the scene (same behavior as pressing the slot's number key on the scenes row). |
| Scene 1-0 Cue     | Cue the scene using the `Space`-style scene behavior.                                   |
| Scene Stop        | Stop the currently active scene. If a stop is already queued, executes immediately.     |

### Mixer

| Action           | Description                     |
| ---------------- | ------------------------------- |
| Channel 1-0 Mute | Toggle mute on a mixer channel. |

### Keypress

| Action   | Description                                                                                                                                                                                                                                                                                                                                                          |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Keypress | Replay one captured keyboard key through the normal app key handler. Supported keys include printable characters, `Enter`, `Space`, `Tab`, `Backspace`, `Delete`, `Insert`, arrows, `Home`, `End`, `PageUp`, `PageDown`, and function keys `F1` through `F24`. `Esc` is reserved for cancel during capture. Modifier combinations are not supported in this version. |

### PerformFX

These actions are available when the PerformFX feature is enabled.

| Action                             | Description                                             |
| ---------------------------------- | ------------------------------------------------------- |
| FX Slot `[1]` through `[9]`, `[0]` | Trigger the fixed PerformFX slot at the given position. |
| Bank Toggle                        | Switch between PerformFX banks.                         |
| Kill All FX                        | Kill all active PerformFX effects.                      |

## MIDI learn flow phases

The learn flow uses these phases and capture states:

| Phase            | What happens                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Listening        | Waiting for a MIDI control movement. Shows existing mappings.                                                                                                                                                                                                                                                                                                                                                                                  |
| Assigning        | Hierarchical menu for choosing an action. Navigate with `Up`/`Down`/`Enter`/`Esc`. Re-trigger the same MIDI control to select the highlighted row without touching the keyboard.                                                                                                                                                                                                                                                               |
| Keypress Capture | Inside Assigning, the Keypress category captures the next supported physical key. `Esc` cancels capture and returns to the category menu.                                                                                                                                                                                                                                                                                                      |
| Editing Behavior | After a CC leaf action is picked for a Gate-eligible target (Loop slot, Channel Mute, Transport, Scene slot), choose Trigger or Gate, threshold, and invert. `Enter` saves, `Esc` returns to Assigning. One-shot CC targets (Pad, Cue, Kill All, etc.), Note triggers, and Keypress mappings skip this step and commit directly with the default behavior. Press `B` on any existing mapping in the Listening list to edit its behavior later. |

## Trigger behavior

Each mapping carries a Behavior that decides how the control's value drives the action.

| Behavior | Fires action                                                                                                                                                                                                       |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Trigger  | Once, on the rising edge above `threshold` (or falling edge if inverted). Default for Pad, PadChop, Scene Cue, Scene Stop, Loop Mute/Solo/Undo/Clear, Record/Overdub, Bank Toggle, Kill All, Keypress.             |
| Gate     | Action's "on" variant on rising edge above `threshold`, "off" variant on falling edge. Default for CC mapped to Loop slot (play/stop), Channel Mute (unmute/mute), Transport (play/stop), Scene slot (start/stop). |

Both behaviors carry a `threshold` (1-127, default 64) and an `inverted` flag (default false).

* Note triggers always use `Trigger { threshold: 1 }` — note-on with velocity 0 is filtered as Note Off, so any note event is a rising edge.
* CC value 0 is forwarded to the app (it is the falling-edge signal for Gate). Gate mappings will not act on a Recording / Armed loop slot to protect takes in progress.
* Mappings loaded from configs saved before this version load with `Trigger { threshold: 1 }` so existing projects keep their prior behavior.

## MIDI tab shortcuts

### Mappings sub-view (Listening phase)

| Key                     | Action                                                                 |
| ----------------------- | ---------------------------------------------------------------------- |
| `Up` and `Down`         | Navigate mapping list                                                  |
| `Enter`                 | Edit selected mapping                                                  |
| `B`                     | Edit the selected mapping's behavior (Trigger/Gate, threshold, invert) |
| `Delete` or `Backspace` | Remove selected mapping                                                |
| `Esc`                   | Leave MIDI tab                                                         |

### Mappings sub-view (Assigning phase)

| Key                     | Action                                                                |
| ----------------------- | --------------------------------------------------------------------- |
| `Up` and `Down`         | Navigate menu                                                         |
| `Enter`                 | Drill into category or confirm action                                 |
| Same MIDI control       | Drill into the highlighted row or confirm the highlighted leaf action |
| `Esc`                   | Go up one menu level, or return to Listening from the top level       |
| `Delete` or `Backspace` | Remove this control's mapping and return to Listening                 |
| `Shift+Delete`          | Clear all mappings and return to Listening                            |

### Mappings sub-view (Keypress capture)

| Key           | Action                                             |
| ------------- | -------------------------------------------------- |
| Supported key | Assign that keypress to the detected MIDI control  |
| `Esc`         | Cancel key capture and return to the category menu |

### Mappings sub-view (Editing Behavior step)

| Key                | Action                                                                                                                                                   |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Up` and `Down`    | Move focus between Mode / Threshold / Invert rows                                                                                                        |
| `Left` and `Right` | Adjust the focused field (toggle Gate/Trigger on Mode row; ±1 threshold on Threshold row; flip Invert on Invert row). Hold `Shift` for ±10 on Threshold. |
| `G` / `T`          | Switch directly to Gate / Trigger mode                                                                                                                   |
| `I`                | Toggle Invert                                                                                                                                            |
| `Enter`            | Save the mapping and return to Listening                                                                                                                 |
| `Esc`              | Back: return to Assigning (new mapping) or Listening (editing existing)                                                                                  |

### Sub-tab navigation

| Key                | Action                                        |
| ------------------ | --------------------------------------------- |
| `Left` and `Right` | Switch between Mappings and Monitor sub-views |

## MIDI transport

The settings include a `transport_enabled` toggle. When disabled, transport messages are visible in the monitor but do not trigger transport behavior.

## Monitor coverage

The MIDI monitor displays all incoming MIDI events, not just mapping-eligible ones.

Visible message types:

* Note Off, Note On, Poly Pressure
* Control Change, Program Change, Channel Pressure, Pitch Bend
* Clock, Start, Stop, Continue
* Active Sensing, SysEx, Unknown

Clock and Active Sensing generate high message volume and can flood the display. Use monitor filters to suppress them unless diagnosing a sync problem.

## Route allowlist

MIDI mappings use two route rules:

* **Keypress mappings** replay the captured key through the normal key handler after the MIDI control is resolved. They work anywhere the same keyboard key would work, including the Trim/chop editor and other focused modal or view states. The MIDI Mapping assignment page still blocks mapped-controller actions while it is learning a control.
* **Direct app-action mappings** use a conservative allowlist so pad, loop, scene, transport, and mixer actions cannot silently dismiss stateful UI.

The direct-action allowlist is:

| Route            | Direct-action MIDI allowed | Reason                                        |
| ---------------- | -------------------------- | --------------------------------------------- |
| Pads row         | yes                        | main sampler view                             |
| Loops row        | yes                        | main sampler view                             |
| Scenes row       | yes                        | main sampler view                             |
| Channel Detail   | yes                        | channel overlay — no unsaved state            |
| Channel Chop     | yes                        | chop overlay — no unsaved state               |
| Help overlay     | yes                        | read-only; note that pad actions dismiss Help |
| All other modals | no                         | stateful UI could be silently dismissed       |
| All other views  | no                         | stateful UI could be silently dismissed       |

New modal or view variants added to the codebase are blocked by default. New `Channel` variants require an explicit allow or block decision at compile time.

<Note>
  If a direct app-action mapping does nothing, check whether the current view is on this allowlist. If a keypress mapping does nothing, verify that the same physical key works in the current UI state. See [MIDI And Sync Problems](/troubleshooting/midi-and-sync) for more.
</Note>

## Current caution

The public marketing copy still describes MIDI controller support as emerging. Use this page as the implementation reference, not as a promise of broader DAW-style MIDI coverage.

## Related pages

* [MIDI and External Gear](/guides/midi-and-external-gear) — guide to the mapping workflow
* [Muting And Soloing](/guides/muting-and-soloing) — explains channel mute versus loop and track mute behavior
* [MIDI and Sync Problems](/troubleshooting/midi-and-sync) — troubleshooting
* [Keyboard Shortcuts](/reference/keyboard-shortcuts) — full shortcut reference
