Testing the Web Audio API


Hi!

With Chris, Ehsan and other's help I've started work on the test suite
for the Web Audio API. This test suite is a requirement for our
standardisation process, but more importantly it will help codify the
decisions we make on the specification, and hopefully help the
implementation effort.

Our test suite is here:

   https://github.com/WebAudio/web-platform-tests

And the best way to clone a local copy is:

   git clone --recursive -b master git@github.com:WebAudio/web-platform-tests.git

We've put together three types of test for the GainNode, and I'd really
like your feedback on the approaches. I've taken code from the webkit
and mozilla test suites, and ported it across to use the W3C's test
harness (so we can have our tests included in the broader set of "Web
Platform Tests").

Firstly, ported from the Mozilla test suite is the following test:

   https://github.com/WebAudio/web-platform-tests/blob/master/webaudio/the-audio-api/the-gainnode-interface/gain-node-mozilla.html

It uses a ScriptProcessor to compare 2 buffers where the expected buffer
has half the amplitude of the input buffer in order to test that a
GainNode with a 'gain.value' of 0.5 behaves as expected.

Secondly, ported from the WebKit testsuite is the following test:

   https://github.com/WebAudio/web-platform-tests/blob/master/webaudio/the-audio-api/the-gainnode-interface/gain-node-webkit.html

It creates a buffer with a sequence of notes with diminishing amplitude
and compares them to an expected .wav file using an OfflineAudioContext.
I've made a few changes to how the comparison happens here to make it
more compatible with our test harness, but the principle is the same as
in the source test suite.

Finally, we have a test of the GainNode interface using the WebIDL from
the specification itself:

   https://github.com/WebAudio/web-platform-tests/blob/master/webaudio/the-audio-api/the-gainnode-interface/gain-node-idl.html

Ehsan and I imported this IDL by hand from the spec, but I am writing a
script to update these IDL blocks for us automatically by parsing the
source of the spec itself.


On a recent phone call we discussed ScriptProcessor vs
OfflineAudioContext for testing. ScriptProcessor is used in the mozilla
test suite in lieu of an implementation of OfflineAudioContext, but it
may be possible to write a generic helper to abstract this away and run
the tests faster-than-real-time using OfflineAudioContext where possible
and fall back to ScriptProcessor if an implementation of
OfflineAudioContext isn't available.

I'd really appreciate any thoughts and pull requests on this. I think
the process will be that tests are contributed by pull requests to our
fork of the Web Platform Test suite, and once we've merged them in and
checked that the paper work is in order (see
https://github.com/WebAudio/web-platform-tests/blob/webaudio-readme/README.md)
we can send a pull request to the main Web Platform Test project for
inclusion in their repo.


Cheers!

Chris


-----------------------------
http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and 
may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in 
error, please delete it from your system.
Do not use, copy or disclose the 
information in any way nor act in reliance on it and notify the sender 
immediately.
Please note that the BBC monitors e-mails 
sent or received.
Further communication will signify your consent to 
this.
-----------------------------

Received on Friday, 17 May 2013 11:25:22 UTC