RT1050 WM8960 codec - change audio parameters

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1050 WM8960 codec - change audio parameters

Jump to solution
2,340 Views
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?

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
1,940 Views
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?

View solution in original post

0 Kudos
Reply
2 Replies
1,941 Views
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 Kudos
Reply
1,940 Views
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 Kudos
Reply