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

prestissimo

v2.2.0

Published

Ergonomic wrapper for node-midi, powered by TypeScript

Downloads

4

Readme

Prestissimo

Making MIDI interfacing with NodeJS even easier. Quick, quicker... prestissimo!

Depends on node-midi - excellent for the low-level interface, but not particularly easy to use. Also inspired by easymidi which works well but lacks TypeScript support and some other conveniences.

Functionality

This module currently only supports input/output for the following types of MIDI messages:

  • "note on"
  • "note off"
  • "control change"

It does not (yet) support

  • pitch bend, sysex messages, etc.

Install and import

npm install prestissimo

Import into Node Javascript:

const { findInput, findOutput } = require('prestissimo');

Or in your Typescript application:

import {  findInput, findOutput } from 'prestissimo'

Either way, if you're using an editor that understands Typescript definitions (e.g. VS Code), you will get handy hints for function parameters and return types. Nice!

Usage

Input

Connect a keyboard, controller, pedal or some other MIDI device and identify it either by name or port number. For example:

const { findInput } = require('prestissimo');
const input = findInput({ name: "Samson Graphite M25" });

This will check the list of available MIDI input devices on your system, and pick the one that (at least partially) matches the name "Samson Graphite M25".

Now register an event handler for "ready", i.e. the device has been found and the port has been opened:

input.on("ready", match => {
  console.log('device identified by', match, 'connected');
  // Do stuff now...
});

You can register events for specific messages, nicely parsed:

input.on("noteOn", payload => {
  const { channel, note, velocity } = payload;
  // do something with the data...
});

input.on("noteOff", payload => {
  const { channel, note, velocity } = payload;
  // do something with the data...
});

input.on("controlChange", payload => {
  const { channel, controller, value } = payload;
  // do something with the data...
})

Or listen for "rawMessage" events, which are fired whether prestissimo could parse the message or not:

input.on("rawMessage", message => {
  const { deviceName, deltaTime, bytes } = message;
  // Parse the raw bytes yourself?
});

Output

Get a valid output MIDI device by name or port number:

const { findOutput } = require('prestissimo');
const output = findOutput({name: "myMidiOutput"})

Send messages to the device:

output.send("noteOn", {
  note: 60,
  velocity: 127,
  channel: 0
});

Virtual Inputs and Outputs

If you need to create virtual (software-only) MIDI devices on your system, simply use createVirtualInput instead of findInput and createVirtualOutput instead of findOutput. All other functionality is identical.

Utils

If you have prestissimo installed as a local or global dependency, you should be able to run

midi-list

... to get a list of available input and output MIDI devices available on your system, with full names and port numbers.

or

midi-listen

... to listen on all available MIDI Input channels and print out some useful info on any incoming notes, CC values, etc.

or

midi-simulate

... to send a bunch of Control Change values, useful for training or MIDI Mapping. Append --help to see the command-line options