STM32F746-DISCO audio delay line implementation problem.
I have audio pass-through working project for STM32F746/769 DISCO module, where block of 4 samples (2 left and 2 right channel ones) from input are passed to output chanell DMA buffer.
My delay line implementation is as follows:
#define BUFF_SIZE 4
#define DBUF_SIZE 8192
int32_t buff_in[BUFF_SIZE];
int32_t buff_out[BUFF_SIZE];
int32_t dbuf[DBUF_SIZE];
int i=0,j=0,k;
...
void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai){
memcpy(&dbuf[i], buff_in, BUFF_SIZE*sizeof(uint32_t));
i += BUFF_SIZE;
if(i>=DBUF_SIZE) i=0;
memcpy(buff_out, &dbuf[i], BUFF_SIZE*sizeof(uint32_t));
}
The effect should be a DBUF_SIZE/2 samples delay but instead of this i observe additionally echo, where subsequent repetitions of input signal occur at DBUF_SIZE/2*sample_period intervals.
I suspect, that the source of this maybe some analog or digital loopback in WM8994 audio codec.
Please, help me find the bug.
Regards,
Roman
