Link to home
Start Free TrialLog in
Avatar of ecsdsq
ecsdsq

asked on

Playing Audio Using java in AU Format

Dear sir,
We are involved in Developing Audio Conferencing system using Java.
Audio capture is achived using WINAPI calls (Java Native Methods) with
wave recording format as :

 waveformattag == WAVE_FORMAT_PCM
number of channels == 1
Bitspersample == 8
no. of samples per second = 8000
This audio sample is converted into .au format by adding header
information.
viz
struct {
int magic =  0x2E736E64;
    int dataLocation =24;
    int dataSize = filesize ;
    int dataFormat =2;
    int samplingRate =8000;
    int channelCount = 1;
}
 Playing audio is achived using audio.play method in JDK1.1.3   (& Sun
audio Package).
The problem is, the audio quality is diminished while playing using the
above mentioned method.
While it is good when done with Mutimedia Media Player(available with
WIN95).
Kindly let us know what is the underlined problem. Awaiting your reply.

Regards
ECS Development Team
DSQ s/w Ltd, Madras, India.

Avatar of gwalters
gwalters

You can't convert WAV to AU by adding a header.  WAV is PCM, and AU uses ULAW.
Avatar of ecsdsq

ASKER

Thanks Gwalters for your immediate response. Actually we are struggling for recording the sound using ULAW only. But the SB16 of Creative Labs does not allow us to do so. So we are recording th raw samples in PCM format and then adding the 32 bit header corresponding to the .au format thinking that we will get the audio format. We would like to have more details about how to record in .au format with the SB16 of creative labs in the Windows-95 platform.
Expecting your fast response,

DSQ ECS team.
Yes, that's where my limited knowlege ends.  I think you'll probably need to write/find a conversion program.

I used a program called "sox" (SOund eXchange), that converts almost any format to almost any other format.  Sox comes with source code, so you probably can port the appropriate parts to java (or just use it directly as native code).

ASKER CERTIFIED SOLUTION
Avatar of kollegov
kollegov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Found one more, which can be interesting to you:

http://www.scrawl.com/store/

SoundBite v1.0
Audio Recording/Playback in Java
using Native Methods (Windows 95/NT)
Shareware
And ONE more exactly what you need!!!!
Wav2Au converts Microsoft .wav files to the .au format
 supported by Java. It reads mono or stereo, 8 or 16 bit,
 PCM-encoded files at any reasonable sampling rate,
 and writes the 8-bit, 8012 Hz sampling rate, mono,
 mu-law encoded files supported by Java. Full source
 code is included.
http://saturn.math.uaa.alaska.edu/~hursha