ESP-DSP Biquad peak gain

normanalie
Posts: 1
Joined: Sat Nov 11, 2023 8:54 pm

ESP-DSP Biquad peak gain

Postby normanalie » Sat Nov 11, 2023 9:11 pm

I'm using ESP-DSP to process audio and I wanted to add Peaking EQ, but I can't understand why there is no gain parameter ?

Code: Select all

esp_err_t dsps_biquad_gen_peakingEQ_f32(float *coeffs, float f, float qFactor);
If I understand the current implementation, the gain is fixed to 1.

I would have like to write my own implementation based on the current one but I do not understand how the coefficients are calculated ?

In the lib there is:

Code: Select all

    float b0 = alpha;
    float b1 = 0;
    float b2 = -alpha;
    float a0 = 1 + alpha;
    float a1 = -2 * c;
    float a2 = 1 - alpha;
But with my limited knowledge of digital filters, I would have thought that the coefficients should have been:

Code: Select all

    float b0 = 1 + alpha;
    float b1 = -2 * c;
    float b2 = 1 - alpha;
    float a0 = 1 + alpha;
    float a1 = -2 * c;
    float a2 = 1 - alpha;
And with gain:

Code: Select all

    float A = sqrtf(pow(10, (double)gain / 20.0));
    float b0 = 1 + alpha * A;
    float b1 = -2 * c;
    float b2 = 1 - alpha * A;
    float a0 = 1 + alpha / A;
    float a1 = -2 * c;
    float a2 = 1 - alpha / A;
Am I missing something ? How do I apply gain to a peak EQ in ESP-DSP implemetation ?

Who is online

Users browsing this forum: No registered users and 99 guests