# MIDI merge

> Interleave up to four MIDI streams by time, in input order for equal offsets.

Source: https://docs.tune.toys/nodes/midi.merge/

MIDI merge interleaves up to four MIDI streams by time into one.

## What it does

Messages from in1 to in4 are ordered by their sample offset within the block. When two messages share an offset, the one from the lower-numbered input comes first, so the result is deterministic. Unused inputs are ignored. The node has no parameters.

## When to use it

Use it to let several sources play one instrument, for example an external controller through [MIDI in](https://docs.tune.toys/nodes/midi.in/) alongside the on-screen [Keyboard](https://docs.tune.toys/nodes/midi.keyboard/). A MIDI input takes only one cable, so merge first.

## Ports

<!-- ports:start -->

| Port   | Direction | Signal | Lanes            |
| ------ | --------- | ------ | ---------------- |
| `in1`  | Input     | MIDI   | 16 MIDI channels |
| `in2`  | Input     | MIDI   | 16 MIDI channels |
| `in3`  | Input     | MIDI   | 16 MIDI channels |
| `in4`  | Input     | MIDI   | 16 MIDI channels |
| `midi` | Output    | MIDI   | 16 MIDI channels |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

This node has no numeric parameters.

<!-- parameters:end -->

## Tips

- Merge is not a mixer: it keeps every message, including notes that overlap.
- To tell sources apart downstream, remap each to its own channel with [MIDI channel](https://docs.tune.toys/nodes/midi.channel/) before merging.

## See also

[Keyboard](https://docs.tune.toys/nodes/midi.keyboard/), [MIDI in](https://docs.tune.toys/nodes/midi.in/), [MIDI channel](https://docs.tune.toys/nodes/midi.channel/), [MIDI](https://docs.tune.toys/concepts/midi/).
