RT1050 WM8960 codec - change audio parameters

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RT1050 WM8960 codec - change audio parameters

跳至解决方案
2,343 次查看
pazdimpazdim
Contributor II

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?

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,943 次查看
pazdimpazdim
Contributor II

I found the problem. WM8960 inserts zeros after each byte in u-law mode. The target device uses the PCMU without zeros (each byte is informational). How do I configure DMA to automatically insert zeros?

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,944 次查看
pazdimpazdim
Contributor II

I found the problem. WM8960 inserts zeros after each byte in u-law mode. The target device uses the PCMU without zeros (each byte is informational). How do I configure DMA to automatically insert zeros?

0 项奖励
回复
1,943 次查看
pazdimpazdim
Contributor II

I need a sound in the format of PCMU. I changed the fields DACCOMP and ADCCOMP of register 09h. After processing in audio editor, I saw that the stereo sound. How do I set the SAI or MQS to mono?

...

And this is only for the PCMU/PCMA, the raw sound is received as 8000 kHz mono.

0 项奖励
回复