WebAudio / web-midi-api

The Web MIDI API, developed by the W3C Audio WG
http://webaudio.github.io/web-midi-api/
Other
323 stars 49 forks source link

Missing MIDI Output Devices #126

Closed notator closed 9 years ago

notator commented 9 years ago

The situation/use case: I'm writing a Web MIDI application (in Javascript) [1] that sends MIDI messages to MIDI output devices returned by the Web MIDI API. My application does the usual thing: It gets the user's output devices by calling the appropriate functions in the Web MIDI API, loads a popup menu with the results, and then lets the user decide which one to use. There are currently several problems: Problem 1: is that operating systems are no longer providing default MIDI output devices. (Chris says that's true of OSX, and I know that Microsoft has dropped theirs in Windows 8 or 8.1.) So my device selector pop-up is going to be empty unless the user has first installed some third party soft- or hardware. That's a disaster for any Web MIDI application. Problem 2: is that I would really like to be able to use custom sounds. Problem 3: Quite apart from the pop-up scenario, it ought to be possible to write Web MIDI applications that start playing immediately when the site loads, or at the touch of a single button, without the visitor having to think about MIDI devices. Visitors to web sites should not have to be bothered with details like the format of the audio being played.

Proposal: As a Javascript programmer, I would like to have access to a Javascript library that implements a virtual MIDI output device. I could then include the library on my site, and create an output device on the fly. I could even add it to my pop-up device selector as an alternative to my client's own soft- and hardware.

Such a virtual output device would be a bridge between the Web MIDI API and the Web Audio API. If such a library existed, I could simply create an output device in Javascript, and send my MIDI messages there. The device would not itself include any patch information (samples), but would load these at construction time from a file stored on my website. I, as the author of the site, know which patches I need. We are not talking about huge General MIDI SoundFonts. If I just need a piano, I load a piano. If I want a Renaissance crumhorn, I load one of those. If I need several instruments I load them all, - and am in control over the trade-off between loading times and the number of patches I want to use.

I think the interface to such a virtual output device could be defined quite easily. It would be the same as for any other output device, plus a constructor that loads the patch(es). The constructor could, for example, take the URL of a custom soundFont (containing only the necessary patches) as its only argument. (There are soundFont editors out there...) Maybe there are better ways of doing this, but you know better than I do about that. This project is not trivial of course, but I think it ought to be realizable within a reasonable time, and it sounds to me like a good project for a team - which would speed things up. (I'm a Web MIDI application developer, not a Web Audio expert, so I'm not a candidate programmer.)

There are, of course, lots of issues that need discussing. The first is to decide whether this proposal hits the sweet spot: relatively cheap, but powerful.

Another thought: Maybe the code that joins the Web MIDI API to the Web Audio API really belongs in browsers after all. In that case, the Javascript project I'm proposing could be regarded as a shim.

Whatever the answer turns out to be, I think its very important for the success of the Web MIDI API, that the issue of missing output devices gets addressed and solved somehow.

All the best, James

p.s. this proposal relates to several issues that have been discussed here recently. I'm afraid I can't remember them all.

[1] https://github.com/notator/assistant-performer

toyoshim commented 9 years ago

I think this is a duplicated feature request of #45.

As a currently available workaround, you may be able to write a bridge interface to WebMidiLink (http://www.g200kg.com/en/docs/webmidilink/) that is a community based API for software synthesizer written in JavaScript with Web Audio.

cwilso commented 9 years ago

Yes, this is a duplicate of #45.

longears commented 7 years ago

If you're reading this because your MIDI outputs are empty on OSX, this is the solution for now: in Audio MIDI Setup, in the IAC driver, add a port and check "Device is online".