Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Sound generation via PWM

Not open for further replies.


Newbie level 3
Sep 20, 2006
Reaction score
Trophy points
Activity points
pwm sound generation

Dear friends,

I need to play 8-bit, 11kHz, mono .wav files using an MCU. The sound quality doesn't have to be great.

The idea is to generate a 11 kHz PWM with varying duty cycle proportional to the current sample's amplitude. The PWM will be generated by AT91SAM7S64 MCU.

A friend of mine proposed such a circuit

I am not sure what should be the values of caps and the resistor forming the filter network. Any help here?

pwm sound

The frequency of the PWM signal should be as high as the MCU supports for 8 bit PWM. The PWM signal should be applied to a low pass filter, with the cut frequency of 5.5kHz (for 11kHz sampling), and the filtered signal goes to audio amplifier.
Thus, the high frequency PWM signal is attenuated, and the speaker gets the time medium signal, which is proportional to the sample's amplitude. A simple RC filter may be enough, if the PWM frequency is high compared to 5.5kHz. If not, u need a higher order filter. Consider that the high frequency PWM signal is about 5V in amplitude, and if not properly attenuated, it would saturate the audio amp.

I've tested this for voice signal sampled at 8kHz, with 8bit PWM and the PWM signal frequency of about 40kHz, on Atmel AVR. The audio signal was applied to A/D converter and "copied" to output on PWM. The results were acceptable for 8 bit.

The circuit in the image isn't a lowpass filter.

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to