Expand description
True-peak measurement and lookahead limiting for planar f32 audio.
Inputs contain 1–8 equal-length channels at 44.1, 48, 88.2, 96, 176.4, or 192 kHz. Non-finite samples are rejected. An empty channel represents silence; silence reads negative infinity in decibels.
limit returns time-aligned audio and verifies its measured peak against
the requested ceiling. Inspect Output::ceiling_met before accepting a
render. Limiter exposes a single streaming pass with uncompensated latency.
Upsampler and Downsampler can also be used independently.
use std::sync::atomic::AtomicBool;
use truepeak::{Config, limit};
let left = [0.0_f32, 1.2, -1.2, 0.0];
let right = [0.0_f32, 0.3, -0.3, 0.0];
let config = Config {
verify_bit_depth: Some(24),
..Config::default()
};
let output = limit(
&[&left, &right],
48_000,
&config,
&AtomicBool::new(false),
&mut |_| {},
)?;
assert!(output.ceiling_met);The optional serde feature enables serialization of configuration and
result types. Negative infinity is not a JSON number; consumers serializing
silence need to choose a representation for it.
Re-exports§
pub use limiter::Config;pub use limiter::Limiter;pub use limiter::Link;pub use limiter::Output;pub use limiter::limit;pub use meter::ChannelSamplePeak;pub use meter::SamplePeak;pub use meter::TruePeak;pub use meter::sample_peak;pub use meter::sample_peak_with_control;pub use meter::true_peak;pub use meter::true_peak_in_range;pub use meter::true_peak_in_range_with_control;pub use meter::true_peak_per_channel;pub use meter::true_peak_per_channel_in_range;pub use meter::true_peak_per_channel_in_range_with_control;pub use meter::true_peak_per_channel_with_control;pub use meter::true_peak_with_control;pub use resample::Downsampler;pub use resample::Upsampler;
Modules§
Structs§
- Progress
- Counts base-rate samples across channels. Standalone meters use pass 1; the limiter uses pass 0 for input measurement and its pass number thereafter.