# midi-relay

> Listens for HTTP request with JSON payload and relays MIDI/MSC commands on local ports.

Latest version **1.0.0** (published 2019-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install midi-relay
pnpm add midi-relay
yarn add midi-relay
bun add midi-relay
```

Provides the command `midi-relay`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-06-06 |
| First published | 2019-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 74 |
| Author | Joseph Adams |
| Maintainers | josephdadams |
| Keywords | util, functional, server, client, browser, midi |

## Links

- npm: https://www.npmjs.com/package/midi-relay
- Repository: https://github.com/josephdadams/midi-relay
- Homepage: https://github.com/josephdadams/midi-relay#readme
- Issues: https://github.com/josephdadams/midi-relay/issues
- npm.io page: https://npm.io/package/midi-relay

## Dependencies (4)

- [jzz](https://npm.io/package/jzz.md) ^0.7.9
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [express](https://npm.io/package/express.md) ^4.16.3
- [body-parser](https://npm.io/package/body-parser.md) ^1.18.3

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-06-06

## README

# About MIDI Relay

MIDI Relay was written by Joseph Adams and is distributed under the MIT License.

It is not sold, authorized, or associated with any other company or product.  

To contact the author or for more information, please visit [www.techministry.blog](http://www.techministry.blog).

**INSTALLING THIS SOFTWARE:**
`npm install midi-relay`
To run, `node main.js` within the midi-relay folder.

**TO USE THIS SOFTWARE:**  

1.  This program runs an HTTP server listening on port 4000.
2.  Upon startup, the program will enumerate through the available MIDI ports.
3.  Making a GET request to `/midi_inputs` will return a JSON list of MIDI Input ports available on the server.
4.  Making a GET request to `/midi_outputs` will return a JSON list of MIDI Output ports available on the server.
5.  Making a GET request to `/refresh` will refresh the list of available MIDI ports and update the internal variables with these ports. A JSON response of `{result: 'ports-refreshed-successfully'}` indicates it was successful.
6.  Making a POST request to `/sendmidi` will send a MIDI command to the port identified in the JSON object included in the POST body.  
    If sending a MIDI Note On or Note Off, the JSON object should be in this format:  
    ```javascript
	{  
    midiport: 'MIDI Port Name',  
    midicommand: 'noteon',  
    note: 21,  
    channel: 0,  
    velocity: 1  
    }
	```

    A JSON response of `{result: 'note-on-sent-successfully'}` indicates the note was successfully sent. A _midicommand_ of _noteon_ specifies a MIDI Note On command. _noteoff_ specifies that it is a Note Off command.  

    *   _note_ should be an integer of the MIDI Number value that represents the note, between 21 (A0) and 108 (C8).
    *   _channel_ should be a integer between 0 and 15.
    *   _velocity_ should be a integer between 1 and 127.
	
    To send a MSC (MIDI Show Control) message, the JSON object should be in this format:
	```javascript
    {
    midiport: 'MIDI Port Name',  
    midicommand: 'msc',  
    deviceid: 0,  
    commandformat: 'lighting.general',  
    command: 'go',  
    cue: '10',  
    cuelist: '13',  
    cuepath: '' }
	```

    _deviceid_ should be an integer between 0 and 111\. It can also be a string "g1" through "g15" to represent groups, or it can be "all".  

    _commandformat_ should be a string with one of the following values:
    *   lighting.general
    *   sound.general
    *   machinery.general
    *   video.general
    *   projection.general
    *   processcontrol.general
    *   pyro.general
    *   all
	Any other value for _commandformat_ will default to "all".  

    _command_ should be a string with one of the following values:
    *   go
    *   stop
    *   gojam
    *   gooff
    *   resume
    *   timedgo
    *   load
    *   set
    *   fire
    *   alloff
    *   restore
    *   reset
    *   opencuelist
    *   closecuelist
    *   startclock
    *   stopclock
	
	Any other value for _command_ will default to "go".  

    Values for _cue_, _cuelist_, and _cuepath_ are all optional strings. If left blank ("") or not included in the object, those will not be included in the MIDI command that is generated.  
    A JSON response of `{result: 'msc-sent-successfully'}` indicates the note was successfully sent.

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