Conversation
Agent-Logs-Url: https://github.com/jmg049/audio_samples/sessions/4fc06268-a999-4f9a-bdd9-02c72f0e53df Co-authored-by: jmg049 <121042936+jmg049@users.noreply.github.com>
…patch in FWeighted path Agent-Logs-Url: https://github.com/jmg049/audio_samples/sessions/4fc06268-a999-4f9a-bdd9-02c72f0e53df Co-authored-by: jmg049 <121042936+jmg049@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add peak_dbfs and rms_dbfs methods to AudioStatistics
Add peak_dbfs/rms_dbfs to AudioStatistics, normalize_to_dbfs/apply_gain_db to AudioProcessing, and new dithering feature
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the operation trait surface with dBFS-aware statistics and processing helpers, and adds a new
ditheringfeature module following the same end-to-end pattern as existing feature-gated modules (dynamic-range, etc.).statisticsfeature —AudioStatisticspeak_dbfs() -> f64—20·log₁₀(peak)viaamplitude_to_db; -80 dB floor for silencerms_dbfs() -> f64—20·log₁₀(rms); paired dBFS companion topeak_dbfsBoth are default implementations built on the existing
peak()andrms()methods.processingfeature —AudioProcessingnormalize_to_dbfs(target: f64)— converts target dBFS → linear, delegates tonormalize(NormalizationConfig::peak(...))apply_gain_db(db: f64)— converts dB → linear scale factor, delegates toscale()Both are default implementations; no changes to existing
normalize/scalelogic.New
ditheringfeatureMirrors the
dynamic-rangemodule layout exactly: feature flag → submodule → trait intraits.rs→ config types intypes.rs→ re-exports inmod.rsandlib.rs.Cargo.toml:dithering = ["random-generation"], added tofullandfull_no_plotting.NoiseShapeenum (types.rs):Flat— pure TPDF (two uniform draws subtracted)FWeighted— TPDF with first-order highpass shapingH(z) = 1 − 0.5·z⁻¹; per-channel state, no dynamic dispatchAudioDitheringtrait (traits.rs+dithering.rs):dither(shape: NoiseShape) -> Self— noise amplitude is 1 LSB of native type (1/MAX for integers; ~2⁻²³ for floats). Works in the normalised f64 domain viaconvert_to/convert_from.requantize(bits: u32) -> AudioSampleResult<Self>— snaps each sample to a 2^(bits−1)-level grid in normalised f64 space; valid range[1, 32]. Distinct fromto_type::<i16>()which rescales — this reduces precision within the same container type.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
googlechromelabs.github.io/tmp/codeql-scratch-36880336822b49dd/dbs/rust/working/target/debug/build/plotly_static-03bec48163cb1e33/build-script-build /tmp/codeql-scratch-36880336822b49dd/dbs/rust/working/target/debug/build/plotly_static-03bec48163cb1e33/build-script-build --emit=dep-info,link -C embed-bitcode=no --cfg y-8bf299a6c1c85399/rustc0cHjNP/symbols.o y-8bf299a6c1c85399/build_script_build-8bf299a6c1c85399.build_script_build.7856c5/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/librustc_std_workspace_alloc-76b5fe9328c1063f.rlib y-8bf299a6c1c85399/build_script_build-8bf299a6c1c85399.build_script_build.7856c5/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libminiz_oxide-2b6a8d2f6e1dc71b.rlib y-8bf299a6c1c85399/build_script_build-8bf299a6c1c85399.build_script_build.7856c5/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/lib/libadler2-39ffdbc27c978ccc.rlib y-8bf299a6c1c85399/build_script_build-8bf299a6c1c85399.build_script_build.7856c59261�� y-8bf299a6c1c85399/build_script_build-8bf299a6c1c85399.build_script_build.7856c59261fca26f-cgu.4.rcgu.o y-8bf299a6c1c85399/build_script_build-8bf299a6c1c85399.bfhgfe28tz5rsrewzu21g7722.rcgu.o ug/d�� ug/deps/liblibc--Wl,--as-needed 64-REDACTED-linux-gnu/lib/libstd-46d936097e8c5b85.rlib 64-REDACTED-linux-gnu/lib/libpanic_unwind-e462f106b2b26a06.rlib 64-REDACTED-linux-gnu/lib/libobject-926daa94a00ee327.rlib ild.bfce194cf466c7c3-cgu.0.rcgu.o j9cveizfax.rcgu.o 64-REDACTED-linux-gnu/lib/libgimli-7aeefe72516b1ebd.rlib(dns block)If you need me to access, download, or install something from one of these locations, you can either: