Gin
Loading...
Searching...
No Matches
GraphicEQ Class Reference

Multi-band graphic equalizer with configurable band count and per-channel control. More...

#include <gin_graphiceq.h>

Public Types

enum  NumBands {
  Bands5 = 5 , Bands7 = 7 , Bands10 = 10 , Bands15 = 15 ,
  Bands31 = 31
}
 Number of bands configuration. More...

Public Member Functions

 GraphicEQ (NumBands bands=Bands31)
 Creates a graphic equalizer with the specified number of bands.
void setSampleRate (double sr)
 Sets the sample rate for processing.
void setBlockSize (int blockSize)
 Sets the maximum block size for processing.
void setNumChannels (int ch)
 Sets the number of audio channels.
int getNumBands () const
 Gets the number of bands.
int getNumChannels () const
 Gets the number of channels.
void reset ()
 Resets the filter state for all bands and channels.
void setBandGain (int channel, int band, float gainDb)
 Sets the gain for a specific band on a specific channel.
float getBandGain (int channel, int band) const
 Gets the gain for a specific band on a specific channel.
float getBandFrequency (int band) const
 Gets the center frequency for a specific band.
void setAllBandGains (int channel, const float *gains)
 Sets the gain for all bands on a specific channel.
void flatten (int channel)
 Sets all bands on a specific channel to 0 dB (flat response).
void flattenAll ()
 Sets all bands on all channels to 0 dB (flat response).
float getFrequencyResponse (int channel, float frequency) const
 Gets the frequency response magnitude for a specific channel at a given frequency.
float getFrequencyResponseDb (int channel, float frequency) const
 Gets the frequency response in dB for a specific channel at a given frequency.
void process (juce::AudioSampleBuffer &buffer)
 Processes an audio buffer through the equalizer.

Detailed Description

Multi-band graphic equalizer with configurable band count and per-channel control.

GraphicEQ provides a professional graphic equalizer with selectable band counts (5, 7, 10, 15, or 31 bands) using ISO standard center frequencies. Each channel can have independent gain settings, and frequency response can be queried per channel.

Key Features:

  • Selectable band count (5, 7, 10, 15, or 31 bands)
  • Configurable number of channels
  • Independent gain control per channel per band
  • Per-channel frequency response calculation
  • Uses gin::Filter internally for high-quality processing

Band Configurations:

  • 5 bands: 60, 250, 1k, 4k, 16k Hz
  • 7 bands: 63, 160, 400, 1k, 2.5k, 6.3k, 16k Hz
  • 10 bands: 31.5, 63, 125, 250, 500, 1k, 2k, 4k, 8k, 16k Hz
  • 15 bands: 25, 40, 63, 100, 160, 250, 400, 630, 1k, 1.6k, 2.5k, 4k, 6.3k, 10k, 16k Hz
  • 31 bands: ISO 1/3 octave from 20Hz to 20kHz

Usage:

eq.setNumChannels(2);
eq.setSampleRate(44100.0);
eq.setBandGain(0, 0, 3.0f); // Channel 0, Band 0: +3dB
eq.setBandGain(1, 0, -3.0f); // Channel 1, Band 0: -3dB
eq.process(audioBuffer);
// Get frequency response for channel 0 at 1kHz
float response = eq.getFrequencyResponse(0, 1000.0f);
GraphicEQ(NumBands bands=Bands31)
Creates a graphic equalizer with the specified number of bands.
Definition gin_graphiceq.h:71
@ Bands31
Definition gin_graphiceq.h:65
See also
EQ, Filter

Member Enumeration Documentation

◆ NumBands

Number of bands configuration.

Enumerator
Bands5 
Bands7 
Bands10 
Bands15 
Bands31 

Constructor & Destructor Documentation

◆ GraphicEQ()

GraphicEQ::GraphicEQ ( NumBands bands = Bands31)

Creates a graphic equalizer with the specified number of bands.

Parameters
bandsNumber of bands (5, 7, 10, 15, or 31)

References Bands31.

Member Function Documentation

◆ setSampleRate()

void GraphicEQ::setSampleRate ( double sr)

Sets the sample rate for processing.

Parameters
sampleRateSample rate in Hz

◆ setBlockSize()

void GraphicEQ::setBlockSize ( int blockSize)

Sets the maximum block size for processing.

Call this before processing to allocate working buffers.

Parameters
blockSizeMaximum number of samples per block

◆ setNumChannels()

void GraphicEQ::setNumChannels ( int ch)

Sets the number of audio channels.

Parameters
chNumber of channels

References Filter::bandpass, and Filter::db12.

◆ getNumBands()

int GraphicEQ::getNumBands ( ) const

Gets the number of bands.

Returns
Number of bands

◆ getNumChannels()

int GraphicEQ::getNumChannels ( ) const

Gets the number of channels.

Returns
Number of channels

◆ reset()

void GraphicEQ::reset ( )

Resets the filter state for all bands and channels.

◆ setBandGain()

void GraphicEQ::setBandGain ( int channel,
int band,
float gainDb )

Sets the gain for a specific band on a specific channel.

Parameters
channelChannel index
bandBand index
gainDbGain in decibels (positive = boost, negative = cut)

◆ getBandGain()

float GraphicEQ::getBandGain ( int channel,
int band ) const

Gets the gain for a specific band on a specific channel.

Parameters
channelChannel index
bandBand index
Returns
Gain in decibels

◆ getBandFrequency()

float GraphicEQ::getBandFrequency ( int band) const

Gets the center frequency for a specific band.

Parameters
bandBand index
Returns
Center frequency in Hz

◆ setAllBandGains()

void GraphicEQ::setAllBandGains ( int channel,
const float * gains )

Sets the gain for all bands on a specific channel.

Parameters
channelChannel index
gainsArray of gain values in dB (must have numBands elements)

◆ flatten()

void GraphicEQ::flatten ( int channel)

Sets all bands on a specific channel to 0 dB (flat response).

Parameters
channelChannel index

Referenced by flattenAll().

◆ flattenAll()

void GraphicEQ::flattenAll ( )

Sets all bands on all channels to 0 dB (flat response).

References flatten().

◆ getFrequencyResponse()

float GraphicEQ::getFrequencyResponse ( int channel,
float frequency ) const

Gets the frequency response magnitude for a specific channel at a given frequency.

Parameters
channelChannel index
frequencyFrequency in Hz
Returns
Response magnitude (linear scale, 1.0 = unity gain)

Referenced by getFrequencyResponseDb().

◆ getFrequencyResponseDb()

float GraphicEQ::getFrequencyResponseDb ( int channel,
float frequency ) const

Gets the frequency response in dB for a specific channel at a given frequency.

Parameters
channelChannel index
frequencyFrequency in Hz
Returns
Response in decibels

References getFrequencyResponse().

◆ process()

void GraphicEQ::process ( juce::AudioSampleBuffer & buffer)

Processes an audio buffer through the equalizer.

Parameters
bufferAudio buffer to process in-place

The documentation for this class was generated from the following file: