0
\$\begingroup\$

I am using WM8731 Audio Codec taking hints from the Audio Board PROTO with a 1 W Audio Power Amplifier LM4889 to drive a speaker from CUI INC: CDS-13138-SMT. The setup works but not as expected. I am using the recommended circuitry given in LM4889 Datasheet for high gain amplifier.

My application requires a speaker to output frequencies in 17 to 20 KHz. But when I pass a wave audio of pure 19 KHz(from here) to it, the speaker outputs a frequency at around 9KHz and 15 KHz.(Why?) The playback is slow too.(I tried playing a song. It ran in slow motion)(can't understand Why?)

(I am using Spectrum Analyzer. It shows the two peaks at 9 and 15). The whole setup is interfaced with Raspberry Pi through I2S.

I don't have much experience with audio applications. Is my approach wrong? Am I using a wrong speaker for my application? Can anyone provide any alternative? What all can be improved in the design? I am sorry if I come across as a complete noob.

Thank you.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ You can edit your post. Always put all the information required in the post and not sprinkled through the comments. Welcome to EE.SE. \$\endgroup\$
    – Transistor
    Commented Aug 2, 2016 at 17:05
  • \$\begingroup\$ It didn't allow me to add more than 2 links. Sorry. \$\endgroup\$
    – cr0ssb0w
    Commented Aug 2, 2016 at 17:12
  • \$\begingroup\$ Sorry, I forgot that limit. You can add them as text and someone else will fix them up. \$\endgroup\$
    – Transistor
    Commented Aug 2, 2016 at 17:25

3 Answers 3

1
\$\begingroup\$

This sounds like a software issue of the I2S bus on the Raspberry PI.

In these cases I would be very tempted to break out the scope to probe the BCLK and DACLRC lines of the DAC board. The LRCLK signal should tell you the sampling frequency of the DAC. It could be the audio sounds like lower/higher pitch or distorted, because an incorrect sample frequency is used.

Also make sure the BCLK is correct. You can verify that by looking at the bit depth of the DAC and the sample frequency. The product of these 2 should give you the BCLK frequency.

It seems like the WM8731 is pretty flexible in the audio format it accepts. You should be able to send it 48kHz 16 or 24-bit I2S data without any issues. Make sure your RPi software is configured to output those exact settings to the DAC. Maybe the software is still configured to 44100Hz. I am not sure if this DAC supports that sample frequency (because it does not fit nicely between 8, 16, 24, 48, 96 kHz)

\$\endgroup\$
2
\$\begingroup\$

Well, if the input frequency is 19 kHz and you sample it at too low a frequency like 27 kHz you will output an aliased signal at 9 kHz: -

enter image description here

Your sampling rate needs to be greater than twice the highest frequency you wish to reproduce.This could also explain why when you play a song it plays back too slow.

If the sampling is at 34 kHz then you could also produce 15 kHz due to aliasing. I suspect you have your output sampling rate set too low.

Also, as another idea, if your source audio is digitized at a different sampling rate compared to your playback rate then you will get similar problems.

\$\endgroup\$
1
\$\begingroup\$

The playback speed issue is most likely a software problem. Or maybe a circuit design problem where you are hot clocking audio data into the D/A converter at the proper rate.

The other problem you describe is most likely the result of "aliasing" which is a common side-effect of analog to digital and digital to analog conversion. The analog audio must be properly bandwidth filtered to eliminate false alias signals.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.