cancel
Showing results for 
Search instead for 
Did you mean: 

GrEq audio library

FCola.1
Associate III

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

5 REPLIES 5

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?

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. 

 


@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...

>(GREQ_UNSUPPORTED_NB OF BYTEPERSAMPLES) but I don't understand why. 

Maybe because you set it wrong ?

2 ch. /sample at 16bit -> 2 x 2 = 4 BYTEPERSAMPLES ; so try 4.

If you feel a post has answered your question, please click "Accept as Solution".

Hi AScha.3, thanks for your advice. 

@Andrew Neil  Unfortunately, the library's code is not available. The only things that you can rely on are the functions return values. 

The documentation says only that the maximum input frame size must be 480 stereo samples (I am using 96 samples so I don't see any problem). 

@Andrew Neil  I am sure that the changes  are applied because the library dynamically allocate memory through malloc function and I clearly see that changes are made when I am using "greq_setConfig" (thanks to Call Stack viewer).

@AScha.3 Changing BYTESPERSAMPLES from 2 to 4 does not seem to solve the problem.