Send MIDI Messages from Your Browser with Updated Web MIDI Console

21 Jan 2017

I released the first version of the Web MIDI console back in November of 2015.  I'd been thinking about adding support for message sending for awhile and Geert Bevin's SendMIDI tool gave me the inspiration to finally implement it.  Thanks, Geert!  (And apologies if I mispronounced your name in the video.)

The following video shows a quick demo of the new features in the console, which you can access at https://factotumo.com/web-midi-console/.  The source code is available at https://github.com/benschmaus/web-midi-console if you'd like to run it locally.

 

 

The API is very similar to SendMIDI, however, since it's JavaScript there are some differences.  The first is that a fluent interface is used to enable chaining messages together.

For example, with SendMIDI, to send a CC on channel 16 you could have:

dev "Output Name" ch 16 cc 21 0

This same sequence in the Web MIDI console would look like:

device("Output Name").ch(16).cc(21, 0)

The main syntactic difference here is the requirement for parentheses around message parameters and periods between messages.

The other big difference is in the way that commands from external files/scripts are handled.  Since one of the use cases for tools like SendMIDI and this is testing device configuration, which may require many messages to be sent, it's convenient to be able to save a sequence of commands somewhere and execute them later.  In the case of the Web MIDI console, you use a script that's serves a JSONP response.  You can view an example here, and there's also an example of it's usage in the video.  For detailed usage information run "scriptHelp()" in the terminal.  But for quick experimentation there's no need for executing commands via URL; you can do everything direct from the terminal interface.

Last and not least, thanks to the developer(s) of the jQuery terminal emulator plugin for the very configurable and easy to use code.