and it is my turn to come here. After a disastrous run with a BlueNRG based solution, my customer and I are trying to rescue what is left of the project.
We decided to settle on the ESP-ADS; and use a LyraT 4.3 as our development board (nice hardware). Sadly, we have a problem. Our worker sits in the process method, and should do FFT on the incoming signal with the following code:
- static int _tams_process(audio_element_handle_t self, char *in_buffer, int in_len)
- {
- ESP_LOGI("ICY", "FFT for %i len data buf", in_len);
- short* realBuffer = ((void*)in_buffer);
- for (int i=0 ; i< in_len ; i++)
- {
- y_cf[i] = realBuffer[i];
- }
- dsps_fft2r_fc32(y_cf, N);
- dsps_bit_rev_fc32(y_cf, N);
- dsps_cplx2reC_fc32(y_cf, N);
- // Bit reverse
- dsps_bit_rev_fc32(y_cf, N);
- // Convert one complex vector to two complex vectors
- dsps_cplx2reC_fc32(y_cf, N);
- float tams_store[N/10 + 1];
- for (int i = 0 ; i < N ; i++) {
- tams_store[i/10] =0;
- }
- for (int i = 0 ; i < N ; i++) {
- tams_store[i/10] +=y1_cf[i];
- }
- int lmin= tams_store[0];
- int lmax= tams_store[0];
- for (int i = 0 ; i < N/10 ; i++) {
- if(lmin > tams_store[i])lmin=tams_store[i];
- if(lmax < tams_store[i])lmax=tams_store[i];
- }
- // Show power spectrum in 64x10 window from -100 to 0 dB from 0..N/4 samples
- ESP_LOGW("ICY", "Signal min %i max %i", lmin, lmax);
If we chase the data through dsps_view, the diagram looks really crazy too.I (7111) ICY: FFT for 2048 len data buf
W (7111) ICY: Signal min -6864482 max 6757346
I (7121) ICY: FFT for 2048 len data buf
W (7131) ICY: Signal min -6864633 max 6756954
I (7131) ICY: FFT for 2048 len data buf
W (7131) ICY: Signal min -6858810 max 6753439
I (7141) ICY: FFT for 2048 len data buf
W (7151) ICY: Signal min -6860889 max 6753106
I (7161) ICY: FFT for 2048 len data buf
W (7161) ICY: Signal min -6863030 max 6751432
I (7171) ICY: FFT for 2048 len data buf
W (7171) ICY: Signal min -6858686 max 6753943
I (7181) ICY: FFT for 2048 len data buf
W (7181) ICY: Signal min -6856832 max 6755413
Could it be a problem with the way we use the input data? I took the initialization from the SD card recorder program, so the pipeline should get 44.1KhZ data at 16bit resolution and with two channels.
Ideas, anyone? And big thanks in advance
Tam + Elicia