# transmidi

> Translate midi messages

Latest version **1.0.0** (published 2021-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install transmidi
pnpm add transmidi
yarn add transmidi
bun add transmidi
```

Provides the command `transmidi`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-07-01 |
| First published | 2021-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alberto Miranda |
| Maintainers | codealchemist |
| Keywords | midi, tool |

## Links

- npm: https://www.npmjs.com/package/transmidi
- Repository: https://github.com/codealchemist/transmidi
- Homepage: https://github.com/codealchemist/transmidi#readme
- Issues: https://github.com/codealchemist/transmidi/issues
- npm.io page: https://npm.io/package/transmidi

## Dependencies (4)

- [midi](https://npm.io/package/midi.md) ^2.0.0
- [chalk](https://npm.io/package/chalk.md) ^4.1.1
- [printii](https://npm.io/package/printii.md) ^1.0.0
- [cli-select](https://npm.io/package/cli-select.md) ^1.1.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-07-01

## README

```
 _                                 _     _ _
| |_ _ __ __ _ _ __  ___ _ __ ___ (_) __| (_)
| __| '__/ _` | '_ \/ __| '_ ` _ \| |/ _` | |
| |_| | | (_| | | | \__ \ | | | | | | (_| | |
 \__|_|  \__,_|_| |_|___/_| |_| |_|_|\__,_|_|
 
```

Translate midi messages

## Motivation

I have a Roland FC-100 MKII pedal board I wanted to use with Bias FX 2 and I didn't find any tool to translate program changes to the control changes required to command Bias FX 2.

## Install

`npm i -g transmidi`

## Usage without installation

`npx transmidi [translations-file]`

## Usage

`transmidi [translations-file]`

### Input selection
First, you'll select your midi input:

![screenshot](https://cldup.com/WM36iJa1vg-3000x3000.png)

### Output selection

Then, the midi output where translated messages will go to:

![screenshot](https://cldup.com/lP60t6eden-3000x3000.png)

And after that you can start having fun!

![screenshot](https://cldup.com/5oA5MZoH0d-3000x3000.png)

On the left you'll see the input messages and on the right you'll see your translations.

### Print help / usage

`transmidi --help`

### Monitor mode

Start in **monitor mode** (will print all messages on the selected input):

`transmidi`

![screenshot](https://cldup.com/SdLKB63eey-3000x3000.png)

## Sample translations file

```
const translations = {
  192: {
    0: [176, 81, 0],
    1: [176, 82, 0],
    2: [176, 83, 0],
    3: [176, 84, 0],
    4: [176, 85, 0],
    5: [176, 86, 0],
    6: [176, 87, 0],
    7: [176, 88, 0]
  },
  176: {
    80: {
      127: [176, 81, 0],
      0: [176, 82, 0]
    }
  }
}

module.exports = translations
```

## Translations file

The translations file is what you need to tell **transmidi** how to translate a given input into the desired input.

Midi messages are composed of: `[status, data1, data2]`.
You can read more in [midi](https://www.npmjs.com/package/midi), the core midi package used by **transmidi** to work its magic.

Message can have one or two data elements.

Let's say you want to translate `[192, 0]` into `[176, 81, 0]`, that's:

```
{
  192: {
    0: [176, 81, 0]
  }
}
```

If you have a message with two data elements, for example, `[176, 80, 0]`, and you want to translate it into `[176, 81, 0]`, you'll need:

```
{
  176: {
    81: {
      0: [176, 81, 0]
    } 
  }
}
```

Simple right?! 😁

If you know some JavaScript, you'll notice you match input messages with an object and translations are always arrays.

And you don't need to know the input midi messages beforehand, **transmidi** got you covered there too! Just run `transmidi` and you'll get into **monitor mode**, where you'll be able to see all the midi messages generated by your device.

Enjoy!

---
_Source: https://npm.io/package/transmidi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
