ULAW format to PCM format conversion.

Java to go!
Java Sound QuickStart

Tony Loton
Listing 3. ULAW format to PCM format conversion.


if (
    (format.getEncoding() ==
    AudioFormat.Encoding.ULAW)
    ||(format.getEncoding() ==
    AudioFormat.Encoding.ALAW)
) 
{
  AudioFormat newFormat = new AudioFormat
  (AudioFormat.Encoding.PCM_SIGNED,
   format.getSampleRate(),
   format.getSampleSizeInBits() * 2,
   format.getChannels(),
   format.getFrameSize() * 2,
   format.getFrameRate(),
   true);

  stream =AudioSystem
   .getAudioInputStream(newFormat, stream);

  format = newFormat;
}

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.