Skip to content

Electron usage #235

@dirkk0

Description

@dirkk0

Might be obvious but to use this with Electron-forge, you need to:
a) insert this in the dependencies of package.json

"dependencies": {
  "electron-squirrel-startup": "^1.0.0",
  "midi": "^2.0.0"
},

and yarn to install it.

b) add this on one of the first lines of index.js:

const midi = require('midi')

c) add this in the main loop of createWindow:

const input = new midi.Input();

for (let i = 0; i < input.getPortCount(); i++) {
  console.log(i, input.getPortName(i))
}

input.on('message', (deltaTime, message) => {
  console.log(`m: ${message} d: ${deltaTime}`);
});
input.openPort(1);

In my case the Launchpad was on index 1 and I could see the midi messages on the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions