this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add back smoothing and remove dead code

alice 8b35f788 e11ce136

+6 -71
+6 -71
src/ext/fft.c
··· 217 217 float val = 2.0f * sqrtf(out[i].r * out[i].r + out[i].i * out[i].i); 218 218 _samples[i] = val * fAmplification; 219 219 } 220 + 221 + float fFFTSmoothingFactor = 0.9; 222 + for ( int i = 0; i < FFT_SIZE; i++ ) 223 + { 224 + _samples[i] = _samples[i] * fFFTSmoothingFactor + (1 - fFFTSmoothingFactor) * _samples[i]; 225 + } 220 226 } else { 221 227 for (int i = 0; i < FFT_SIZE; i++) 222 228 { ··· 227 233 228 234 return true; 229 235 } 230 - 231 - // bool FFT_GetFFT( float * _samples ) 232 - // { 233 - // kiss_fft_cpx out[ FFT_SIZE + 1 ]; 234 - // kiss_fftr( fftcfg, sampleBuf, out ); 235 - 236 - // bool bPeakNormalization = true; 237 - // if (bPeakNormalization) { 238 - // float peakValue = fPeakMinValue; 239 - // for ( int i = 0; i < FFT_SIZE; i++ ) 240 - // { 241 - // float val = 2.0f * sqrtf(out[i].r * out[i].r + out[i].i * out[i].i); 242 - // if (val > peakValue) peakValue = val; 243 - // _samples[ i ] = val * fAmplification; 244 - // } 245 - // if (peakValue > fPeakSmoothValue) { 246 - // fPeakSmoothValue = peakValue; 247 - // } 248 - // if (peakValue < fPeakSmoothValue) { 249 - // fPeakSmoothValue = fPeakSmoothValue * fPeakSmoothing + peakValue * (1 - fPeakSmoothing); 250 - // } 251 - // fAmplification = 1.0f / fPeakSmoothValue; 252 - // } else { 253 - // for (int i = 0; i < FFT_SIZE; i++) 254 - // { 255 - // static const float scaling = 1.0f / (float)FFT_SIZE; 256 - // _samples[i] = 2.0f * sqrtf(out[i].r * out[i].r + out[i].i * out[i].i) * scaling * fAmplification; 257 - // } 258 - // } 259 - 260 - // return true; 261 - // } 262 - 263 - 264 - // bool FFT_GetFFT( float * _samples ) 265 - // { 266 - // kiss_fft_cpx out[ FFT_SIZE + 1 ]; 267 - // kiss_fftr( fftcfg, sampleBuf, out ); 268 - 269 - // // TODO: make it an option? 270 - // bool bPeakNormalization = true; 271 - // if (bPeakNormalization) { 272 - // float peakValue = fPeakMinValue; 273 - // for ( int i = 0; i < FFT_SIZE; i++ ) 274 - // { 275 - // float val = 2.0f * sqrtf(out[i].r * out[i].r + out[i].i * out[i].i); 276 - // if (val > peakValue) peakValue = val; 277 - // _samples[ i ] = val * fAmplification; 278 - // } 279 - // if (peakValue > fPeakSmoothValue) { 280 - // fPeakSmoothValue = peakValue; 281 - // } 282 - // if (peakValue < fPeakSmoothValue) { 283 - // fPeakSmoothValue = fPeakSmoothValue * fPeakSmoothing + peakValue * (1 - fPeakSmoothing); 284 - // } 285 - // fAmplification = 1.0f / fPeakSmoothValue; 286 - // } else { 287 - // for (int i = 0; i < FFT_SIZE; i++) 288 - // { 289 - // static const float scaling = 1.0f / (float)FFT_SIZE; 290 - // _samples[i] = 2.0f * sqrtf(out[i].r * out[i].r + out[i].i * out[i].i) * scaling * fAmplification; 291 - // } 292 - // } 293 - // float fFFTSmoothingFactor = 0.9; 294 - // for ( int i = 0; i < FFT_SIZE; i++ ) 295 - // { 296 - // _samples[i] = _samples[i] * fFFTSmoothingFactor + (1 - fFFTSmoothingFactor) * _samples[i]; 297 - // } 298 - 299 - // return true; 300 - // } 301 236 302 237 double tic_api_fft(tic_mem* memory, s32 freq) 303 238 {