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

# MIR Capture

> Capture an incoming MIDI performance and seed the engines with your playing

# MIR Capture

MIR Capture analyzes incoming MIDI notes in real time and builds a **Performance Fingerprint** — a multi-dimensional model of the playing style. The fingerprint then seeds RESERVOIR's rhythm, pitch, perforation, and micro-timing engines, so generated output inherits characteristics of the captured performance while still being shaped by RESERVOIR's algorithmic pipeline.

## How It Works

Capture is automatic. Route MIDI input to the track that hosts RESERVOIR and play. The **engine status** label in the bottom bar reflects the capture state:

| Label                        | State                | What's happening                                                   |
| ---------------------------- | -------------------- | ------------------------------------------------------------------ |
| `Idle`                       | No MIDI received yet | Engines run normally                                               |
| `Learning... N notes (X%)`   | Capturing            | Note-ons are accumulating; confidence rises as more notes arrive   |
| `Seeded: <Key> (key fit X%)` | Seeded               | Fingerprint is computed; engines that support seeding are using it |

Hover the status label for a multi-line tooltip with the full fingerprint breakdown (detected key, grid resolution, swing, density, phrase length, articulation profile, polyphony).

### State Machine

```
Idle → Capturing → Seeded
 ↑                   │
 └───────────────────┘
```

The machine transitions:

* **Idle → Capturing** — On the first incoming MIDI note-on
* **Capturing → Seeded** — Once enough notes are captured for a stable fingerprint (\~8 notes minimum, 30+ for reliable rhythm/groove)
* **Seeded → Idle** — On a transport jump or region boundary (`onPlayheadDiscontinuity`); the next note-on restarts capture from scratch

There are no manual CAPTURE / STOP / APPLY buttons — the state advances automatically based on incoming MIDI and transport state.

## What Gets Analyzed

The Performance Fingerprint captures six dimensions:

### Pitch Model

* **Pitch-class transition matrices** (PPM-Decay variable-order Markov), separate ascending and descending
* **Interval distribution** — preference for stepwise motion vs leaps
* **Scale + root detection** via Krumhansl-Schmuckler key correlation
* **Register histogram** — which octave ranges are favored
* **Register slope** — whether playing trends upward or downward

### Rhythm Model

* **IOI ratio transitions** — inter-onset intervals quantized to 12 musical categories (PPM-Decay)
* **Mean density and variance**
* **Tempo estimation** — beat tracking via autocorrelation with perceptual weighting (80–160 BPM preferred)

### Groove Model

* **Per-grid-position deviations** at 12 sub-beat positions
* **Per-position variance** — how consistent the timing is at each position
* **Swing ratio** — even-to-odd eighth-note timing ratio

### Phrase Model

* **Phrase boundaries** detected via LBDM (Local Boundary Detection Model) over pitch, IOI, and rest streams
* **Mean phrase length** in notes

### Articulation Model

* **Gate ratio** — how long notes are held relative to the inter-onset interval
* **Dominant style** — classified as Legato, Staccato, Accent, or Mixed
* **Style fractions** — proportion of staccato, legato, and normal notes

### Velocity Model

* **Range and statistics** — min, max, mean, variance
* **Velocity curve** — envelope shape extractable for the `Captured` setting on `velocityCurveShape`

## Seeded Engines

When the fingerprint is active, four subsystems can draw on it:

* **Rhythm** — PPM-Decay Markov trained on captured IOI ratios. The Density Min/Max range acts as a morph between the captured rhythm and the selected algorithmic engine.
* **Pitch** — PPM-Decay Markov over captured pitch-class transitions, with directional submodels. The Pitch Shape parameter morphs between captured and algorithmic.
* **Perforation** — Context-dependent rest insertion conditioned on note length and pitch direction. The Perforation amount morphs between captured rests and the selected method.
* **Micro-Timing** — Set `microTimingStyle` to **User Groove** to apply the captured per-grid-position deviations and swing ratio.

## Preset Integration

The fingerprint is **saved and restored with presets**. Saving a preset while a fingerprint is active serializes the full fingerprint (matrices, distributions, models) as JSON inside the preset. Loading that preset restores the fingerprint and re-seeds the engines.

## Tips

* **Minimum viable capture**: 8–10 notes produce a basic fingerprint. 30+ notes over 15+ seconds give reliable phrase and groove detection.
* **Consistent style**: The analyzer reflects what it sees. Mixed playing produces averaged results.
* **Steady tempo**: Best groove extraction comes from steady tempo input. The beat tracker prefers 80–160 BPM.
* **Re-capture freely**: Triggering a transport jump (stop/seek) drops the current fingerprint and re-enters Idle; the next note-on starts a fresh capture.

<Note>
  MIR Capture requires incoming MIDI — from a controller routed through the DAW, or from MIDI clips on RESERVOIR's track. The DAW must route MIDI input to the track that hosts RESERVOIR.
</Note>
