npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

midi-interceptor

v1.0.2

Published

A tool to intercept and handle MIDI messages.

Downloads

5

Readme

midi-interceptor

A small Node.js application that listens to available MIDI input devices, processes incoming messages, and sends them to a virtual MIDI output, which can be used by your DAW as a MIDI input source.

The application merges MIDI inputs and offers flexible control over how incoming MIDI Note On and Note Off messages are routed and split across MIDI channels.

You can define split definitions for routing either individual notes or note ranges to specific MIDI channels (currently supports channels 1-16). This can be leveraged within your DAW or sequencer, for example, to record specific notes to specific tracks or assign virtual instruments to specific zones of your keyboard.

This project is designed as a command-line tool and is powered by cli-primer, making it highly configurable through CLI arguments and/or a configuration file.

Typical scenarios

  • You have several MIDI controllers but your DAW/notation editor only supports one input controller at a time.
  • You want to input/record distinct musical elements from your MIDI keyboard (e.g., simultaneously record a bassline and a melody on two different tracks), but your MIDI keyboard does not have built-in split functionality.

Installation

Ensure you have the latest LTS version of Node.js installed. If not, check their official releases page.

  1. Use npm to globally install midi-interceptor:
npm install -g midi-interceptor
  1. Ensure you have a virtual MIDI port. This is needed to collect the MIDI messages midi-interceptor rewrites, and to send them to your DAW, sequencer, or notation editor.

    To set up a virtual MIDI port:

    • Windows: Install loopMIDI, a free tool for creating virtual MIDI ports. Once installed, open it, add a virtual MIDI port (e.g., name it "MIDI Interceptor Output"), and note the name you gave it.

    • macOS: Use the built-in IAC Driver:

      1. Open Audio MIDI Setup.
      2. Go to Window > Show MIDI Studio.
      3. Double-click IAC Driver and check Device is online.
      4. Create a new port (e.g., name it "MIDI Interceptor Output") and note the name you gave it.
    • Linux: Depending on your distribution, there may be a built-in virtual MIDI port, or you may need to install and configure an additional package. Consult your distribution's documentation for details.

Configuration

To initialize a configuration file:

midi-interceptor --ic

This creates the file midi-interceptor.config in your home directory. Open it in a JSON editor. The file allows you to define multiple profiles, which you can switch between at runtime, via the --cp=<profile_name> argument.

Here is a sample configuration:


{
  "profiles": [
    {
      "name": "satb_choir",
      "settings": {
        "virtualOutputName": "MIDI Interceptor Output",
        "splitTable": [
          { "type": "range", "midiFrom": 74, "midiTo": 88, "channel": 1 },
          { "type": "range", "midiFrom": 63, "midiTo": 73, "channel": 2 },
          { "type": "range", "midiFrom": 55, "midiTo": 62, "channel": 3 },
          { "type": "range", "midiFrom": 35, "midiTo": 54, "channel": 4 }
        ]
      }
    }
  ]
}

This defines a profile named "satb_choir," which splits the customary range of a mixed choir across four MIDI channels and sends all transformed messages to a virtual MIDI port named "MIDI Interceptor Output".

Take this as a starting point, adjust as needed, and don't forget to set "MIDI Interceptor Output" (or whatever you named it) as a MIDI input in your DAW/sequencer/notation editor.

Additional options

In the settings section of the configuration file you can also add these keys:

  • inputPortsExclusions: use it to exclude certain MIDI ports, by their name. Supports the wildcards * and ? that match any chars and any char, respectively. Excluding a port prevents midi-interceptor from listening to it, thus leaving that port available for other applications to use. Example:
"inputPortsExclusions": ["Akai MPK Mini", "Native Instruments*", "Alesis V??"]
  • debug: use it to cause incoming Note On and Note Off messages to be printed to the console, along with any rerouting they are affected by. Example:
"debug": true

Note: for infrequent use, it is better to provide debug as a command line argument rather than a configuration file setting.

Note: A virtualOutputName is mandatory; midi-interceptor will exit with an error if one is not provided.

Note: Ensure the midi-interceptor.config file contains valid JSON. Use a JSON validator like the one from curiousconcept if unsure.

Execution

Run the midi-interceptor application from the command line. Ensure the MIDI gear you want to intercept is plugged in and turned on, then run, e.g.:

midi-interceptor --cp=satb_choir

Note: You can override any setting from the configuration file via the command line. For example, to specify on-the-fly a different virtual output you would do:

midi-interceptor --cp=satb_choir --virtualOutputName="my Other Virtual Port"

on Windows, or

midi-interceptor --cp=satb_choir --virtualOutputName=my\ Other\ Virtual\ Port

on macOs/Linux.

The default profile

You can define a profile named "default" in your configuration file. This profile will be loaded automatically and serve as the base for any subsequent settings given in another profile (loaded via --cp) or specified on the command line. Here’s how you can use this to your advantage:

  • Single Profile Use: If you only plan to use one profile, name it default and include all your settings there. This way, you can run midi-interceptor without any arguments:
midi-interceptor
  • Common Settings: If you have settings that should apply across multiple profiles, place them in the default profile.

Accessing the Built-in Documentation

To view the documentation for all supported settings, run the following command in your console:

midi-interceptor --h

Other considerations

This open-source project is still in its early stages. Any help is appreciated. Feel free to report bugs and suggest features, or fork the code and send pull requests.

License

This project is licensed under the MIT License.