AnsweredAssumed Answered

RT1050 WM8960 codec - change audio parameters

Question asked by PazDim PazDim on Jul 7, 2018

Hello.

I am using I.mx RT1050 evk with WM8960 codec for audio playback. SDK example plays 16 khz 16bit stereo sound. Its working good - I created corresponding raw audio file and transmit it to EVK via ethernet. But I need to work with 8 khz 16bit mono sound. Default configuration from example:

/* Clock pre divider for sai1 clock source */
#define DEMO_SAI1_CLOCK_SOURCE_PRE_DIVIDER (1U)
/* Clock divider for sai1 clock source */
#define DEMO_SAI1_CLOCK_SOURCE_DIVIDER (63U)
/* Get frequency of sai1 clock */
#define DEMO_SAI_CLK_FREQ (CLOCK_GetFreq(kCLOCK_AudioPllClk) / (DEMO_SAI1_CLOCK_SOURCE_DIVIDER + 1U) / (DEMO_SAI1_CLOCK_SOURCE_PRE_DIVIDER + 1U))

 

format.bitWidth = kSAI_WordWidth16bits;
format.channel = 0U;
format.sampleRate_Hz = kSAI_SampleRate16KHz;
format.masterClockHz = DEMO_SAI_CLK_FREQ;
format.protocol = config.protocol;
format.stereo = kSAI_Stereo;
format.isFrameSyncCompact = false;
format.watermark = FSL_FEATURE_SAI_FIFO_COUNT / 2U;

What parameters do I need to change? I tried to set sampleRate_HZ to 8KHz, stereo to kSAI_MonoRight. But I do not understand the CLOCK parameters. How do I calculate them? The frequency of transmitting is reduced by 4 times (16khz to 8khz and stereo to mono) and the playback frequency is reduced by 2 times (16khz to 8khz), right?

Outcomes