band filtering in the frequency domain

We describe how band filtering in the frequency domain is performed.

We start with a Sound and end with a filter bank representation of this sound. We assume a standard analysis context: a sound divided into frames according to a certain window length and time step. We will simulate a filterbank with N filters.

The algorithm for each sound frame proceeds in the following way:

1. Apply a Gaussian window to the sound frame.
2. Convert the windowed frame into a Spectrum object.
3. Convert the spectral amplitudes to energy values by squaring the real and imaginary parts and multiplying by df, the frequency distance between two successive frequency points in the spectrum. Since the Spectrum object only contains positive frequencies, we have to multiply all energy values, except the first and the last frequency, by another factor of 2 to compensate for negative frequencies.
4. For each of the N filters in the filter bank: determine the inner product of its filter function with the energies as determined in the previous step. The result of each inner product is the energy in the corresponding filter.
5. Convert the energies in each filter to power by dividing by the window length.
6. Correct the power, due to the windowing of the frame, by dividing by the integral of the squared windowing function.
7. Convert all power values to dB's according to 10 * log10 (power / 4 10-10).