401 bool converter_on =
false) {
417 if (!(tau >= 0.0) || tau > 1.0)
return 0.0;
424 constexpr double kLn10 = 2.302585092994045684;
425 const double alpha =
kAmbDropDb * kLn10 / 20.0;
426 return fade_in * std::exp(-alpha * tau);
429 const double h = gate_hold;
431 if (tau <= h)
return 1.0;
432 if (tau <= h + w)
return 1.0 - (tau - h) / w;
437 if (tau <= r)
return std::pow(tau / r,
kRevPow);
442 if (tau > h)
return 0.0;
443 constexpr double kTwoPi = 6.283185307179586476925286766559;
444 const double ripple =
445 0.5 - 0.5 * std::cos(kTwoPi *
static_cast<double>(
kNlHumps) * tau);
458 const double clamped = std::clamp(
u, 0.0, 1.0);
459 return nd_min + (
kNdMax - nd_min) * std::pow(clamped, gamma);
473 double position_samples,
476 int predelay_samples,
486 if (window_samples <= 0 || predelay_samples < 0 ||
487 predelay_samples > std::numeric_limits<int>::max() - (window_samples - 1) ||
488 !std::isfinite(position_samples) || position_samples < 0.0 ||
489 !std::isfinite(grid_samples) || grid_samples < 0.0 ||
490 !std::isfinite(draw.jitter) || draw.jitter < 0.0 || draw.jitter >= 1.0 ||
491 (draw.sign != -1 && draw.sign != 1) ||
492 !std::isfinite(gate_hold) || !std::isfinite(
attack)) {
496 const double candidate = position_samples +
497 draw.jitter * std::max(0.0, grid_samples - 1.0);
498 if (!std::isfinite(candidate))
return result;
499 const double bounded = std::clamp(candidate, 0.0,
500 static_cast<double>(window_samples - 1));
501 const int delay =
static_cast<int>(std::lround(
bounded));
502 const double tau =
static_cast<double>(
delay) /
static_cast<double>(window_samples);
506 if (!result.
audible)
return result;
507 result.
magnitude = env * std::sqrt(grid_samples);
508 result.
gain =
static_cast<double>(draw.sign) * result.
magnitude;
The one shared old→new crossfade gain law for the SIGNAL side.
The calibration register: every number this module ships that is not cited to the literature lives he...
Definition nonlin_ambience_design.hpp:253
constexpr double kRevRise
Reverse program: normalized rise point r and swell exponent p (p < 1 concave, p > 1 convex).
Definition nonlin_ambience_design.hpp:305
constexpr double kConverterFcHi
Definition nonlin_ambience_design.hpp:359
constexpr double kFcBright
Segment tilt corners.
Definition nonlin_ambience_design.hpp:327
constexpr double kMinDensityPct
Lower bound of the density control's documented 10 .. 100 % range.
Definition nonlin_ambience_design.hpp:379
constexpr double kParamSmoothMs
Smoothing time for the continuous gain parameters.
Definition nonlin_ambience_design.hpp:336
constexpr double kMaxLengthMs
Definition nonlin_ambience_design.hpp:375
constexpr int kTapGuard
Headroom above the expected tap count, so the jittered grid can never outgrow the pre-sized table.
Definition nonlin_ambience_design.hpp:353
constexpr double kFcDark
Definition nonlin_ambience_design.hpp:328
constexpr double kNlHold
Definition nonlin_ambience_design.hpp:313
double worst_case_gain(double diffusion=kDiffusionDefault, bool converter_on=false)
The shipped worst-case gain as a closed form of the shipped constants: Π_i (1 + 2·g_i) · G_L1,...
Definition nonlin_ambience_design.hpp:400
constexpr double kRevPow
Definition nonlin_ambience_design.hpp:306
constexpr double kNormFloor
Floor below which the normalization sum is treated as empty, so a program whose taps all land in a ze...
Definition nonlin_ambience_design.hpp:385
constexpr double kL1Budget
The per-channel L1 budget of the tap-gain vector.
Definition nonlin_ambience_design.hpp:318
constexpr double kAllpassDelaysMs[2]
Allpass delays in ms, rounded to the nearest sample and then nudged to the nearest prime sample count...
Definition nonlin_ambience_design.hpp:262
constexpr double kDensityRefPct
The density_pct value at which Nd_min equals kNdMin exactly, so the shipped default reproduces the sh...
Definition nonlin_ambience_design.hpp:280
constexpr double kGammaDefault
Density growth exponent γ.
Definition nonlin_ambience_design.hpp:286
constexpr double kAmbDropDb
Ambience drop across the window, in dB; sets α = A_drop·ln(10)/20.
Definition nonlin_ambience_design.hpp:290
constexpr double kGateHold
Gated program: normalized hold point h and fall width w.
Definition nonlin_ambience_design.hpp:299
constexpr double allpass_l1_gain(double g)
The time-domain L1 (peak) gain of one Schroeder allpass with coefficient g: Σ|h| = g + (1−g²)/(1−g) =...
Definition nonlin_ambience_design.hpp:389
constexpr double kGateFall
Definition nonlin_ambience_design.hpp:300
constexpr double kMinLengthMs
Largest window and pre-delay prepare() sizes storage for, in ms.
Definition nonlin_ambience_design.hpp:374
constexpr int kConverterBitsMax
Converter word length at converter_amount = 0 and the depth of the sweep: bits = kConverterBitsMax − ...
Definition nonlin_ambience_design.hpp:364
constexpr double kMaxPredelayMs
Definition nonlin_ambience_design.hpp:376
constexpr double kFadeInFrac
Linear rise over the first fraction of the window, which kills the first-tap click on the programs th...
Definition nonlin_ambience_design.hpp:295
constexpr int kConverterBitSweep
Definition nonlin_ambience_design.hpp:365
constexpr std::uint32_t kSeedRodd
seed_R = seed_L ⊕ kSeedRodd.
Definition nonlin_ambience_design.hpp:344
constexpr std::uint32_t kDefaultSeed
Default seed_L.
Definition nonlin_ambience_design.hpp:348
constexpr double kDiffusionMax
Definition nonlin_ambience_design.hpp:267
constexpr double kConverterFcLo
Converter-character pre-filter corners (§5).
Definition nonlin_ambience_design.hpp:358
constexpr double kDcBlockerL1Gain
The time-domain L1 gain of the DC blocker, which is exactly 2 for any pole p < 1: h[0] = 1,...
Definition nonlin_ambience_design.hpp:393
VelvetTapDesign design_velvet_tap(NonlinProgram program, double position_samples, double grid_samples, int window_samples, int predelay_samples, double gate_hold, double attack, const VelvetNoiseDrawT< double > &draw) noexcept
Definition nonlin_ambience_design.hpp:472
double pulse_density(double u, double density_pct, double gamma)
Instantaneous pulse density in pulses/second at normalized time u ∈ [0,1]: Nd(u) = Nd_min + (Nd_max −...
Definition nonlin_ambience_design.hpp:456
constexpr int kNumAllpass
Number of pre-diffusion Schroeder allpasses.
Definition nonlin_ambience_design.hpp:257
constexpr double kNdMax
Definition nonlin_ambience_design.hpp:275
constexpr double kSwapFadeMs
Equal-power crossfade length applied when a topology change swaps tap banks.
Definition nonlin_ambience_design.hpp:332
double program_envelope(NonlinProgram program, double tau, double gate_hold=kGateHold, double attack=kRevRise)
The dimensionless program envelope E(τ), τ ∈ [0, 1] (series law 7 — scale invariant,...
Definition nonlin_ambience_design.hpp:413
constexpr int kSegments
Number of time segments the tap range is split into for spectral tilt.
Definition nonlin_ambience_design.hpp:323
constexpr int kNlHumps
NonLin2 program: number of raised-cosine humps, ripple depth, gate point.
Definition nonlin_ambience_design.hpp:311
constexpr double kNlDepth
Definition nonlin_ambience_design.hpp:312
constexpr double kDiffusionDefault
Allpass coefficient, exposed as diffusion.
Definition nonlin_ambience_design.hpp:266
constexpr double kNdMin
Instantaneous pulse density at the start and end of the window, in pulses/second.
Definition nonlin_ambience_design.hpp:274
constexpr double kConverterDcPole
DC-blocker pole used by the converter stage.
Definition nonlin_ambience_design.hpp:369
Definition additive_bank.hpp:218
@ bounded
Definition fm_operator_engine.hpp:35
@ delay
Definition envelope.hpp:57
@ attack
Definition envelope.hpp:58
@ u
Definition formant_filter_bank.hpp:20
@ i
Definition formant_filter_bank.hpp:20
@ e
Definition formant_filter_bank.hpp:20
NonlinProgram
The four programs.
Definition nonlin_ambience_design.hpp:243
@ nonlin2
Rippled body, shaped attack, hard gate.
Definition nonlin_ambience_design.hpp:247
@ gated
Flat body, hard cut.
Definition nonlin_ambience_design.hpp:245
@ ambience
Short falling cloud — the "natural" one.
Definition nonlin_ambience_design.hpp:244
@ reverse
Rise to a peak, then cut.
Definition nonlin_ambience_design.hpp:246
Deterministic randomness for modulation: a counter-free PRNG, a Gaussian draw, a stateless purpose-ke...
Definition velvet_noise.hpp:14
Pure intermediate for one candidate in a velvet tap grid.
Definition nonlin_ambience_design.hpp:464
double magnitude
Definition nonlin_ambience_design.hpp:466
double gain
Definition nonlin_ambience_design.hpp:467
bool audible
Definition nonlin_ambience_design.hpp:469
int segment
Definition nonlin_ambience_design.hpp:468
int delay
Definition nonlin_ambience_design.hpp:465
First-order topology-preserving transform (TPT) filter.
The real-unit vocabulary shared by every DSP block in the catalog.
Coordinate-keyed velvet-noise grid draws.