public class ComplexAudioBuffer extends Object implements AudioBuffer, Cloneable
Buffer that holds complex, time domain audio data and some meta information in the form of
an AudioFormat instance.
SignalPullProcessor,
SignalProcessor,
RealAudioBuffer| Constructor and Description |
|---|
ComplexAudioBuffer(ComplexAudioBuffer buffer)
Copy constructor that creates a deep copy of the data, but a shallow (reference) copy of the format.
|
ComplexAudioBuffer(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates an exact copy of this buffer.
|
protected float[] |
computeMagnitudes(int length,
float[] powers) |
protected float[] |
computePowers(int length) |
ComplexAudioBuffer |
derive(float[] real,
float[] imaginary)
Creates a copy of this buffer, but replaces its values with the given real and imaginary data.
|
boolean |
equals(Object o) |
AudioFormat |
getAudioFormat()
Describes the audio data contained in this buffer.
|
float[] |
getData()
This is the same as
getMagnitudes(). |
int |
getFrameNumber()
Number of the first frame at the beginning of this buffer.
|
float[] |
getImaginaryData()
Imaginary part of this buffer's data.
|
float[] |
getMagnitudes()
Magnitudes for this buffer - since this is a real-only buffer, this is equivalent to
abs(getRealData()). |
int |
getNumberOfSamples()
Returns the number of samples this buffer was built from.
|
float[] |
getPowers()
Powers for this buffer - since this a real-only buffer, this is equivalent to
square(getRealData()). |
float[] |
getRealData()
Real part of this buffer's data.
|
long |
getTimestamp()
Time from the beginning of the track to the beginning of this buffer in ms.
|
long |
getTimestamp(TimeUnit timeUnit)
Time from the beginning of the track to the beginning of this buffer in the requested unit.
|
int |
hashCode() |
void |
reuse(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat)
Refills this buffer with new data.
|
String |
toString() |
public ComplexAudioBuffer(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat)
public ComplexAudioBuffer(ComplexAudioBuffer buffer)
buffer - buffer to copypublic void reuse(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat)
frameNumber - frameNumberrealData - realDataimaginaryData - imaginaryDataaudioFormat - audioFormatpublic long getTimestamp()
AudioBufferAudioBuffer.getTimestamp(java.util.concurrent.TimeUnit) with a
finer unit.
If we didn't start reading at the beginning of the file (i.e. timestamp == 0),
the offset may not be 100% precise.getTimestamp in interface AudioBufferAudioBuffer.getFrameNumber(),
AudioBuffer.getTimestamp(java.util.concurrent.TimeUnit)public long getTimestamp(TimeUnit timeUnit)
AudioBuffergetTimestamp in interface AudioBuffertimeUnit - time unitAudioBuffer.getTimestamp()public int getFrameNumber()
AudioBufferAudioBuffer.getTimestamp(), this method may not be the most accurate, if you didn't
start reading at the beginning of the file.getFrameNumber in interface AudioBufferAudioBuffer.getTimestamp(),
AudioFormatpublic AudioFormat getAudioFormat()
AudioBuffergetAudioFormat in interface AudioBufferpublic float[] getData()
getMagnitudes().getData in interface AudioBufferAbstractAudioSpectrum.getData()public float[] getRealData()
getRealData in interface AudioBufferpublic float[] getImaginaryData()
getImaginaryData in interface AudioBufferpublic float[] getPowers()
square(getRealData()).getPowers in interface AudioBufferAudioBuffer.getMagnitudes()public float[] getMagnitudes()
abs(getRealData()).getMagnitudes in interface AudioBufferAudioBuffer.getPowers()public int getNumberOfSamples()
AudioBuffergetNumberOfSamples in interface AudioBufferprotected float[] computePowers(int length)
protected float[] computeMagnitudes(int length,
float[] powers)
public ComplexAudioBuffer derive(float[] real, float[] imaginary)
AudioBufferderive in interface AudioBufferreal - real dataimaginary - imaginary datapublic Object clone() throws CloneNotSupportedException
AudioBufferclone in interface AudioBufferclone in class ObjectCloneNotSupportedExceptionCopyright © 2011–2020 tagtraum industries incorporated. All rights reserved.