Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::FFT< Real >::STFTProcessor Class Reference

Stateful STFT processor for chunked real-time analysis. More...

#include <fft.H>

Collaboration diagram for Aleph::FFT< Real >::STFTProcessor:
[legend]

Public Member Functions

 STFTProcessor ()=default
 Default constructor for an unconfigured processor.
 
 STFTProcessor (const Array< Real > &window, const STFTOptions &options)
 Construct an STFT processor with a fixed analysis window.
 
 STFTProcessor (const size_t frame_size, const STFTOptions &options)
 Construct an STFT processor using a Hann window.
 
template<typename WindowContainer >
requires Is_Real_Container<WindowContainer>
 STFTProcessor (const WindowContainer &window, const STFTOptions &options)
 Construct an STFT processor from any real container.
 
size_t frame_size () const noexcept
 
bool configured () const noexcept
 
size_t hop_size () const noexcept
 
size_t fft_size () const noexcept
 
bool centered () const noexcept
 
bool pad_end () const noexcept
 
bool finalized () const noexcept
 
const Array< Real > & window () const noexcept
 
void reset ()
 
Array< Array< Complex > > process_block (const Array< Real > &block)
 
Array< Array< Complex > > pprocess_block (ThreadPool &pool, const Array< Real > &block, const size_t chunk_size=0)
 
Array< Array< Complex > > flush ()
 
Array< Array< Complex > > pflush (ThreadPool &pool, const size_t chunk_size=0)
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Array< Complex > > process_block (const Container &block)
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Array< Complex > > pprocess_block (ThreadPool &pool, const Container &block, const size_t chunk_size=0)
 

Private Member Functions

void require_configured (const char *ctx) const
 
void initialize_pending ()
 
void append_samples (const Array< Real > &block)
 
Array< Array< Complex > > emit_ready_frames (ThreadPool *pool, const size_t chunk_size, const bool allow_partial_frames)
 

Private Attributes

Array< Realwindow_
 
STFTOptions options_
 
size_t fft_size_ = 0
 
size_t center_pad_ = 0
 
Plan plan_
 
Array< Realpending_
 
bool configured_ = false
 
bool has_seen_input_ = false
 
bool finalized_ = false
 

Detailed Description

template<std::floating_point Real = double>
class Aleph::FFT< Real >::STFTProcessor

Stateful STFT processor for chunked real-time analysis.

Definition at line 10237 of file fft.H.

Constructor & Destructor Documentation

◆ STFTProcessor() [1/4]

template<std::floating_point Real = double>
Aleph::FFT< Real >::STFTProcessor::STFTProcessor ( )
default

Default constructor for an unconfigured processor.

◆ STFTProcessor() [2/4]

template<std::floating_point Real = double>
Aleph::FFT< Real >::STFTProcessor::STFTProcessor ( const Array< Real > &  window,
const STFTOptions options 
)
inlineexplicit

Construct an STFT processor with a fixed analysis window.

Parameters
windowAnalysis window (e.g. Hann, Hamming).
optionsSTFT parameters (hop size, centered, etc.).

Definition at line 10306 of file fft.H.

References Aleph::FFT< Real >::STFTProcessor::initialize_pending().

◆ STFTProcessor() [3/4]

template<std::floating_point Real = double>
Aleph::FFT< Real >::STFTProcessor::STFTProcessor ( const size_t  frame_size,
const STFTOptions options 
)
inlineexplicit

Construct an STFT processor using a Hann window.

Parameters
frame_sizeAnalysis window size.
optionsSTFT parameters.

Definition at line 10325 of file fft.H.

◆ STFTProcessor() [4/4]

template<std::floating_point Real = double>
Aleph::FFT< Real >::STFTProcessor::STFTProcessor ( const WindowContainer window,
const STFTOptions options 
)
inlineexplicit

Construct an STFT processor from any real container.

Template Parameters
WindowContainerContainer type (e.g. std::vector<double>).
Parameters
windowAnalysis window.
optionsSTFT parameters.

Definition at line 10338 of file fft.H.

Member Function Documentation

◆ append_samples()

◆ centered()

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::STFTProcessor::centered ( ) const
inlinenoexcept

◆ configured()

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::STFTProcessor::configured ( ) const
inlinenoexcept

Definition at line 10348 of file fft.H.

References Aleph::FFT< Real >::STFTProcessor::configured_.

◆ emit_ready_frames()

◆ fft_size()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::STFTProcessor::fft_size ( ) const
inlinenoexcept

Definition at line 10358 of file fft.H.

References Aleph::FFT< Real >::STFTProcessor::fft_size_.

◆ finalized()

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::STFTProcessor::finalized ( ) const
inlinenoexcept

Definition at line 10373 of file fft.H.

References Aleph::FFT< Real >::STFTProcessor::finalized_.

◆ flush()

◆ frame_size()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::STFTProcessor::frame_size ( ) const
inlinenoexcept

◆ hop_size()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::STFTProcessor::hop_size ( ) const
inlinenoexcept

◆ initialize_pending()

◆ pad_end()

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::STFTProcessor::pad_end ( ) const
inlinenoexcept

◆ pflush()

◆ pprocess_block() [1/2]

◆ pprocess_block() [2/2]

template<std::floating_point Real = double>
Array< Array< Complex > > Aleph::FFT< Real >::STFTProcessor::pprocess_block ( ThreadPool pool,
const Container block,
const size_t  chunk_size = 0 
)
inline

◆ process_block() [1/2]

◆ process_block() [2/2]

template<std::floating_point Real = double>
Array< Array< Complex > > Aleph::FFT< Real >::STFTProcessor::process_block ( const Container block)
inline

◆ require_configured()

◆ reset()

◆ window()

template<std::floating_point Real = double>
const Array< Real > & Aleph::FFT< Real >::STFTProcessor::window ( ) const
inlinenoexcept

Definition at line 10378 of file fft.H.

References Aleph::FFT< Real >::STFTProcessor::window_.

Member Data Documentation

◆ center_pad_

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::STFTProcessor::center_pad_ = 0
private

◆ configured_

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::STFTProcessor::configured_ = false
private

◆ fft_size_

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::STFTProcessor::fft_size_ = 0
private

◆ finalized_

◆ has_seen_input_

◆ options_

◆ pending_

◆ plan_

template<std::floating_point Real = double>
Plan Aleph::FFT< Real >::STFTProcessor::plan_
private

Definition at line 10243 of file fft.H.

Referenced by Aleph::FFT< Real >::STFTProcessor::emit_ready_frames().

◆ window_

template<std::floating_point Real = double>
Array<Real> Aleph::FFT< Real >::STFTProcessor::window_
private

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