From 4861603cf895a1a2a1191b04914145c6b9726018 Mon Sep 17 00:00:00 2001 From: boblark Date: Fri, 11 Feb 2022 14:22:50 -0800 Subject: [PATCH] Fixed Pass Through. Initial Issue of AudioFilterConvolution_F32 --- AudioFilterConvolution_F32.cpp | 3 +-- .../TestConvolutinalFilter/TestConvolutinalFilter.ino | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/AudioFilterConvolution_F32.cpp b/AudioFilterConvolution_F32.cpp index f66cd0f..d38a8e2 100644 --- a/AudioFilterConvolution_F32.cpp +++ b/AudioFilterConvolution_F32.cpp @@ -78,9 +78,8 @@ void AudioFilterConvolution_F32::update(void) k++; l++; } - // convert floats to Q15 and save in temporary array tbuffer - arm_copy_f32 (&buffer[0], &tbuffer[0], BUFFER_SIZE*4); } + arm_copy_f32 (&buffer[0], &tbuffer[0], BUFFER_SIZE*4); bp = block->data; for (int i = 0; i < AUDIO_BLOCK_SAMPLES; i++) { buffer[i] = *bp; diff --git a/examples/TestConvolutinalFilter/TestConvolutinalFilter.ino b/examples/TestConvolutinalFilter/TestConvolutinalFilter.ino index b70a3e3..ff97a83 100644 --- a/examples/TestConvolutinalFilter/TestConvolutinalFilter.ino +++ b/examples/TestConvolutinalFilter/TestConvolutinalFilter.ino @@ -49,7 +49,7 @@ void setup(void) { // *** Un-comment just ONE of the following filters *** // Low Pass Filter, 4000 Hz cut off, 60 dB first sidelobe - convFilt1.initFilter(4000.0f, 60.0f, LOWPASS, 0.0f); + //convFilt1.initFilter(4000.0f, 60.0f, LOWPASS, 0.0f); // High Pass Filter, 2000 Hz cut off, 25 dB first sidelobe //convFilt1.initFilter(2000.0f, 25.0f, HIGHPASS, 0.0f); @@ -85,6 +85,10 @@ void setup(void) { convFilt1.initFilter(); // Generate the filter mask */ + // Alternatively, the passthrough case: + convFilt1.passThrough(1); + convFilt1.initFilter(); + // Design for direct FIR. This sets frequency response. // Bin for 4kHz at 44.117kHz sample rate and 400 coeff's is (4000/44117) * (512/2) = 23.2 // for(int ii=0; ii<47; ii++) attenFIR[ii] = 0.0f; @@ -108,7 +112,7 @@ void setup(void) { Serial.print(f); Serial.print(", "); while(!toneDet2.available())delay(2) ; - Serial.println(20.0f*log10f(toneDet2.read() ) ); + Serial.println(20.0f*log10f(toneDet2.read()), 3); } }