Simple Effects

Delay-line based audio effects: echo, tremolo, and comb-filter reverb.

pyminidsp.delay_echo(signal, delay_samples, feedback=0.5, dry=1.0, wet=0.5)[source]

Apply a delay/echo effect.

Parameters:
  • signal – Input signal.

  • delay_samples – Delay length in samples.

  • feedback – Echo feedback gain (|feedback| < 1).

  • dry – Dry mix weight.

  • wet – Wet mix weight.

Returns:

numpy array of the processed signal.

Delay line / echo effect using a circular buffer with feedback. Creates repeating echoes that decay geometrically when |feedback| < 1.

Internal delay state:

\[s[n] = x[n] + \text{feedback} \cdot s[n - D]\]

Output:

\[y[n] = \text{dry} \cdot x[n] + \text{wet} \cdot s[n - D]\]
Parameters:
  • signal – Input signal.

  • delay_samples – Delay length in samples (must be > 0).

  • feedback – Echo feedback gain (must satisfy |feedback| < 1).

  • dry – Dry (original) mix weight.

  • wet – Wet (delayed) mix weight.

Returns:

Processed signal (same length as input).

pyminidsp.tremolo(signal, rate_hz, depth=0.5, sample_rate=44100.0)[source]

Apply a tremolo effect (amplitude modulation).

Parameters:
  • signal – Input signal.

  • rate_hz – LFO rate in Hz.

  • depth – Modulation depth in [0, 1].

  • sample_rate – Sampling rate in Hz.

Returns:

numpy array of the processed signal.

Tremolo effect — amplitude modulation by a sinusoidal LFO.

The modulation gain is:

\[g[n] = (1 - d) + d \cdot \frac{1 + \sin(2\pi f_\text{LFO} \, n / f_s)}{2}\]

so g[n] ranges from 1 - depth to 1.

Parameters:
  • signal – Input signal.

  • rate_hz – LFO rate in Hz (must be >= 0).

  • depth – Modulation depth in [0, 1].

  • sample_rate – Sampling rate in Hz.

Returns:

Processed signal (same length as input).

pyminidsp.comb_reverb(signal, delay_samples, feedback=0.5, dry=1.0, wet=0.3)[source]

Apply a comb-filter reverb effect.

Parameters:
  • signal – Input signal.

  • delay_samples – Comb delay in samples.

  • feedback – Feedback gain (|feedback| < 1).

  • dry – Dry mix weight.

  • wet – Wet mix weight.

Returns:

numpy array of the processed signal.

Comb-filter reverb (feedback comb filter with dry/wet mix).

Internal comb section:

\[c[n] = x[n] + \text{feedback} \cdot c[n - D]\]

Output:

\[y[n] = \text{dry} \cdot x[n] + \text{wet} \cdot c[n]\]
Parameters:
  • signal – Input signal.

  • delay_samples – Comb delay in samples (must be > 0).

  • feedback – Feedback gain (must satisfy |feedback| < 1).

  • dry – Dry (original) mix weight.

  • wet – Wet (comb output) mix weight.

Returns:

Processed signal (same length as input).