arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::TfLiteAudioStream Class Reference

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>

Inheritance diagram for audio_tools::TfLiteAudioStream:
audio_tools::TfLiteAudioStreamBase audio_tools::AudioStreamX audio_tools::AudioStream Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource Print

Public Member Functions

virtual int available () override
 We can provide only some audio data when cfg.input is defined. More...
 
virtual int availableToWrite () override
 Constant streaming. More...
 
virtual bool begin (TfLiteConfig config) override
 Start the processing. More...
 
TfLiteConfigconfig () override
 Provides the TfLiteConfig information. More...
 
virtual TfLiteConfig defaultConfig () override
 
tflite::MicroInterpreter & interpreter () override
 Provides the tf lite interpreter. More...
 
int8_t * modelInputBuffer () override
 Provides access to the model input buffer. More...
 
virtual size_t readBytes (uint8_t *data, size_t len) override
 provide audio data with cfg.input More...
 
void setInterpreter (tflite::MicroInterpreter *p_interpreter)
 Optionally define your own p_interpreter. More...
 
virtual size_t write (const uint8_t *audio, size_t bytes) override
 process the data in batches of max kMaxAudioSampleSize. More...
 
virtual int availableToWrite ()=0
 
virtual bool begin (TfLiteConfig config)=0
 
virtual TfLiteConfigconfig ()=0
 Provides the TfLiteConfig information. More...
 
virtual TfLiteConfig defaultConfig ()=0
 
virtual tflite::MicroInterpreter & interpreter ()=0
 
virtual int8_t * modelInputBuffer ()=0
 Provides access to the model input buffer. More...
 
virtual void setInterpreter (tflite::MicroInterpreter *p_interpreter)=0
 
virtual size_t write (const uint8_t *audio, size_t bytes)=0
 process the data in batches of max kMaxAudioSampleSize. More...
 
- Public Member Functions inherited from audio_tools::AudioStreamX
virtual int available () override
 
virtual int peek () override
 
virtual int read () override
 
virtual size_t readBytes (uint8_t *buffer, size_t length) override
 
virtual size_t write (const uint8_t *buffer, size_t size) override
 
virtual size_t write (uint8_t) override
 
- Public Member Functions inherited from audio_tools::AudioStream
 AudioStream (AudioStream const &)=delete
 
virtual AudioBaseInfo audioInfo () override
 
virtual int availableForWrite () override
 
virtual bool begin ()
 
virtual void end ()
 
virtual void flush ()
 
 operator bool ()
 
AudioStreamoperator= (AudioStream const &)=delete
 
virtual size_t readBytes (char *buffer, size_t length)
 
virtual size_t readBytes (uint8_t *buffer, size_t length)=0
 
virtual void setAudioInfo (AudioBaseInfo info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)
 
virtual size_t write (const uint8_t *buffer, size_t size)=0
 
- Public Member Functions inherited from Stream
virtual int available ()=0
 
bool find (char target)
 
bool find (const char *target)
 
bool find (const char *target, size_t length)
 
bool find (const uint8_t *target)
 
bool find (const uint8_t *target, size_t length)
 
bool findUntil (const char *target, const char *terminator)
 
bool findUntil (const char *target, size_t targetLen, const char *terminate, size_t termLen)
 
bool findUntil (const uint8_t *target, const char *terminator)
 
bool findUntil (const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen)
 
unsigned long getTimeout (void)
 
float parseFloat (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
long parseInt (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
virtual int peek ()=0
 
virtual int read ()=0
 
size_t readBytes (char *buffer, size_t length)
 
size_t readBytes (uint8_t *buffer, size_t length)
 
size_t readBytesUntil (char terminator, char *buffer, size_t length)
 
size_t readBytesUntil (char terminator, uint8_t *buffer, size_t length)
 
String readString ()
 
String readStringUntil (char terminator)
 
void setTimeout (unsigned long timeout)
 
- Public Member Functions inherited from Print
virtual int availableForWrite ()
 
void clearWriteError ()
 
virtual void flush ()
 
int getWriteError ()
 
size_t print (char)
 
size_t print (const __FlashStringHelper *)
 
size_t print (const char[])
 
size_t print (const Printable &)
 
size_t print (const String &)
 
size_t print (double, int=2)
 
size_t print (int, int=DEC)
 
size_t print (long long, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned char, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (unsigned long long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t println (char)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const char[])
 
size_t println (const Printable &)
 
size_t println (const String &s)
 
size_t println (double, int=2)
 
size_t println (int, int=DEC)
 
size_t println (long long, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned char, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (unsigned long long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (void)
 
size_t write (const char *buffer, size_t size)
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t)=0
 
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
 
virtual void setAudioInfo (AudioBaseInfo info)=0
 
virtual bool validate (AudioBaseInfo &info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0
 

Protected Member Functions

virtual bool setModel (const unsigned char *model)
 
virtual bool setupInterpreter ()
 
virtual bool setupWriter ()
 
- Protected Member Functions inherited from audio_tools::AudioStream
virtual int not_supported (int out)
 
- Protected Member Functions inherited from Stream
int findMulti (struct MultiTarget *targets, int tCount)
 
float parseFloat (char ignore)
 
long parseInt (char ignore)
 
int peekNextDigit (LookaheadMode lookahead, bool detectDecimal)
 
int timedPeek ()
 
int timedRead ()
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Protected Attributes

TfLiteConfig cfg
 
bool is_setup = false
 
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
 
- Protected Attributes inherited from audio_tools::AudioStream
AudioBaseInfo info
 
AudioBaseInfoDependentp_notify =nullptr
 
- Protected Attributes inherited from Stream
unsigned long _startMillis
 
unsigned long _timeout
 

Detailed Description

TfLiteAudioStream which uses Tensorflow Light to analyze the data. If it is used as a generator (where we read audio data)

Author
Phil Schatzmann

Member Function Documentation

◆ available()

virtual int audio_tools::TfLiteAudioStream::available ( )
inlineoverridevirtual

We can provide only some audio data when cfg.input is defined.

Reimplemented from audio_tools::AudioStreamX.

◆ availableToWrite()

virtual int audio_tools::TfLiteAudioStream::availableToWrite ( )
inlineoverridevirtual

Constant streaming.

Implements audio_tools::TfLiteAudioStreamBase.

◆ begin()

virtual bool audio_tools::TfLiteAudioStream::begin ( TfLiteConfig  config)
inlineoverridevirtual

Start the processing.

Implements audio_tools::TfLiteAudioStreamBase.

◆ config()

TfLiteConfig & audio_tools::TfLiteAudioStream::config ( )
inlineoverridevirtual

Provides the TfLiteConfig information.

Implements audio_tools::TfLiteAudioStreamBase.

◆ defaultConfig()

virtual TfLiteConfig audio_tools::TfLiteAudioStream::defaultConfig ( )
inlineoverridevirtual

◆ interpreter()

tflite::MicroInterpreter & audio_tools::TfLiteAudioStream::interpreter ( )
inlineoverridevirtual

Provides the tf lite interpreter.

Implements audio_tools::TfLiteAudioStreamBase.

◆ modelInputBuffer()

int8_t * audio_tools::TfLiteAudioStream::modelInputBuffer ( )
inlineoverridevirtual

Provides access to the model input buffer.

Implements audio_tools::TfLiteAudioStreamBase.

◆ readBytes()

virtual size_t audio_tools::TfLiteAudioStream::readBytes ( uint8_t *  data,
size_t  len 
)
inlineoverridevirtual

provide audio data with cfg.input

Reimplemented from audio_tools::AudioStreamX.

◆ setInterpreter()

void audio_tools::TfLiteAudioStream::setInterpreter ( tflite::MicroInterpreter *  p_interpreter)
inlinevirtual

Optionally define your own p_interpreter.

Implements audio_tools::TfLiteAudioStreamBase.

◆ write()

virtual size_t audio_tools::TfLiteAudioStream::write ( const uint8_t *  audio,
size_t  bytes 
)
inlineoverridevirtual

process the data in batches of max kMaxAudioSampleSize.

Implements audio_tools::TfLiteAudioStreamBase.


The documentation for this class was generated from the following file: