Jump to content
43oh

NickTompkins

Members
  • Content Count

    15
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    NickTompkins got a reaction from gsutton in FFT   
    Here is some C code I have used to make the sine table for the fix_fft function if I wanted to change the size of the FFT
    #include <stdio.h> #include <math.h> #define POINTS 128 #define BITS   16 int main(void) {   int n;   int a=0;   int TF_FLAG=POINTS-POINTS/4; printf("#define N_WAVE      %d    /* full length of Sinewave[] */\n",POINTS); printf("#define LOG2_N_WAVE %d      /* log2(N_WAVE) */\n",(long)log2(POINTS)); printf("/* 3/4 of N_WAVE = %d  */\n",TF_FLAG); printf("const int8_t Sinewave[N_WAVE-N_WAVE/4] = {\n");   for (n=0; n<POINTS; n++){         if(n==TF_FLAG){           printf("/*");         }   if(a<15){     printf("%d,", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         a++;}        else{         a=0;         printf("%d,\n", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         } } printf("*/"); printf("};\n");   return 0; } You can copy and paste the output into your fix_fft.c file ;-)
  2. Like
    NickTompkins got a reaction from tripwire in FFT   
    Here is some C code I have used to make the sine table for the fix_fft function if I wanted to change the size of the FFT
    #include <stdio.h> #include <math.h> #define POINTS 128 #define BITS   16 int main(void) {   int n;   int a=0;   int TF_FLAG=POINTS-POINTS/4; printf("#define N_WAVE      %d    /* full length of Sinewave[] */\n",POINTS); printf("#define LOG2_N_WAVE %d      /* log2(N_WAVE) */\n",(long)log2(POINTS)); printf("/* 3/4 of N_WAVE = %d  */\n",TF_FLAG); printf("const int8_t Sinewave[N_WAVE-N_WAVE/4] = {\n");   for (n=0; n<POINTS; n++){         if(n==TF_FLAG){           printf("/*");         }   if(a<15){     printf("%d,", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         a++;}        else{         a=0;         printf("%d,\n", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         } } printf("*/"); printf("};\n");   return 0; } You can copy and paste the output into your fix_fft.c file ;-)
  3. Like
    NickTompkins got a reaction from Fmilburn in FFT   
    Here is some C code I have used to make the sine table for the fix_fft function if I wanted to change the size of the FFT
    #include <stdio.h> #include <math.h> #define POINTS 128 #define BITS   16 int main(void) {   int n;   int a=0;   int TF_FLAG=POINTS-POINTS/4; printf("#define N_WAVE      %d    /* full length of Sinewave[] */\n",POINTS); printf("#define LOG2_N_WAVE %d      /* log2(N_WAVE) */\n",(long)log2(POINTS)); printf("/* 3/4 of N_WAVE = %d  */\n",TF_FLAG); printf("const int8_t Sinewave[N_WAVE-N_WAVE/4] = {\n");   for (n=0; n<POINTS; n++){         if(n==TF_FLAG){           printf("/*");         }   if(a<15){     printf("%d,", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         a++;}        else{         a=0;         printf("%d,\n", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         } } printf("*/"); printf("};\n");   return 0; } You can copy and paste the output into your fix_fft.c file ;-)
  4. Like
    NickTompkins got a reaction from bluehash in FFT   
    Here is some C code I have used to make the sine table for the fix_fft function if I wanted to change the size of the FFT
    #include <stdio.h> #include <math.h> #define POINTS 128 #define BITS   16 int main(void) {   int n;   int a=0;   int TF_FLAG=POINTS-POINTS/4; printf("#define N_WAVE      %d    /* full length of Sinewave[] */\n",POINTS); printf("#define LOG2_N_WAVE %d      /* log2(N_WAVE) */\n",(long)log2(POINTS)); printf("/* 3/4 of N_WAVE = %d  */\n",TF_FLAG); printf("const int8_t Sinewave[N_WAVE-N_WAVE/4] = {\n");   for (n=0; n<POINTS; n++){         if(n==TF_FLAG){           printf("/*");         }   if(a<15){     printf("%d,", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         a++;}        else{         a=0;         printf("%d,\n", (int)floor(0.5 + ((1 << (BITS-1)) - 0.50001) * sin(2 * 3.1415926535897932 / POINTS * n)));         } } printf("*/"); printf("};\n");   return 0; } You can copy and paste the output into your fix_fft.c file ;-)
×
×
  • Create New...