Main Page · Modules · All Classes · Class Hierarchy
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MASoundBasicAnalyzer Class Reference

Sound analyzer class. More...

#include <MASoundBasicAnalyzer.hpp>

Inheritance diagram for MASoundBasicAnalyzer:
MAAnalyzer MASoundAdvancedAnalyzer MASoundEventAnalyzer

Public Member Functions

 MASoundBasicAnalyzer (unsigned int frequency, bool only_mfcc_components=false)
 Class constructor. More...
 
virtual void AddSamples (const MARobotState &robot_state) override
 Add new samples from the robot state. More...
 
virtual void Reset () override
 Reset the analyzer and drop all samples.
 
virtual bool IsValid () const override
 Check if enough samples were added to the analyzer. More...
 
virtual MC::FloatList GetFeatureVector () override
 Get a feature vector. More...
 
MC::FloatTable GetFeatureVectors (unsigned int desired_vector_count=0, unsigned int erased_vector_count=0)
 Get all feature vectors. More...
 
unsigned int GetFeatureVectorCount () const
 Get the available feature vector count. More...
 
void AddSoundData (const MCBinaryData &raw_data)
 Add raw (byte) sound data. More...
 
void AddSoundData (const MC::DoubleList &raw_data)
 Add raw (float numbers) sound data. More...
 
- Public Member Functions inherited from MAAnalyzer
const MC::StringList & GetFeatureNames () const
 Get the feature names. More...
 

Protected Member Functions

virtual void GenerateFeatureVectors ()
 Generate feature vector frames.
 
MC::FloatList ApplyHorizontalFeatures (const MC::FloatList &vector)
 Add a feature vector to a sliding window to calculate horizontal features. More...
 
virtual MC::FloatList CalculateHorizontalFeatures ()
 Calculate horizontal features for the feature vectors.
 
MC::DoubleTable GenerateHannWindows (const MC::DoubleList &audio_data, int &remaining_count)
 Generate Hann windows from audio data. More...
 

Protected Attributes

double Frequency
 Audio frequency.
 
int WindowSize
 Ideal window size.
 
boost::scoped_ptr< FilterBankWrapper > Wrapper
 Filter bank for MFCC calculation.
 
MC::DoubleTable DataWindows
 Audio data windows.
 
MC::DoubleList LastDeltaFrame
 Last delta frame.
 
MC::DoubleList LastMmbsesDeltaFrame
 Last MMBSES frame.
 
MC::FloatTable FeatureVectors
 Feature vectors.
 
int SlidingWindowLimit
 Sliding window count.
 
MC::FloatTable SlidingWindow
 Sliding window of feature vectors.
 
MC::DoubleList Buffer
 Audio buffer.
 
double * HannWindow
 Hann window.
 
int * BarkBandLimits
 Bark band limits.
 
bool OnlyMfccCoefs
 Calculate only mfcc band components.
 
- Protected Attributes inherited from MAAnalyzer
MC::StringList FeatureNames
 Feature names.
 
bool FeatureNamesReady
 Whether the feature names are defined.
 

Static Protected Attributes

static const int MfccCount = 26
 Number of mfcc components.
 

Additional Inherited Members

- Static Public Member Functions inherited from MAAnalyzer
static MC::FloatTable CompactFeatureVectors (const MC::FloatTable &feature_vectors, const unsigned int window_size)
 Compacting the feature vectors. More...
 

Detailed Description

Sound analyzer class.

Definition at line 43 of file MASoundBasicAnalyzer.hpp.

Constructor & Destructor Documentation

MASoundBasicAnalyzer::MASoundBasicAnalyzer ( unsigned int  frequency,
bool  only_mfcc_components = false 
)
explicit

Class constructor.

Parameters
frequencySampling frequency of the audio data
only_mfcc_componentsCalculate only MFCC band components

Definition at line 34 of file MASoundBasicAnalyzer.cpp.

Member Function Documentation

void MASoundBasicAnalyzer::AddSamples ( const MARobotState robot_state)
overridevirtual

Add new samples from the robot state.

Parameters
robot_stateRobot state

Implements MAAnalyzer.

Definition at line 77 of file MASoundBasicAnalyzer.cpp.

void MASoundBasicAnalyzer::AddSoundData ( const MCBinaryData raw_data)

Add raw (byte) sound data.

Parameters
raw_dataRaw data

Definition at line 146 of file MASoundBasicAnalyzer.cpp.

void MASoundBasicAnalyzer::AddSoundData ( const MC::DoubleList &  raw_data)

Add raw (float numbers) sound data.

Parameters
raw_dataRaw data

Definition at line 152 of file MASoundBasicAnalyzer.cpp.

MC::FloatList MASoundBasicAnalyzer::ApplyHorizontalFeatures ( const MC::FloatList &  vector)
protected

Add a feature vector to a sliding window to calculate horizontal features.

Parameters
vectorFeature vector
Returns
Horizontal features for the passed feature vector

Definition at line 742 of file MASoundBasicAnalyzer.cpp.

MC::DoubleTable MASoundBasicAnalyzer::GenerateHannWindows ( const MC::DoubleList &  audio_data,
int &  remaining_count 
)
protected

Generate Hann windows from audio data.

Parameters
audio_dataAudio data
remaining_countRemaining data count
Returns
Hann windows

Definition at line 766 of file MASoundBasicAnalyzer.cpp.

MC::FloatList MASoundBasicAnalyzer::GetFeatureVector ( )
overridevirtual

Get a feature vector.

Returns
The first feature vector in the queue otherwise empty vector

Implements MAAnalyzer.

Definition at line 100 of file MASoundBasicAnalyzer.cpp.

unsigned int MASoundBasicAnalyzer::GetFeatureVectorCount ( ) const

Get the available feature vector count.

Returns
The feature vector count in the queue

Definition at line 140 of file MASoundBasicAnalyzer.cpp.

MC::FloatTable MASoundBasicAnalyzer::GetFeatureVectors ( unsigned int  desired_vector_count = 0,
unsigned int  erased_vector_count = 0 
)

Get all feature vectors.

Parameters
desired_vector_countDesired vector count or zero
erased_vector_countPreserved vector count
Returns
All feature vectors in the queue otherwise empty table

Definition at line 118 of file MASoundBasicAnalyzer.cpp.

bool MASoundBasicAnalyzer::IsValid ( ) const
overridevirtual

Check if enough samples were added to the analyzer.

Returns
True if the analyzer can provide feature vectors otherwise false.

Implements MAAnalyzer.

Definition at line 94 of file MASoundBasicAnalyzer.cpp.


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