<Sound Dev> DirectSound multi-channel recording

Klaus Jaensch klausj at phonetik.uni-muenchen.de
Thu Jan 3 07:18:53 PST 2008


Hi Florian,

Happy New Year to all ! 

> 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.
>
Yes, I understand. No good idea of the DirectSound programmers.

> 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:
> http://www.microsoft.com/whdc/device/audio/multichaud.mspx
> 
> 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...
>

For my tests I used a soundcard to connect 8-channels to an digital mixing 
console, so there were no particular assignments to the channels.
Maybe the channel masking/mapping can be done in a further step.  

I see that the return values of method
DataLine.Info.isFormatSupported(AudioFormat format)
should not be changed. But maybe DataLine.Info should provide the 
information that the line possibly has more format/channel capabilities, 
e.g. with a method: boolean isPossiblySupportingOtherFormats().
The DirectSound implentation should return true, while another 
implementation (ALSA ?) which definitely knows about the device 
capabilities could return false.
 
Then if the DataLine.open(AudioFormat format) method would not check 
the AudioFormat by calling DataLine.Info.isFormatSupported(AudioFormat format) 
it would be possible to record multi-channel without pretending non-existing 
quality or channels. 
To keep compatibility entirely, unchecked opening of the line could be 
signalized by an AudioFormat property (e.g. FORCE_UNCHECKED_OPEN).

Regards,

Klaus
 
> Regards,
> Florian
> 
> 
> 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!
> 

------------------------------------------
Klaus Jaensch
Muenchen
Germany

Institut fuer Phonetik und Sprachverarbeitung
Schellingstr.3/II
80799 München

Phone (Work): +49-(0)89-2180-2806
Fax:          +49-(0)89-2180-5790
EMail: klausj at phonetik.uni-muenchen.de


More information about the sound-dev mailing list