How to find a Push? => Like so! ;)

Learn about building and using Max for Live devices.
Post Reply
hoffman2k
Posts: 14718
Joined: Tue Jun 15, 2004 6:40 pm
Location: Belgium
Contact:

Re: How to find a Push? => Like so! ;)

Post by hoffman2k » Mon Sep 02, 2019 6:42 pm

Nice one Peter!

Funny enough, I was just going to start a thread about something remotely similar.
Last night I got WebMIDI working in Node.js. Nothing worth sharing yet, but that is just because I suck at JS.
Somebody with some JS chops can probably whip up new MIDI I/O objects easily. Which not only can find Push, you can look for its ports specifically and use them. Hence me hijacking your thread :D

This is what I found so far:

The engine JZZ.js comes from Jazz-soft and is very actively maintained:
https://jazz-soft.net/doc/JZZ/

I'm using the version from GIT:
https://github.com/jazz-soft/JZZ/tree/master/minified

I got it working by putting JZZ.js in the source path and including it with:

Code: Select all

const JZZ = require('JZZ');
Then I got it to spill out MIDI Data to the console. Which looked like Hex wrapped in a String. Thats about how far I got.

Code: Select all

JZZ({sysex:true}).or('Cannot start MIDI engine!')
     .openMidiIn('Ableton Push User Port').or('MIDI-In: Cannot open!')
     .and(function(){ console.log('MIDI-In:', this.name()); })
     .connect(function(msg){ console.log(msg.toString()); })  // and log to the console
Notice that the first 2 lines already find and confirm Push 1 being there. The .openMidiIn function also takes integers and there's a message in the docs to spill all the ports. So making a new midiinfo object is also possible.
With the code above, I think that only the last line needs a change so that it uses an outlet to spit out the Raw MIDI Bytes instead of strings. Not sure if the Hex needs converting to Integers.

I haven't gotten it working well enough to rule out any flaws. But the upsides so far: Cross-Platform, Supports the entire spec including MPE and SMF, Easy to update, supposedly can connect to the same port multiple times and I haven't gotten any "Ports in Use" conflicts on windows yet.

Post Reply