User-Defined Opcode Database

Fofilter

A formant filter version of the FOF opcode.

Download UDO File

Description

This filter generates a stream of overlapping sinewave grains, when fed with a pulse train. Each grain is the
impulse response of a combination of two BP filters. The grains are defined by their attack time (determining the skirtwidth of the formant region at
-60dB) and decay time (-6dB bandwidth). Overlapping will occur when 1/freq < decay, but, unlike FOF, there is no upper limit on the number of overlaps.
The original idea for this opcode came from J McCartney\'s formlet class in SuperCollider, but this is
possibly implemented differently (?).

Syntax

ar Fofilter asig, kcf, kris, kdec

Performance

asig - input signal
kcf - formant center frequency (Hz)
kris - impulse response attack time (secs)
kdec - impulse response decay time (to -60dB, in secs)

Code

opcode Fofilter, a, akkk

   setksmps 1

ipiosr = 4*taninv(1)/sr  /* pi/sr */
af1z1 init 0             /* filter delays */
af1z2 init 0
af2z1 init 0
af2z2 init 0

asig,kcf,kris,kdec  xin

kang = 2*ipiosr*kcf   /* pole angle */
kfsc = sin(kang) - 3  /* freq scl   */
krad1 =  10^(kfsc/(kdec*sr))  /* filter radii */
krad2 =  10^(kfsc/(kris*sr))

aw1  = asig + 2*krad1*cos(kang)*af1z1 - krad1*krad1*af1z2
adec =  aw1 - af1z2
af1z2 = af1z1
af1z1 = aw1

aw2  = asig + 2*krad2*cos(kang)*af2z1 - krad2*krad2*af2z2
att =  aw2 - af2z2
af2z2 = af2z1
af2z1 = aw2
       
        xout  adec - att     
	
endop

Examples

instr 1
	
kfe         expseg 10, p3*0.9, 180, p3*0.1, 175
kenv        linen  1000, 0.05, p3, 0.05
asig        buzz   kenv, kfe, sr/(2*kfe), 1
afil        fofilter  asig, 900, 0.007, 0.04
             
            out afil 
	
endin

Credits

Victor Lazzarini


Previous Home Next
ensembleChorus   Moogladder