Microcontrollers can be programmed to play melody tunes. You first need to find out the right notes of the tune that you want to play and then convert the tunes to proper frequencies. After that you can program a microcontroller to generate those frequency tones in sequence with appropriate timing. This project plays a “Happy birthday tune” with a PIC12F683 microcontroller.
Happy birthday tune with a PIC Micro - [Link]









