[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGL 1.0 ratified and released

> On Tue, Mar 8, 2011 at 10:33 AM, <steve@sjbaker.org> wrote:
> You can't get JavaScript to issue the "play this sound" command at the
> correct time.  That's the problem. Being a few ms off for triggering an
> explosion is fine. Being a few ms off for triggering an instrument is a
> song is the different between music and noise.

Yes - but who plays music note-by-note in a video game anymore?

If you have enough memory, you grab the entire audio buffer and hand it to
OpenAL and say "play this - tell me when it's nearly done".  If you don't
have enough RAM then streaming is just about the one thing that the
<audio> tag is really good for - so just use that instead.

If it's really considered likely that people would want note-by-note music
synthesis then we should layer a MIDIfile player onto the thing...that
would be a useful addition for super-low-memory/bandwidth music - but it's
far from essential.  But no amount of fancy API will help you if you
really need to choose which notes to play right at the instant when they
are due.

That's just not a typical modern "use case"...proof of which is that
L-O-N-G list of games that use OpenAL.

That's precisely why I think we should use an audio API that's popular
amongst game writers - and not try to invent one to solve problems that
don't actually exist.

What's neat about OpenAL is that you can attach an engine sound to a car -
drive the car around the virtual world, passing the exact same world-space
4x4 matrix to OpenAL as you do to OpenGL and with a couple of lines of
JavaScript, you get the car doing the right thing in the stereo image,
getting louder as it comes closer, having that cool doppler shift as it
drives past...all with just a handful of lines of code.

If you have the right hardware/drivers, you can even do 5.1 surround-sound
or (with headphones) get synthetic 3D audio.

  -- Steve

You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl