Category Archives: LWJGL

Multichannel sound

It was looking like Java3D only handled Mono and stereo, but I just found com.sun.j3d.audioengines.javasound .JavaSoundMixer, It also uses javax.media.j3d.PhysicalEnvironment, which looks like it has built-in head tracking.

Darn it – got my hopes up too soon: “While the sound image created for final output to the playback system is either only mono or stereo, most device driver implementations will mix the left and right image signals generated for each rendered sound source before outputting the final playback image. Each sound source will use N input channels of this internal mixer. Each implemented Java3D audio device driver will have its own limitations and driver-specific characteristics. These include channel availability and usage (during rendering). Methods for querying these device-driver specific characteristics are provided.” (from javax.media.j3d.AudioDevice)

OK, I’m not ready to give up on Java yet. According to this bug report, multichannel support has been working for a while. My two options at this point are OpenAl through the LWJGL folks, and the javax.sound.sampled library.

Because I’d like to show graphically where the sounds are coming from, I’m going to try the LWJGL approach first.

Looks like multichannel support is in OpenAl, but will require care: “The multi-channel extension provides a mechanism to play multi-channel data via OpenAL. A variety of formats are supported. Multi-channel buffers can be attached or queued on a source. Note that when using the “Generic Software” device, the multi-channel buffers are mixed down to a stereo output. On a hardware device (such as the “Generic Hardware” device or a native device), each channel of a buffer requires a hardware voice. So, for example playing a buffer using the AL_FORMAT_51CHN16 format will require 6 free hardware voices. If the hardware resources are unavailable, the call to alSourceQueueBuffers or alSourcei will fail.”


And then there’s Javascript….

It turns out that there is a good deal of work going on in bringing multichannel audio to your browser. Since this *is* the future, it’s not a thing that I want to overlook, but I don’t want to put all that much time into it right now either. So here are some links: