This is a simple program that listens to a midi device and sends key strokes to the active window.
Please note that this is not a finished program, just something I hacked together. It works, but I've only tested it on Mac M1, Sonoma 14.1.2. I have no idea if it works on other platforms. Things might change and config files may not be compatible between versions.
- Install Node.js (v20 or later)
- On Mac, the terminal app needs to be granted System Settings > Privacy & Security > Accessibility permissions. The program will check and help you with this if it's not set. The reason it needs this is to be able to send key strokes.
Either you install it globally or you run it using npx.
Run the following command in a terminal to install it globally:
npm install -g github:hcanber/midi2keys
After this you can use midi2keys
as a command.
You can also run it using npx, which means that you don't have to install it globally. The downside is that it will be slower to start .
In the instructions below, replace midi2keys
with npx github:hcanber/midi2keys
.
Create a config file (see below). You can start by create a config based on example_config.jsonc and edit it.
midi2keys create-config
or
npx github:hcanber/midi2keys create-config
Run the program with:
midi2keys
midi2keys monitor
Usage: midi2Keys [options] [--config <filename>]
Perform actions based on received midi messages as defined in config file.
Specify "help" to see full help
Options:
-c, --config <filename> The config file to use. If not specified, will use midikeys_config.jsonc.
-d, --debug Enable debug logging, including logging of received midi messages
-i, --input <name> The name of the midi input to use. Use list-inputs to list available
inputs. Will override preferredInput in config file.
-m, --monitor Enable logging of received midi messages
-h, --help Displays this help
Usage: midi2Keys [command]
Commands:
create-config [filename] Creates a config file based on example config. Use this as a starting point
list-inputs List available midi inputs
monitor [options] Logs received midi messages
help [command] display help for command
See example_config.jsonc for an example config file. The format is JSONC, which means that it's JSON that allows comments.
-
Clone the code to a folder
-
Install dependencies: Open the folder in a terminal and execute:
yarn install