Class DiffSound

java.lang.Object
  extended by DiffSound

public class DiffSound
extends java.lang.Object

A class that encodes a Sound using an array of differences between sound samples. It is lossless only if every difference is in the range [-128..127].


Constructor Summary
DiffSound(int sample, byte[] diffs)
          Initialize the DiffSound using a given first sample and array of differences between adjacent samples.
 
Method Summary
 Sound decompress()
          Deompresses the receiver as a Sound, reconstructing the array of samples from its array of _differences_ between samples.
 void displayDifferences(int start, int end)
          Display to standard output the difference values between locations start and end, inclusive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiffSound

public DiffSound(int sample,
                 byte[] diffs)
Initialize the DiffSound using a given first sample and array of differences between adjacent samples.

Parameters:
sample - the first sample in the sound [-32768..32767]
diffs - an array of differences between samples
Method Detail

displayDifferences

public void displayDifferences(int start,
                               int end)
Display to standard output the difference values between locations start and end, inclusive.

Parameters:
start - the location of the first value to display
end - the location of the last value to display

decompress

public Sound decompress()
Deompresses the receiver as a Sound, reconstructing the array of samples from its array of _differences_ between samples.

Returns:
a Sound object