
Web Audio API comes to Firefox - rnyman
https://hacks.mozilla.org/2013/07/web-audio-api-comes-to-firefox/
======
chipsy
After trying to implement it, I've grown frustrated by the Web Audio spec. It
has a lot of nice features, but they're ultimately justified by JS being slow.
The spec itself is not very tight considering how much it covers - for
example, I can easily see parameter changes behaving differently across
different implementations. The real tests of the API haven't appeared yet, and
if they fail all those features will be a waste because nobody will want to
ship on it.

~~~
ehsanakhgari
Do you have specific complaints? We're definitely eager to hear about them at
the Audio working group.

~~~
chipsy
There is no specification for the computation of filter coefficients.

Audio Nodes are subject to garbage collection delays. This effectively makes
the API no-go for live performance situations. (I know you can't fix it
either.)

Parameter change specifications contain either an analytic or a mutable form,
but in practical implementations, both forms become desirable to implement
efficient processing that can also begin at arbitrary times within the
envelope. I cancelled my implementation of the API after discovering that the
lack of detail in this section made for a fragile, confusing, trial-and-error
situation to prevent discrepancies when comparing the results of the analytic
form against the mutable one.

Rendering does not appear to have any automatic regression test available. Web
Audio needs an Acid3-style test.

~~~
cromwellian
I'm not sure how reverting to a lower level JS-driven API could fix the
performance issues. High performance audio, like 2D and 3D graphics, needs the
ability to offload to native code or dedicated hardware. Writing a DSP in JS
makes things portable, but so does writing an OpenGL rasterizer in CPU code.
OpenGL to this day still has portability issues between GPUs, but the benefits
outweigh the disadvantages.

The only solution is IMHO is to keep finding holes in the spec, driven by
feedback from application developers, and plugging the holes.

I don't think a spec/standards committee can fix all of these issues, and like
with OpenGL, I suspect, we'll need Web Audio 1.1/1.2/1.3/etc

~~~
ehsanakhgari
Absolutely. Feedback from developers testing their applications and ideas with
the existing implementations is crucial to having a high quality spec, so if
you have specific issues, please provide feedback here:
[http://lists.w3.org/Archives/Public/public-
audio/](http://lists.w3.org/Archives/Public/public-audio/). We'll definitely
take that into consideration and we can always amend the spec based on the
feedback we receive to improve things.

------
9999
This is fantastic! I have been using the webkitAudioContext for a project and
had a very simple script setup to prepare for WebAudio in FF:

if (typeof AudioContext !== "undefined") { this.context = new AudioContext();
}

It worked without modification, and the audio sounds great so far. In the
meantime I'm still falling back to webkitAudioContext for Chrome and Safari
until they catch up.

~~~
ehsanakhgari
Great to hear that! Is this project publicly available somewhere by any
chance?

~~~
9999
Unfortunately it's not at the moment.

------
md224
I built a fairly basic ambient drone generator with the Chrome implementation
of the Web Audio API:

[http://matt-diamond.com/drone.html](http://matt-diamond.com/drone.html)

Haven't gotten a chance to add Firefox compatibility yet (working on it!).

~~~
ehsanakhgari
That sounds great! Please get in touch with me if you hit any problems, would
be happy to help!

------
pnp
This is great news. I've been playing around with audio streams generated by
script (DAC emulation) on Chrome/Safari and now I can try Firefox.

A key problem (and measure of quality) for me is reducing the latency. I've
had trouble getting continuous sound with less than a quarter second of
buffer. (Ideally, I'd like to achieve smooth sound with only 17ms of
buffer/lag). Another browser to work with will help, and, maybe the IE team
will take notice.

~~~
ehsanakhgari
If you hit latency issues in Firefox, please get in touch with me. Note that
we currently have a rather high latency on Android, which we have plans to
fix, but things should work fairly well on desktop platforms.

------
jamespitts
Fantastic to see some of these things come to reality. In our real-time video
entertainment game we've had to code all sorts of tricks in the client to get
sound events to occur in sync across clients.

Timed events is the most important aspect of creating a game or entertainment
experience that sounds real to users. I completely took it for granted before
I started on this project. Time is quite a rubbery material right now in
browsers!

------
dtf
Fantastic news. I've used Web Audio under Chrome for a couple of experimental
projects now, and it really is a fun API to work with.

------
andrethegiant
For those interested, Apple documents the Web Audio API pretty well:
[http://developer.apple.com/library/safari/#documentation/Aud...](http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/PlayingandSynthesizingSounds/PlayingandSynthesizingSounds.html)

------
comex
Excellent. Although Firefox previously had a simple API that could be used to
do most of these things manually in JavaScript, the Web Audio API provides
convenient high level functionality while retaining the ability to manually
process samples if needed, and, of course, now works in both WebKit and
Firefox.

~~~
ehsanakhgari
For whatever it's worth, we have deprecated support for the Mozilla Audio Data
API in favor of Web Audio, and will remove support for it in the near future.

------
adaline
I have made something a little more advanced with Web Audio:
[http://mixbolt.com](http://mixbolt.com) Cant wait to have support on all the
browsers (especially mobile) :)

------
paul9290
Good stuff!

Our mobile & desktop web app, SpeakerBlast, uses the web audio API to play
audio in sync across multiple devices.

Though up until now it only works in Chrome & in mobile Safari.

~~~
ehsanakhgari
If you hit problems porting that to Firefox, please get in touch with me,
would be happy to help you!

------
Nekorosu
That's huge! I've been waiting for this for quite some time. If Firefox also
got some more UI polish it would be my fave browser.

------
arc_of_descent
This is great news! Been waiting for this. Now if only I don't need to use
javascript for this. :)

------
wavesounds
Does this mean Firefox will be able to play MP3s now?

~~~
ehsanakhgari
We currently support MP3 playback for Windows Vista+ and Android if I'm not
mistaken, and support for other platforms is being worked on. Web Audio will
support all of the codecs supported by <audio> depending on the platform.

~~~
wavesounds
Thanks! MP3 support for OSX would be great. I was recently working on a music
playing web app and was frustrated by this chart
[http://www.w3schools.com/html/html5_audio.asp](http://www.w3schools.com/html/html5_audio.asp)

~~~
ehsanakhgari
You can follow this bug
[https://bugzilla.mozilla.org/show_bug.cgi?id=851290](https://bugzilla.mozilla.org/show_bug.cgi?id=851290)
if you're interested. :)

------
antocv
Good show, but I wonder how far we can really push the web browser, how will
this affect desktop/native apps? We have already canvas and webgl and all but
I dont see a web photoshop version competing with the real deal, how come?
We're here giving access to "web-scripts" to more and more OS functions and
closer to hardware, and yet the most productive apps are native, hm?

~~~
kevincennis
I'm not sure that the point is necessarily that the browser should be
competing with native pro apps.

Web apps tend to be really good at very specialized functions. A silly, but I
think still valid example would be a meme generator using <canvas> and JS. If
you want a picture of a cat with some white Arial text and a black drop
shadow, a web app is going to be great. It'll probably be faster than
Photoshop (especially if you count startup time), and way more accessible.

Same thing goes for the Web Audio API. Will we see a full-fledged Pro Tools
competitor? Probably not. But we will see ringtone generators and voice
recorders and (hopefully!) some T-Pain AutoTune apps.

Great web apps are all about playing off the web's strengths, not trying to
replicate the desktop.

