Re: How to remove PWM pop and click

I'm using an Arduino Due to play wav-files, and every wave file that's loaded has a loud pop before it plays. At first, I thought that it must be the wave header, or just a poppy wave file, but even when I turn the volume down to 0, there is a pop.

I've looked at the code referenced above, but I can't find any pointers to fixing this problem.

I'm using the Due's default Audio library.

May I ask why you are not using the Due's DAC pins?

MrHaroldA:
I'm using an Arduino Due to play wav-files, and every wave file that's loaded has a loud pop before it plays. At first, I thought that it must be the wave header, or just a poppy wave file, but even when I turn the volume down to 0, there is a pop.

I've looked at the code referenced above, but I can't find any pointers to fixing this problem.

With 8-bit PWM audio, typically an 'analogWrite(127)' is 'no sound'.
This is "speaker membrane in the middle" at an average voltage level of "VCC/2".

But if you start from "voltage off" (0V) to 'analogWrite(127)' (VCC/2) and vice versa, you always get a loud pop, except you provide a suitable "fade in" and "fade out". Either within the WAV data, or before and after playing the data.

Sorry for the late reply! I was expecting an email notification on replies and forgot about this thread when I didn't receive anything.

Anyway: I was using the DAC of the Due and had a lot of popping, hissing and digital noise. This is also a 12-bit DAC, which is below my requirements.

The description on Teensy's Audio System Design also told me the following:

The output rate is 44.1 kHz (no oversampling). Ultrasonic noise present if not filtered. This may not be an issue for many uses, but care should be used if amplified and driven to high power tweeters.

As I'm going to use it for playing audio samples on big PA systems, I quickly abandoned the DAC's :wink:

I've now purchased an VS1053 shield for my UNO which can stream data directly from it's SDcard to the audio chip, so bypassing the Arduino and yielding way bigger data streams and sound quality!

... the only limit now is my C knowledge, and the lack of SRAM of the UNO. :wink:

A PWM output is probably lower quality than a DAC.

LMI:
A PWM output is probably lower quality than a DAC.

This is what Teensy says about using the PWM as audio output:

The PWM carrier frequency is 88.2 kHz. The suggested circuit will only slightly filter the carrier. Extra filtering will be required for a clean signal without the ultrasonic PWM carrier.

Analog signals created by filtering PWM waveforms use the digital power supply as their reference voltage. Any noise on the digital power line can directly couple to the output signal. The built-in DAC or audio shield should be used when higher quality signals are needed.