W3C home > Mailing lists > Public > public-audio-dev@w3.org > December 2015

Re: Web MIDI Synths

From: James Ingram <j.ingram@netcologne.de>
Date: Thu, 3 Dec 2015 23:12:52 +0100
To: Chris Wilson <cwilso@google.com>
Cc: "public-audio-dev@w3.org" <public-audio-dev@w3.org>
Message-ID: <5660BE64.7040606@netcologne.de>
Hi Chris, all,

I've just uploaded SimpleMIDISynthHost2 to the web:
http://james-ingram-act-two.de/open-source/SimpleMIDISynthHost2/host.html
and GitHub:
https://github.com/notator/SimpleMIDISynthHost2

Maybe you could give it a try.

I've also updated the original SimpleMIDISynthHost (that works without a 
hardware input device), but have not yet got to updating the main 
WebMIDISynthHost app/GitHub. That's next on my TODO list.

I've tested as much of the new SimpleMIDISynthHost2 as I can with my 
E-MU keyboard, and don't know of any bugs. I'm doing my best, but 
remember that this is a prototype. Its the principles that matter rather 
than elegance...

Current Issues:

1. Exceptions (this may be a bit of a red herring but):
I thought a lot more about this while revising the app, and of course 
you are more right than I am.
I think the host ought to enclose the call to synth.send(...) in a 
try..catch clause, since there's no way to guarantee that the synth 
isn't going to throw an exception. Maybe there's a programming error in 
there somewhere.
But throwing exceptions is, I imagine, very time consuming, so synths 
shouldn't do it deliberately. Especially not at run-time.
There may well be a better way of doing this, but I've now changed the 
synth code so that it uses console.warn(...) instead of throwing exceptions.
If the synth warns the host while the host is being programmed, then the 
host can avoid sending unnecessary messages. This worked fine for me.
Can the calls to console.warn be left in production code, or must there 
be two versions of the synth: one that warns, and one that just ignores 
unimplemented messages?
Is there a better way to do this?

2. Missing CC indices
You didn't assign CC indices to *all* the controls in your original GUI. 
I've used the ones you did set, and allocated the others (fairly 
arbitrarily) to CCs that are not defined in the MIDI standard. Okay?
I think its important for *all* the available controls to have CC 
indices so that the host can send them messages. The host may be 
generating messages itself, not just relaying messages coming from a 
hardware input device.
The x1 and x2 buttons are not in your GUI as far as I can see. Maybe 
these are buttons on your keyboard? I have treated them _as_if_ they 
were controls in the GUI, so that these can be changed using MIDI 
messages too. But I have not been able to test them.

3. CC values
I'm not sure if I have got the ranges of all the CCs right. See, for 
example, OSC1_DETUNE in cwMIDISynthCore.js.

3. NoteOn/NoteOff
My E-MU keyboard generates zero volume NoteOns instead of real NoteOffs, 
so I've added the corresponding code to the cwMIDISynth.js. (I'm now 
trying to leave cwMIDISynthCore.js alone, as far as possible.)
I think synth programmers implementing their own WebMIDISynth API would 
probably organize their files differently, but in this case...

Have fun!
James
Received on Thursday, 3 December 2015 22:13:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:55 UTC