3D audio test using JavaFX and procedural java sound

File is here.

Am in a bit of a rush–so quickly:

I am working on a 3D audio system.
I made a quickie 3D chess board with JavaFX. You can tool around using the arrow keys.
The purple towers that come and go each emit a sound generated via a procedural FM synthesizer. There are six towers and five have pretty much the same frequency (slight variations in the amounts and rates of lfo and other tweaks) and one is considerably deeper in pitch.

The main thing: I’m using TIME to create a pan effect.

  1. put the audio output of each tower onto a delay line
  2. calculate the distance of each tower to the “ears” of the camera (the ears are separated by 32 pixels)
  3. use the difference in distance to control two variable pointers into the delay line, one for each ear.

There is NO volume panning being used. Both ears are getting the exact same data, just with a time offset.

I had a pretty good volume pan going, but here’s the problem with that: if you get up close to a tower and make one ear next to it, and the other away, the tower is pretty much silent in the far ear, allowing one to hear other stuff on the board.

In reality, if you are standing next to a jackhammer, the volume of the jackhammer masks both ears. It doesn’t create an audio shadow that allows the sound to disappear in the far ear. With the temporal pan, the masking is much more correct.

I haven’t yet tried putting in any filters to replicate front-back cone-of-confusion disambiguation. Nor even tried a slight front-back volume difference, which might be helpful. I do plan to get to this.

There is a bunch to do, in that first it has to work, then you improve performance and design. I seem to have to do things wrong a few ways before I can figure out a more reasonable way to do things.

Patting self on back: the changes in pan and volume are smooth, no zippering. I might try making my camera ears the equivalent of 35 centimeters apart instead of 32. There are undoubtedly other things to fix, too.