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, wait
derive, getBin, getFrequencies
protected 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()
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 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 AudioFormat getAudioFormat()
getAudioFormat
in interface AudioBuffer
public float[] getRealData()
getRealData
in interface AudioBuffer
public float[] getImaginaryData()
getImaginaryData
in interface AudioBuffer
public float[] getData()
getMagnitudes()
getData
in interface AudioBuffer
getData()
public float getFrequency(int bin)
x
.getFrequency
in interface AudioSpectrum
bin
- bin numberAudioSpectrum.getFrequencies()
public int getNumberOfSamples()
getNumberOfSamples
in interface AudioBuffer
getRealData()
.length
.protected float[] computePowers(int length)
protected float[] computeMagnitudes(int length, float[] powers)
public float[] getPowers()
getPowers
in interface AudioBuffer
getMagnitudes()
public float[] getMagnitudes()
getMagnitudes
in interface AudioBuffer
getPowers()
public Object clone() throws CloneNotSupportedException
AudioBuffer
clone
in interface AudioBuffer
clone
in class Object
CloneNotSupportedException
Copyright © 2011–2020 tagtraum industries incorporated. All rights reserved.