SPECTEQ

FFT-based EQ (in package insts.jg)

SPECTEQ is part of the SPECTACLE family of fft-based fun things. Be forewarned -- John Gibson placed the following "README" file source directory (SPECTEQ is located in the SPECTACLE source dir): See also the PVOC and VOCODE instruments.

p-fields:

/* SPECTEQ - FFT-based EQ

   p0  = output start time
   p1  = input start time
   p2  = input duration
   p3  = amplitude multiplier
   p4  = ring-down duration (can set to 0)
   p5  = FFT length (power of 2, usually 1024)
   p6  = window length (power of 2, usually FFT length * 2)
   p7  = window type (0: Hamming; see below for others)
   p8  = overlap - how much FFT windows overlap (any power of 2)
         1: no overlap, 2: hopsize=FFTlen/2, 4: hopsize=FFTlen/4, etc.
         2 or 4 is usually fine; 1 is fluttery; the higher the more CPU time
   p9  = input channel [optional, default is 0]
   p10 = percent to left channel [optional, default is .5]

   The following function tables control amplitude.

      Function table 1 is the input amplitude, spanning just the input
         duration.
      Function table 2 is the output amplitude, spanning the entire
         note, including ring-down duration.
      Function table 3 is the EQ table (i.e., amplitude scaling of each band),
         in dB (0 dB means no change, + dB boost, - dB cut).

   NOTES:

      p7 - window type:
            0: Hamming, 1: Hanning, 2: Rectangle, 3: Triangle, 4: Blackman,
            5: Kaiser
           When in doubt, use Hamming.

      p8 - overlap:
            1: no overlap, 2: hopsize=FFTlen/2, 4: hopsize=FFTlen/4, etc.
            2 or 4 is usually fine; 1 is fluttery; higher overlaps use more CPU.
            Also possible to use negative powers of 2, e.g., .5, .25, .125, etc.
            This leaves a gap between successive FFTs, creating ugly robotic
            effects -- beware of clipping.
Sample scorefile:
sr = 44100
nyquist = sr / 2
rtsetparams(sr, 2)
load("SPECTEQ")

/* ftp://presto.music.virginia.edu/pub/rtcmix/snd/ah.snd */
rtinput("/snd/Public_Sounds/vccm_old/ah.snd")

inchan = 0
inskip = .4
indur = 2
ringdur = 0
amp = 15
fftlen = 1024           /* yielding 512 frequency bands */
winlen = fftlen * 2     /* the standard window length is twice FFT size */
overlap = 2             /* 2 hops per fftlen (4 per window) */
wintype = 0             /* use Hamming window */

/* input envelope (covering ) */
makegen(1, 18, 1000, 0,0, 1,1, 19,1, 20,0)

/* output envelope (covering  + ) */
copygen(2, 1)

/* EQ curve: -90 dB at 0 Hz, ramping up to -10 dB at 400 Hz, etc. */
makegen(3, 18, nyquist/10,
       0,   -90,
     300,   -90,
     400,   -10,
     800,   -20,
    1000,   -90,
    2000,   -90,
    5000,   0,
 nyquist,   -40)
//fplot(3, 5, "with lines")

/* do it for the left chan! */
start = 0
SPECTEQ(start, inskip, indur, amp, ringdur, fftlen, winlen, wintype, overlap,
   inchan, pctleft=1)

/* do it for the right chan! */
SPECTEQ(start, inskip, indur, amp, ringdur, fftlen, winlen, wintype, overlap,
   inchan, pctleft=0)