public abstract class AbstractAudioSpectrum extends Object implements AudioSpectrum, Cloneable
AudioSpectrum.| Modifier and Type | Field and Description |
|---|---|
protected AudioFormat |
audioFormat |
protected int |
frameNumber |
protected float[] |
imaginaryData |
protected float[] |
magnitudes |
protected float[] |
powers |
protected float[] |
realData |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractAudioSpectrum(AbstractAudioSpectrum abstractAudioSpectrum)
Copy constructor for creating exact copies of a spectrum, if you know, what class it is.
|
|
AbstractAudioSpectrum(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) |
AudioFormat |
getAudioFormat()
AudioFormat of the data this spectrum was generated from.
|
float[] |
getData()
Synonymous with
getMagnitudes() |
int |
getFrameNumber()
Number of the first frame at the beginning of this buffer.
|
float |
getFrequency(int bin)
Frequency represented by bin/index
x. |
float[] |
getImaginaryData()
Imaginary part of the spectrum (phase).
|
float[] |
getMagnitudes()
Magnitudes (square root of the powers) of the spectrum.
|
int |
getNumberOfSamples()
Number of samples.
|
float[] |
getPowers()
Powers (sum of the squares of the real and imaginary part) of the spectrum.
|
float[] |
getRealData()
Real part of the spectrum (amplitudes).
|
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.
|
protected void |
reuse(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat)
Refills this spectrum with new data.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitderive, getBin, getFrequenciesprotected float[] realData
protected float[] imaginaryData
protected int frameNumber
protected AudioFormat audioFormat
protected float[] magnitudes
protected float[] powers
public AbstractAudioSpectrum(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat)
protected AbstractAudioSpectrum(AbstractAudioSpectrum abstractAudioSpectrum)
clone().abstractAudioSpectrum - spectrum to copyprotected void reuse(int frameNumber,
float[] realData,
float[] imaginaryData,
AudioFormat audioFormat)
frameNumber - frame numberrealData - real dataimaginaryData - imaginary dataaudioFormat - audio formatpublic 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 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 AudioFormat getAudioFormat()
getAudioFormat in interface AudioBufferpublic float[] getRealData()
getRealData in interface AudioBufferpublic float[] getImaginaryData()
getImaginaryData in interface AudioBufferpublic float[] getData()
getMagnitudes()getData in interface AudioBuffergetData()public float getFrequency(int bin)
x.getFrequency in interface AudioSpectrumbin - bin numberAudioSpectrum.getFrequencies()public int getNumberOfSamples()
getNumberOfSamples in interface AudioBuffergetRealData().length.protected float[] computePowers(int length)
protected float[] computeMagnitudes(int length,
float[] powers)
public float[] getPowers()
getPowers in interface AudioBuffergetMagnitudes()public float[] getMagnitudes()
getMagnitudes in interface AudioBuffergetPowers()public Object clone() throws CloneNotSupportedException
AudioBufferclone in interface AudioBufferclone in class ObjectCloneNotSupportedExceptionCopyright © 2011–2020 tagtraum industries incorporated. All rights reserved.