Hi,
Where can I download the source code for plotting fft spectrum on the oled display of ezdsp5535?
Thanks.
Alex
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Can you be more specific? What source code are you looking for?
regards.
In the connected audio framework,
one eye candy feature is the spectrum bar graph display on the OLED. The display code is implemented in this function:
void calculate_FFT(int *input, int size);
I am looking for this function.
Thanks,
Alex
http://dl.transfer.ro/tms_320_c_5515-transfer_ro-06may-91cef7.rar
Please .. I can help me with this project. Can you put me in the comments and how this project works in more detail, where be sampled, thank you very much.
Hi all,
I have found the calculate_FFT() function which also displays the result on the OLED display of the ezdsp5535.
This has been added to my project on the ezdsp5535 which turns it into a USB Audio Class 2 stereo playback device with explicit rate feedback, and with automatic switching of sampling freq among 44.1/48/88.2/96khz at 24 bits. Currently it only works with a Linux host (and a modified version for Mac OSX host). Windows ASIO driver pending.
The source code of my whole project is in github (NOTE: this is a git repo, NOT an http link. You CANNOT click on it.)::
git://github.com/alexlee188/C5535.git
I have attached the binary bootimg.bin which you can test by copying into the root directory of a microSD card for your ezdsp5535.
The relevant code fragment for calculate_FFT() is copied below for easy reference:
/*****************************************************************************/
/* calculate_power() */
/*---------------------------------------------------------------------------*/
/* */
/* Parameter 1: Real term a. */
/* Parameter 2: Immaginary term jb. */
/* */
/* RETURNS: a*a + b*b. Result will always be positive. */
/* */
/*****************************************************************************/
int calculate_power (int a, int b)
{
return ( (int) ( ( (long)a * a + (long) b * b) >> 11) );
}
/*****************************************************************************/
/* calculate_FFT() */
/*---------------------------------------------------------------------------*/
/* */
/* Parameter 1: Latest audio input (real value). */
/* Parameter 2: size of FFT e.g. 128, 512 and 1024 elements. */
/* */
/* RETURNS: None. */
/* */
/*****************************************************************************/
void calculate_FFT(int *input, int size)
{
int i, j;
Uint16 out_sel;
for (i=0; i<size; i++)
{
bufferFFT[i*2] = input[i]; /* Store as a real value */
bufferFFT[i*2+1] = 0; /* Store with an imaginary value of 0 */
}
/* Perform complex FFT using N real and N imaginary values */
#if 1
cfft (&bufferFFT[0], size, SCALE);
cbrev(&bufferFFT[0], &bufferFFT[0], size);
out_sel = 1;
#else
hwafft_br((Int32 *)bufferFFT, (Int32 *)bufferScrach, 256);
out_sel = hwafft_256pts((Int32 *)bufferScrach, (Int32 *)bufferFFT, 0, 1);
#endif
// construct the bargraph
for ( j = 0 ; j < 128 ; j ++)
{
// display first 96 bins out of 128 bins (256/2)
if (out_sel)
display_buffer[j] = calculate_power((int) bufferFFT[2*j], (int)bufferFFT[2*j+1])+8;
else
display_buffer[j] = calculate_power((int) bufferScrach[2*j], (int)bufferScrach[2*j+1])+8;
}
// display the bargraph
oled_display_bargraph( &display_buffer[0]);
}