Efficient bandpass filter bank for real-time zero latency frequency analysis. Each band is a separated bandpass filter with custom width and center frequency.
More...
#include "SuperpoweredBandpassFilterbank.h"
Efficient bandpass filter bank for real-time zero latency frequency analysis. Each band is a separated bandpass filter with custom width and center frequency.
◆ BandpassFilterbank() [1/2]
Superpowered::BandpassFilterbank::BandpassFilterbank |
( |
unsigned int |
numBands, |
|
|
float * |
frequencies, |
|
|
float * |
widths, |
|
|
unsigned int |
samplerate, |
|
|
unsigned int |
numGroups = 0 |
|
) |
| |
Constructor.
- Parameters
-
numBands | The number of bands. Must be a multiply of 8. |
frequencies | Center frequencies of each band in Hz. |
widths | Widths of each band in octave (1.0f is one octave, 1.0f / 12.0f is one halfnote). |
samplerate | The initial sample rate in Hz. |
numGroups | For advanced use. The filter bank can be set up with multiple frequency + width groups, then process() or processNoAdd() can be performed with one specific frequency + width group. For example, set up one group with wide frequency coverage for the 20-20000 Hz range and three additional groups for 20-200 Hz, 200-2000 Hz and 2000-20000 Hz. When processing with the wide group of 20-20000 Hz and the highest magnitude can be found at 1000 Hz, use the 200-2000 Hz group for the next process() or processNoAdd() call, so the filter bank will have a "focus" on a narrower range. If numGroups > 0, then the number of frequencies and widths should be numGroups * numBands. Example: for numBands = 8 and numGroups = 2, provide 8 + 8 frequencies and 8 + 8 widths. |
◆ ~BandpassFilterbank()
Superpowered::BandpassFilterbank::~BandpassFilterbank |
( |
| ) |
|
◆ BandpassFilterbank() [2/2]
◆ getAverageVolume()
float Superpowered::BandpassFilterbank::getAverageVolume |
( |
| ) |
|
◆ getPeakVolume()
float Superpowered::BandpassFilterbank::getPeakVolume |
( |
| ) |
|
◆ getSumVolume()
float Superpowered::BandpassFilterbank::getSumVolume |
( |
| ) |
|
Returns with the cumulated absolute value of all audio passed to all previous process() or processNoAdd() calls. Like you would add the absolute value of all audio samples together.
◆ operator=()
◆ process()
void Superpowered::BandpassFilterbank::process |
( |
float * |
input, |
|
|
unsigned int |
numberOfFrames, |
|
|
int |
group = 0 |
|
) |
| |
Processes the audio.
It will ADD to the current magnitude in bands (like bands[0] += 0.123), so you can "measure" the magnitude of each frequency for a longer period of time. To calculate a result between 0 and 1 for multiple consecutive process() calls, divide each value in bands with the total number of frames passed to the consecutive process() calls.
- Parameters
-
input | 32-bit interleaved stereo input buffer. |
numberOfFrames | Number of frames to process. |
group | The group index for advanced "grouped" usage. |
◆ processNoAdd()
void Superpowered::BandpassFilterbank::processNoAdd |
( |
float * |
input, |
|
|
unsigned int |
numberOfFrames, |
|
|
int |
group = 0 |
|
) |
| |
Processes the audio.
It will replace the contents of bands.
- Parameters
-
input | 32-bit interleaved stereo input buffer. |
numberOfFrames | Number of frames to process. |
group | The group index for advanced "grouped" usage. |
◆ resetBands()
void Superpowered::BandpassFilterbank::resetBands |
( |
| ) |
|
Sets all values of bands to 0.
◆ resetPeakVolume()
void Superpowered::BandpassFilterbank::resetPeakVolume |
( |
| ) |
|
Resets the peak volume value to start measurement anew.
◆ resetSumAndAverageVolume()
void Superpowered::BandpassFilterbank::resetSumAndAverageVolume |
( |
| ) |
|
Resets the sum and average volume value to start measurement anew.
◆ bands
float* Superpowered::BandpassFilterbank::bands |
◆ internals
bandpassFilterbankInternals* Superpowered::BandpassFilterbank::internals |
|
private |
◆ samplerate
unsigned int Superpowered::BandpassFilterbank::samplerate |
The documentation for this class was generated from the following file:
- latest/Superpowered/SuperpoweredBandpassFilterbank.h