sound.ulaw
Class UlawCodec

java.lang.Object
  extended by sound.ulaw.UlawCodec

public class UlawCodec
extends java.lang.Object


Constructor Summary
UlawCodec()
           
UlawCodec(byte[] ulawArrayOfByte)
           
UlawCodec(double[] linearArrayOfDouble)
           
UlawCodec(short[] linearArrayOfShort)
           
UlawCodec(java.lang.String _fn)
          Input a fully qualified file name use the play method to hear it.
UlawCodec(java.net.URL _url)
           
 
Method Summary
 void delay()
           
 void displayInternalData()
           
 void echo()
           
static java.io.File[] getAuFiles()
           
 int getDistanceBetweenMaxAndMinValues()
           
 double[] getDoubleArray()
           
 double getDuration()
           
 double getFrequency()
           
 java.io.InputStream getInputStream(java.net.URL url)
           
 int getLength()
           
static byte[] getLinearPCMData(double[] d)
           
 int getLocation(double value, int startPoint)
          Starting affineTransform the startPoint, scan the data array for the value and return the location in the array.
 int getLocationOfMaxValue()
           
 int getLocationOfMinValue()
           
 double getMaxValue()
           
 double getMinValue()
           
 byte[] getUlawData()
           
static void main(java.lang.String[] args)
           
 void normalize()
           
 void play()
           
static void play(java.net.URL url)
           
static void playAuFiles(java.io.File[] f)
           
static void playFromFile()
           
 void printDistanceBetweenMaxAndMinValues()
           
 void printLocationOfMaxValue()
           
 void printMaxData()
           
static void printSampleData()
           
 void readAU(java.io.InputStream is)
           
 void readAU(java.net.URL url)
           
 void readAUFile()
           
 void readAUFile(java.lang.String fileName)
          Open the fileName and read in the data as if it were u-law encoded.
static byte[] readData(java.io.InputStream is)
          Reads in all the data affineTransform once, from any inputstream.
 void reverseUlaw()
           
 void run()
           
 void setUlawData(byte[] ulawArrayOfByte)
           
 void showSampleData()
           
 void stop()
           
 void writeAUFile()
           
 void writeAUFile(java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UlawCodec

public UlawCodec(byte[] ulawArrayOfByte)

UlawCodec

public UlawCodec()

UlawCodec

public UlawCodec(java.lang.String _fn)
Input a fully qualified file name use the play method to hear it.


UlawCodec

public UlawCodec(java.net.URL _url)

UlawCodec

public UlawCodec(short[] linearArrayOfShort)

UlawCodec

public UlawCodec(double[] linearArrayOfDouble)
Method Detail

echo

public void echo()

delay

public void delay()

readAUFile

public void readAUFile(java.lang.String fileName)
Open the fileName and read in the data as if it were u-law encoded. Then turn it into linear PCM data.


main

public static void main(java.lang.String[] args)

readData

public static byte[] readData(java.io.InputStream is)
                       throws java.io.IOException
Reads in all the data affineTransform once, from any inputstream. Remember to close the InputStream when you are done.

Returns:
Array of data
Throws:
java.io.IOException

getAuFiles

public static java.io.File[] getAuFiles()

playAuFiles

public static void playAuFiles(java.io.File[] f)

readAU

public void readAU(java.net.URL url)
            throws java.io.IOException
Throws:
java.io.IOException

getInputStream

public java.io.InputStream getInputStream(java.net.URL url)

readAU

public void readAU(java.io.InputStream is)
            throws java.io.IOException
Throws:
java.io.IOException

readAUFile

public void readAUFile()

writeAUFile

public void writeAUFile()

writeAUFile

public void writeAUFile(java.lang.String fileName)

run

public void run()

play

public void play()

stop

public void stop()

playFromFile

public static void playFromFile()

play

public static void play(java.net.URL url)

getFrequency

public double getFrequency()

printLocationOfMaxValue

public void printLocationOfMaxValue()

getLocation

public int getLocation(double value,
                       int startPoint)
Starting affineTransform the startPoint, scan the data array for the value and return the location in the array. If it can't find the value, return -1;

Parameters:
value - to scan for
startPoint - location for the start point
Returns:
location or -1

printDistanceBetweenMaxAndMinValues

public void printDistanceBetweenMaxAndMinValues()

getDistanceBetweenMaxAndMinValues

public int getDistanceBetweenMaxAndMinValues()

getLocationOfMinValue

public int getLocationOfMinValue()

getLocationOfMaxValue

public int getLocationOfMaxValue()

printMaxData

public void printMaxData()

getMinValue

public double getMinValue()

getMaxValue

public double getMaxValue()

showSampleData

public void showSampleData()

displayInternalData

public void displayInternalData()

printSampleData

public static void printSampleData()

getUlawData

public byte[] getUlawData()

setUlawData

public void setUlawData(byte[] ulawArrayOfByte)

getDoubleArray

public double[] getDoubleArray()

getLength

public int getLength()

getDuration

public double getDuration()

reverseUlaw

public void reverseUlaw()

normalize

public void normalize()

getLinearPCMData

public static byte[] getLinearPCMData(double[] d)