public class InstantaneousFrequencySpectrum extends AbstractAudioSpectrum implements Cloneable
Represents a spectrum with instantaneous frequencies based on two subsequent LinearFrequencySpectrum
s.
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, getTimestamp
public 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)
AbstractAudioSpectrum
reuse
in class AbstractAudioSpectrum
frameNumber
- frame numbermagnitudes
- real datafrequencies
- imaginary dataaudioFormat
- audio formatpublic float getBandwidth()
public float[] getFrequencies()
getFrequencies
in interface AudioSpectrum
numberOfSamples/2
due to symmetrygetFrequency(int)
public float getFrequency(int bin)
getFrequencies()
, as it is more efficient.getFrequency
in interface AudioSpectrum
getFrequency
in class AbstractAudioSpectrum
bin
- bin numbergetFrequencies()
public int getBin(float frequency)
getBin
in interface AudioSpectrum
frequency
- frequencypublic float[] getPowers()
getPowers
in interface AudioBuffer
getPowers
in class AbstractAudioSpectrum
getMagnitudes()
public float[] getMagnitudes()
getMagnitudes
in interface AudioBuffer
getMagnitudes
in class AbstractAudioSpectrum
getPowers()
public InstantaneousFrequencySpectrum derive(float[] magnitudes, float[] frequencies)
AudioSpectrum
derive
in interface AudioBuffer
derive
in interface AudioSpectrum
magnitudes
- real datafrequencies
- imaginary datapublic Object clone() throws CloneNotSupportedException
AudioBuffer
clone
in interface AudioBuffer
clone
in class AbstractAudioSpectrum
CloneNotSupportedException
Copyright © 2011–2020 tagtraum industries incorporated. All rights reserved.