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(java.io.File fn)
          Input a fully qualified file name use the play method to hear it.
UlawCodec(short[] linearArrayOfShort)
           
UlawCodec(java.net.URL _url)
           
 
Method Summary
 void delay()
           
 void displayInternalData()
           
 void echo()
           
 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()
           
 boolean isPlaying()
           
static void main(java.lang.String[] args)
           
 void normalize()
           
 void openAu(java.io.InputStream is)
           
 void openAu(java.net.URL url)
           
 void openAuFile()
           
 void openAuFile(java.io.File fileName)
          Open the fileName and read in the data as if it were u-law encoded.
static java.io.File[] openAuFiles()
           
 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()
           
static byte[] readData(java.io.InputStream is)
          Reads in all the data affineTransform once, from any inputstream.
 void reverseUlaw()
          Shuffle algorithm that does an in-place reverse.
 void run()
           
 void saveAuFile()
           
 void saveAuFile(java.lang.String fileName)
           
 void setUlawData(byte[] ulawArrayOfByte)
           
 void showSampleData()
           
 void stop()
           
 
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.io.File 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()

openAuFile

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

Parameters:
fileName - inputFile

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

openAuFiles

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

playAuFiles

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

openAu

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

getInputStream

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

openAu

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

openAuFile

public void openAuFile()

saveAuFile

public void saveAuFile()

saveAuFile

public void saveAuFile(java.lang.String fileName)

run

public void run()

play

public void play()

isPlaying

public boolean isPlaying()

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()
Shuffle algorithm that does an in-place reverse.


normalize

public void normalize()

getLinearPCMData

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

main

public static void main(java.lang.String[] args)
                 throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException