This project is about playing back audio snippets, stored in flash memory, on some AVR microcontrollers (ATtiny85 and ATmega328p so far). My original intent was to modify existing software and develop a high-order filter to suppress the 62.5 kHz PWM carrier wave and a simple power amp to drive a speaker. There is a very nice Arduino library, Michael Smith's PCM library, for 8-bit audio samples with 8 kHz sample rate. You can produce input for this library by first converting a WAV file into a raw data array in a header file using Mathieu Brethes' wave2c tool. You can produce discernible sound with no or minimal filtering and amplification of this raw PCM signal. Just apply it across the coil of a loudspeaker and rely on the coil inductance and your ears to do the low-pass filtering.
However, I realized that bitcrushing (reducing the bit depth from 8 to 4, 2 or 1), not only allows longer audio samples to fit in flash memory, it also allows you to operate at higher PWM frequency, which makes filtering out the ultrasonic carrier trivial. I also wanted to be able to play a sample multiple times and to play multiple different samples. I then learned that ATtiny85 is better at PCM than ATmega328p and that's when I decided to write a new PCM library from scratch. It's called pcm-avr, has an MIT license, supports ATtiny85 and ATmega328p (so far) and does 4-bit audio with 4 MHz PWM frequency (on ATtiny85) and 1 MHz PWM frequency (on ATmega328p). I use it with gcc-avr directly and I don't know if it works with the Arduino IDE yet, but I did avoid things that I know break Arduino compatibility (like explicit interrupts on Timer 0).
With MHz PWM frequencies, a simple RC low-pass filter should suffice. I still need to build a power amp, which will probably be Class AB with negative feedback.
Hint: use more than one AVR to increase quality. Try stereo