arduino-audio-tools
|
TfLiteAudioStream which uses Tensorflow Light to analyze the data. If it is used as a generator (where we read audio data) More...
#include <TfLiteAudioStream.h>
Public Member Functions | |
virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
Adds target to be notified about audio changes. | |
virtual AudioInfo | audioInfo () override |
provides the actual input AudioInfo | |
virtual AudioInfo | audioInfoOut () |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream | |
virtual int | available () override |
We can provide only some audio data when cfg.input is defined. | |
virtual int | availableForWrite () override |
virtual int | availableToWrite () override |
Constant streaming. | |
virtual bool | begin () |
virtual bool | begin (TfLiteConfig config) override |
Start the processing. | |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
TfLiteConfig & | config () override |
Provides the TfLiteConfig information. | |
virtual TfLiteConfig | defaultConfig () override |
virtual void | end () |
virtual void | flush () override |
tflite::MicroInterpreter & | interpreter () override |
Provides the tf lite interpreter. | |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
int8_t * | modelInputBuffer () override |
Provides access to the model input buffer. | |
virtual | operator bool () |
virtual size_t | readBytes (uint8_t *data, size_t len) override |
provide audio data with cfg.input | |
virtual size_t | readSilence (uint8_t *buffer, size_t length) |
Source to generate silence: just sets the buffer to 0. | |
virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
Removes a target in order not to be notified about audio changes. | |
virtual void | setAudioInfo (AudioInfo newInfo) override |
Defines the input AudioInfo. | |
void | setInterpreter (tflite::MicroInterpreter *p_interpreter) |
Optionally define your own p_interpreter. | |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
virtual size_t | write (const uint8_t *data, size_t len) override |
process the data in batches of max kMaxAudioSampleSize. | |
virtual size_t | write (uint8_t ch) override |
virtual void | writeSilence (size_t len) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
virtual int | not_supported (int out, const char *msg="") |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
virtual bool | setModel (const unsigned char *model) |
virtual bool | setupInterpreter () |
virtual bool | setupWriter () |
Protected Attributes | |
int | _timeout = 10 |
TfLiteConfig | cfg |
AudioInfo | info |
bool | is_notify_active = true |
bool | is_setup = false |
Vector< AudioInfoSupport * > | notify_vector |
tflite::MicroInterpreter * | p_interpreter = nullptr |
const tflite::Model * | p_model = nullptr |
TfLiteTensor * | p_tensor = nullptr |
uint8_t * | p_tensor_arena = nullptr |
int8_t * | p_tensor_buffer = nullptr |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
TfLiteAudioStream which uses Tensorflow Light to analyze the data. If it is used as a generator (where we read audio data)