Skip to content

Commit 05fb89d

Browse files
committed
TF Lite DRAFT - config support
1 parent ac9133b commit 05fb89d

File tree

2 files changed

+162
-110
lines changed

2 files changed

+162
-110
lines changed

examples/sandbox/streams-audiokit-tf/streams-audiokit-tf.ino

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "model.h" // tensorflow model
66

77
AudioKitStream kit; // Audio source
8-
TfLiteAudioFeatureProvider fp;
98
TfLiteAudioOutput<4> tfl; // Audio sink
109
const char* kCategoryLabels[4] = {
1110
"silence",
@@ -29,7 +28,7 @@ void respondToCommand(const char* found_command, uint8_t score,
2928

3029
void setup() {
3130
Serial.begin(115200);
32-
AudioLogger::instance().begin(Serial, AudioLogger::Info);
31+
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
3332

3433
// setup Audiokit
3534
auto cfg = kit.defaultConfig(RX_MODE);
@@ -43,10 +42,14 @@ void setup() {
4342
kit.begin(cfg);
4443

4544
// 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);
5053
}
5154

52-
void loop() { copier.copy(); }
55+
void loop() { copier.copy(); }

0 commit comments

Comments
 (0)