notator / WebMIDISynthHost

Hosts software Web MIDI Synths that implement a superset of the Web MIDI API Output Device interface.
Other
18 stars 3 forks source link

WebMIDI integration #25

Closed ColemanGariety closed 8 years ago

ColemanGariety commented 8 years ago

We're working on a way to build web app which takes a .mid file and basically just "plays" it in a variety of soundfonts.

This repo makes use of new AudioContext() but not navigator.requestMidiAccess.

Is there a way your "synth host" can be hooked up to, say, a midi file reader like this? https://github.com/nfroidure/MIDIPlayer

ColemanGariety commented 8 years ago

The problem is that, as you mentioned in this issue: https://github.com/WebAudio/web-midi-api/issues/45

New OSs make users jump through hoops to open a virtual MIDI port. It's a usability disaster.

So I found this which opens virtual ports: https://github.com/justinlatimer/node-midi

But it has no synths, obviously. I'm trying to put the puzzle pieces together here, can you help?

node-midi seems unable to create a real virtual output port! Does yours?

notator commented 8 years ago

https://github.com/notator/residentSf2Synth contains the code for a synth that should work for you. All you have to do is include the code for the synth on your website [1], load it with the soundfont of choice, and then send it MIDI messages. You'll have to construct those by reading the .mid file of course. The Resident Sf2 Synth works fine [2], but its by no means perfect. See the issues in its repo.

Think of it like this: Your app is the host. The synth itself implements the API for Web MIDI output devices, so you don't need the browser's implementation of the Web MIDI API, and you don't need to call navigator.requestMidiAccess. And you don't need to go through complicated low level stuff like opening virtual output ports! :-)

[1] for an example of how to do that, see http://james-ingram-act-two.de/open-source/SimpleSoundFontSynthHost/host.html [2] I'm using it in my own app at http://james-ingram-act-two.de/open-source/assistantPerformer/assistantPerformer.html -- see the instructions there.

ColemanGariety commented 8 years ago

thanks!

notator commented 8 years ago

Please let me know here if you get it working. Thanks.

ColemanGariety commented 8 years ago

@notator absolutely, although, we may go the Timidity++ route.