Last active
February 5, 2020 21:45
-
-
Save konsumer/33b93d9fba4dc606e00bc71e0e7f8112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // npm i easymidi esm && node -r esm simple_midi_forwarder.js | |
| import { Input, Output, getInputs, getOutputs } from 'easymidi' | |
| // these are lists of available devices | |
| const inputs = getInputs() | |
| const outputs = getOutputs() | |
| console.log({ inputs, outputs }) | |
| // these will depend on your setup | |
| const input = new Input(inputs[1]) | |
| const output = new Output(outputs[0]) | |
| const handler = ({ _type, ...params }) => { | |
| output.send(_type, params) | |
| } | |
| input.on('noteon', handler) | |
| input.on('noteoff', handler) | |
| input.on('poly', handler) | |
| input.on('cc', handler) | |
| input.on('program', handler) | |
| input.on('channel', handler) | |
| input.on('pitch', handler) | |
| input.on('position', handler) | |
| input.on('mtc', handler) | |
| input.on('select', handler) | |
| input.on('clock', handler) | |
| input.on('start', handler) | |
| input.on('continue', handler) | |
| input.on('stop', handler) | |
| input.on('reset', handler) | |
| input.on('sysex', handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment