Commit Graph
20 Commits
Author SHA1 Message Date
David MannandClaude Opus 5.5 72b6a1664d craft-audio-dsp: doc links that next's workspace docs check refuses
next builds every crate's docs with -D warnings; main has no such check,
so main's new crate meets it here first. [`effects`] is both a module and
a function (mod@ picks the module), and loudness linked to the private
oversample module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:04:33 +01:00
Dylan M. Taylor 7ec2437906 Bound default loudness channel weights 2026-11-19 22:30:27 -05:00
dotCooCoo adb01c12d8 audio-dsp: finite filter designs at the limits; fix tails, thresholds and searches
- Complex division scales by the divisor's larger component, so a
  24-pole band-pass at 1.536 MHz keeps its gain instead of going silent.
- The elliptic selectivity comes from the nomes when k1 is below 1e-6,
  so 0.01 dB ripple with 150 dB attenuation designs a finite filter.
- Fft::new rounds a size up to a power of two between 2 and 16 M points,
  and a transform leaves slices shorter than the size unchanged.
- A NaN delay reads the newest sample instead of NaN.
- Ducking activity reads its hop and limits as their decimals: a region
  of exactly min_on_s is kept, a gap of exactly bridge_s is not bridged,
  and a one-sample hop no longer drifts over a long envelope.
- WSOLA searches every offset when the coarse pass finds no match.
- Sync confidence compares the peak with the RMS over every lag, so a
  narrow max_lag can still give a reliable result; the coarse and
  refinement sizes are bounded.
- measure() reports the file loudness range, counting the windows of
  1.5 s of silence after the program (EBU Tech 3342).
- Scientific Filter clears the sections an order change drops.
- The click remover repairs a click in digital silence.
- Flanger Special Effects subtracts the opposite sweep.
- Phaser reports the tail of its all-pass ring.
2026-11-18 13:48:27 -08:00
dotCooCoo 54dd37aa09 audio-dsp: an infinite or huge gain designs a finite biquad
Coeffs::design turned an infinite gain into infinite or NaN coefficients, so the section's output was not finite. The gain is now clamped to +/-240 dB.
2026-11-18 07:48:41 -08:00
dotCooCoo 276461be2c audio-dsp: name the crate's own copyright holder as the Craft contributors
NOTICE and the README carry "The Craft contributors" as the crate's own holder. ATTRIBUTION.md names FilmCraft and SoundCraft as the two sources.
2026-11-18 07:38:56 -08:00
dotCooCoo ad05996bc3 audio-dsp: the click remover keeps a sample that is not finite as silence
A NaN or infinite input sample went into the analysis span unchanged. It
stopped the prediction for that span and came out of a later block. Such
a sample is now kept as silence.
2026-11-17 19:38:44 -08:00
dotCooCoo e000dc5f76 audio-dsp: Mastering EQ changes ramp, Binauralizer reports its tail
- Mastering: a change to an EQ gain or the peak frequency replaced the
  coefficients at once, under the old filter memories, which gave a
  transient. The four EQ settings now ramp over 20 ms, the coefficients
  designed again for each sample while they ramp; reset goes straight to
  the target.
- Binauralizer: tail_samples was 0, so an offline render stopped before
  the far ear's delayed sound. It now covers the longer of the current and
  target delay and the head-shadow filters' decay.
- The neutral identity test fails on a sample that is not finite.
2026-11-17 19:32:40 -08:00
dotCooCoo 518d94bdf5 audio-dsp: a NaN frequency or gain designs a finite biquad
Coeffs::design clamped a NaN frequency to NaN, so every coefficient was
NaN and the section's output stayed NaN after the next finite sample. A
NaN frequency now designs at 1000 Hz, as design::realize does, and a NaN
gain at 0 dB.
2026-11-17 19:32:39 -08:00
dotCooCoo e6fc8fccdd audio-dsp: true-peak oversampling reaches 176.4 kHz at every sample rate
true_peak_factor returns the smallest factor whose effective rate is at least 176.4 kHz, after the rate is replaced as sane_sample_rate describes. Below 44.1 kHz it returned 4, so at 32 kHz the loudness meter and the limiter checked 128 kHz. The factors at 44.1, 48, 88.2, 96, 176.4 and 192 kHz do not change. true_peak_factor_reaches_176_4_khz_at_every_rate fails without the change.

noise_shaping_error_stays_bounded_at_full_scale checks that the dither's fed-back error stays within two steps on sustained full-scale input.
2026-11-17 18:48:02 -08:00
dotCooCoo 3af8718e64 audio-dsp: multiband crossovers stay in order at low sample rates
The low and mid crossovers are capped below the high one's sample-rate limit before the next is derived. At 1 kHz with the low crossover at 1000 Hz, crossovers() returned [1000, 360, 450], so the low band sat above the other two. crossovers_stay_increasing_at_the_lowest_sample_rate fails without the change. Rates whose limit is above the parameter ranges get the same crossovers as before.
2026-11-17 18:41:17 -08:00
dotCooCoo a43ffece02 audio-dsp: document the event, transport, parameter and biquad items
EventInput::note_on and note_off state the MIDI 1.0 note and velocity ranges, and the trait states that callers keep offset below the next block's frame count. The Transport fields, the ParamSpec range fields, the Coeffs fields, FilterType::from_index and the Biquad methods gain doc comments.
2026-11-17 18:36:32 -08:00
dotCooCoo 3ec7639bf7 audio-dsp: filter design takes 1 kHz for a NaN edge frequency
`realize` and `design` replaced a NaN edge frequency with nothing, so the
prewarp gave NaN coefficients and the filter output NaN. A NaN edge now
takes 1 kHz in every band, as a NaN ripple or attenuation takes its usual
value.
2026-11-17 10:38:19 -08:00
dotCooCoo 1a8548c2b5 audio-dsp: Mastering maximizer fade stays finite on overflowed samples
A sample that the widener overflows to infinity takes the maximized value
during the maximizer's crossfade, as it does once the maximizer is fully
on, instead of turning the blend into NaN.
2026-11-17 10:32:29 -08:00
dotCooCoo 9d24360e52 audio-dsp: resampler frames past the position limit read at the limit
A block that starts near MAX_RESAMPLE_POSITION and runs past it now reads
every later frame at the limit's position, as the constant's docs say,
instead of reading past the held source and returning silence.
2026-11-17 07:11:15 -08:00
dotCooCoo 07370abc7e audio-dsp: Analog Delay tail covers its ramps; Mastering maximizer crossfades
- Analog Delay's tail counts the delay, spread and feedback at the larger
  of their current and target values, so a shortened delay still reports
  the echoes left in the line while the delay ramps down.
- The Mastering loudness maximizer crossfades in and out over the 20 ms
  smoothing ramp instead of switching its soft clip on or off at once.
  During the fade the output stays within the -0.3 dB ceiling.
2026-11-17 07:06:41 -08:00
dotCooCoo 267a66cfd5 audio-dsp: meter Dynamics, multiband and tube compressor gain reduction; smooth Mastering bypasses
- Dynamics, the multiband compressor and the tube-modeled compressor
  report their deepest gain reduction in the last block through
  gain_reduction_db, and clear it on reset. Dynamics leaves out the
  compressor's make-up gain; the multiband compressor adds the limiter to
  the most reduced band.
- Mastering keeps the loudness maximizer in while its boost ramps back
  to 0 dB, and clears the limiter once it is out.
- Mastering clears its reverb at the end of the chunk in which the fade
  ends, so the result does not depend on the block size.
2026-11-17 06:34:35 -08:00
dotCooCoo 2625ee59f8 audio-dsp: reverbs keep the side signal; fix delay tails and crossover ramps
- Reverb feeds the side signal (even channels minus odd channels) into
  its network as well as the mid, and Surround Reverb's early reflections
  carry the side too. Opposite-polarity stereo input, or Surround Reverb
  with Center Input at 0, no longer gives a silent reverb.
- Analog Delay reports the tail of its longest channel delay, which
  Spread lengthens by up to half.
- The multiband compressor designs its crossovers once more after a
  ramp ends, so they reach the frequency that was set.
- Mastering keeps running its reverb while the amount fades to 0 and then
  clears it, so turning the reverb off fades the tail and turning it back
  on starts from silence.
2026-11-17 06:22:48 -08:00
dotCooCoo e8b366dbf1 audio-dsp: report Mastering and flanger tails, band-limit the triangle, bound Sections
- Mastering reports its reverb's tail while the reverb is on, Chorus/Flanger
  the echoes of its longest voice delay, and Flanger those of the longer
  sweep delay, so an offline render no longer cuts their tails off.
- The triangle oscillator rounds its corners with PolyBLAMP: a 10 kHz
  triangle at 48 kHz no longer has the naive -18.7 dB alias at 18 kHz.
- Sections::as_slice and magnitude_db read a count above MAX_SECTIONS as
  every section instead of panicking.
2026-11-17 06:11:34 -08:00
dotCooCoo e3a4c0b2bd audio-dsp: Dynamics make-up comes before the limiter; Mastering covers every channel
Dynamics applied the compressor's make-up gain together with the output
gain after the limiter, so make-up raised the signal past the limiter
threshold (constant 1.0 with 6 dB make-up and a -1 dB limiter came out at
about +5 dBFS). Make-up now goes into the gain the limiter detects, the
output gain stays after the limiter, and transfer_db reports the same order.

Mastering ran the EQ on every channel but the exciter, the loudness
maximizer and the output gain on the first two only. Those stages now run
on every channel, with the maximizer taking its peak across all of them;
reverb and the widener stay on the first two channels.
2026-11-17 06:02:12 -08:00
dotCooCoo 5a0f824678 Add craft-audio-dsp: compressor, limiter, equalizer, loudness meter and other effects
Adds crates/audio-dsp. It combines FilmCraft's crates/audio-dsp
(3f137a7) and SoundCraft's crates/dsp (648ed9d): the AudioEffect trait
and its registry, the effects, a BS.1770-4 / EBU R 128 loudness meter,
panning, channel layouts, test signals, resampling, time stretch,
offset search and ducking. NOTICE keeps both projects' copyright
notices.

- pan::direction_gains sends an ear-level direction to the height
  speakers at full level when a layout has no ear-level speakers,
  instead of returning silence.
- realtime_factor_sanity compares processing time with the wall clock
  and is now ignored by default.
- The crate inherits the workspace package fields and lints, and
  ATTRIBUTION.md lists it.
2026-11-16 21:20:51 -08:00