# midi-listener

> Listen for and interpret MIDI device input

Latest version **0.2.0** (published 2017-01-12) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-01-12 |
| First published | 2016-12-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Chase Moskal |
| Maintainers | chasemoskal |

## Links

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

## Recent versions

- 0.2.0 (latest) — 2017-01-12
- 0.1.0 — 2016-12-04
- 0.0.2 — 2016-12-03
- 0.0.1 — 2016-12-03
- 0.0.0 — 2016-12-03

## README

MIDI LISTENER
=============

***This project is early WIP pre-release code.*** *Open to suggestions or comments, please submit an issue!*

Listen for and interpret MIDI device input.

  - Simply listens to all connected MIDI devices simultaneously
  - Written in TypeScript
  - Inspired by [the stack overflow post](http://stackoverflow.com/questions/40902864/how-to-parse-web-midi-api-input-messages-onmidimessage)
  - Published as an [npm package](https://www.npmjs.com/package/midi-listener)
  - Usage example: [the CSM repository](https://github.com/ChaseMoskal/csm)

Basic usage with your TypeScript project:
-----------------------------------------

### Install midi-listener:

    npm install --save midi-listener

### Reference the Web MIDI API declarations:

    /// <reference path="../node_modules/midi-listener/source/web-midi.d.ts"/>

### Import into your code and use

```typescript
import MidiListener from "midi-listener"

(async () => {

  // Create the midi listener.
  const midiListener = new MidiListener({
    access: await navigator.requestMIDIAccess()
  })

  // Subscribe to the midi listener's events with callbacks.
  midiListener.subscribe({
    onInputChange: report => console.log("MIDI Input Change:", report.inputNames),
    onMessage:     report => console.log("MIDI Message:", report),
    onNote:        report => console.log(" - Note:", report),
    onPad:         report => console.log(" - Pad:", report),
    onPitchBend:   report => console.log(" - Pitch bend:", report),
    onModWheel:    report => console.log(" - Mod wheel:", report)
  })
})()
```

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