The design makes use of 2 timers to provide audio output. A buffer amplifier is used to drive the speaker. The tone of a note is set with one timer and the duration of the note is set with the other. The harmonic content of digital output is discussed.
PIC18F4550 Audio Output