The Piano Component is implemented to have near full functionality. In order to obtain a full list of keys for a standard piano, I found a set of piano samples online for each key represented on the keyboard. I then took these sample files, and loaded them into my component using my LoadWave function. Once they were loaded properly, I generated a wavetbale for each note which contains a vector of the actual wave itself, as well as some important memeber variables to classify each note, such as notename, samplerate, and sampleframes. Once a wavetbale has been set up for each of the notes, I then create a master vector of wavetables, which contains every note on the piano. If I need to access a note from that vector, I can simply use the LookupWave function I created, which compares the notename, and sets the current note according to the master vector of wavetables.
The elements of the Piano Component I have implemented based on the grading rubric are as follows:
Plays piano notes: My piano component can play all of the notes on a standard piano, and those notes do in fact sound like a real piano.
Envelope Generation: I have created a function in my component called Attack_Decay, which takes care of generating an envelope for a note which elminates the popping sound.
Basic Dynamics: Notes can be played louder or softer based on the amplitude associated with each note.
Please listen to a
composition of the piano's features.
See the score file for
this composition.