See also: web-midi-test, test-midi-files
Install: npm install midi-test --save-dev
Manual rebuild (if needed): node-gyp rebuild
var MT = require('midi-test');
var port = new MT.MidiSrc('VIRTUAL MIDI-In');
port.connect();
port.emit([0x90, 0x40, 0x7f]);
//...
port.disconnect();
var MT = require('midi-test');
var port = new MT.MidiDst('VIRTUAL MIDI-Out');
port.receive = function(msg) { console.log('received:', msg); };
port.connect();
//...
port.disconnect();
import * as MT from 'midi-test'
//...
midi-test currently works in Linux and MacOS.
Windows version may appear some day in the future, but it is not in the immediate plans.
This package requires Node.js v18 or above,
and the full stack of node-gyp build tools.
(for older versions of Node please use midi-test v1.2.9)
Linux build also requires the ALSA libraries: apt-get install libasound2-dev
Since the Linux version needs special permissions to access the computer's sound system,
it may not work properly in virtual Linux environments such as the one at Travis-CI
or GitHub Actions.
To make your test work with Travis-CI or GitHub Actions, run it on MacOS.
in .travis.yml
:
os:
- osx
...
in .github/workflows/*.yml
:
jobs:
build-macos:
runs-on: macos-latest
...
If you are getting a build error related to Python 3.12, you may want to add this build step (see the build.yml file):
- run: python -m pip install --upgrade packaging pip setuptools