Creating a factory of musical notes
Composing music with computers is something very common nowadays. Creating software that allows a musician to create his own music looks easy but it is not, mainly because there are lots of possibilities for each note.
In this recipe, we will use the pattern Abstract Factory. This pattern will allow us to change the note type that we want to create, and it will also initialize the note type for us.
As you may know, there are a lot of note symbols; you can check this URL on Wikipedia if you want to know more about it: http://en.wikipedia.org/wiki/List_of_musical_symbols.
However, for this recipe, we will work with three types of notes: the drum quarter note, the piano quarter note, and the quarter rest note. Of course, this is only an example; in a real program, probably you will have to complete it with tied notes, and so on.
Getting ready
Create a project called Chapter 4 Musical Notes
; now, download the pictures that correspond to this recipe from the Internet...