SciLib.SP
Class muLawCodec

java.lang.Object
  extended by SciLib.SP.muLawCodec

public final class muLawCodec
extends java.lang.Object

This class contains some useful methods to handle audio file.


Constructor Summary
muLawCodec()
           
 
Method Summary
static vector decodeMuLaw(byteVector s)
          Decode a mu-law vector
static byteVector muLawCode(double[] s)
          Produce mu-law encoded audio samples from an linerly encoded array of 64 bit signed signed floating point numbers ranged from -1 to 1
static byteVector muLawCode(short[] s)
          Produce mu-law encoded audio samples from an linerly encoded array of 16 bit signed integers
static double mulawToDouble(byte s)
          Convert a byte s in the muLawCode to a double
static int mulawToLinear(byte s)
          Convert a byte s in the muLawCode to an integer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

muLawCodec

public muLawCodec()
Method Detail

muLawCode

public static byteVector muLawCode(short[] s)
Produce mu-law encoded audio samples from an linerly encoded array of 16 bit signed integers

Parameters:
s - the signal array
Returns:
A byteVector that contains the audio signal

muLawCode

public static byteVector muLawCode(double[] s)
Produce mu-law encoded audio samples from an linerly encoded array of 64 bit signed signed floating point numbers ranged from -1 to 1

Parameters:
s - the signal array
Returns:
A byteVector that contains the audio signal

mulawToDouble

public static double mulawToDouble(byte s)
Convert a byte s in the muLawCode to a double

Parameters:
s - A byte
Returns:
A double value

mulawToLinear

public static int mulawToLinear(byte s)
Convert a byte s in the muLawCode to an integer

Parameters:
s - A byte
Returns:
A double value

decodeMuLaw

public static vector decodeMuLaw(byteVector s)
Decode a mu-law vector

Parameters:
s - the mu-law byteVector
Returns:
a vector