Sharkysoft home

Package lava.riff.wave

Wave file processing.

See:
          Description

Class Summary
PcmWaveFormatChunk Format chunk for Microsoft PCM .wav files.
PcmWaveStreamReader Reads standard Microsoft PCM .wav file.
PcmWaveStreamWriter Writes standard Microsoft PCM wave files.
RIFF_WAVE RIFF-wave file constants.
WaveAdtlChunkReader Parses associated data list chunk.
WaveCuePoint Single cue point from cue points chunk.
WaveCuePointList Parses cue point list.
WaveFormatChunk Base format chunk.
WaveSampleClipper Clips wave sample data.
WaveSampleConverter Casts samples from one type to another.
WaveSampleRounder Rounds wave sample data.
WaveStreamReader Base class for all .wav stream decoders.
WaveStreamWriter Base class for .wav file encoders.
 

Package lava.riff.wave Description

Wave file processing.

Details: This package contains classes for reading and writing RIFF-wave (.wav) files. Although only the basic Microsoft Pulse Code Modulation (PCM) format is supported, these classes have been designed to support additional codecs which you can developed and graft into the package.

Detailed information on the RIFF-wave file format can be found in RIFF WAVE (.WAV) file format.

channel samples vs. (full) samples

The method names and related documentation in this package differentiate between the terms (regular) samples and channel samples. A channel sample is considered to be a single measurement of a single channel at a single point in time. A (regular) "sample," however, without the "channel" qualification, refers to the set of samples taken from all channels at the same time. For single channel audio files, of course, there is no difference. The main reason for making this distinction is to avoid ambiguity when discussing bits per sample, sample rate, etc.

sample arrays

In methods that read, write, or convert sample data, samples are stored in arrays of bytes, shorts, ints, longs, floats, and doubles. The sample array's primitive type implies the sample resolution of the data stored in the arrays. Each method that can reasonably be expected to do so is able to produce and consume each of these array types, even if the .wav file being processed has a fixed resolution. (Samples are automatically converted if necessary.) The resolution represented by each array types is described in the following table:

array type resolution minimum value maximum value
byte[] 8-bit samples 0
BYTE.MIN_UBYTE
255
BYTE.MAX_UBYTE
short[] 16-bit samples -32768
SHORT.MIN_SSHORT
Short.MIN_VALUE
32767
SHORT.MAX_SSHORT
Short.MIN_VALUE
int[] 32-bit samples -2147483648
INT.MIN_SINT
Integer.MIN_VALUE
+2147483647
INT.MAX_SINT
Integer.MAX_VALUE
long[] 64-bit samples -9223372036854775808
LONG.MIN_SLONG
Long.MIN_VALUE
-9223372036854775807
LONG.MAX_SLONG
Long.MAX_VALUE
float[] real-valued samples -1.0 +1.0
double[] real-valued samples -1.0 +1.0

When samples are converted from one integer resolution to another integer resolution, simple bit shifting is used. When samples are converted from a real resolution to an integer resolution, the real values are multiplied by the integer resolution's maximum value. When samples are converted from an integer resolution to a real resolution, the values are divided by the integer resolution's maximum value.

If this wave source contains multiple channels, the individual channel samples are interleaved.


Sharkysoft home