CREATING A PLAYER PIANO

Another possibility for a piano program is to have it play all by itself. You can provide it with a series of notes and durations, and feed them to the key behaviors at the proper time.

The first step is to come up with a simple notation scheme. Specifying the notes by their member names is a good start, but you also need to specify their duration. A good idea might be to measure this in one-tenths of a second, or six ticks.