public interface SampleBuffer extends Iterable<Float>
Integer.MAX_VALUE
and Integer.MIN_VALUE
. Despite using
floats, this allows us to detect clipping. Return values are signed such that
an empty signal has sample value 0. If the audio has multiple channels they
will occur in the same order as the original file (likely to be multiplexed -
so Modifier and Type | Method and Description |
---|---|
double[] |
asDoubleArray()
Returns the normalised (0..1) sample buffer data as a double array.
|
double[][] |
asDoubleChannelArray()
Returns the samples in their channels as normalise (0..1) sample buffer
data.
|
float[] |
asFloatArray()
Returns the normalised (0..1) sample buffer data as a float array.
|
float[][] |
asFloatChannelArray()
Returns the samples in their channels as normalise (0..1) sample buffer
data.
|
float |
get(int index)
Get the sample at the given index.
|
AudioFormat |
getFormat()
Returns the audio format for this set of samples.
|
SampleChunk |
getSampleChunk()
Return a sample chunk that contains the data from this sample buffer.
|
SampleChunk |
getSampleChunk(int channel)
Return a sample chunk that contains the data from a specific channel in
this sample buffer.
|
AudioTimecode |
getStartTimecode()
Returns the timecode of the start of this sample buffer.
|
float |
getUnscaled(int index)
Returns the sample value at the given index without scaling - that is, at
it's original sample value.
|
void |
set(int index,
float sample)
Set the sample value at the given index.
|
void |
setFormat(AudioFormat af)
Reset the audio format for the samples in this buffer.
|
int |
size()
Returns the size of this buffer.
|
forEach, iterator, spliterator
float get(int index)
Integer.MAX_VALUE
and Integer.MIN_VALUE
.
That sample will be signed.index
- The index of the sample to retrievevoid set(int index, float sample)
Integer.MAX_VALUE
and Integer.MIN_VALUE
(i.e. it should be signed).index
- The index of the sample to set.sample
- The sample value to set.int size()
AudioFormat getFormat()
AudioFormat
for this set of samples.void setFormat(AudioFormat af)
af
- The AudioFormat
SampleChunk getSampleChunk()
SampleChunk
containing data in this buffer.SampleChunk getSampleChunk(int channel)
channel
- The channelSampleChunk
containing data in this buffer.double[] asDoubleArray()
float[][] asFloatChannelArray()
float[] asFloatArray()
double[][] asDoubleChannelArray()
float getUnscaled(int index)
index
- The index to retrieveAudioTimecode getStartTimecode()