<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Bins are spaced sample_frequency/fft_size hz apart. And you take
the magnitude of the polar coordinates:  sqrt(i*i+r*r) to calculate the
magnitude of the signal.  The resulting magnitiude isbetween zero and 1
(for in-range signales), and you would convert db2a to get a db value. For
signal <b><i>power</i></b>, as opposed to magnitude, you multiply by two (or
don’t take the square root). <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>You’ll need to multiple the samples in the input with a window
function in order to get sensible values. See <a
href="http://en.wikipedia.org/wiki/Window_function#Hamming_window">http://en.wikipedia.org/wiki/Window_function#Hamming_window</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> Hamming, or Hann window functions would be good choices. 
Without a window function, all you’ll get is the frequency of the step
response at the start and end of the FFT frame – which is terribly useful.
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> chuck-users-bounces@lists.cs.princeton.edu
[mailto:chuck-users-bounces@lists.cs.princeton.edu] <b>On Behalf Of </b>Lucas
Samaruga<br>
<b>Sent:</b> Thursday, March 04, 2010 10:30 PM<br>
<b>To:</b> ChucK Users Mailing List<br>
<b>Subject:</b> Re: [chuck-users] Simple question about getting a basic frequency
spectrum<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Hello v bar<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>Just an approximation, I suggest a good book or internet
resource.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>The polars you have are the magnitud (amp) and phase of each
band of frequencies. The bands of frequencies you have are defined by the
ratio between the sampling rate the windows size, that ratio is the
analysis frequency. In this case, the analysis frequency is 44100 / 1024 =
43.06640625. Then you have windowssize / 2 = 512 harmonically related bands
starting from 43.066 and... I strongly suggest a good reading, sorry I don't
have nothing at hand right now.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>Best<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>Lucas<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

<div>

<p class=MsoNormal>2010/3/5 v bar <<a href="mailto:vomc8one@gmail.com">vomc8one@gmail.com</a>><o:p></o:p></p>

<p class=MsoNormal>Hi,<br>
<br>
I am a little confused with fourier-transforms, math not being my specialty.<br>
<br>
In essence all I am trying to do is take 1 second samples of an audio<br>
file and print out coordinates as follows:<br>
<br>
- amplitude at 80Hz, amplitude at 200Hz, amplitude at 1000Hz<br>
<br>
I have set up a file connecting:<br>
<br>
SndBuf buf => dac;<br>
buf => FFT fft  => blackhole;<br>
<br>
And now I assume that I set the fft.size to 1024 samples (for a 44k<br>
16bit audio file) and then upchuck that every 1024 samples.<br>
<br>
Most likely my error is there...<br>
<br>
But now I don't know how to get at the correct output.<br>
<br>
I have a ton of polar values but I don't really know what any of them<br>
correspond to.<br>
<br>
Some sample values:<br>
<br>
"time: 0:5000.0000" : (string)<br>
%(0.0140,-0.9985*pi) %(0.0004,-0.6629*pi) %(0.0001,-0.4812*pi)<br>
%(0.0001,-0.4412*pi) %(0.0001,-0.7007*pi) %(0.0001,-0.7549*pi)<br>
%(0.0001,-0.5928*pi) %(0.0000,0.7277*pi) %(0.0000,0.0000*pi)<br>
%(0.0000,0.0000*pi) %(0.0000,0.0000*pi) %(0.0000,0.0000*pi)<br>
"time: 0:6000.0000" : (string)<br>
%(0.0189,0.0008*pi) %(0.0003,0.4507*pi) %(0.0001,0.2899*pi)<br>
%(0.0001,0.2122*pi) %(0.0001,0.3072*pi) %(0.0000,0.5483*pi)<br>
%(0.0001,0.1053*pi) %(0.0000,0.2292*pi) %(0.0000,0.0000*pi)<br>
%(0.0000,0.0000*pi) %(0.0000,0.0000*pi) %(0.0000,0.0000*pi)<br>
"time: 0:7000.0000" : (string)<br>
%(0.0148,0.9997*pi) %(0.0002,0.4662*pi) %(0.0002,0.1996*pi)<br>
%(0.0001,0.4250*pi) %(0.0001,0.2651*pi) %(0.0001,0.4396*pi)<br>
%(0.0000,0.9036*pi) %(0.0001,0.4967*pi) %(0.0000,0.0000*pi)<br>
%(0.0000,0.0000*pi) %(0.0000,0.0000*pi) %(0.0000,0.0000*pi)<br>
<br>
<br>
Can someone help? I bet this is actually pretty simple I just can't<br>
seem to figure it out. I understand the notion of polar coordinates<br>
and know how I can convert them to Cartesian. But what I am not<br>
understanding is where I find out what the actual frequencies that are<br>
being sampled are...<br>
<br>
<br>
Thanks<br>
- J<br>
<span style='color:#888888'><br>
<br>
<br>
--<br>
---- <a href="mailto:vomc8one@gmail.com">vomc8one@gmail.com</a> ----<br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users"
target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a></span><o:p></o:p></p>

</div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

</div>

</body>

</html>