Skip to main content

BbdModel

Struct BbdModel 

pub struct BbdModel {
    pub num_stages: usize,
    pub clock_min: f64,
    pub clock_max: f64,
    pub bandwidth_ratio: f64,
    pub noise_floor: f64,
    pub leakage_per_stage: f64,
    pub clock_feedthrough: f64,
    pub compander_error: f64,
}
Expand description

BBD delay line model parameters.

Bucket-brigade devices (MN3007, MN3207, MN3005) are analog delay lines used in classic chorus, flanger, and delay pedals. Each device has a fixed number of stages and a clock frequency range that determines the delay time.

The BBD introduces characteristic artifacts:

  • Clock noise: high-frequency switching artifacts (filtered by LPF)
  • Bandwidth limiting: Nyquist limit at half the clock frequency
  • Companding noise: from the compander used to improve S/N ratio
  • Aliasing: soft HF rolloff from the sample-and-hold nature

We model these as a delay buffer with a variable-rate reader, anti-aliasing LPF, and subtle noise/distortion.

Fields§

§num_stages: usize

Number of BBD stages. MN3207=1024, MN3007=1024, MN3005=4096.

§clock_min: f64

Minimum clock frequency (Hz). Determines maximum delay time.

§clock_max: f64

Maximum clock frequency (Hz). Determines minimum delay time.

§bandwidth_ratio: f64

Signal bandwidth limit as fraction of clock (Nyquist ≈ 0.45 * fclk).

§noise_floor: f64

Noise floor (linear amplitude). BBDs are noisy devices.

§leakage_per_stage: f64

Per-stage charge leakage rate (fraction lost per stage per clock period). Real BBDs lose charge through substrate leakage and junction capacitance. Typical: 0.0001–0.001 per stage, causing progressive HF loss at longer delays.

§clock_feedthrough: f64

Clock feedthrough amplitude (normalized). The switching clock couples into the analog signal path through parasitic capacitance in the MOSFET switches. Audible as a high-pitched whine. Typical: -60 to -80 dB below signal = 0.001–0.0001.

§compander_error: f64

Compander tracking error. Real BBD circuits use NE571/SA571 compander ICs to expand dynamic range. The compressor (input) and expander (output) don’t track perfectly — the rectifier time constants differ, causing “breathing” and pumping artifacts. 0.0 = perfect tracking, 1.0 = maximum error.

Implementations§

§

impl BbdModel

pub fn mn3207() -> BbdModel

MN3207 — 1024-stage BBD, used in Boss CE-2 chorus.

Clock range: 10kHz – 200kHz Delay range: 1024/(2*fclk) = 2.56ms – 51.2ms Relatively high leakage and clock feedthrough (consumer-grade).

pub fn mn3007() -> BbdModel

MN3007 — 1024-stage BBD, used in Boss DM-2 delay.

Lower noise version of MN3207, same stage count. Better charge retention and lower clock feedthrough. Clock range: 10kHz – 100kHz Delay range: 5.12ms – 51.2ms

pub fn mn3005() -> BbdModel

MN3005 — 4096-stage BBD, used in Boss DM-2 (long delay mode), Electro-Harmonix Memory Man.

4x more stages means leakage accumulates more, causing darker repeats at long delay times — the “warm decay” Memory Man sound. Clock range: 10kHz – 100kHz Delay range: 20.48ms – 204.8ms

pub fn delay_at_clock(&self, clock_hz: f64) -> f64

Delay time in seconds for a given clock frequency.

BBD delay = num_stages / (2 * fclk) The factor of 2 is because samples advance one stage per half-clock.

pub fn min_delay(&self) -> f64

Minimum delay time in seconds.

pub fn max_delay(&self) -> f64

Maximum delay time in seconds.

Trait Implementations§

§

impl Clone for BbdModel

§

fn clone(&self) -> BbdModel

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
§

impl Copy for BbdModel

§

impl Debug for BbdModel

§

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

Formats the value using the given formatter. Read more

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more