I would like to interface a small speaker, with PWM. I need to generate some ringing sound for a door lock, so that it gives audible alert when it's open.
I was going to store a few samples (say 2K) as program memory, and than play that over and over again.
I don't know how to "generate" those samples. 2K ~ 0.25sec @ 8000 samples/sec, and when I tried to just play a wav file, you could hear when it started from the beginning...
If you know any good algorithm to generate such a sound (a fourier transform, or anything else), I would be very happy :)