Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interfacing a midi keyboard or other real-time midi input with javascript?

I want to create a simple visualization tool that would allow to represent my playing a midi keyboard on the screen. I play a relatively novel instrument type, called the harmonic table:

http://en.wikipedia.org/wiki/Harmonic_table_note_layout

http://www.soundonsound.com/newspix/image/axis49.jpg

And want to build tools to ease their use and to teach others how to use them.

However, I can't find a good way to get get midi into javascript environment (or, for that matter, Flash, or Java without a large helping of jiggery-pokery slightly beyond my reach, and the use of code from what look to be rather stale and abandoned open source projects. Neither language I am too enthused to work in for this project in any case).

Is there a suitable library or application that I have missed, that will enable me to do this?

like image 330
Jon Biz Avatar asked Jun 28 '11 23:06

Jon Biz


4 Answers

The Web MIDI API is now real in Google Chrome 43+. I even wrote a library to make it easier to work with it. If you are still interested and do not care that it currently only works in Chrome, check it out: https://github.com/cotejp/webmidi

like image 61
djip.co Avatar answered Sep 18 '22 23:09

djip.co


While searching around for another solution (Flash based, using the functions of the Red5 Open source flash server - really ugly, but I'm desperate at this point) I found someone who had done exactly what I needed using Java to interface with the hardware. They had started with a flash solution and recently ported to Javascript. Yay!

http://www.abumarkub.net/abublog/?p=505

Don't let the caveats about 'proof of concept' discourage you: the basic functionality appears solid, at least with everything I have been able to throw at it.

So now I'm on my way, and so is anyone else who want to build javascript based midi interfaces/synths/what have you.

I can manipulate real-time midi in javascript! This is much better than flying cars and jetboots.

like image 36
Jon Biz Avatar answered Sep 20 '22 23:09

Jon Biz


I have made a NPAPI browser plugin that lets you communicate in Javascript with MIDI devices.

Currently it works on OSX in Chrome and Safari, and on Windows in Chrome.

I am working on support for other browsers (Firefox, Internet Explorer) and other operating systems (Linux, Android, iOs)

See: http://abumarkub.net/abublog/?p=754

like image 30
abudaan Avatar answered Sep 17 '22 23:09

abudaan


EDIT:

I recently published this module https://github.com/hems/midi2funk it's a node.js module that listens to midi and broadcast it through socket.io so if you have the luxury of running a node.js service locally together with your client side you might get some fun out of it...

~~~~~

A few others handy links, i kinda ordered in what i think would be most important for you:

  • midibridge.js - A Javascript API for interacting with MIDI devices

  • midi.js sequencing in javascript

  • jasmid - A Javascript MIDI file reader and synthesiser

  • Second web midi api working draft published - 11/12/2012

  • Jazz Soft - MIDI IN / OUT PLUGIN FOR BROWSER

edit: just realised the thread is old, hopefully the links will help someone ( :

like image 22
kroe Avatar answered Sep 20 '22 23:09

kroe