|
MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
|
Typedefs | |
| using | ConvolutionProcessor = std::function< void(const std::vector< std::complex< double > > &signal_fft, const std::vector< std::complex< double > > &kernel_fft, std::vector< std::complex< double > > &result_fft)> |
| Frequency-domain processor callback for apply_convolution. | |
| using | SpectrumProcessor = std::function< void(std::vector< std::complex< double > > &, size_t)> |
| Callable type for per-frame spectrum modification Receives the one-sided complex spectrum (bins 0..N/2 inclusive) and the frame index. | |
Enumerations | |
| enum class | SortingDirection : uint8_t { ASCENDING , DESCENDING , CUSTOM , BIDIRECTIONAL } |
| Ascending or descending sort order. More... | |
| enum class | SortingAlgorithm : uint8_t { STANDARD , STABLE , PARTIAL , NTH_ELEMENT , HEAP , PARALLEL , RADIX , COUNTING , BUCKET , MERGE_EXTERNAL , QUICK_OPTIMIZED , LAZY_STREAMING , PREDICTIVE_ML , EIGEN_OPTIMIZED , GPU_ACCELERATED } |
| Available sorting algorithm backends. More... | |
Functions | |
| std::vector< double > | rms (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| RMS energy per window. | |
| std::vector< double > | peak (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Peak amplitude per window. | |
| std::vector< double > | power (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Power (sum of squares) per window. | |
| std::vector< double > | dynamic_range (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Dynamic range in dB per window. | |
| std::vector< double > | zero_crossing_rate (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Zero-crossing rate per window. | |
| std::vector< double > | spectral_energy (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Spectral energy per window using Hann-windowed FFT. | |
| std::vector< double > | low_frequency_energy (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, double low_bin_fraction=0.125) |
| Low-frequency spectral energy per window. | |
| std::vector< double > | mean (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Arithmetic mean per window. | |
| std::vector< double > | variance (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, bool sample_variance=true) |
| Variance per window. | |
| std::vector< double > | std_dev (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, bool sample_variance=true) |
| Standard deviation per window. | |
| std::vector< double > | skewness (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Skewness (standardised third central moment) per window. | |
| std::vector< double > | kurtosis (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Excess kurtosis (fourth central moment - 3) per window. | |
| std::vector< double > | median (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Median per window via nth_element partial sort. | |
| std::vector< double > | percentile (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, double percentile_value) |
| Arbitrary percentile per window via linear interpolation. | |
| std::vector< double > | entropy (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, size_t num_bins=0) |
| Shannon entropy per window using Sturges-rule histogram. | |
| std::vector< double > | min (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Minimum value per window. | |
| std::vector< double > | max (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Maximum value per window. | |
| std::vector< double > | range (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Value range (max - min) per window. | |
| std::vector< double > | sum (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Sum per window. | |
| std::vector< double > | count (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Sample count per window (as double for pipeline uniformity) | |
| std::vector< double > | mad (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Median absolute deviation per window. | |
| std::vector< double > | coefficient_of_variation (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, bool sample_variance=true) |
| Coefficient of variation (std_dev / mean) per window. | |
| std::vector< double > | mode (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size) |
| Mode per window via tolerance-bucketed frequency count. | |
| std::vector< double > | mean_zscore (std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, bool sample_variance=true) |
| Mean z-score per window. | |
| std::vector< size_t > | zero_crossing_positions (std::span< const double > data, double threshold=0.0) |
| Sample indices of zero crossings in the full span. | |
| std::vector< size_t > | peak_positions (std::span< const double > data, double threshold=0.0, size_t min_distance=1) |
| Sample indices of local peak maxima in the full span. | |
| std::vector< size_t > | onset_positions (std::span< const double > data, uint32_t window_size, uint32_t hop_size, double threshold=0.1) |
| Sample indices of onsets detected via spectral flux. | |
| size_t | num_windows (size_t data_size, uint32_t window_size, uint32_t hop_size) noexcept |
| Compute the number of analysis windows for a given data size. | |
| std::vector< double > | apply_convolution (std::span< const double > src, std::span< const double > kernel, const ConvolutionProcessor &processor, bool full_size=false) |
| Core FFT convolution engine. | |
| std::vector< double > | convolve (std::span< const double > src, std::span< const double > ir) |
| Linear FFT convolution. | |
| std::vector< double > | cross_correlate (std::span< const double > src, std::span< const double > tmpl, bool normalize=true) |
| Cross-correlation via FFT. | |
| std::vector< double > | matched_filter (std::span< const double > src, std::span< const double > reference) |
| Matched filter (normalised cross-correlation) | |
| std::vector< double > | deconvolve (std::span< const double > src, std::span< const double > ir, double regularization=1e-6) |
| Frequency-domain deconvolution with Tikhonov regularisation. | |
| std::vector< double > | auto_correlate (std::span< const double > src, bool normalize=true) |
| Auto-correlation via FFT. | |
| bool | validate_window_parameters (uint32_t window_size, uint32_t hop_size, size_t data_size) noexcept |
| Validate window/hop parameters for windowed processing. | |
| std::vector< std::pair< size_t, size_t > > | merge_intervals (const std::vector< std::pair< size_t, size_t > > &intervals) |
| Merge overlapping or adjacent half-open intervals. | |
| std::vector< double > | slice_intervals (std::span< const double > data, const std::vector< std::pair< size_t, size_t > > &intervals) |
| Copy data from a set of half-open intervals into a flat vector. | |
| std::vector< std::pair< size_t, size_t > > | regions_around_positions (const std::vector< size_t > &positions, size_t half_region, size_t data_size) |
| Build [start, end) intervals centred on a set of positions. | |
| std::vector< std::pair< size_t, size_t > > | intervals_from_window_starts (const std::vector< size_t > &window_starts, uint32_t window_size, size_t data_size) |
| Build [start, end) intervals from window start indices. | |
| std::vector< double > | overlapping_windows (std::span< const double > data, uint32_t window_size, double overlap) |
| Extract overlapping windows as a flat concatenated vector. | |
| std::vector< double > | windowed_by_indices (std::span< const double > data, const std::vector< size_t > &window_starts, uint32_t window_size) |
| Extract windows at specific starting indices as a flat concatenated vector. | |
| void | sort_span (std::span< double > data, SortingDirection direction, SortingAlgorithm algorithm=SortingAlgorithm::STANDARD) |
| Sort a single span in-place. | |
| std::span< double > | sort_span_into (std::span< const double > data, std::vector< double > &output_storage, SortingDirection direction, SortingAlgorithm algorithm=SortingAlgorithm::STANDARD) |
| Sort a span into a caller-owned output buffer. | |
| void | sort_channels (std::vector< std::span< double > > &channels, SortingDirection direction, SortingAlgorithm algorithm=SortingAlgorithm::STANDARD) |
| Sort all channels in-place. | |
| std::vector< std::span< double > > | sort_channels_into (const std::vector< std::span< const double > > &channels, std::vector< std::vector< double > > &output_storage, SortingDirection direction, SortingAlgorithm algorithm=SortingAlgorithm::STANDARD) |
| Sort all channels into caller-owned output buffers. | |
| std::vector< size_t > | span_sort_indices (std::span< double > data, SortingDirection direction) |
| Indices that would sort a span in the given direction. | |
| std::vector< std::vector< size_t > > | channels_sort_indices (const std::vector< std::span< double > > &channels, SortingDirection direction) |
| Per-channel sort indices. | |
| auto | double_comparator (SortingDirection direction) noexcept |
| Direction-based comparator for doubles. | |
| template<typename T > requires requires(T v) { { std::abs(v) } -> std::convertible_to<double>; } | |
| auto | magnitude_comparator (SortingDirection direction) noexcept |
| Magnitude-based comparator for complex-like types. | |
| template<typename Container , typename Comparator > | |
| std::vector< size_t > | sort_indices (const Container &container, Comparator comp) |
| Generic sort-index generator for any random-access container. | |
| template<std::random_access_iterator Iterator, typename Comparator > | |
| void | execute (Iterator begin, Iterator end, Comparator comp, SortingAlgorithm algorithm) |
| Execute a sorting algorithm on an iterator range. | |
| std::vector< double > | apply_spectral (std::span< const double > src, uint32_t window_size, uint32_t hop_size, const SpectrumProcessor &processor) |
| Apply a per-frame spectrum processor via WOLA analysis-synthesis. | |
| std::vector< double > | spectral_filter (std::span< const double > src, double lo_hz, double hi_hz, double sample_rate, uint32_t window_size=1024, uint32_t hop_size=256) |
| Hard bandpass filter: zero all bins outside [lo_hz, hi_hz]. | |
| std::vector< double > | spectral_invert (std::span< const double > src, uint32_t window_size=1024, uint32_t hop_size=256) |
| Spectral phase inversion (conjugate all bins) | |
| std::vector< double > | harmonic_enhance (std::span< const double > src, double enhancement_factor, uint32_t window_size=1024, uint32_t hop_size=256) |
Linear spectral tilt: scale each bin by a factor that rises linearly from 1 at bin 0 to enhancement_factor at the Nyquist bin. | |
| std::vector< double > | spectral_gate (std::span< const double > src, double threshold_db, uint32_t window_size=1024, uint32_t hop_size=256) |
| Hard spectral gate: zero bins whose magnitude is below the threshold. | |
| std::vector< double > | phase_vocoder_stretch (std::span< const double > src, double stretch_factor, uint32_t window_size=2048, uint32_t analysis_hop=512) |
| Time-stretch via phase vocoder analysis-synthesis. | |
| std::vector< double > | pitch_shift (std::span< const double > src, double semitones, uint32_t window_size=2048, uint32_t analysis_hop=512) |
| Pitch-shift by resampling around a phase vocoder stretch. | |
| void | linear (std::span< double > data, double a, double b) noexcept |
| Linear map y = a*x + b applied in-place. | |
| void | power (std::span< double > data, double exponent) noexcept |
| Power map y = x^exponent applied in-place Scalar transcendental — not SIMD hot-path. | |
| void | exponential (std::span< double > data, double a, double b, double base=std::numbers::e) noexcept |
| Exponential map y = a * base^(b*x) applied in-place Scalar transcendental — not SIMD hot-path. | |
| void | logarithmic (std::span< double > data, double a, double b, double c, double base=std::numbers::e) noexcept |
| Logarithmic map y = a * log_base(b*x + c) applied in-place Values where (b*x + c) <= 0 are mapped to 0. | |
| void | clamp (std::span< double > data, double lo, double hi) noexcept |
| Clamp values to [lo, hi] in-place. | |
| void | quantize (std::span< double > data, uint8_t bits) noexcept |
| Quantize to n-bit resolution in-place Input is assumed to be in [-1, 1]; values outside are clamped first. | |
| void | normalize (std::span< double > data, double target_min=-1.0, double target_max=1.0) noexcept |
| Normalize to [target_min, target_max] in-place Single-pass min/max reduction followed by a single transform pass. | |
| void | reverse (std::span< double > data) noexcept |
| Reverse temporal order in-place. | |
| void | fade (std::span< double > data, double fade_in_ratio, double fade_out_ratio) noexcept |
| Apply equal-power (cosine) fade-in then fade-out envelope in-place The cosine taper maintains constant perceived loudness at the crossover point (0 dB centre gain vs −6 dB for a linear taper). | |
| std::vector< double > | slice (std::span< const double > data, double start_ratio, double end_ratio) |
| Extract a contiguous slice by ratio, returning a new vector. | |
| std::vector< double > | delay (std::span< const double > data, uint32_t delay_samples, double fill_value=0.0) |
| Prepend delay_samples zero-valued (or fill_value) samples, returning a new vector. | |
| void | interpolate_linear (std::span< const double > src, std::span< double > dst) noexcept |
| Linear interpolation from src into dst (caller sizes dst) Branchless inner loop with precomputed step; dst may be larger or smaller than src. | |
| void | interpolate_cubic (std::span< const double > src, std::span< double > dst) noexcept |
| Catmull-Rom cubic interpolation from src into dst (caller sizes dst) Branchless boundary clamping; Horner evaluation form. | |
| std::vector< double > | time_stretch (std::span< const double > data, double stretch_factor) |
| Time-stretch via linear interpolation resampling Fast but alias-naive: no anti-aliasing pre-filter is applied when stretch_factor < 1. | |
| template<typename TrigFunc > requires std::invocable<TrigFunc, double> && std::same_as<std::invoke_result_t<TrigFunc, double>, double> | |
| void | apply_trig (std::span< double > data, TrigFunc func, double frequency, double amplitude, double phase) noexcept |
| Trigonometric map y = amplitude * f(frequency*x + phase) applied in-place. | |