Sound Quality Issues on the LPC4357

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

Sound Quality Issues on the LPC4357

883 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dennislumiad on Tue Jun 09 11:38:39 MST 2015
Hi all,

I am facing problems while using the I2S peripheral of the NXP LPC4357. I am using the CMSIS lib and in principle everything works fine for a 44,1KHz mono wav file with a 16 bit word width. However, when I switch to an 8KHz mono wav file with a 16 bit word width, problems are showing up.

In the specs I found that a 16KHz signal is the lowest the I2S peripheral can go. Therefore, I configured it with a 16KHz config and send every sample of my wav file twice to the output buffer.
My question concerns the sound quality. When I am playing the mentioned 8Khz wav file on a 16KHz I2S configuration, the produced sound has a whistle in itself and is more or less deformed. Has anyone face this problem before? Or does anyone understand where this comes from?

For the 44,1KHz wav file a 12MHz clock is fed to the I2S peripheral.
For the 8KHz wav file a 240KHz clock is fed to the I2S peripheral.

Many thanks in advance for your time and consideration!
Labels (1)
0 Kudos
Reply
4 Replies

870 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dennislumiad on Wed Jan 06 04:50:07 MST 2016
I found the problem!

Two things:

1) i combined left and right as follows:

int16_t sampleLeft;
int16_t sampleRight;

i2sOutputRegister = (sampleLeft << 16) | sampleRight;

This goes wrong with signedness, i.e. when right is negative, left is corrputed.

uint16_t sampleLeft;
uint16_t sampleRight;

i2sOutputRegister = (sampleLeft << 16) | sampleRight;

2) The chosen DAC was not able to support sample rates lower than 32KHz. So that explains the undefined bahaviour.

Thanks for participating in this!
0 Kudos
Reply

870 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dennislumiad on Mon Jun 15 04:49:00 MST 2015
Has anyone seen such a problem before? I have played around a bit again yesterday but still no success, i am getting out of inspiration.
0 Kudos
Reply

870 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dennislumiad on Fri Jun 12 02:43:14 MST 2015
Dear Wolfgang,

Many thanks for your quick reply! I have been working on it the past two days. However still no success. As I don't like to have a filter in the system, i translated the wav-file from 8KHz to 16KHz on my computer. Unfortunately, while this new file is played, the same problem showed up.

Now I have done the following:
I took my 44,1KHz file (which is played fine) and translated it to a 22.05KHz file. I recognized bad sound quality and i hooked up my scope, please find attached the view. This revealed that half of the time the wav file is played correctly and half of the time not. This triggered to idea to translate the 44,1KHz again to 11025Hz. Please find attached those results too. This revealed that quarter of the time the wav file is played correctly and three quarter of the time not.

The sine wave in the "wrong" part could be the reason for the whistling sound heared.

I have played around extensively with the I2S parameters but not results. Anyone an idea how to solve this? Many thanks :)
0 Kudos
Reply

870 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Tue Jun 09 14:23:37 MST 2015
If you double each sample of the 8 KHz WAV file, you will get a distortion in the sound. The I2S Peripheral cannot filter this distortion out, because it is in the passband of the output filter.

In order to generate a correct upsampling filter, you have to set each second sample to 0, and then you apply a 4 KHz lowpass filter to the data. You may need 24-32 Taps for a good filter.

regards
Wolfgang
0 Kudos
Reply