Too lazy to click the mouse on your piano? This program by Keivn has an extra "player" sprite that composes music for you. It is not very exciting music---just random noodling around on the C-major chord with a 4/4 beat, but it shows how to write a tiny composer that is no worse than the loops in a lot of crude games. It uses the polyphonic piano, but you could easily remove most of the visual parts and have just the sound.