phaflangers.lib

Phasers and Flangers library. Its official prefix is pf.

This library provides a set of phaser and flanger effects based on delay-line modulation.

The Phaflangers library is organized into 1 section:

References

Functions Reference


(pf.)flanger_mono

flanger_mono — response plots

Mono flanging effect.

Usage:

_ : flanger_mono(dmax,curdel,depth,fb,invert) : _

Where:

  • dmax: maximum delay-line length (power of 2) - 10 ms typical
  • curdel: current dynamic delay in samples, between 1 and dmax (values below 1 act as 1)
  • depth: effect strength between 0 and 1 (1 typical)
  • fb: feedback gain between 0 and 1 (0 typical)
  • invert: 0 for normal, 1 to invert sign of flanging sum

The output is 0.5*(x + depth*v[n-curdel]) (minus with invert=1), where v[n] = x[n] + fb*v[n-curdel]: the feedback loop and the feedforward path have the same delay, so the feedback reinforces the comb peaks at every frequency.

Test

pf = library("phaflangers.lib");
os = library("oscillators.lib");
ba = library("basics.lib");
ma = library("maths.lib");
no = library("noises.lib");
flanger_mono_test = os.tosc(440) : pf.flanger_mono(4096, 1024, 0.7, 0.25, 0);
flanger_mono_impulse_test = (1-1') : pf.flanger_mono(64, 5, 1, 0.5, 0);
flanger_mono_slider_test = os.tosc(440) : pf.flanger_mono(4096, hslider("flanger_mono:curdel", 1024, 1, 4095, 1), hslider("flanger_mono:depth", 0.7, 0, 1, 0.01), hslider("flanger_mono:fb", 0.25, 0, 0.99, 0.01), 0);
flanger_mono_modulated_test = no.noise : pf.flanger_mono(512, 1 + 255*tri, 1, 0.7, 0) with { P = int(ma.SR/10); tri = 1 - abs(2*ba.period(P)/P - 1); };
flanger_mono_jump_test = no.noise : pf.flanger_mono(512, 1 + 255*sq, 1, 0.7, 0) with { P = int(ma.SR/10); sq = ba.period(2*P) < P; };

References


(pf.)flanger_stereo

Stereo flanging effect. flanger_stereo is a standard Faust function.

Usage:

_,_ : flanger_stereo(dmax,curdel1,curdel2,depth,fb,invert) : _,_

Where:

  • dmax: maximum delay-line length (power of 2) - 10 ms typical
  • curdel1: current dynamic delay in samples for the left channel, between 1 and dmax
  • curdel2: current dynamic delay in samples for the right channel, between 1 and dmax
  • depth: effect strength between 0 and 1 (1 typical)
  • fb: feedback gain between 0 and 1 (0 typical)
  • invert: 0 for normal, 1 to invert sign of flanging sum

Test

pf = library("phaflangers.lib");
os = library("oscillators.lib");
flanger_stereo_test = os.tosc(440), os.tosc(660) : pf.flanger_stereo(4096, 1024, 1536, 0.7, 0.25, 0);
flanger_stereo_slider_test = os.tosc(440), os.tosc(660) : pf.flanger_stereo(4096, hslider("flanger_stereo:curdel1", 1024, 1, 4095, 1), hslider("flanger_stereo:curdel2", 1536, 1, 4095, 1), hslider("flanger_stereo:depth", 0.7, 0, 1, 0.01), hslider("flanger_stereo:fb", 0.25, 0, 0.99, 0.01), 0);

References


(pf.)vibrato2_mono

Sweeping second-order resonant allpass chain with feedback, the core used by phaser2_mono: sections allpass sections whose notch frequencies are swept between frqmin and frqmax by a sinusoidal LFO. The allpass sections are realized as TPT state-variable filters (the allpass case of fi.tf2_tpt, x - bp(2k*x)), which stay accurate in single precision at low frequencies and finite however fast the notches move, and the LFO is computed from a phasor (os.lf_sawpos), so it does not drift. A notch whose frequency would pass 0.475SR (e.g. a high notch, at frqmax*fratio^(sections-1)) stays at 0.475SR instead of aliasing back down: a section with poles near z = -1 swept past the Nyquist limit overshoots in this realization.

Usage

_ : vibrato2_mono(sections,phase01,fb,width,frqmin,fratio,frqmax,speed) : _

Where:

  • sections: number of second-order allpass sections (MACRO ARGUMENT - not a signal)
  • phase01: phase of the LFO (0-1): crossfades between sine and cosine phase
  • fb: feedback gain between -1 and 1
  • width: approximate width of spectral notches in Hz
  • frqmin: approximate minimum frequency of first spectral notch in Hz
  • fratio: ratio of adjacent notch frequencies
  • frqmax: approximate maximum frequency of first spectral notch in Hz
  • speed: LFO frequency in Hz

Test

pf = library("phaflangers.lib");
os = library("oscillators.lib");
ba = library("basics.lib");
ma = library("maths.lib");
no = library("noises.lib");
vibrato2_mono_test = os.tosc(440) : pf.vibrato2_mono(4, 0, 0.5, 1000, 100, 1.5, 4800, 0.5);
vibrato2_mono_slider_test = os.tosc(440) : pf.vibrato2_mono(4, hslider("vibrato2_mono:phase01", 0, 0, 1, 0.01), hslider("vibrato2_mono:fb", 0.5, -0.99, 0.99, 0.01), hslider("vibrato2_mono:width", 1000, 10, 5000, 1), hslider("vibrato2_mono:frqmin", 100, 20, 5000, 1), hslider("vibrato2_mono:fratio", 1.5, 1, 4, 0.01), hslider("vibrato2_mono:frqmax", 4800, 20, 10000, 1), hslider("vibrato2_mono:speed", 0.5, 0, 10, 0.01));
vibrato2_mono_jump_test = no.noise : pf.vibrato2_mono(4, 0, 1.8*sq - 0.9, 1000, 100, 1.5, 4800, 0.5) with { P = int(ma.SR/10); sq = ba.period(2*P) < P; };
vibrato2_mono_modulated_test = no.noise : pf.vibrato2_mono(4, 0, 0.5, 10*pow(100.0, tri), 100, 1.5, 4800, 0.5) with { P = int(ma.SR/10); tri = 1 - abs(2*ba.period(P)/P - 1); };
vibrato2_mono_freq_jump_test = no.noise : pf.vibrato2_mono(4, 0, 0, 50, f, 1.5, f, 0) with { P = int(ma.SR/10); sq = ba.period(2*P) < P; f = 100*pow(48.0, sq); };
vibrato2_mono_audio_modulated_test = 0.1*no.noise : pf.vibrato2_mono(4, 0, 0.5, 100, 100, 1.5, 1900, 500);
vibrato2_mono_nyquist_test = no.noise : pf.vibrato2_mono(4, 0, 0.9, 10, 5000, 4, 10000, 0.5);
vibrato2_mono_wrap_test = no.noise : pf.vibrato2_mono(1, 0, 0, 10, 320000, 1, 640000, 0.5);

References


(pf.)phaser2_mono

phaser2_mono — response plots

Mono phasing effect.

Usage

_ : phaser2_mono(Notches,phase,width,frqmin,fratio,frqmax,speed,depth,fb,invert) : _

Where:

  • Notches: number of spectral notches (MACRO ARGUMENT - not a signal)
  • phase: phase of the oscillator (0-1)
  • width: approximate width of spectral notches in Hz
  • frqmin: approximate minimum frequency of first spectral notch in Hz
  • fratio: ratio of adjacent notch frequencies
  • frqmax: approximate maximum frequency of first spectral notch in Hz
  • speed: LFO frequency in Hz (rate of periodic notch sweep cycles)
  • depth: effect strength between 0 and 1 (1 typical) (aka "intensity") when depth=2, "vibrato mode" is obtained (pure allpass chain)
  • fb: feedback gain between -1 and 1 (0 typical)
  • invert: 0 for normal, 1 to invert sign of flanging sum

Test

pf = library("phaflangers.lib");
os = library("oscillators.lib");
phaser2_mono_test = os.tosc(330) : pf.phaser2_mono(4, 0.0, 50, 200, 1.5, 4000, 0.5, 0.8, 0.2, 0);
phaser2_mono_slider_test = os.tosc(330) : pf.phaser2_mono(4, hslider("phaser2_mono:phase01", 0, 0, 1, 0.01), hslider("phaser2_mono:width", 50, 10, 5000, 1), hslider("phaser2_mono:frqmin", 200, 20, 5000, 1), hslider("phaser2_mono:fratio", 1.5, 1, 4, 0.01), hslider("phaser2_mono:frqmax", 4000, 20, 10000, 1), hslider("phaser2_mono:speed", 0.5, 0, 10, 0.01), hslider("phaser2_mono:depth", 0.8, 0, 2, 0.01), hslider("phaser2_mono:fb", 0.2, -0.99, 0.99, 0.01), 0);
phaser2_mono_low_test = os.tosc(30) : pf.phaser2_mono(4, 0, 20, 20, 1.5, 20, 0, 1, 0, 0);

References


(pf.)phaser2_stereo

Stereo phasing effect. phaser2_stereo is a standard Faust function.

Usage

_,_ : phaser2_stereo(Notches,width,frqmin,fratio,frqmax,speed,depth,fb,invert) : _,_

Where:

  • Notches: number of spectral notches (MACRO ARGUMENT - not a signal)
  • width: approximate width of spectral notches in Hz
  • frqmin: approximate minimum frequency of first spectral notch in Hz
  • fratio: ratio of adjacent notch frequencies
  • frqmax: approximate maximum frequency of first spectral notch in Hz
  • speed: LFO frequency in Hz (rate of periodic notch sweep cycles)
  • depth: effect strength between 0 and 1 (1 typical) (aka "intensity") when depth=2, "vibrato mode" is obtained (pure allpass chain)
  • fb: feedback gain between -1 and 1 (0 typical)
  • invert: 0 for normal, 1 to invert sign of flanging sum

Test

pf = library("phaflangers.lib");
os = library("oscillators.lib");
phaser2_stereo_test = os.tosc(220), os.tosc(330) : pf.phaser2_stereo(4, 50, 200, 1.5, 4000, 0.5, 0.8, 0.2, 0);

References