ESP
0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
|
Input stream for getting the FFT spectrum of an audio file as it plays. This class plays an audio file and supplies its 1024-sample / 512-bin FFT spectrum as input to the current pipeline. The spectrum is supplied every ~23 milliseconds (i.e. 441000 KHz / 1024 = ~43 Hz). More...
#include <istream.h>
Public Member Functions | |
AudioFileStream (char *file, bool loop=false) | |
virtual bool | start () final |
virtual void | stop () final |
virtual int | getNumInputDimensions () final |
Public Member Functions inherited from InputStream | |
InputStream () | |
virtual | ~InputStream ()=default |
virtual int | getNumOutputDimensions () |
void | useNormalizer (normalizeFunc f) |
void | useNormalizer (vectorNormalizeFunc f) |
void | onDataReadyEvent (onDataReadyCallback callback) |
template<typename T1 , typename arg , class T > | |
void | onDataReadyEvent (T1 *owner, void(T::*listenerMethod)(arg)) |
void | setLabelsForAllDimensions (const vector< string > labels) |
void | setLabelsForAllDimensions (std::initializer_list< string > list) |
const vector< string > & | getLabels () const |
Public Member Functions inherited from Stream | |
Stream () | |
void | toggle () |
bool | hasStarted () |
Additional Inherited Members | |
Public Types inherited from InputStream | |
using | normalizeFunc = std::function< double(double)> |
using | vectorNormalizeFunc = std::function< vector< double >(vector< double >)> |
typedef std::function< void(GRT::MatrixDouble)> | onDataReadyCallback |
Protected Member Functions inherited from InputStream | |
vector< double > | normalize (vector< double >) |
Protected Attributes inherited from InputStream | |
vector< string > | InputStream_labels_ |
onDataReadyCallback | data_ready_callback_ |
normalizeFunc | normalizer_ |
vectorNormalizeFunc | vectorNormalizer_ |
Protected Attributes inherited from Stream | |
std::atomic_bool | has_started_ |
Input stream for getting the FFT spectrum of an audio file as it plays. This class plays an audio file and supplies its 1024-sample / 512-bin FFT spectrum as input to the current pipeline. The spectrum is supplied every ~23 milliseconds (i.e. 441000 KHz / 1024 = ~43 Hz).
AudioFileStream::AudioFileStream | ( | char * | file, |
bool | loop = false |
||
) |
|
finalvirtual |
Get the number of dimensions of the data that's provided by the input stream (before it's run through the normalizer, if any).
Implements InputStream.
|
finalvirtual |
Start the stream.
Reimplemented from Stream.
|
finalvirtual |
Reimplemented from Stream.