3
3
* @brief Copy audio from I2S to I2S using an FIR filter
4
4
* @author Phil Schatzmann
5
5
* @copyright GPLv3
6
- * #TODO testing is outstanding
7
6
*/
8
7
9
8
#include " AudioTools.h"
@@ -14,8 +13,8 @@ uint16_t channels = 2;
14
13
AudioKitStream kit;
15
14
16
15
// copy filtered values
17
- FilteredStream<int16_t , float > inFiltered (kit, channels); // Defiles the filter as BaseConverter
18
- StreamCopy copier (kit, inFiltered ); // copies sound into i2s
16
+ FilteredStream<int16_t , float > filtered (kit, channels); // Defiles the filter as BaseConverter
17
+ StreamCopy copier (filtered, kit ); // copies sound into i2s (both from kit to filtered or filered to kit are supported)
19
18
20
19
// define FIR filter
21
20
float coef[] = { 0.021 , 0.096 , 0.146 , 0.096 , 0.021 };
@@ -28,13 +27,14 @@ void setup(void) {
28
27
AudioLogger::instance ().begin (Serial, AudioLogger::Info);
29
28
30
29
// setup filters for all available channels
31
- inFiltered .setFilter (0 , new FIR<float >(coef));
32
- inFiltered .setFilter (1 , new FIR<float >(coef));
30
+ filtered .setFilter (0 , new FIR<float >(coef));
31
+ filtered .setFilter (1 , new FIR<float >(coef));
33
32
34
33
// start I2S in
35
34
Serial.println (" starting KIT..." );
36
- auto config = kit.defaultConfig (RX_TX_MODE );
35
+ auto config = kit.defaultConfig (RXTX_MODE );
37
36
config.sample_rate = sample_rate;
37
+ config.channels = channels;
38
38
config.sd_active = false ;
39
39
config.input_device = AUDIO_HAL_ADC_INPUT_LINE2;
40
40
kit.begin (config);
@@ -45,4 +45,4 @@ void setup(void) {
45
45
// Arduino loop - copy sound to out
46
46
void loop () {
47
47
copier.copy ();
48
- }
48
+ }
0 commit comments