Skip to main content
Graduate
November 7, 2024
Question

GrEq audio library

  • November 7, 2024
  • 1 reply
  • 1272 views

Hello everyone, 

I am using a STM32H750 with STM32CubeExpansion_Audio_V1.1.1 and I am trying to use the Graphical equalizer library.

This is what I've done: 

I have an aux audio signal that I'm sampling at 96Khz with a DMA's interrupt transfer every 1 ms ( 1 ms == 96 samples). Then I am using "arm_fir_decimate_q15" in order to have a buffer of 48 samples. This buffer is the input of GrEq library's processing function. 

The GrEq library configuration is: 

nb_bands = GREQ_NB_BANDS_8;

user_gain_per_band_dB = 0; /* For all 8 band */

nb_bytes_per_Sample = 2; /* 16 bits in one sample */
nb_channels = 2; /* stereo */

buffer_size = 48; /* Samples for channel */
mode = INTERLEAVED;

During run time, thanks to a custom graphical interface , I can change the "user_gain_per_band_dB " and then call for "greq_setConfig" without any errors. 

 

This is my GrEq processing function's core: 

 

void audio_equalize_adc(uint16_t *in_out_buff, uint16_t size) 
{

/* Create audio stereo buffer */
for (uint16_t i = 0; i < size; i++)
{
audio_equal_buff[i * 2] = in_out_buff[i]; 
audio_equal_buff[(i * 2) + 1] = in_out_buff[i];
}

BufferHandler_in.data_ptr = audio_equal_buff;

greq_process(&BufferHandler_in, &BufferHandler_in, pGreqPersistentMem);

/* Return to audio mono */
for (uint16_t i = 0; i < size; i++)
{
in_out_buff[i] = audio_equal_buff[i * 2]; 
}
}

Where :

- in_out_buff is arm_fir_decimate_q15 output buffer (48 samples size);

- uint16_t audio_equal_buff is a local buffer of 48*2 samples size (GrEq needs a stereo input signal as indicated in its documentation);

- size is 48; 

 

The problem is that I don't hear a difference in the audio post equalization. Can anyone suggest which is the problem? 

 

Thanks in advance

    This topic has been closed for replies.

    1 reply

    Super User
    November 7, 2024

    Please see the Posting Tips for how to properly post source code:

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

     


    @FCola.1 wrote:

    During run time, thanks to a custom graphical interface , I can change the "user_gain_per_band_dB "


    Are you sure that the changes from the GUI are actually being applied?

     


    @FCola.1 wrote:

    I don't hear a difference in the audio post equalization. Can anyone suggest which is the problem? 


    Do you have a more objective way to see the results; eg, compare input & output spectrum?

    FCola.1Author
    Graduate
    November 7, 2024

    Hi Andrew, thanks for your quick reply. 

    1) I am sure that the changes are applied when I am modifying values from graphical interface; 

    2) Now I have seen that "greq_process" is returning error = -1 (GREQ_UNSUPPORTED_NB OF BYTEPERSAMPLES) but I don't understand why. 

     

    Super User
    November 7, 2024

    @FCola.1 wrote:

    1) I am sure that the changes are applied when I am modifying values from graphical interface; 


    how are you sure?

     


    @FCola.1 wrote:

    2) Now I have seen that "greq_process" is returning error = -1 (GREQ_UNSUPPORTED_NB OF BYTEPERSAMPLES) but I don't understand why. 


    What does the documentation say about valid numbers of bytes per sample?

    Do you have the source for the library? If so, use the debugger step in and see what causes it...