<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Sun Sep 18 18:13:12 EDT 2011 -->
<TITLE>
FourierTransform (libgdx API)
</TITLE>
<META NAME="date" CONTENT="2011-09-18">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="FourierTransform (libgdx API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package
</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class
</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/FourierTransform.html"><FONT CLASS="NavBarFont1"><B>Use
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help
</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
libgdx API
<style>
body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%; font-weight:bold }
.TableHeadingColor { background:#EEEEFF; }
a { text-decoration:none }
a:hover { text-decoration:underline }
a:link, a:visited { color:blue }
table { border:0px }
.TableRowColor td:first-child { border-left:1px solid black }
.TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
hr { border:0px; border-bottom:1px solid #333366; }
</style>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../com/badlogic/gdx/audio/analysis/FFT.html" title="class in com.badlogic.gdx.audio.analysis"><B>PREV CLASS
</B></A>
<A HREF="../../../../../com/badlogic/gdx/audio/analysis/KissFFT.html" title="class in com.badlogic.gdx.audio.analysis"><B>NEXT CLASS
</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/badlogic/gdx/audio/analysis/FourierTransform.html" target="_top"><B>FRAMES
</B></A>
<A HREF="FourierTransform.html" target="_top"><B>NO FRAMES
</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes
</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:
NESTED
|
<A HREF="#field_summary">FIELD
</A> |
CONSTR
|
<A HREF="#method_summary">METHOD
</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:
<A HREF="#field_detail">FIELD
</A> |
CONSTR
|
<A HREF="#method_detail">METHOD
</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.badlogic.gdx.audio.analysis
</FONT>
<BR>
Class FourierTransform
</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>com.badlogic.gdx.audio.analysis.FourierTransform
</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:
</B> <DD><A HREF="../../../../../com/badlogic/gdx/audio/analysis/DFT.html" title="class in com.badlogic.gdx.audio.analysis">DFT
</A>,
<A HREF="../../../../../com/badlogic/gdx/audio/analysis/FFT.html" title="class in com.badlogic.gdx.audio.analysis">FFT
</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public abstract class
<B>FourierTransform
</B><DT>extends java.lang.Object
</DL>
</PRE>
<P>
A Fourier Transform is an algorithm that transforms a signal in the time domain, such as a sample buffer, into a signal in the
frequency domain, often called the spectrum. The spectrum does not represent individual frequencies, but actually represents
frequency bands centered on particular frequencies. The center frequency of each band is usually expressed as a fraction of the
sampling rate of the time domain signal and is equal to the index of the frequency band divided by the total number of bands.
The total number of frequency bands is usually equal to the length of the time domain signal, but access is only provided to
frequency bands with indices less than half the length, because they correspond to frequencies below the
<a
href="http://en.wikipedia.org/wiki/Nyquist_frequency">Nyquist frequency
</a>. In other words, given a signal of length
<code>N
</code>, there will be
<code>N/2
</code> frequency bands in the spectrum.
<p>
As an example, if you construct a FourierTransform with a
<code>timeSize
</code> of 1024 and and a
<code>sampleRate
</code> of
44100 Hz, then the spectrum will contain values for frequencies below 22010 Hz, which is the Nyquist frequency (half the sample
rate). If you ask for the value of band number 5, this will correspond to a frequency band centered on
<code>5/1024 * 44100 = 0.0048828125 * 44100 = 215 Hz
</code>. The width of that frequency band is equal to
<code>2/1024
</code>,
expressed as a fraction of the total bandwidth of the spectrum. The total bandwith of the spectrum is equal to the Nyquist
frequency, which in this case is 22100, so the bandwidth is equal to about 50 Hz. It is not necessary for you to remember all
of these relationships, though it is good to be aware of them. The function
<code>getFreq()
</code> allows you to query the
spectrum with a frequency in Hz and the function
<code>getBandWidth()
</code> will return the bandwidth in Hz of each frequency
band in the spectrum.
<p>
<b>Usage
</b>
<p>
A typical usage of a FourierTransform is to analyze a signal so that the frequency spectrum may be represented in some way,
typically with vertical lines. You could do this in Processing with the following code, where
<code>audio
</code> is an
AudioSource and
<code>fft
</code> is an FFT (one of the derived classes of FourierTransform).
<pre>
fft.forward(audio.left);
for (int i = 0; i
< fft.specSize(); i++) {
// draw the line for frequency band i, scaling it by 4 so we can see it a bit better
line(i, height, i, height - fft.getBand(i) * 4);
}
</pre>
<b>Windowing
</b>
<p>
Windowing is the process of shaping the audio samples before transforming them to the frequency domain. If you call the
<code>window()
</code> function with an appropriate constant, such as FourierTransform.HAMMING, the sample buffers passed to the
object for analysis will be shaped by the current window before being transformed. The result of using a window is to reduce
the noise in the spectrum somewhat.
<p>
<b>Averages
</b>
<p>
FourierTransform also has functions that allow you to request the creation of an average spectrum. An average spectrum is
simply a spectrum with fewer bands than the full spectrum where each average band is the average of the amplitudes of some
number of contiguous frequency bands in the full spectrum.
<p>
<code>linAverages()
</code> allows you to specify the number of averages that you want and will group frequency bands into
groups of equal number. So if you have a spectrum with 512 frequency bands and you ask for 64 averages, each average will span
8 bands of the full spectrum.
<p>
<code>logAverages()
</code> will group frequency bands by octave and allows you to specify the size of the smallest octave to
use (in Hz) and also how many bands to split each octave into. So you might ask for the smallest octave to be 60 Hz and to
split each octave into two bands. The result is that the bandwidth of each average is different. One frequency is an octave
above another when it's frequency is twice that of the lower frequency. So, 120 Hz is an octave above 60 Hz, 240 Hz is an
octave above 120 Hz, and so on. When octaves are split, they are split based on Hz, so if you split the octave 60-120 Hz in
half, you will get 60-90Hz and 90-120Hz. You can see how these bandwidths increase as your octave sizes grow. For instance, the
last octave will always span
<code>sampleRate/4 - sampleRate/2
</code>, which in the case of audio sampled at 44100 Hz is
11025-22010 Hz. These logarithmically spaced averages are usually much more useful than the full spectrum or the linearly
spaced averages because they map more directly to how humans perceive sound.
<p>
<code>calcAvg()
</code> allows you to specify the frequency band you want an average calculated for. You might ask for 60-500Hz
and this function will group together the bands from the full spectrum that fall into that range and average their amplitudes
for you.
<p>
If you don't want any averages calculated, then you can call
<code>noAverages()
</code>. This will not impact your ability to
use
<code>calcAvg()
</code>, it will merely prevent the object from calculating an average array every time you use
<code>forward()
</code>.
<p>
<b>Inverse Transform
</b>
<p>
FourierTransform also supports taking the inverse transform of a spectrum. This means that a frequency spectrum will be
transformed into a time domain signal and placed in a provided sample buffer. The length of the time domain signal will be
<code>timeSize()
</code> long. The
<code>set
</code> and
<code>scale
</code> functions allow you the ability to shape the spectrum
already stored in the object before taking the inverse transform. You might use these to filter frequencies in a spectrum or
modify it in some other way.
<P>
<P>
<DL>
<DT><B>Author:
</B></DT>
<DD>Damien Di Fede
</DD>
<DT><B>See Also:
</B><DD><a href="http://www.dspguide.com/ch8.htm">The Discrete Fourier Transform
</a></DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary
</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#averages">averages
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#avgPerOctave">avgPerOctave
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#bandWidth">bandWidth
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#HAMMING">HAMMING
</A></B></CODE>
<BR>
A constant indicating a Hamming window should be used on sample buffers.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#imag">imag
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#LINAVG">LINAVG
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#LOGAVG">LOGAVG
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#NOAVG">NOAVG
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#NONE">NONE
</A></B></CODE>
<BR>
A constant indicating no window should be used on sample buffers.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#octaves">octaves
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#real">real
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#sampleRate">sampleRate
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#spectrum">spectrum
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#timeSize">timeSize
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static
float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#TWO_PI">TWO_PI
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#whichAverage">whichAverage
</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#whichWindow">whichWindow
</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary
</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected abstract
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#allocateArrays()">allocateArrays
</A></B>()
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#avgSize()">avgSize
</A></B>()
</CODE>
<BR>
Returns the number of averages currently being calculated.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#calcAvg(float, float)">calcAvg
</A></B>(float
lowFreq,
float
hiFreq)
</CODE>
<BR>
Calculate the average amplitude of the frequency band bounded by
<code>lowFreq
</code> and
<code>hiFreq
</code>, inclusive.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#doWindow(float[])">doWindow
</A></B>(float[]
samples)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#fillSpectrum()">fillSpectrum
</A></B>()
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#forward(float[])">forward
</A></B>(float[]
buffer)
</CODE>
<BR>
Performs a forward transform on
<code>buffer
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#forward(float[], int)">forward
</A></B>(float[]
buffer,
int
startAt)
</CODE>
<BR>
Performs a forward transform on values in
<code>buffer
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#freqToIndex(float)">freqToIndex
</A></B>(float
freq)
</CODE>
<BR>
Returns the index of the frequency band that contains the requested frequency.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getAverageCenterFrequency(int)">getAverageCenterFrequency
</A></B>(int
i)
</CODE>
<BR>
Returns the center frequency of the i
<sup>th
</sup> average band.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getAvg(int)">getAvg
</A></B>(int
i)
</CODE>
<BR>
Gets the value of the
<code>i
<sup>th
</sup></code> average.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getBand(int)">getBand
</A></B>(int
i)
</CODE>
<BR>
Returns the amplitude of the requested frequency band.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getBandWidth()">getBandWidth
</A></B>()
</CODE>
<BR>
Returns the width of each frequency band in the spectrum (in Hz).
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getFreq(float)">getFreq
</A></B>(float
freq)
</CODE>
<BR>
Gets the amplitude of the requested frequency in the spectrum.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getImaginaryPart()">getImaginaryPart
</A></B>()
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getRealPart()">getRealPart
</A></B>()
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float[]
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#getSpectrum()">getSpectrum
</A></B>()
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#hamming(float[])">hamming
</A></B>(float[]
samples)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> float
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#indexToFreq(int)">indexToFreq
</A></B>(int
i)
</CODE>
<BR>
Returns the middle frequency of the i
<sup>th
</sup> band.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#inverse(float[])">inverse
</A></B>(float[]
buffer)
</CODE>
<BR>
Performs an inverse transform of the frequency spectrum and places the result in
<code>buffer
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#inverse(float[], float[], float[])">inverse
</A></B>(float[]
freqReal,
float[]
freqImag,
float[]
buffer)
</CODE>
<BR>
Performs an inverse transform of the frequency spectrum represented by freqReal and freqImag and places the result in
buffer.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#linAverages(int)">linAverages
</A></B>(int
numAvg)
</CODE>
<BR>
Sets the number of averages used when computing the spectrum and spaces the averages in a linear manner.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#logAverages(int, int)">logAverages
</A></B>(int
minBandwidth,
int
bandsPerOctave)
</CODE>
<BR>
Sets the number of averages used when computing the spectrum based on the minimum bandwidth for an octave and the number of
bands per octave.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#noAverages()">noAverages
</A></B>()
</CODE>
<BR>
Sets the object to not compute averages.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#scaleBand(int, float)">scaleBand
</A></B>(int
i,
float
s)
</CODE>
<BR>
Scales the amplitude of the
<code>i
<sup>th
</sup></code> frequency band by
<code>s
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#scaleFreq(float, float)">scaleFreq
</A></B>(float
freq,
float
s)
</CODE>
<BR>
Scales the amplitude of the requested frequency by
<code>a
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#setBand(int, float)">setBand
</A></B>(int
i,
float
a)
</CODE>
<BR>
Sets the amplitude of the
<code>i
<sup>th
</sup></code> frequency band to
<code>a
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#setComplex(float[], float[])">setComplex
</A></B>(float[]
r,
float[]
i)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#setFreq(float, float)">setFreq
</A></B>(float
freq,
float
a)
</CODE>
<BR>
Sets the amplitude of the requested frequency in the spectrum to
<code>a
</code>.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#specSize()">specSize
</A></B>()
</CODE>
<BR>
Returns the size of the spectrum created by this transform.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#timeSize()">timeSize
</A></B>()
</CODE>
<BR>
Returns the length of the time domain signal expected by this transform.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/badlogic/gdx/audio/analysis/FourierTransform.html#window(int)">window
</A></B>(int
which)
</CODE>
<BR>
Sets the window to use on the samples before taking the forward transform.
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object
</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail
</B></FONT></TH>
</TR>
</TABLE>
<A NAME="NONE"><!-- --></A><H3>
NONE
</H3>
<PRE>
public static final int
<B>NONE
</B></PRE>
<DL>
<DD>A constant indicating no window should be used on sample buffers.
<P>
<DL>
<DT><B>See Also:
</B><DD><A HREF="../../../../../constant-values.html#com.badlogic.gdx.audio.analysis.FourierTransform.NONE">Constant Field Values
</A></DL>
</DL>
<HR>
<A NAME="HAMMING"><!-- --></A><H3>
HAMMING
</H3>
<PRE>
public static final int
<B>HAMMING
</B></PRE>
<DL>
<DD>A constant indicating a Hamming window should be used on sample buffers.
<P>
<DL>
<DT><B>See Also:
</B><DD><A HREF="../../../../../constant-values.html#com.badlogic.gdx.audio.analysis.FourierTransform.HAMMING">Constant Field Values
</A></DL>
</DL>
<HR>
<A NAME="LINAVG"><!-- --></A><H3>
LINAVG
</H3>
<PRE>
protected static final int
<B>LINAVG
</B></PRE>
<DL>
<DL>
<DT><B>See Also:
</B><DD><A HREF="../../../../../constant-values.html#com.badlogic.gdx.audio.analysis.FourierTransform.LINAVG">Constant Field Values
</A></DL>
</DL>
<HR>
<A NAME="LOGAVG"><!-- --></A><H3>
LOGAVG
</H3>
<PRE>
protected static final int
<B>LOGAVG
</B></PRE>
<DL>
<DL>
<DT><B>See Also:
</B><DD><A HREF="../../../../../constant-values.html#com.badlogic.gdx.audio.analysis.FourierTransform.LOGAVG">Constant Field Values
</A></DL>
</DL>
<HR>
<A NAME="NOAVG"><!-- --></A><H3>
NOAVG
</H3>
<PRE>
protected static final int
<B>NOAVG
</B></PRE>
<DL>
<DL>
<DT><B>See Also:
</B><DD><A HREF="../../../../../constant-values.html#com.badlogic.gdx.audio.analysis.FourierTransform.NOAVG">Constant Field Values
</A></DL>
</DL>
<HR>
<A NAME="TWO_PI"><!-- --></A><H3>
TWO_PI
</H3>
<PRE>
protected static final float
<B>TWO_PI
</B></PRE>
<DL>
<DL>
<DT><B>See Also:
</B><DD><A HREF="../../../../../constant-values.html#com.badlogic.gdx.audio.analysis.FourierTransform.TWO_PI">Constant Field Values
</A></DL>
</DL>
<HR>
<A NAME="timeSize"><!-- --></A><H3>
timeSize
</H3>
<PRE>
protected int
<B>timeSize
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="sampleRate"><!-- --></A><H3>
sampleRate
</H3>
<PRE>
protected int
<B>sampleRate
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="bandWidth"><!-- --></A><H3>
bandWidth
</H3>
<PRE>
protected float
<B>bandWidth
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="whichWindow"><!-- --></A><H3>
whichWindow
</H3>
<PRE>
protected int
<B>whichWindow
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="real"><!-- --></A><H3>
real
</H3>
<PRE>
protected float[]
<B>real
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="imag"><!-- --></A><H3>
imag
</H3>
<PRE>
protected float[]
<B>imag
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="spectrum"><!-- --></A><H3>
spectrum
</H3>
<PRE>
protected float[]
<B>spectrum
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="averages"><!-- --></A><H3>
averages
</H3>
<PRE>
protected float[]
<B>averages
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="whichAverage"><!-- --></A><H3>
whichAverage
</H3>
<PRE>
protected int
<B>whichAverage
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="octaves"><!-- --></A><H3>
octaves
</H3>
<PRE>
protected int
<B>octaves
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="avgPerOctave"><!-- --></A><H3>
avgPerOctave
</H3>
<PRE>
protected int
<B>avgPerOctave
</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail
</B></FONT></TH>
</TR>
</TABLE>
<A NAME="allocateArrays()"><!-- --></A><H3>
allocateArrays
</H3>
<PRE>
protected abstract void
<B>allocateArrays
</B>()
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setComplex(float[], float[])"><!-- --></A><H3>
setComplex
</H3>
<PRE>
protected void
<B>setComplex
</B>(float[]
r,
float[]
i)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="fillSpectrum()"><!-- --></A><H3>
fillSpectrum
</H3>
<PRE>
protected void
<B>fillSpectrum
</B>()
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="noAverages()"><!-- --></A><H3>
noAverages
</H3>
<PRE>
public void
<B>noAverages
</B>()
</PRE>
<DL>
<DD>Sets the object to not compute averages.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="linAverages(int)"><!-- --></A><H3>
linAverages
</H3>
<PRE>
public void
<B>linAverages
</B>(int
numAvg)
</PRE>
<DL>
<DD>Sets the number of averages used when computing the spectrum and spaces the averages in a linear manner. In other words,
each average band will be
<code>specSize() / numAvg
</code> bands wide.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>numAvg
</CODE> - how many averages to compute
</DL>
</DD>
</DL>
<HR>
<A NAME="logAverages(int, int)"><!-- --></A><H3>
logAverages
</H3>
<PRE>
public void
<B>logAverages
</B>(int
minBandwidth,
int
bandsPerOctave)
</PRE>
<DL>
<DD>Sets the number of averages used when computing the spectrum based on the minimum bandwidth for an octave and the number of
bands per octave. For example, with audio that has a sample rate of 44100 Hz,
<code>logAverages(11, 1)
</code> will result in
12 averages, each corresponding to an octave, the first spanning 0 to 11 Hz. To ensure that each octave band is a full
octave, the number of octaves is computed by dividing the Nyquist frequency by two, and then the result of that by two, and
so on. This means that the actual bandwidth of the lowest octave may not be exactly the value specified.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>minBandwidth
</CODE> - the minimum bandwidth used for an octave
<DD><CODE>bandsPerOctave
</CODE> - how many bands to split each octave into
</DL>
</DD>
</DL>
<HR>
<A NAME="window(int)"><!-- --></A><H3>
window
</H3>
<PRE>
public void
<B>window
</B>(int
which)
</PRE>
<DL>
<DD>Sets the window to use on the samples before taking the forward transform. If an invalid window is asked for, an error will
be reported and the current window will not be changed.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>which
</CODE> - FourierTransform.HAMMING or FourierTransform.NONE
</DL>
</DD>
</DL>
<HR>
<A NAME="doWindow(float[])"><!-- --></A><H3>
doWindow
</H3>
<PRE>
protected void
<B>doWindow
</B>(float[]
samples)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="hamming(float[])"><!-- --></A><H3>
hamming
</H3>
<PRE>
protected void
<B>hamming
</B>(float[]
samples)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="timeSize()"><!-- --></A><H3>
timeSize
</H3>
<PRE>
public int
<B>timeSize
</B>()
</PRE>
<DL>
<DD>Returns the length of the time domain signal expected by this transform.
<P>
<DD><DL>
<DT><B>Returns:
</B><DD>the length of the time domain signal expected by this transform
</DL>
</DD>
</DL>
<HR>
<A NAME="specSize()"><!-- --></A><H3>
specSize
</H3>
<PRE>
public int
<B>specSize
</B>()
</PRE>
<DL>
<DD>Returns the size of the spectrum created by this transform. In other words, the number of frequency bands produced by this
transform. This is typically equal to
<code>timeSize()/2 + 1
</code>, see above for an explanation.
<P>
<DD><DL>
<DT><B>Returns:
</B><DD>the size of the spectrum
</DL>
</DD>
</DL>
<HR>
<A NAME="getBand(int)"><!-- --></A><H3>
getBand
</H3>
<PRE>
public float
<B>getBand
</B>(int
i)
</PRE>
<DL>
<DD>Returns the amplitude of the requested frequency band.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>i
</CODE> - the index of a frequency band
<DT><B>Returns:
</B><DD>the amplitude of the requested frequency band
</DL>
</DD>
</DL>
<HR>
<A NAME="getBandWidth()"><!-- --></A><H3>
getBandWidth
</H3>
<PRE>
public float
<B>getBandWidth
</B>()
</PRE>
<DL>
<DD>Returns the width of each frequency band in the spectrum (in Hz). It should be noted that the bandwidth of the first and
last frequency bands is half as large as the value returned by this function.
<P>
<DD><DL>
<DT><B>Returns:
</B><DD>the width of each frequency band in Hz.
</DL>
</DD>
</DL>
<HR>
<A NAME="setBand(int, float)"><!-- --></A><H3>
setBand
</H3>
<PRE>
public abstract void
<B>setBand
</B>(int
i,
float
a)
</PRE>
<DL>
<DD>Sets the amplitude of the
<code>i
<sup>th
</sup></code> frequency band to
<code>a
</code>. You can use this to shape the
spectrum before using
<code>inverse()
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>i
</CODE> - the frequency band to modify
<DD><CODE>a
</CODE> - the new amplitude
</DL>
</DD>
</DL>
<HR>
<A NAME="scaleBand(int, float)"><!-- --></A><H3>
scaleBand
</H3>
<PRE>
public abstract void
<B>scaleBand
</B>(int
i,
float
s)
</PRE>
<DL>
<DD>Scales the amplitude of the
<code>i
<sup>th
</sup></code> frequency band by
<code>s
</code>. You can use this to shape the
spectrum before using
<code>inverse()
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>i
</CODE> - the frequency band to modify
<DD><CODE>s
</CODE> - the scaling factor
</DL>
</DD>
</DL>
<HR>
<A NAME="freqToIndex(float)"><!-- --></A><H3>
freqToIndex
</H3>
<PRE>
public int
<B>freqToIndex
</B>(float
freq)
</PRE>
<DL>
<DD>Returns the index of the frequency band that contains the requested frequency.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>freq
</CODE> - the frequency you want the index for (in Hz)
<DT><B>Returns:
</B><DD>the index of the frequency band that contains freq
</DL>
</DD>
</DL>
<HR>
<A NAME="indexToFreq(int)"><!-- --></A><H3>
indexToFreq
</H3>
<PRE>
public float
<B>indexToFreq
</B>(int
i)
</PRE>
<DL>
<DD>Returns the middle frequency of the i
<sup>th
</sup> band.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>i
</CODE> - the index of the band you want to middle frequency of
</DL>
</DD>
</DL>
<HR>
<A NAME="getAverageCenterFrequency(int)"><!-- --></A><H3>
getAverageCenterFrequency
</H3>
<PRE>
public float
<B>getAverageCenterFrequency
</B>(int
i)
</PRE>
<DL>
<DD>Returns the center frequency of the i
<sup>th
</sup> average band.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>i
</CODE> - which average band you want the center frequency of.
</DL>
</DD>
</DL>
<HR>
<A NAME="getFreq(float)"><!-- --></A><H3>
getFreq
</H3>
<PRE>
public float
<B>getFreq
</B>(float
freq)
</PRE>
<DL>
<DD>Gets the amplitude of the requested frequency in the spectrum.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>freq
</CODE> - the frequency in Hz
<DT><B>Returns:
</B><DD>the amplitude of the frequency in the spectrum
</DL>
</DD>
</DL>
<HR>
<A NAME="setFreq(float, float)"><!-- --></A><H3>
setFreq
</H3>
<PRE>
public void
<B>setFreq
</B>(float
freq,
float
a)
</PRE>
<DL>
<DD>Sets the amplitude of the requested frequency in the spectrum to
<code>a
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>freq
</CODE> - the frequency in Hz
<DD><CODE>a
</CODE> - the new amplitude
</DL>
</DD>
</DL>
<HR>
<A NAME="scaleFreq(float, float)"><!-- --></A><H3>
scaleFreq
</H3>
<PRE>
public void
<B>scaleFreq
</B>(float
freq,
float
s)
</PRE>
<DL>
<DD>Scales the amplitude of the requested frequency by
<code>a
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>freq
</CODE> - the frequency in Hz
<DD><CODE>s
</CODE> - the scaling factor
</DL>
</DD>
</DL>
<HR>
<A NAME="avgSize()"><!-- --></A><H3>
avgSize
</H3>
<PRE>
public int
<B>avgSize
</B>()
</PRE>
<DL>
<DD>Returns the number of averages currently being calculated.
<P>
<DD><DL>
<DT><B>Returns:
</B><DD>the length of the averages array
</DL>
</DD>
</DL>
<HR>
<A NAME="getAvg(int)"><!-- --></A><H3>
getAvg
</H3>
<PRE>
public float
<B>getAvg
</B>(int
i)
</PRE>
<DL>
<DD>Gets the value of the
<code>i
<sup>th
</sup></code> average.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>i
</CODE> - the average you want the value of
<DT><B>Returns:
</B><DD>the value of the requested average band
</DL>
</DD>
</DL>
<HR>
<A NAME="calcAvg(float, float)"><!-- --></A><H3>
calcAvg
</H3>
<PRE>
public float
<B>calcAvg
</B>(float
lowFreq,
float
hiFreq)
</PRE>
<DL>
<DD>Calculate the average amplitude of the frequency band bounded by
<code>lowFreq
</code> and
<code>hiFreq
</code>, inclusive.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>lowFreq
</CODE> - the lower bound of the band
<DD><CODE>hiFreq
</CODE> - the upper bound of the band
<DT><B>Returns:
</B><DD>the average of all spectrum values within the bounds
</DL>
</DD>
</DL>
<HR>
<A NAME="forward(float[])"><!-- --></A><H3>
forward
</H3>
<PRE>
public abstract void
<B>forward
</B>(float[]
buffer)
</PRE>
<DL>
<DD>Performs a forward transform on
<code>buffer
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - the buffer to analyze
</DL>
</DD>
</DL>
<HR>
<A NAME="forward(float[], int)"><!-- --></A><H3>
forward
</H3>
<PRE>
public void
<B>forward
</B>(float[]
buffer,
int
startAt)
</PRE>
<DL>
<DD>Performs a forward transform on values in
<code>buffer
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - the buffer of samples
<DD><CODE>startAt
</CODE> - the index to start at in the buffer. there must be at least timeSize() samples between the starting index and
the end of the buffer. If there aren't, an error will be issued and the operation will not be performed.
</DL>
</DD>
</DL>
<HR>
<A NAME="inverse(float[])"><!-- --></A><H3>
inverse
</H3>
<PRE>
public abstract void
<B>inverse
</B>(float[]
buffer)
</PRE>
<DL>
<DD>Performs an inverse transform of the frequency spectrum and places the result in
<code>buffer
</code>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - the buffer to place the result of the inverse transform in
</DL>
</DD>
</DL>
<HR>
<A NAME="inverse(float[], float[], float[])"><!-- --></A><H3>
inverse
</H3>
<PRE>
public void
<B>inverse
</B>(float[]
freqReal,
float[]
freqImag,
float[]
buffer)
</PRE>
<DL>
<DD>Performs an inverse transform of the frequency spectrum represented by freqReal and freqImag and places the result in
buffer.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>freqReal
</CODE> - the real part of the frequency spectrum
<DD><CODE>freqImag
</CODE> - the imaginary part the frequency spectrum
<DD><CODE>buffer
</CODE> - the buffer to place the inverse transform in
</DL>
</DD>
</DL>
<HR>
<A NAME="getSpectrum()"><!-- --></A><H3>
getSpectrum
</H3>
<PRE>
public float[]
<B>getSpectrum
</B>()
</PRE>
<DL>
<DD><DL>
<DT><B>Returns:
</B><DD>the spectrum of the last FourierTransform.forward() call.
</DL>
</DD>
</DL>
<HR>
<A NAME="getRealPart()"><!-- --></A><H3>
getRealPart
</H3>
<PRE>
public float[]
<B>getRealPart
</B>()
</PRE>
<DL>
<DD><DL>
<DT><B>Returns:
</B><DD>the real part of the last FourierTransform.forward() call.
</DL>
</DD>
</DL>
<HR>
<A NAME="getImaginaryPart()"><!-- --></A><H3>
getImaginaryPart
</H3>
<PRE>
public float[]
<B>getImaginaryPart
</B>()
</PRE>
<DL>
<DD><DL>
<DT><B>Returns:
</B><DD>the imaginary part of the last FourierTransform.forward() call.
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package
</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class
</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/FourierTransform.html"><FONT CLASS="NavBarFont1"><B>Use
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help
</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
libgdx API
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../com/badlogic/gdx/audio/analysis/FFT.html" title="class in com.badlogic.gdx.audio.analysis"><B>PREV CLASS
</B></A>
<A HREF="../../../../../com/badlogic/gdx/audio/analysis/KissFFT.html" title="class in com.badlogic.gdx.audio.analysis"><B>NEXT CLASS
</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/badlogic/gdx/audio/analysis/FourierTransform.html" target="_top"><B>FRAMES
</B></A>
<A HREF="FourierTransform.html" target="_top"><B>NO FRAMES
</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes
</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:
NESTED
|
<A HREF="#field_summary">FIELD
</A> |
CONSTR
|
<A HREF="#method_summary">METHOD
</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:
<A HREF="#field_detail">FIELD
</A> |
CONSTR
|
<A HREF="#method_detail">METHOD
</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<div style="font-size:9pt"><i>
Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
</i></div>
</BODY>
</HTML>