3#include <nlohmann/json.hpp>
20 using Ts::operator()...;
26constexpr uint32_t kDefaultSampleRate = 48000;
27constexpr uint32_t kDefaultBlockSize = 128;
143 std::optional<float>
arg{std::nullopt};
167 float frequency{0.f};
168 float amplitude{0.f};
169 float initial_phase{0.f};
178 std::vector<ModulationOptions>
187 uint32_t max_delay{512};
191 std::optional<sfFDN::ModulationOptions> lfo_config{
202 uint32_t block_size{kDefaultBlockSize};
211 std::vector<float> delays;
216 std::vector<ModulationOptions> time_varying_config;
258 std::vector<std::pair<uint32_t, float>> coeffs;
264 std::vector<FilterCoefficients> coeffs;
270 std::vector<float> coeffs{1.f};
277 std::vector<float> delays;
278 std::vector<float> gains;
280 bool parallel{
false};
288 std::vector<SchroederAllpassSectionOptions> sections;
298 float sample_rate = kDefaultSampleRate;
310 std::array<float, 2>
t60s{1.f, 0.5f};
313 float sample_rate = kDefaultSampleRate;
322 std::array<float, 3> t60s{1.f, 0.5f, 0.25f};
325 std::array<float, 2> freqs{800.f, 8000.f};
326 float q = 1.f / std::numbers::sqrt2_v<float>;
328 float sample_rate = kDefaultSampleRate;
342 std::array<float, 10>
t60s = {1.f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f, 0.1f};
357 std::variant<HomogenousFilterOptions, TwoBandFilterOptions, ThreeBandFilterOptions, TenBandFilterOptions>;
405 {ScalarMatrixType::Count,
"Count"}});
410 {DelayInterpolationType::Lagrange,
"Lagrange"}});
423void to_json(nlohmann::json& j,
const ScalarFeedbackMatrixOptions& config);
424void from_json(
const nlohmann::json& j, ScalarFeedbackMatrixOptions& config);
425NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(CascadedFeedbackMatrixOptions, matrix_size, stage_count, sparsity, type,
427NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ModulationOptions, frequency, amplitude, initial_phase);
428NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ParallelGainsOptions, mode, gains, time_varying_config);
429void to_json(nlohmann::json& j,
const DelayOptions& config);
430void from_json(
const nlohmann::json& j, DelayOptions& config);
431NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DelayBankOptions, delays, block_size, interpolation_type);
432NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DelayBankTimeVaryingOptions, delays, max_delay, interpolation_type,
433 time_varying_config);
434NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FilterCoefficients, b0, b1, b2, a0, a1, a2);
435NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(AllpassFilterOptions, coeff);
436NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SparseFirOptions, coeffs);
437NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(CascadedBiquadsOptions, coeffs);
438NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FirOptions, coeffs);
439NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SchroederAllpassSectionOptions, delays, gains, parallel);
440NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MultichannelSchroederAllpassSectionOptions, sections);
441NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HomogenousFilterOptions, t60, delay, sample_rate);
442NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TwoBandFilterOptions, t60s, delay, sample_rate);
443NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ThreeBandFilterOptions, t60s, delay, freqs, q, sample_rate);
444NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TenBandFilterOptions, t60s, delay, sample_rate, shelf_cutoff);
445NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GraphicEQOptions, gains_db, freqs, sample_rate);
447void to_json(nlohmann::json& j,
const AttenuationFilterBankOptions& config);
448void from_json(
const nlohmann::json& j, AttenuationFilterBankOptions& config);
std::optional< float > arg
Optional argument for certain matrix types. For example, for the VariableDiffusion type,...
Definition types.h:143
float coeff
The coefficient for the allpass filter.
Definition types.h:252
ParallelGainsMode mode
Mode of parallel gain processing.
Definition types.h:175
float shelf_cutoff
Cutoff frequency for the shelf filters.
Definition types.h:352
std::vector< ModulationOptions > time_varying_config
Optional time-varying modulation configuration for each channel.
Definition types.h:179
ScalarMatrixType type
Type of the feedback matrix.
Definition types.h:132
uint32_t matrix_size
Size of the feedback matrix.
Definition types.h:129
std::array< float, 10 > freqs
Frequency values for the ten bands in Hz.
Definition types.h:374
ScalarMatrixType type
Type of the feedback matrix.
Definition types.h:159
std::vector< attenuation_filter_variant_t > filter_configs
Vector of attenuation filter configurations.
Definition types.h:363
std::array< float, 2 > t60s
Target T60 values for the low and high bands.
Definition types.h:310
float delay
Delay in samples for the delay line preceding the filter. If set to <= 0, it will be updated automati...
Definition types.h:346
uint32_t rng_seed
Optional. Seed for random number generation when type is Random or RandomHouseholder.
Definition types.h:139
float sample_rate
Sample rate in Hz. This is used to calculate the filter coefficients based on the specified T60 value...
Definition types.h:349
uint32_t stage_count
Number of stages.
Definition types.h:156
std::optional< std::vector< float > > custom_matrix
Optional custom matrix values in col-major order. The size of the vector must be equal to matrix_size...
Definition types.h:136
std::array< float, 10 > gains_db
Target gains for the ten bands in dB.
Definition types.h:371
std::vector< float > gains
Gain values for each channel.
Definition types.h:177
uint32_t matrix_size
Size of the feedback matrix.
Definition types.h:155
float sample_rate
Sample rate in Hz.
Definition types.h:377
float sparsity
Sparsity level (>= 1).
Definition types.h:157
std::array< float, 10 > t60s
Target T60 values for the ten bands.
Definition types.h:342
float gain_per_samples
Gain per sample.
Definition types.h:161
std::variant< ParallelGainsOptions, MultichannelSchroederAllpassSectionOptions, AttenuationFilterBankOptions, DelayBankOptions, DelayBankTimeVaryingOptions, CascadedFeedbackMatrixOptions, ScalarFeedbackMatrixOptions > multi_channel_processor_variant_t
Variant type for holding different multi-channel processor options.
Definition types.h:389
std::variant< CascadedFeedbackMatrixOptions, ScalarFeedbackMatrixOptions > feedback_matrix_variant_t
Variant type for holding different feedback matrix options.
Definition types.h:381
std::variant< SchroederAllpassSectionOptions, AllpassFilterOptions, CascadedBiquadsOptions, FirOptions, DelayOptions, GraphicEQOptions > single_channel_processor_variant_t
Variant type for holding different single-channel processor options.
Definition types.h:384
ParallelGainsMode
Enumeration for parallel gain processing modes.
Definition types.h:109
DelayInterpolationType
Types of interpolation for fractional delay lengths.
Definition types.h:65
ScalarMatrixType
Represents the type of a scalar matrix.
Definition types.h:50
DelayLengthType
Types of delay length distributions.
Definition types.h:84
std::variant< HomogenousFilterOptions, TwoBandFilterOptions, ThreeBandFilterOptions, TenBandFilterOptions > attenuation_filter_variant_t
Variant type for holding different attenuation filter options.
Definition types.h:356
@ Merge
Process each input channel separately and output to one channel.
@ Split
Process input as a single channel and output to multiple channels.
@ Parallel
Process each input channel separately and output to the same number of channels.
@ Linear
Linear interpolation.
@ None
No interpolation. The delay length will be rounded to the nearest integer value.
@ Allpass
Allpass interpolation.
@ NestedAllpass
Nested Allpass matrix.
@ Householder
Householder matrix.
@ Random
Random orthogonal matrix.
@ VariableDiffusion
Variable diffusion matrix as described in [3].
@ Circulant
Circulant matrix as described in [1].
@ RandomHouseholder
Random Householder matrix.
@ Hadamard
Hadamard matrix.
@ Identity
Identity matrix.
@ Random
Delay lengths are generated randomly within the specified range based on a uniform distribution.
@ SteamAudio
Delay lengths are generated using the algorithm from the SteamAudio library.
@ PrimePower
Delay lengths are generated as powers of prime numbers within the specified range....
@ Uniform
Delay lengths are uniformly distributed within the specified range.
@ Primes
Delay lengths are selected randomly from a list of prime numbers within the specified range.
@ Gaussian
Delay lengths are generated based on a Gaussian distribution within the specified range.
Options for configuring an allpass filter.
Definition types.h:250
Options for configuring an attenuation filter bank.
Definition types.h:361
Options for configuring cascaded biquad filters.
Definition types.h:263
Information structure for constructing a cascaded feedback matrix (also known as a filter feedback ma...
Definition types.h:154
Options for configuring a delay bank.
Definition types.h:198
Options for configuring a time-varying delay bank.
Definition types.h:210
Options for configuring delays.
Definition types.h:185
Options for configuring a FIR filter.
Definition types.h:269
Options for configuring a graphic equalizer.
Definition types.h:368
Options for configuring a homogenous filter.
Definition types.h:294
Options for configuring signal modulation.
Definition types.h:166
Options for configuring a multichannel bank of Schroeder allpass sections.
Definition types.h:287
Options for configuring parallel gain processing.
Definition types.h:174
Options for configuring a scalar feedback matrix.
Definition types.h:127
Options for configuring a Schroeder allpass section consisting of N Schroeder allpass in series or in...
Definition types.h:276
Options for configuring a sparse FIR filter.
Definition types.h:257
Options for configuring a ten-band filter.
Definition types.h:340
Options for configuring a three-band filter.
Definition types.h:321
Options for configuring a two-band filter.
Definition types.h:309
Coefficients for a digital IIR filter.
Definition types.h:222
float b1
Feedforward coefficients.
Definition types.h:227
float a1
Feedback coefficient.
Definition types.h:236
float a2
Feedback coefficient.
Definition types.h:239
float b2
Feedforward coefficients.
Definition types.h:230
float b0
Feedforward coefficients.
Definition types.h:224
FilterCoefficients Normalize() const
Returns the filter coefficients normalized so that a0 is equal to 1.
Definition types.h:242
float a0
Feedback coefficient.
Definition types.h:233