cancel
Showing results for 
Search instead for 
Did you mean: 

SRC236 Sample rate converter, noisy

KBéla.1
Associate III

Hy,

I have tried to resample a 16bit/8kHz audio signal to 16kHz and 48kHz.

Conversion works, but the audio is noisy. I am tested it on development board STM32H747 CM7 core.

I have tried libraries: SRC236_CM7_GCC.a and SRC236HQ_CM7_GCC.a without quality improvement.

I am working with 10ms blocks.

Initialization parameters are:

 

 

// conversion from 8kHz to 16kHz
src236_static_param_t src236_static_param.src_mode = SRC236_RATIO_2;
// library initialization
src_error = src236_reset(PSrc236PersistentMem_ToCodecOut, PSrcScratchMem_ToCodecOut);
if (src_error != SRC236_ERROR_NONE)
{
    return (-1); //error AUDIO_ERROR_SRC
}
/* SRC236 effect static parameters setting */
src_error = src236_setParam(&src236_static_param, PSrc236PersistentMem_ToCodecOut);
if (src_error != SRC236_ERROR_NONE)
{
    return (-1); //error AUDIO_ERROR_SRC
}

// 8kHz, 16 bit audio input // 10ms block
LowRateConversionBuff_ToCodecOut.nb_channels = 1;
LowRateConversionBuff_ToCodecOut.nb_bytes_per_Sample = 2;
LowRateConversionBuff_ToCodecOut.mode = NOT_INTERLEAVED;
// LowRateConversionBuff_ToCodecOut.data_ptr = //set data pointer before usage
LowRateConversionBuff_ToCodecOut.buffer_size = 80;

// 16kHz, 16bit audio output
HighRateConversionBuff_ToCodecOut.nb_channels = 1;
HighRateConversionBuff_ToCodecOut.nb_bytes_per_Sample = 2;
HighRateConversionBuff_ToCodecOut.mode = NOT_INTERLEAVED;
// HighRateConversionBuff_ToCodecOut.data_ptr = //set data pointer before usage
HighRateConversionBuff_ToCodecOut.buffer_size = 160;

 

 

Processing part:

 

 

LowRateConversionBuff_ToCodecOut.data_ptr = pInData;
HighRateConversionBuff_ToCodecOut.data_ptr = pOutData;

src_error = src236_process(&LowRateConversionBuff_ToCodecOut, &HighRateConversionBuff_ToCodecOut, PSrc236PersistentMem_ToCodecOut);
if (src_error == SRC236_ERROR_NONE)
{
    return 0;
}

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
KBéla.1
Associate III

Thank you for your helps, it was my fault.

I sometimes processed the same packet of data more times. It generated a noise when a new packet started.

After a repair, audio quality is good, both in normal, and in HQ modes, too. 

Anyway I am extracted the resample functionality from X-CUBE-AUDIO-KIT, for IIR mode, 16 bit data, without any malloc, OS functionality, and it works too. 

 

View solution in original post

6 REPLIES 6
STOne-32
ST Employee

Dear @KBéla.1 ,

 

It may happen you are using a Library not compatible yet with STM32H7 series .  let us know which version are you using .

You can check this link  : X-CUBE-AUDIO-KIT - Audio processing software expansion for STM32Cube - STMicroelectronics

 

If you are using this Library : X-CUBE-AUDIO - Audio effects software expansion for STM32Cube - STMicroelectronics  you can see 

  • STM32Cube audio effect modules and libraries for the STM32F4 and STM32F7 Series of microcontrollers

Hope it helps

STOne-32.

KBéla.1
Associate III

I tried SRC236 lib version: V1.0.3 , from 

X-CUBE-AUDIO v1.1.1, and it is noisy. The only parameter which I can change is the audio block size, which can be a mono or stereo signal. Now I am using 10ms Mono audio blocks, which not works.

 

Now I am going to try resample functionality from X-CUBE-AUDIO-KIT. I can`t find documentation for it, but the sources are available, so I hope, I can do it.

Thanks for the info

 

 


@KBéla.1 wrote:

X-CUBE-AUDIO-KIT. I can`t find documentation for it


Did you see:

https://www.st.com/en/embedded-software/x-cube-audio-kit.html#documentation

In particular, UM3297Getting started with X-CUBE-AUDIO-KIT

 

KBéla.1
Associate III

Thank you for your helps, it was my fault.

I sometimes processed the same packet of data more times. It generated a noise when a new packet started.

After a repair, audio quality is good, both in normal, and in HQ modes, too. 

Anyway I am extracted the resample functionality from X-CUBE-AUDIO-KIT, for IIR mode, 16 bit data, without any malloc, OS functionality, and it works too. 

 

Great @KBéla.1  ! very happy to see you made it working.