Ever wanted to play audio on an 8-bit microcontroller? This is possible by using the hardware PWM-module of your microcontroller;
- You configure your PWM to work at a fixed (high) frequency of something around 100 kHz.
- Configure a hardware timer module to give an interrupt at the rate of the sampling frequency (e.g. 8000 Hz).
- Every time and interrupt occurs you update the duty cycle of the PWM module with the next value in the PCM-buffer created by pcm2hdr
- Put a low-pass filter with a cut-off frequency of half the sampling-frequency after the PWM-output of your microcontroller.
- Et voila, you can enjoy your noisy sounds, awesome!