#include "compute.h" #include "fft.h" #include #define MIN_SAMPLES 256 #define MAX_SAMPLES 2048 //#define MAX(a,b) (a>b?a:b) //#define MIN(a,b) (a= MAX_SAMPLES) { printf("WARN : nsamples >= MAX_SAMPLES : %i >= %i\n", nsamples, MAX_SAMPLES); nsamples=MAX_SAMPLES; } if (nsamples < MIN_SAMPLES) { printf("WARN : nsamples < MIN_SAMPLES : %i >= %i\n", nsamples, MIN_SAMPLES); return -120.f; } /* Replicate with symmetry the sound to obtain an input buffer of the minimal len for (i=0;i 0.0) output[i] = 10*log10(temp); else output[i] = 0; } } void audio2hsv_1(float audio_level, float *light_h, float *light_s, float *light_v) { static float hue=0; float level_norm=(38.f+audio_level)/30.f; if (level_norm<0.0f) level_norm=0.f; //if (level_norm<0.1f) level_norm=0.f; //FIXME : ici cache misere pour le tremblement sur plancher bruit if (level_norm>1.f) level_norm=1.f; hue=(hue+0.0002f); if (hue>1.f) hue-=1.f; // printf("%+3.1f %+1.3f\n", audio_level, level_norm); // Dummy code *light_h=hue; *light_s=1.f; *light_v=level_norm; }