<Sound Dev> DirectSound multi-channel recording

Florian Bomers javasound-dev at bome.com
Tue Oct 2 05:57:21 PDT 2007

Hi Klaus,

when I implemented Java Sound's DirectSound implementation, the
DirectSound specs stated (and I could verify by way of tests)
that requesting more than 16-bits or more than 2 channels would
just "expand" the soundcard's stereo, 16-bit signal to the
required format. So you could get 8 channels with 32-bits, but it
was just 4 times the stereo signal, and the 32-bits was just
extrapolated from the original 16-bits signal.

That's why it was limited to maximum of 2 channels and 16 bits,
to not wrongly provide a line with e.g. 24 bits, where the lower
8 bits are just extrapolated.

Further, using multi channel will raise the problem "which
channels?", that's why we need an additional parameter to specify
a channel mask.
The MS docs gives a good introduction:

Now, AudioFormat.properties are the intended way of specifying a
channel mask, and "validBitsPerSample", and so on. However, when
defining AudioFormat.properties, we must make sure that they are
usable in the same way on Linux, Solaris, possibly MacOS.

But the main, first problem remains how to prevent DirectSound
from emulating multi-channel/high resolution audio. Java Sound
must never wrongly pretend a certain quality...


On 9/24/2007 11:22 AM, Klaus Jaensch wrote:
> Hello,
> I would like to record multi-channel 24-bit audio with the 
> DirectSound JavaSound implementation under Windows. 
> But the audio formats defined in
> j2se/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp
> are limited to 8/16bit and 1 or 2 channels. 
> I would like to discuss how this limitation could be removed.
> For testing multichannel capabilities of JavaSound I extended 
> channelsArray up to 8 channels and bitsArray for 
> 24/32 bit recordings, then compiled dsound.dll and tested recording.
> It worked fine, so it's a pity that the recording formats are restricted 
> to basic formats.
> The question is how to make multi-channel possible without changing 
> the supported defaults formats, which can be queried by 
> isFormatSupported(AudioFormat).
> Regards,
> Klaus
> ------------------------------------------
> Klaus Jaensch
> Muenchen
> Germany
> Institut fuer Phonetik und Sprachverarbeitung
> Schellingstr.3/II
> 80799 München
> EMail: klausj at phonetik.uni-muenchen.de

Florian Bomers
Bome Software

Music Software, Development Tools:  http://www.bome.com
Java Sound extensions, plugins: http://www.tritonus.org
The Java Sound Resources:    http://www.jsresources.org
Please quote this email in your reply. Thanks!

More information about the sound-dev mailing list