Code below works for pass thru, and compiles for implementing the low pass filter, but does not output anything on the dac or respond to serial. I am at a loss. Does the filter need to be of a specific size? I only saw the max of 200 constraint
Code:
#include <Audio.h>
AudioInputAnalog audio_in(A3); //xy=179,383
AudioFilterFIR fir1; //xy=342,383
AudioOutputAnalog dac1; //xy=519,360
AudioRecordQueue amdf_samples; //xy=543,409
AudioConnection patchCord1(audio_in, fir1);
AudioConnection patchCord2(fir1, dac1);
AudioConnection patchCord3(fir1, amdf_samples);
/*
FIR filter designed with
http://t-filter.appspot.com
sampling frequency: 44100 Hz
fixed point precision: 16 bits
* 0 Hz - 6000 Hz
gain = 1
desired ripple = 5 dB
actual ripple = n/a
* 15000 Hz - 22050 Hz
gain = 0
desired attenuation = -60 dB
actual attenuation = n/a
*/
#define FILTER_TAP_NUM 11
const short filter_lowpass[FILTER_TAP_NUM] = {
-779,
-2839,
-2707,
5409,
19375,
26657,
19375,
5409,
-2707,
-2839,
-779
};
unsigned long last_time = millis();
void setup() {
Serial.begin(9600);
delay(300);
// allocate memory for the audio library
AudioMemory(100);
//fir1.begin(FIR_PASSTHRU, 0);
// Initialize the filter
fir1.begin(filter_lowpass, FILTER_TAP_NUM);
}
void loop()
{
// print information about resource usage
// Proc = 18 (18), Mem = 4 (5)
if (millis() - last_time >= 2000) {
Serial.print("Proc = ");
Serial.print(AudioProcessorUsage());
Serial.print(" (");
Serial.print(AudioProcessorUsageMax());
Serial.print("), Mem = ");
Serial.print(AudioMemoryUsage());
Serial.print(" (");
Serial.print(AudioMemoryUsageMax());
Serial.println(")");
last_time = millis();
}
}