spectrum — Generate a constant-Q, exponentially-spaced DFT.
Generate a constant-Q, exponentially-spaced DFT across all octaves of a multiply-downsampled control or audio input signal.
ihann (optional) -- apply a Hamming or Hanning window to the input. The default is 0 (Hamming window)
idbout (optional) -- coded conversion of the DFT output:
0 = magnitude
1 = dB
2 = mag squared
3 = root magnitude
The default value is 0 (magnitude).
idisprd (optional) -- if non-zero, display the composite downsampling buffer every idisprd seconds. The default value is 0 (no display).
idsines (optional) -- if non-zero, display the Hamming or Hanning windowed sinusoids used in DFT filtering. The default value is 0 (no sinusoid display).
This unit first puts signal asig or ksig through iocts of successive octave decimation and downsampling, and preserves a buffer of down-sampled values in each octave (optionally displayed as a composite buffer every idisprd seconds). Then at every iprd seconds, the preserved samples are passed through a filter bank (ifrqs parallel filters per octave, exponentially spaced, with frequency/bandwidth Q of iq), and the output magnitudes optionally converted (idbout ) to produce a band-limited spectrum that can be read by other units.
The stages in this process are computationally intensive, and computation time varies directly with iocts, ifrqs, iq, and inversely with iprd. Settings of ifrqs = 12, iq = 10, idbout = 3, and iprd = .02 will normally be adequate, but experimentation is encouraged. ifrqs currently has a maximum of 120 divisions per octave. For audio input, the frequency bins are tuned to coincide with A440.
This unit produces a self-defining spectral datablock wsig, whose characteristics used (iprd, iocts, ifrqs, idbout) are passed via the data block itself to all derivative wsigs. There can be any number of spectrum units in an instrument or orchestra, but all wsig names must be unique.