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:

Some times you get to push the Easy Button

Not much to report today, except that everything worked the way it was supposed to.

  • Dolby worked as plug-and play.
  • The small tactile actuator seems best.
  • The amp is powerful.
  • Java3D talks to at least two channels

So the next step is to get three more amps, six more actuators, and some kind of headgear. And maybe some kind of rigid helmet to attach the actuators to? I’m thinking I can use one of my old bike helmets to start with.

Anyway. Progress!

Sounding good to me!

So, after following the link from yesterday’s post, I put the following call in, just after main().

System.setProperty("j3d.audiodevice", "com.sun.j3d.audioengines.javasound.JavaSoundMixer");

It all compiles fine and runs! I get the following warning:

***
*** WARNING: JavaSoundMixer: Streaming (uncached) audio not implemented
***

But since at this point I’m only interested in looping sounds anyway, this should be just fine. Nothing like a 13 year old code base that still works. A toast to Sun.
And we get 3D graphics to boot:

SimpleSounds window

Now I need to get the Dolby unit installed and running, and hook up the amp to my collection of tactile transducers. Tomorrow?