Hello All,
I'm working on Audio Codec(WM8904 IC).
Facing an issues like Back Ground Noise and Quality issues, below are the details we followed for implementation,
1. We are converting the text to audio(.mp3 /.wav)
2. (.mp3 / .wav) Converting into Bin file using audacity tool
3. And storing into External Flash using J-Link of NXP
4. And we are reading chunk wise(i.e. 1024 bytes/ 1KB)
5. After collecting the data sending to Audio Codec(WM8904 IC) via I2S in DMA method
Below are the points experimented from our end,
1. Changed sample rate from 8Khz to 48Khz.
2. Increased and Decreased chunk size.
3. Same chunk Data sending two times to Audio Codec instead of one time.
4. Adjusted parameters for Volume and Gain.
Note:- Tried by storing audio data into internal buffer of controller and sending to audio codec
Audio size is - 32KB
Kindly help me out in this with your valuable suggestions.
Thanking you in Advance.
Regards,
Nikhil
Hi,
As you said that "We are converting the text to audio(.mp3 /.wav), 2. (.mp3 / .wav) Converting into Bin file using audacity tool", pls check the PCM format, especially, the data length. For example, each PCM sample consists of two bytes or 3 bytes.
If you use two bytes, you have to set
I2S_TxGetDefaultConfig(&s_TxConfig);
s_TxConfig.divider = DEMO_I2S_CLOCK_DIVIDER;
s_TxConfig.masterSlave = DEMO_I2S_TX_MODE;
s_TxConfig.dataLength = 16U;
If you use three Bytes, you have to set:
I2S_TxGetDefaultConfig(&s_TxConfig);
s_TxConfig.divider = DEMO_I2S_CLOCK_DIVIDER;
s_TxConfig.masterSlave = DEMO_I2S_TX_MODE;
s_TxConfig.dataLength = 24U;
BTW, I suggest you use example interrupt_transfer example, in the example, it plays the PCM
array g_Music[], which is defined in music.h, one sample consists of two bytes.
First of all, play the music defined in the g_Music[], then replace the music.h with your own PCM, check if the data length in PCM array matches with the s_TxConfig.dataLength.
Hope it can help you
BR
XiangJun Rong
Hi,
This is music data format, red is one PCM sample, blue is another PCM sample.
Hope it can help you
BR
XiangJun Rong
Hi Xiangjun rong,
I have tried as you suggested, but there is no improvement in the audio, and it is coming bit slow with lag.
I am requesting you that will have a call or discussion personally regarding audio, so that we can discuss in detail.
Please do let us know your convenient time and drop message to this mail id - nikhil@emelite.in
Regards,
Nikhil
Hi Xiangjun rong,
Thanks for your response
We have already installed the SDK package for LPC55S69 EVK Board.
And we tried same configurations, the issue still remains.
Regards,
Nikhil
Hi,
Pls download SDK package for the LPC55S69-EVK board from the link:
This is the codec configuration:
wm8904_config_t wm8904Config = {
.i2cConfig = {.codecI2CInstance = BOARD_CODEC_I2C_INSTANCE, .codecI2CSourceClock = BOARD_CODEC_I2C_CLOCK_FREQ},
.recordSource = kWM8904_RecordSourceLineInput,
.recordChannelLeft = kWM8904_RecordChannelLeft2,
.recordChannelRight = kWM8904_RecordChannelRight2,
.playSource = kWM8904_PlaySourceDAC,
.slaveAddress = WM8904_I2C_ADDRESS,
.protocol = kWM8904_ProtocolI2S,
.format = {.sampleRate = kWM8904_SampleRate48kHz, .bitWidth = kWM8904_BitWidth16},
.mclk_HZ = DEMO_I2S_MASTER_CLOCK_FREQUENCY,
.master = false,
};
codec_config_t boardCodecConfig = {.codecDevType = kCODEC_WM8904, .codecDevConfig = &wm8904Config};
The codec is a slave, it's MCLK is from LPC55S69, it's bit clock and frame clock are from LPC55S69.
The data format is 16 bits for each slot and the baudrate is 48KHz.
Hope it can help you
BR
XiangJun Rong