<Sound Dev> Open question - state of OpenJDK audio

Mandolane Team mandolane at mandolane.co.uk
Thu Oct 28 03:01:06 PDT 2010


Hi Peter and everyone

On 28 Oct 2010, at 01:16, Peter Kirn wrote:

> Thanks to Mandolane -- the MIDI I/O implementation has long been something needed in Mac Java and would be hugely helpful.

This was the spur behind writing Mandolane, although the very latest version of Apple's Java included an implementation of this.  Ironically, Apple's version wasn't as good as ours (I would say that, wouldn't I?) and it completely stopped useful side products such as MidiKeys and SimpleSynth from working with Mac Java programs. 

> 
> I was also curious about the state of audio in OpenJDK across platforms. I know what was originally proposed, but I'm unclear on the current status of things. It seems to me that what's really essential is MIDI I/O and an audio I/O driver and callback mechanism. JavaSound itself includes many other portions, like the MIDI sequencer, that were never really completed. I wonder whether the OpenJDK project is seriously talking about re-implementing JavaSound, or whether a more future-proof, bare-bones audio implementation is what's really needed.

Many years ago, Matthias and Florian explained that the strategy of Java Sound was "make available the facilities of the underlying audio hardware".  I have always disliked this idea.  No graphics programmer has to worry about the minutiae of the graphics card and monitor: they use an abstract model which the underlying systems convert into images which are displayed on the monitor.  Indeed, graphics programming has made the transition from CRT to LCD monitors with zero issues.

So (I believe) it should be with audio, but instead we have anarchy.  If your program uses a few stereo clips and some stereo continuous sound, and if you're not too bothered with latency then Java Sound is just about adequate.  However, if you need low latency then you're dependent on how well the underlying mixer is implemented.  Sometimes it's good and sometimes it's not so good.  If you're really adventurous (!) and want multichannel sound then for the sake of your sanity don't use Java!!  

I firmly believe that within the terribly lax specification of Java Sound, it is possible to create a cross platform abstract audio model that will satisfy the requirements of all but the most exacting application.  Multichannel set ups include 5.1, 4.0, 7.1, and a few others.  I can see no technical reason why we can't write an app for a general multichannel set up and have Java Sound automatically map audio to the underlying speaker system - on ANY platform.  If the programmer only has stereo headphones, then a suitable "dummy head" DSP algorithm can be used instead.

Rant over ;-)

M




More information about the sound-dev mailing list