public class InstantaneousFrequencySpectrum extends AbstractAudioSpectrum implements Cloneable
Represents a spectrum with instantaneous frequencies based on two subsequent LinearFrequencySpectrums.
Even though instances are meant to be immutable, all methods return the original, internally used arrays to increase efficiency and reduce memory consumption. As a consequence you must never modify any of those arrays returned to you.
audioFormat, frameNumber, imaginaryData, magnitudes, powers, realData| Constructor and Description |
|---|
InstantaneousFrequencySpectrum(InstantaneousFrequencySpectrum instantaneousFrequencySpectrum) |
InstantaneousFrequencySpectrum(int frameNumber,
float[] magnitudes,
float[] frequencies,
AudioFormat audioFormat) |
InstantaneousFrequencySpectrum(LinearFrequencySpectrum spectrum1,
LinearFrequencySpectrum spectrum2) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates an exact copy of this buffer.
|
InstantaneousFrequencySpectrum |
derive(float[] magnitudes,
float[] frequencies)
Creates a copy of this spectrum, but replaces its values with the given real and imaginary data.
|
boolean |
equals(Object o) |
float |
getBandwidth()
Returns the bandwidth (or frequency resolution) of this buffer.
|
int |
getBin(float frequency)
Computes a bin/index for the given frequency.
|
float[] |
getFrequencies()
Array with frequency values in Hz corresponding to the bin numbers.
|
float |
getFrequency(int bin)
Returns the frequency of a given bin.
|
float[] |
getMagnitudes()
Magnitudes (square root of the powers) of the spectrum.
|
float[] |
getPowers()
Powers (sum of the squares of the real and imaginary part) of the spectrum.
|
int |
hashCode() |
void |
reuse(int frameNumber,
float[] magnitudes,
float[] frequencies,
AudioFormat audioFormat)
Refills this spectrum with new data.
|
String |
toString() |
computeMagnitudes, computePowers, getAudioFormat, getData, getFrameNumber, getImaginaryData, getNumberOfSamples, getRealData, getTimestamp, getTimestamppublic InstantaneousFrequencySpectrum(LinearFrequencySpectrum spectrum1, LinearFrequencySpectrum spectrum2)
public InstantaneousFrequencySpectrum(int frameNumber,
float[] magnitudes,
float[] frequencies,
AudioFormat audioFormat)
public InstantaneousFrequencySpectrum(InstantaneousFrequencySpectrum instantaneousFrequencySpectrum)
public void reuse(int frameNumber,
float[] magnitudes,
float[] frequencies,
AudioFormat audioFormat)
AbstractAudioSpectrumreuse in class AbstractAudioSpectrumframeNumber - frame numbermagnitudes - real datafrequencies - imaginary dataaudioFormat - audio formatpublic float getBandwidth()
public float[] getFrequencies()
getFrequencies in interface AudioSpectrumnumberOfSamples/2 due to symmetrygetFrequency(int)public float getFrequency(int bin)
getFrequencies(), as it is more efficient.getFrequency in interface AudioSpectrumgetFrequency in class AbstractAudioSpectrumbin - bin numbergetFrequencies()public int getBin(float frequency)
getBin in interface AudioSpectrumfrequency - frequencypublic float[] getPowers()
getPowers in interface AudioBuffergetPowers in class AbstractAudioSpectrumgetMagnitudes()public float[] getMagnitudes()
getMagnitudes in interface AudioBuffergetMagnitudes in class AbstractAudioSpectrumgetPowers()public InstantaneousFrequencySpectrum derive(float[] magnitudes, float[] frequencies)
AudioSpectrumderive in interface AudioBufferderive in interface AudioSpectrummagnitudes - real datafrequencies - imaginary datapublic Object clone() throws CloneNotSupportedException
AudioBufferclone in interface AudioBufferclone in class AbstractAudioSpectrumCloneNotSupportedExceptionCopyright © 2011–2020 tagtraum industries incorporated. All rights reserved.