pub struct Distortion { /* private fields */ }Expand description
Distortion
Waveshaping distortion with multiple algorithms:
- Soft clip (bounded
tanh) - Hard clip
- Foldback
- Asymmetric (tube-style)
All shapers operate in the normalized ±1 domain (the Audio convention is
±5V) so their saturation points match the signal level, and every algorithm
stays within ±5V. The tone control is a real one-pole low-pass whose
cutoff is swept from DISTORTION_TONE_MIN_HZ (dark) to
DISTORTION_TONE_MAX_HZ (≈ transparent).
Implementations§
Source§impl Distortion
impl Distortion
pub fn new(sample_rate: f64) -> Self
Sourcepub fn set_oversample(&mut self, mode: Oversample)
pub fn set_oversample(&mut self, mode: Oversample)
Select the oversampling factor for the waveshaping stage (Q143).
Defaults to Oversample::Off. Enabling 2x/4x runs the (aliasing-prone)
waveshaper at a higher internal rate and band-limits before decimation,
materially reducing the inharmonic aliasing of hard/foldback modes at high
input frequencies. The tone low-pass runs at the base rate, after
decimation.
Sourcepub fn oversample_factor(&self) -> usize
pub fn oversample_factor(&self) -> usize
Current oversampling factor of the waveshaping stage (1 = off, 2, or 4).
Trait Implementations§
Source§impl Default for Distortion
impl Default for Distortion
Source§impl GraphModule for Distortion
impl GraphModule for Distortion
Source§fn tick(&mut self, inputs: &PortValues, outputs: &mut PortValues)
fn tick(&mut self, inputs: &PortValues, outputs: &mut PortValues)
Source§fn set_sample_rate(&mut self, sample_rate: f64)
fn set_sample_rate(&mut self, sample_rate: f64)
Source§fn introspect(&self) -> Option<&dyn ModuleIntrospection>
fn introspect(&self) -> Option<&dyn ModuleIntrospection>
alloc only.ModuleIntrospection view, if it exposes one. Read moreSource§fn introspect_mut(&mut self) -> Option<&mut dyn ModuleIntrospection>
fn introspect_mut(&mut self) -> Option<&mut dyn ModuleIntrospection>
alloc only.introspect, used to set internal parameters.Source§fn process_block(
&mut self,
inputs: &BlockPortValues,
outputs: &mut BlockPortValues,
frames: usize,
)
fn process_block( &mut self, inputs: &BlockPortValues, outputs: &mut BlockPortValues, frames: usize, )
Source§fn breaks_feedback_cycle(&self) -> bool
fn breaks_feedback_cycle(&self) -> bool
Source§fn serialize_state(&self) -> Option<Value>
fn serialize_state(&self) -> Option<Value>
alloc only.Source§impl ModuleIntrospection for Distortion
Available on crate feature alloc only.
impl ModuleIntrospection for Distortion
alloc only.