SoDaRadio-5.0.3-master:8901fb5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SoDa::Spectrogram Class Reference

Spectrogram generates magnitude buffers from input sample stream. More...

#include <Spectrogram.hxx>

Public Member Functions

 Spectrogram (unsigned int fftlen)
 Constructor. More...
 
void apply_acc (std::complex< float > *invec, unsigned int inveclen, float *outvec, float accumulation_gain=0.0)
 Calculate the spectrogram from an input vector – add it to an accumulation buffer. More...
 
void apply_max (std::complex< float > *invec, unsigned int inveclen, float *outvec, bool first=true)
 Calculate the spectrogram from an input vector – add it to an accumulation buffer. More...
 

Private Member Functions

float * initBlackmanHarris ()
 all spectrograms are under a blackman harris window More...
 
void apply_common (std::complex< float > *invec, unsigned int inveclen)
 this is the common spectrogram calculation (window + fft + mag) More...
 

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

Spectrogram generates magnitude buffers from input sample stream.

Definition at line 39 of file Spectrogram.hxx.

Constructor & Destructor Documentation

◆ Spectrogram()

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

Constructor.

Parameters
fftlenhow many frequency points in the spectrogram buffer

Definition at line 34 of file Spectrogram.cxx.

References fft_len, fft_out, fftplan, initBlackmanHarris(), result, win_samp, and window.

Member Function Documentation

◆ apply_acc()

void SoDa::Spectrogram::apply_acc ( std::complex< float > *  invec,
unsigned int  inveclen,
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
inveclenthe length of the buffer
outvecthe result buffer
accumulation_gain(out = result + out * acc_gain)

Definition at line 111 of file Spectrogram.cxx.

References apply_common(), fft_len, and result.

Referenced by SoDa::UI::sendFFT().

◆ apply_common()

void SoDa::Spectrogram::apply_common ( std::complex< float > *  invec,
unsigned int  inveclen 
)
private

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

Parameters
invecthe input sample buffer
inveclenthe length of the buffer

Definition at line 74 of file Spectrogram.cxx.

References fft_len, fft_out, fftplan, result, win_samp, and window.

Referenced by apply_acc(), and apply_max().

◆ apply_max()

void SoDa::Spectrogram::apply_max ( std::complex< float > *  invec,
unsigned int  inveclen,
float *  outvec,
bool  first = true 
)

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

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

Definition at line 142 of file Spectrogram.cxx.

References apply_common(), fft_len, and result.

◆ initBlackmanHarris()

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

all spectrograms are under a blackman harris window

Definition at line 55 of file Spectrogram.cxx.

References fft_len.

Referenced by Spectrogram().

Member Data Documentation

◆ fft_len

unsigned int SoDa::Spectrogram::fft_len
private

Definition at line 94 of file Spectrogram.hxx.

Referenced by apply_acc(), apply_common(), apply_max(), initBlackmanHarris(), and Spectrogram().

◆ fft_out

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

Definition at line 92 of file Spectrogram.hxx.

Referenced by apply_common(), and Spectrogram().

◆ fftplan

fftwf_plan SoDa::Spectrogram::fftplan
private

Definition at line 89 of file Spectrogram.hxx.

Referenced by apply_common(), and Spectrogram().

◆ result

float* SoDa::Spectrogram::result
private

Definition at line 93 of file Spectrogram.hxx.

Referenced by apply_acc(), apply_common(), apply_max(), and Spectrogram().

◆ win_samp

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

Definition at line 91 of file Spectrogram.hxx.

Referenced by apply_common(), and Spectrogram().

◆ window

float* SoDa::Spectrogram::window
private

Definition at line 90 of file Spectrogram.hxx.

Referenced by apply_common(), and Spectrogram().


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