W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

Re: [Bug 20254] Add code examples

From: James Ingram <j.ingram@netcologne.de>
Date: Sun, 09 Dec 2012 23:40:02 +0100
Message-ID: <50C51342.90902@netcologne.de>
To: public-audio@w3.org
CC: Chris Wilson <cwilso@google.com>, Florian Bomers <w3c_bugz@bome.com>
Hi Chris, Florian, all,

Further to Florian's comments:
> 9.1
> > function success( midiAccess )
> should be named
> > function onMIDISuccess( midiAccess )

idx and i are the same variable. Change idx to i.

indexOfPort and index are the same variable. Change index to indexOfPort.
I  think I'd also rename "event" to "msg" in onMIDIMessage(). Might give 
newbies a marginally easier time.

I think that a) the text should include the information that both 
messages are being sent on channel 0, and b) it might be helpful if you 
said a bit more about the omitted timestamp.

For a), maybe just add "Both messages are sent to channel 0." to the 
introductory sentence.
For b), maybe just change "omit timestamp" in the comment to "omitting 
timestamp (means 'send now')".

But it might be easier/better to add a couple of lines at the end of 9.4 
explaining that the first value in the sent array is the status byte 
(=command + channel), and explaining more precisely what happens when 
the timestamp is omitted when calling send ("send now" -- is the default 
0 or window.performance.now()?).

As in 9.3, change index to indexOfPort.

Florian again:
> > output.send( [0x90, 60, 0x00], window.performance.now() + 1000.0 );
> > // note off, middle C, zero velocity, timestamp = now + 1000ms.
> This is actually a Note On message with 0 velocity, which is equivalent to a
> Note Off message with 64 velocity (if I recall correctly). It's probably easier to understand for MIDI newbies to use the actual Note Off message:
> > output.send( [0x80, 60, 0x00], window.performance.now() + 1000.0 );
> > // note off, middle C, zero velocity, timestamp = now + 1000ms.
Agreed about using a note off message (the text actually says "a 
corresponding note off message"), but the velocity should also be 
changed (to 64), -- just to reduce the amount of discussion... :-)

 > output.send( [0x80, 60, 64], window.performance.now() + 1000.0 );
 > // 0x80 is note off on channel 0, 60 is middle C, 64 is velocity, 
timestamp = now + 1000ms.

As in 9.3, I'd rename "event" to "msg" in echoMIDIMessage(). If that's 
done, then I'd rename "msg" to "errorMsg" in onMIDIFailure().

> 9.5
> same as 9.1
Yes (rename "success" to "onMIDISuccess").

I was a bit surprised that MIDIAccess is simply going to be a global 
variable. Is it really going to be that easy? No rigmarole apart from 
navigator.getMIDIAccess()? :-)

All the best,
Received on Sunday, 9 December 2012 22:40:46 UTC

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