Hi, I was able to solve it using the inherent java audio class javax.sound.sampled. I convert an input audio file encoded in uLaw to PCM and then write the PCM file into an Audiostream. Code is given below.
try{
File filein = new File("C:/sourcefile.wav");
File fileout = new File("C:/PCMfile.wav");
AudioInputStream sourceaudio = AudioSystem.getAudioInputStream(filein);
AudioFormat format = sourceaudio.getFormat();
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
format.getSampleSizeInBits() * 2,
format.getChannels(),
format.getFrameSize() * 2,
format.getFrameRate(),
true);
}
AudioFileFormat.Type targettype = AudioFileFormat.Type.WAVE;
AudioInputStream targetaudiostream = AudioSystem.getAudioInputStream(format, sourceaudio);
AudioSystem.write(targetaudiostream, targettype, fileout);
System.out.println("PCM encoded file generated successfully.");
sourceaudio.close();
targetaudiostream.close();
} catch (Exception e) {
out.println("Error in audio format conversion");
e.printStackTrace();
}