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()
AudioBuffer
AudioBuffer.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 AudioBuffer
AudioBuffer.getFrameNumber()
,
AudioBuffer.getTimestamp(java.util.concurrent.TimeUnit)
public long getTimestamp(TimeUnit timeUnit)
AudioBuffer
getTimestamp
in interface AudioBuffer
timeUnit
- time unitAudioBuffer.getTimestamp()
public int getFrameNumber()
AudioBuffer
AudioBuffer.getTimestamp()
, this method may not be the most accurate, if you didn't
start reading at the beginning of the file.getFrameNumber
in interface AudioBuffer
AudioBuffer.getTimestamp()
,
AudioFormat
public AudioFormat getAudioFormat()
AudioBuffer
getAudioFormat
in interface AudioBuffer
public float[] getData()
getMagnitudes()
.getData
in interface AudioBuffer
AbstractAudioSpectrum.getData()
public float[] getRealData()
getRealData
in interface AudioBuffer
public float[] getImaginaryData()
getImaginaryData
in interface AudioBuffer
public float[] getPowers()
square(getRealData())
.getPowers
in interface AudioBuffer
AudioBuffer.getMagnitudes()
public float[] getMagnitudes()
abs(getRealData())
.getMagnitudes
in interface AudioBuffer
AudioBuffer.getPowers()
public int getNumberOfSamples()
AudioBuffer
getNumberOfSamples
in interface AudioBuffer
protected float[] computePowers(int length)
protected float[] computeMagnitudes(int length, float[] powers)
public ComplexAudioBuffer derive(float[] real, float[] imaginary)
AudioBuffer
derive
in interface AudioBuffer
real
- real dataimaginary
- imaginary datapublic Object clone() throws CloneNotSupportedException
AudioBuffer
clone
in interface AudioBuffer
clone
in class Object
CloneNotSupportedException
Copyright © 2011–2020 tagtraum industries incorporated. All rights reserved.