5
5
#include " model.h" // tensorflow model
6
6
7
7
AudioKitStream kit; // Audio source
8
- TfLiteAudioFeatureProvider fp;
9
8
TfLiteAudioOutput<4 > tfl; // Audio sink
10
9
const char * kCategoryLabels [4 ] = {
11
10
" silence" ,
@@ -29,7 +28,7 @@ void respondToCommand(const char* found_command, uint8_t score,
29
28
30
29
void setup () {
31
30
Serial.begin (115200 );
32
- AudioLogger::instance ().begin (Serial, AudioLogger::Info );
31
+ AudioLogger::instance ().begin (Serial, AudioLogger::Warning );
33
32
34
33
// setup Audiokit
35
34
auto cfg = kit.defaultConfig (RX_MODE);
@@ -43,10 +42,14 @@ void setup() {
43
42
kit.begin (cfg);
44
43
45
44
// Setup tensorflow
46
- fp.kAudioChannels = channels;
47
- fp.kAudioSampleFrequency = samples_per_second;
48
- fp.respondToCommand = respondToCommand;
49
- tfl.begin (g_model, fp, kCategoryLabels , 10 * 1024 );
45
+ auto tcfg = tfl.defaultConfig ();
46
+ tcfg.kAudioChannels = channels;
47
+ tcfg.kAudioSampleFrequency = samples_per_second;
48
+ tcfg.kTensorArenaSize = 10 * 1024 ;
49
+ tcfg.respondToCommand = respondToCommand;
50
+ tcfg.model = g_model;
51
+ tcfg.labels = kCategoryLabels ;
52
+ tfl.begin (tcfg);
50
53
}
51
54
52
- void loop () { copier.copy (); }
55
+ void loop () { copier.copy (); }
0 commit comments