AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
Loading...
Searching...
No Matches
AudioDataLib::FrequencyGraph Class Reference

This class is the product of performing an FFT on a given WaveForm instance. More...

#include <FrequencyGraph.h>

Classes

struct  Plot
 

Public Member Functions

 FrequencyGraph ()
 
virtual ~FrequencyGraph ()
 
void Clear ()
 
bool FromWaveForm (const WaveForm &waveForm, uint32_t numSamples, Error &error)
 
bool ToWaveForm (WaveForm &waveForm, Error &error) const
 
const std::vector< Plot > & GetPlotArray () const
 
void GenerateSmootherGraph (FrequencyGraph &smootherGraph, double frequencyRadius) const
 
double EstimateFundamentalFrequency (double strengthThreshold=35.0) const
 

Protected Attributes

std::vector< Plot > * plotArray
 

Detailed Description

This class is the product of performing an FFT on a given WaveForm instance.

While audio data in the time-domain is represented by the WaveForm class, this class represents such data in the frequency-domain.

Constructor & Destructor Documentation

◆ FrequencyGraph()

FrequencyGraph::FrequencyGraph ( )

◆ ~FrequencyGraph()

FrequencyGraph::~FrequencyGraph ( )
virtual

Member Function Documentation

◆ Clear()

void FrequencyGraph::Clear ( )

Remove all plots from this graph's list of such.

◆ EstimateFundamentalFrequency()

double FrequencyGraph::EstimateFundamentalFrequency ( double strengthThreshold = 35.0) const

Analyze this graph to determine the fundamental frequency, assuming the wave-form that was used was a monophonic signal. Note that the fundamental frequency is not always the perceived pitch, but it often is.

◆ FromWaveForm()

bool FrequencyGraph::FromWaveForm ( const WaveForm & waveForm,
uint32_t numSamples,
Error & error )

Generate a frequency graph from the given wave-form using an FFT.

Parameters
waveFormThis is the wave-form upon which to perform the FFT.
numSamplesThis is the number of samples to evaluate from the given wave-form and how many plots in the graph that will be generated. It must be a power of 2.
errorThis will contain detailed error information if false is returned.
Returns
True is returned on success; false otherwise.

◆ GenerateSmootherGraph()

void FrequencyGraph::GenerateSmootherGraph ( FrequencyGraph & smootherGraph,
double frequencyRadius ) const

This creates a smoother-looking version of this frequency graph that might be easier to look at. It may have no real practical use.

◆ GetPlotArray()

const std::vector< Plot > & AudioDataLib::FrequencyGraph::GetPlotArray ( ) const
inline

Get read-only access to this graph's plot array.

◆ ToWaveForm()

bool FrequencyGraph::ToWaveForm ( WaveForm & waveForm,
Error & error ) const

Generate a wave-form from this frequency-graph using an inverse FFT. This function has not yet been test or even written, but it's on my list of things to do. I think that additional parameters may be needed to make it work.

Member Data Documentation

◆ plotArray

std::vector<Plot>* AudioDataLib::FrequencyGraph::plotArray
protected

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