Skip to main content

DynamicsCompressor

Struct DynamicsCompressor 

Source
pub struct DynamicsCompressor { /* private fields */ }
Expand description

Dynamics Range Compressor with soft knee and make-up gain.

Implementations§

Source§

impl DynamicsCompressor

Source

pub fn new( threshold_db: f32, ratio: f32, knee_db: f32, attack_s: f32, release_s: f32, makeup_gain_db: f32, sample_rate_hz: f32, ) -> Self

Creates a new dynamics compressor.

  • threshold_db: Threshold level in dBFS (e.g. -20.0).
  • ratio: Compression ratio (e.g. 4.0 for 4:1).
  • knee_db: Soft knee width in dB (e.g. 6.0 for smooth transition, 0.0 for hard knee).
  • attack_s: Attack time in seconds (e.g. 0.005 for 5 ms).
  • release_s: Release time in seconds (e.g. 0.1 for 100 ms).
  • makeup_gain_db: Post-compression make-up gain in dB (e.g. 4.0).
  • sample_rate_hz: Audio sample rate in Hz (e.g. 48000.0).
Source

pub fn process(&mut self, input: f32) -> f32

Process a single audio/signal sample through the compressor.

Source

pub fn reset(&mut self)

Reset compressor internal state.

Trait Implementations§

Source§

impl Clone for DynamicsCompressor

Source§

fn clone(&self) -> DynamicsCompressor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DynamicsCompressor

Source§

impl Debug for DynamicsCompressor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DspNode<f32> for DynamicsCompressor

Source§

fn process_sample(&mut self, input: f32) -> f32

Process a single input sample and produce one output sample.
Source§

fn process_block(&mut self, in_buf: &[T], out_buf: &mut [T])

Process a block of samples from in_buf into out_buf.
Source§

fn process_in_place(&mut self, buf: &mut [T])

Process a block of samples in place.
Source§

fn then<Next>(self, next: Next) -> Chain<Self, Next>
where Self: Sized, Next: DspNode<T>,

Chains this node with another processing node into a sequential pipeline.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.