. Piano Component by Cory Sites

Piano Component by Cory Sites

The only implementation that is not included in my solution is the advanced dynamics.

  1. Polyphony

    This is implemented pretty easily. With a factory generating notes, each note keeps track of its own length and this allows for multiple notes to be played simultaneously with ease. It supports all 88 notes of a standard piano, but due to the limitations of the delay queue in the Karplus-Strong algorithm, some of the higher frequency notes come out shorter than they should be.
  2. Envelopes

    Within the piano class is an envelope that is similar to the attack/release class. In the score file, a name of "keyheld" indicates the length that the key is pressed down. At the end of this, the note is dampened using the envelope and simulates the dampening of a piano string.
  3. Pedal Simulation/Noise

    When the value of the member function "m_pedal" inside the piano factory is set to true, it negates the dampening caused by reaching the end of the duration of "keyheld". When the pedal value is set to false (as if the pianist let off the pedal) it is reset and the normal dampening occurs when the key is released. In addition, when the pedal is pressed or released it plays a recorded sound to simulate the sound of a piano pedal.
  4. Dynamics

    In the score file there is an attribute named "keyspeed" that is a double ranging from 0 to 1. The default value is 1. This affects the amplitude of the piano sound generated by each note. The higher the value, the faster the key is being pressed, and thus the louder the note sounds.
  5. Advanced Dynamics

    not implemented.