SoftwareI've decided not to release the source code or hex code for this project, but I'll write up the main concept: One of the CCP-modules are used as a PWM-generator, and is running completely standalone (not generating any interrupts). The second CCP-module is used to generate an interrupt on compare-match 22050 times each second. This interrupt routine will load the next sample for each of the sounds that are set to be played back, and all these samples are easily summed (signed 8-bit variables) and loaded into the PWM-module after adding DC-bias to get the samples to swing around 2.5 volts. Another timer generates the time base for the tempo.
HardwareThe main idea was to keep the hardware as simple as possible, and do as much as possible inside the PIC. As of now I haven't even added the OP-amp in the schematic below. Most of the software was developed on a prototype on a breadboard:
Later the first hardware revision was made. Unfortionately, I never took the time to make a PCB in Eagle: