Advertisement

fourier transforms

Started by January 27, 2003 12:58 PM
20 comments, last by walkingcarcass 22 years ago
hmmm it says "load class Analyzer not found"

********


A Problem Worthy of Attack
Proves It''s Worth by Fighting Back
spraff.net: don't laugh, I'm still just starting...
Anyway, this is the working sound spectrum analyzer code:



    // Outer loop for frequenciesfor(int n = 0; n < 128; n++){	double a = 0;	double b = 0;// The size of analyzing window is hard coded and is equal to 256	for(int i = 0; i < 256; i++)	{		double y = sound[at + i]; // get the sample		double x = 2 * i * PI / 256;		y *= 0.5 * (1 - cos(x)); // multiply it with the window function		{// do the discrete fourier transform			a += y * sin(n * x);			b += y * cos(n * x);		}	}	double c = 2 * sqrt(a * a + b * b) / 256;        // Now "c" is the amplitude of frequency "n" at the point denoted by variable "at". (Well, actually at the point "at + 128")}    


[edited by - Advanced Bug on February 3, 2003 4:17:47 AM]

This topic is closed to new replies.

Advertisement