Skip to content

Easier midi interaction using the great `RtMidi` lib port from @justinlatimer

Notifications You must be signed in to change notification settings

JohnnyMarnell/j5-midi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

j5-midi

Easy, convenient library for interfacing with midi devices.

An example, knob controlled transpose:

const { MidiIn, MidiOut, Midi } = require("../")
const input = new MidiIn({ pattern: /LaunchKey|Korg|Akai/gi })
const synth = new MidiOut({ pattern: /FluidSynth/gi })
let transposeAmount = 0

// Transpose the notes on the fly by adding a transpose amount / delta
input.on("midi.noteon midi.noteoff", (msg) => {
    msg.data += transposeAmount
    synth.send(msg)
})

// Set the amount / delta to transpose by listening to a knob (e.g. Midi CC 21)
input.on("midi.cc.*.21", msg => transposeAmount = Math.floor(msg.value / 11))

// Print any midi message
input.on("midi", msg => console.log("Received midi:", Midi.messageText(msg)))

To Do:

  • Add tests, yikes
  • TypeScript, oh dear
  • MidiMessage class instead of functional approach?
  • Auto reconnect for USB hot plug etc...
  • Better, configurable logging
  • Replace some more code with more event emitters and listeners

About

Easier midi interaction using the great `RtMidi` lib port from @justinlatimer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published