|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Stateful STFT processor for chunked real-time analysis. More...
#include <fft.H>
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. | |
| STFTProcessor (const STFTProcessor &other)=default | |
| Copy the configuration and the pending samples of another processor. | |
| STFTProcessor (STFTProcessor &&other) noexcept | |
| Take the configuration and the pending samples of another processor, which is left unconfigured, as built by default. | |
| STFTProcessor & | operator= (const STFTProcessor &other)=default |
| Copy the configuration and the pending samples of another processor. | |
| STFTProcessor & | operator= (STFTProcessor &&other) noexcept |
| Exchange this processor with another, which is left with the previous state of this one. | |
| void | swap (STFTProcessor &other) noexcept |
| Exchange in O(1) the state of this processor and another. | |
| 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< Real > | window_ |
| STFTOptions | options_ |
| size_t | fft_size_ = 0 |
| size_t | center_pad_ = 0 |
| Plan | plan_ |
| Array< Real > | pending_ |
| bool | configured_ = false |
| bool | has_seen_input_ = false |
| bool | finalized_ = false |
Stateful STFT processor for chunked real-time analysis.
|
default |
Default constructor for an unconfigured processor.
|
inlineexplicit |
Construct an STFT processor with a fixed analysis window.
| window | Analysis window (e.g. Hann, Hamming). |
| options | STFT parameters (hop size, centered, etc.). |
Definition at line 10416 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::initialize_pending().
|
inlineexplicit |
|
inlineexplicit |
|
default |
Copy the configuration and the pending samples of another processor.
| [in] | other | processor to copy. |
| std::bad_alloc | if the buffers cannot be allocated. |
|
inlinenoexcept |
Take the configuration and the pending samples of another processor, which is left unconfigured, as built by default.
The implicit move took the window, the plan and the pending samples but copied the FFT size and the flags: the moved-from processor then said that it was configured and transformed frames with a plan that it no longer had.
| [in,out] | other | processor to move from. |
|
inlineprivate |
Definition at line 10375 of file fft.H.
References ah_invalid_argument_if, Aleph::FFT< Real >::append_all(), Aleph::FFT< Real >::STFTProcessor::pending_, and Aleph::Array< T >::size().
Referenced by Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::pflush(), Aleph::FFT< Real >::STFTProcessor::pprocess_block(), and Aleph::FFT< Real >::STFTProcessor::process_block().
|
inlinenoexcept |
Definition at line 10539 of file fft.H.
References Aleph::FFT< Real >::STFTOptions::centered, and Aleph::FFT< Real >::STFTProcessor::options_.
|
inlinenoexcept |
Definition at line 10524 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::configured_.
|
inlineprivate |
Definition at line 10384 of file fft.H.
References Aleph::and, Aleph::Array< T >::append(), Aleph::FFT< Real >::build_padded_frame_from_prefix(), Aleph::FFT< Real >::drop_prefix(), Aleph::FFT< Real >::STFTProcessor::fft_size_, Aleph::FFT< Real >::STFTOptions::hop_size, Aleph::Array< T >::is_empty(), Aleph::FFT< Real >::STFTProcessor::options_, Aleph::FFT< Real >::STFTProcessor::pending_, Aleph::FFT< Real >::STFTProcessor::plan_, Aleph::Array< T >::size(), Aleph::FFT< Real >::transform_stft_frames(), and Aleph::FFT< Real >::STFTProcessor::window_.
Referenced by Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::pflush(), Aleph::FFT< Real >::STFTProcessor::pprocess_block(), and Aleph::FFT< Real >::STFTProcessor::process_block().
|
inlinenoexcept |
Definition at line 10534 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::fft_size_.
|
inlinenoexcept |
Definition at line 10549 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::finalized_.
|
inline |
Definition at line 10600 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::append_samples(), Aleph::FFT< Real >::STFTProcessor::center_pad_, Aleph::Array< T >::create(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::Array< T >::empty(), Aleph::FFT< Real >::STFTProcessor::finalized_, Aleph::FFT< Real >::STFTProcessor::has_seen_input_, Aleph::FFT< Real >::STFTProcessor::options_, Aleph::FFT< Real >::STFTOptions::pad_end, Aleph::FFT< Real >::STFTProcessor::pending_, and Aleph::FFT< Real >::STFTProcessor::require_configured().
|
inlinenoexcept |
Definition at line 10519 of file fft.H.
References Aleph::Array< T >::size(), and Aleph::FFT< Real >::STFTProcessor::window_.
|
inlinenoexcept |
Definition at line 10529 of file fft.H.
References Aleph::FFT< Real >::STFTOptions::hop_size, and Aleph::FFT< Real >::STFTProcessor::options_.
|
inlineprivate |
Definition at line 10366 of file fft.H.
References Aleph::Array< T >::append(), Aleph::FFT< Real >::STFTProcessor::center_pad_, Aleph::Array< T >::empty(), Aleph::FFT< Real >::STFTProcessor::pending_, and Aleph::Array< T >::reserve().
Referenced by Aleph::FFT< Real >::STFTProcessor::STFTProcessor(), and Aleph::FFT< Real >::STFTProcessor::reset().
|
default |
Copy the configuration and the pending samples of another processor.
| [in] | other | processor to copy. |
| std::bad_alloc | if the buffers cannot be allocated. |
|
inlinenoexcept |
Exchange this processor with another, which is left with the previous state of this one.
| [in,out] | other | processor to move from. |
Definition at line 10497 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::swap().
|
inlinenoexcept |
Definition at line 10544 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::options_, and Aleph::FFT< Real >::STFTOptions::pad_end.
|
inline |
Definition at line 10628 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::append_samples(), Aleph::FFT< Real >::STFTProcessor::center_pad_, Aleph::Array< T >::create(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::Array< T >::empty(), Aleph::FFT< Real >::STFTProcessor::finalized_, Aleph::FFT< Real >::STFTProcessor::has_seen_input_, Aleph::FFT< Real >::STFTProcessor::options_, Aleph::FFT< Real >::STFTOptions::pad_end, Aleph::FFT< Real >::STFTProcessor::pending_, and Aleph::FFT< Real >::STFTProcessor::require_configured().
|
inline |
Definition at line 10583 of file fft.H.
References ah_runtime_error_if, Aleph::FFT< Real >::STFTProcessor::append_samples(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::STFTProcessor::finalized_, Aleph::FFT< Real >::STFTProcessor::has_seen_input_, and Aleph::FFT< Real >::STFTProcessor::require_configured().
Referenced by Aleph::FFT< Real >::STFTProcessor::pprocess_block().
|
inline |
Definition at line 10666 of file fft.H.
References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::STFTProcessor::pprocess_block().
|
inline |
Definition at line 10568 of file fft.H.
References ah_runtime_error_if, Aleph::FFT< Real >::STFTProcessor::append_samples(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::STFTProcessor::finalized_, Aleph::FFT< Real >::STFTProcessor::has_seen_input_, and Aleph::FFT< Real >::STFTProcessor::require_configured().
Referenced by Aleph::FFT< Real >::STFTProcessor::process_block().
|
inline |
Definition at line 10658 of file fft.H.
References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::STFTProcessor::process_block().
|
inlineprivate |
Definition at line 10360 of file fft.H.
References ah_runtime_error_if, and Aleph::FFT< Real >::STFTProcessor::configured_.
Referenced by Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::pflush(), Aleph::FFT< Real >::STFTProcessor::pprocess_block(), Aleph::FFT< Real >::STFTProcessor::process_block(), and Aleph::FFT< Real >::STFTProcessor::reset().
|
inline |
|
inlinenoexcept |
Exchange in O(1) the state of this processor and another.
| [in,out] | other | processor to exchange with. |
Definition at line 10506 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::center_pad_, Aleph::FFT< Real >::STFTProcessor::configured_, Aleph::FFT< Real >::STFTProcessor::fft_size_, Aleph::FFT< Real >::STFTProcessor::finalized_, Aleph::FFT< Real >::STFTProcessor::has_seen_input_, Aleph::FFT< Real >::STFTProcessor::options_, Aleph::FFT< Real >::STFTProcessor::pending_, Aleph::FFT< Real >::STFTProcessor::plan_, Aleph::Array< T >::swap(), Aleph::FFT< Real >::Plan::swap(), and Aleph::FFT< Real >::STFTProcessor::window_.
Referenced by Aleph::FFT< Real >::STFTProcessor::operator=().
|
inlinenoexcept |
Definition at line 10554 of file fft.H.
References Aleph::FFT< Real >::STFTProcessor::window_.
|
private |
Definition at line 10352 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::initialize_pending(), Aleph::FFT< Real >::STFTProcessor::pflush(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10355 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::configured(), Aleph::FFT< Real >::STFTProcessor::require_configured(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10351 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::STFTProcessor::fft_size(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10357 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::finalized(), Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::pflush(), Aleph::FFT< Real >::STFTProcessor::pprocess_block(), Aleph::FFT< Real >::STFTProcessor::process_block(), Aleph::FFT< Real >::STFTProcessor::reset(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10356 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::pflush(), Aleph::FFT< Real >::STFTProcessor::pprocess_block(), Aleph::FFT< Real >::STFTProcessor::process_block(), Aleph::FFT< Real >::STFTProcessor::reset(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10350 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::centered(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::hop_size(), Aleph::FFT< Real >::STFTProcessor::pad_end(), Aleph::FFT< Real >::STFTProcessor::pflush(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10354 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::append_samples(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::STFTProcessor::flush(), Aleph::FFT< Real >::STFTProcessor::initialize_pending(), Aleph::FFT< Real >::STFTProcessor::pflush(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10353 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), and Aleph::FFT< Real >::STFTProcessor::swap().
|
private |
Definition at line 10349 of file fft.H.
Referenced by Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::STFTProcessor::frame_size(), Aleph::FFT< Real >::STFTProcessor::swap(), and Aleph::FFT< Real >::STFTProcessor::window().