# Record a MIDI take

![The MIDI panel with an imported phrase on its strip, the instrument controls, the on-screen keyboard and the Place dry and Generate instrument buttons](https://github.com/HamSanders/soundbox/blob/main/site/public/docs/studio/midi.webp)

## Before you begin

- Optional: connect a MIDI keyboard. It needs Web MIDI, which Chromium-based browsers such as Chrome and Edge have.
  The macOS desktop app does not have it; play on screen there.

## Record a take

1. In the **Panels** menu, select **MIDI**.
2. Optional: to use a MIDI keyboard, click **Connect MIDI** and allow MIDI when asked. If several devices are
   connected, select one in the list, or **All MIDI inputs**.
3. Click **Record**.
4. Play on your MIDI keyboard or on the on-screen keyboard. To play the on-screen keyboard from your computer
   keyboard, click it once, then use the keys from <kbd>A</kbd> to <kbd>;</kbd> for white keys and <kbd>W</kbd>,
   <kbd>E</kbd>, <kbd>T</kbd>, <kbd>Y</kbd>, <kbd>U</kbd>, <kbd>O</kbd> and <kbd>P</kbd> for black keys. The notes
   are drawn on the strip as they arrive.
5. Click **Stop**.
6. Click **Preview** to hear the take. To start again, click **Clear**.

If Chrome has blocked MIDI for the site, the panel says *Blocked for this site*. Allow MIDI devices in the padlock
menu in the address bar, then reload the page.

## Import a MIDI file

1. In the **MIDI** panel, click **Import**.
2. Choose a `.mid` file. Its notes replace the take.

## Tidy the timing

1. In the **Quantise to** list, select a grid: **0.25s**, **0.125s** or **0.0625s**.
2. Click **Quantise**. Each note's start moves onto the grid.

## Place the take on the timeline

1. Click the ruler to put the playhead where the take should start.
2. In the **Instrument** list, select the sound that plays the notes.
3. Click **Place dry**. The take is rendered and lands on a new track at the playhead.

To have a music model play the take as a real instrument instead, see
[Turn notes into an instrument](https://mirli.app/docs/studio-instruments/index.md).

## Save the take as a MIDI file

1. In the **MIDI** panel, click **Export**. The take is saved as `take.mid`.

## Map a controller's knobs, pads and pedal

1. In the **MIDI** panel, click **Mapping**.
2. Move a control on your controller and check that the monitor line shows it.
3. In the **Controller layout** list, select the closest match.
4. For each action that does not respond, click **Learn** on its row, then move the control you want for it.

![The Mapping options with the monitor line, the Controller layout list set to General MIDI, and a row per action with a Learn button](https://github.com/HamSanders/soundbox/blob/main/site/public/docs/studio/midi-mapping.webp)

## What's next

- [Edit notes in the piano roll](https://mirli.app/docs/studio-piano-roll/index.md) to fix a wrong note.
- [Turn notes into an instrument](https://mirli.app/docs/studio-instruments/index.md) to have the take played as a violin, a flute or anything
  you describe.
