Details: This package contains classes for reading and writing RIFF-
Detailed information on the RIFF-
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.
In methods that read, write, or convert sample data, samples are stored in arrays of byte
s, short
s, int
s, long
s, float
s, and double
s. 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 {@link lava.konst.BYTE#MIN_UBYTE BYTE.MIN_UBYTE }
|
255 {@link lava.konst.BYTE#MAX_UBYTE BYTE.MAX_UBYTE }
|
short[] | 16-bit samples |
-32768 {@link lava.konst.SHORT#MIN_SSHORT SHORT.MIN_SSHORT }Short.MIN_VALUE
|
32767 {@link lava.konst.SHORT#MAX_SSHORT SHORT.MAX_SSHORT }Short.MIN_VALUE
|
int[] | 32-bit samples |
-2147483648 {@link lava.konst.INT#MIN_SINT INT.MIN_SINT }Integer.MIN_VALUE
|
+2147483647 {@link lava.konst.INT#MAX_SINT INT.MAX_SINT }Integer.MAX_VALUE
|
long[] | 64-bit samples |
-9223372036854775808 {@link lava.konst.LONG#MIN_SLONG LONG.MIN_SLONG }Long.MIN_VALUE
|
-9223372036854775807 {@link lava.konst.LONG#MAX_SLONG 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.