SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SoDa::Spectrogram Class Reference

#include <Spectrogram.hxx>

Inheritance diagram for SoDa::Spectrogram:
SoDa::Base

Public Member Functions

void apply_acc (std::vector< std::complex< float > > &invec, std::vector< float > &outvec, float accumulation_gain=0.0)
 Calculate the spectrogram from an input vector – add it to an accumulation buffer.
void apply_max (std::vector< std::complex< float > > &invec, std::vector< float > &outvec, bool first=true)
 Calculate the spectrogram from an input vector – add it to an accumulation buffer.
Public Member Functions inherited from SoDa::Base
 Base (const std::string &oname)
 The constructor – pass a name for the object.
void registerSelf (BasePtr ptr)
std::string & getObjName ()
 get the name of this object
BasePtr findSoDaObject (const std::string &oname)
 find a SoDa Object by name.
double getTime ()
 Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS).
BasePtr getSelfPtr ()
 get a pointer to myself.

Static Public Member Functions

static SpectrogramPtr make (unsigned int fftlen)

Protected Member Functions

 Spectrogram (unsigned int fftlen)
 Constructor.

Private Member Functions

float * initBlackmanHarris ()
 all spectrograms are under a blackman harris window
void apply_common (std::vector< std::complex< float > > &invec)
 this is the common spectrogram calculation (window + fft + mag)

Private Attributes

fftwf_plan fftplan
float * window
std::complex< float > * win_samp
std::complex< float > * fft_out
float * result
unsigned int fft_len

Detailed Description

Definition at line 46 of file Spectrogram.hxx.

Constructor & Destructor Documentation

◆ Spectrogram()

SoDa::Spectrogram::Spectrogram ( unsigned int fftlen)
protected

Constructor.

Parameters
fftlenhow many frequency points in the spectrogram buffer

Referenced by make().

Member Function Documentation

◆ apply_acc()

void SoDa::Spectrogram::apply_acc ( std::vector< std::complex< float > > & invec,
std::vector< float > & outvec,
float accumulation_gain = 0.0 )

Calculate the spectrogram from an input vector – add it to an accumulation buffer.

Parameters
invecthe input sample buffer
outvecthe result buffer
accumulation_gain(out = result + out * acc_gain)

◆ apply_common()

void SoDa::Spectrogram::apply_common ( std::vector< std::complex< float > > & invec)
private

this is the common spectrogram calculation (window + fft + mag)

Parameters
invecthe buffer we're going to operate on

◆ apply_max()

void SoDa::Spectrogram::apply_max ( std::vector< std::complex< float > > & invec,
std::vector< float > & outvec,
bool first = true )

Calculate the spectrogram from an input vector – add it to an accumulation buffer.

Parameters
invecthe input sample buffer
outvecthe result buffer (out = max(result, out))
firstif true, ignore contents of outvec...

◆ initBlackmanHarris()

float * SoDa::Spectrogram::initBlackmanHarris ( )
private

all spectrograms are under a blackman harris window

◆ make()

SpectrogramPtr SoDa::Spectrogram::make ( unsigned int fftlen)
inlinestatic

Definition at line 56 of file Spectrogram.hxx.

References Spectrogram().

Member Data Documentation

◆ fft_len

unsigned int SoDa::Spectrogram::fft_len
private

Definition at line 105 of file Spectrogram.hxx.

◆ fft_out

std::complex<float>* SoDa::Spectrogram::fft_out
private

Definition at line 103 of file Spectrogram.hxx.

◆ fftplan

fftwf_plan SoDa::Spectrogram::fftplan
private

Definition at line 100 of file Spectrogram.hxx.

◆ result

float* SoDa::Spectrogram::result
private

Definition at line 104 of file Spectrogram.hxx.

◆ win_samp

std::complex<float>* SoDa::Spectrogram::win_samp
private

Definition at line 102 of file Spectrogram.hxx.

◆ window

float* SoDa::Spectrogram::window
private

Definition at line 101 of file Spectrogram.hxx.


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