How to use easymidi - 9 common examples

To help you get started, we’ve selected a few easymidi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github samhiatt / node-ableton-push2 / dist / Push2.js View on Github external
constructor(portName = 'Ableton Push 2 User Port', virtual = false) {
        super();
        // console.log(`Initializing ${portName}`);
        this._input = new easymidi.Input(portName, virtual);
        this._output = new easymidi.Output(portName, virtual);
        this._input.on('message', (msg) => {
            // Emit all messages as 'message' events, plus each individual type separately.
            this.emit(msg._type, msg);
            this.emit('message', msg);
        });
    }
    /**
github samhiatt / node-ableton-push2 / dist / Push2.js View on Github external
constructor(portName = 'Ableton Push 2 User Port', virtual = false) {
        super();
        // console.log(`Initializing ${portName}`);
        this._input = new easymidi.Input(portName, virtual);
        this._output = new easymidi.Output(portName, virtual);
        this._input.on('message', (msg) => {
            // Emit all messages as 'message' events, plus each individual type separately.
            this.emit(msg._type, msg);
            this.emit('message', msg);
        });
    }
    /**
github Pomax / midi-with-node / server.js View on Github external
deviceName = 'NodeJS MIDI out',
    verbose = process.argv.indexOf("--verbose")>-1;

if (process.platform === "win32") {
  // find the loopmidi 'NodeJS MIDI out' virtual port
  var outputs = easymidi.getOutputs();
  outputs.some(name => {
    console.log(name, deviceName);
    if (name.toLowerCase().indexOf(deviceName.toLowerCase()) > -1) {
      out = new easymidi.Output(name);
      return true;
    }
    return false;
  });
} else {
  out = new easymidi.Output(deviceName, true);
}

app.use(express.static(path.join(__dirname,'public')));

app.get('/socket.io.js', function(req, res) {
  res.sendFile('socket.io.js', {
    root: path.join(__dirname, 'node_modules', 'socket.io-client', 'dist')
  });
});

var http = require('http'),
   server = http.Server(app),
   io = socketio(server);

io.sockets.on('connection', function(socket) {
  console.log("User Connected");
github samhiatt / node-ableton-push2 / scripts / monitor_all_inputs.js View on Github external
var easymidi = require('easymidi');

// Monitor all MIDI inputs with a single "message" listener
easymidi.getInputs().forEach(function(inputName){
  var input = new easymidi.Input(inputName);
  input.on('message', function (msg) {
    var vals = Object.keys(msg).map(function(key){return key+": "+msg[key];});
    console.log(inputName+": "+vals.join(', '));
  });
});
github Pomax / midi-with-node / server.js View on Github external
var path = require('path'),
    express = require('express'),
    app = express(),
    socketio = require('socket.io'),
    easymidi  = require('easymidi'),
    deviceName = 'NodeJS MIDI out',
    verbose = process.argv.indexOf("--verbose")>-1;

if (process.platform === "win32") {
  // find the loopmidi 'NodeJS MIDI out' virtual port
  var outputs = easymidi.getOutputs();
  outputs.some(name => {
    console.log(name, deviceName);
    if (name.toLowerCase().indexOf(deviceName.toLowerCase()) > -1) {
      out = new easymidi.Output(name);
      return true;
    }
    return false;
  });
} else {
  out = new easymidi.Output(deviceName, true);
}

app.use(express.static(path.join(__dirname,'public')));

app.get('/socket.io.js', function(req, res) {
  res.sendFile('socket.io.js', {
github samhiatt / node-ableton-push2 / scripts / show_ports.js View on Github external
var easymidi = require('easymidi');

console.log('Input ports: \n\t'+easymidi.getInputs().join('\n\t'));
console.log('Output ports: \n\t'+easymidi.getOutputs().join('\n\t'));

process.exit(0);
github samhiatt / node-ableton-push2 / scripts / show_ports.js View on Github external
var easymidi = require('easymidi');

console.log('Input ports: \n\t'+easymidi.getInputs().join('\n\t'));
console.log('Output ports: \n\t'+easymidi.getOutputs().join('\n\t'));

process.exit(0);
github Pomax / midi-with-node / server.js View on Github external
outputs.some(name => {
    console.log(name, deviceName);
    if (name.toLowerCase().indexOf(deviceName.toLowerCase()) > -1) {
      out = new easymidi.Output(name);
      return true;
    }
    return false;
  });
} else {
github samhiatt / node-ableton-push2 / scripts / monitor_all_inputs.js View on Github external
easymidi.getInputs().forEach(function(inputName){
  var input = new easymidi.Input(inputName);
  input.on('message', function (msg) {
    var vals = Object.keys(msg).map(function(key){return key+": "+msg[key];});
    console.log(inputName+": "+vals.join(', '));
  });
});

easymidi

Simple event-based MIDI messaging

MIT
Latest version published 1 year ago

Package Health Score

52 / 100
Full package analysis