Skip to content
/ piano Public
forked from egmcdonald/piano

An OpenGL application written in C++, simulates the internal movements of a piano upon key presses.

Notifications You must be signed in to change notification settings

lacial/piano

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

piano

An OpenGL application written in C++, simulates the internal movements of a piano upon key presses.

NOTE: executable will run best in OpenGL 4.x environments, 3.3+ also possible but not guaranteed.

Parts

There are 8 parts to the model:
  1. Key (only visible part from the outside of a piano)
  2. Lever (arm attached to key for hammer/dampers to sit upon)
  3. Pivot (non-functional, purely to show creation of tetrahedron object and point of pivot)
  4. Hammer Arm (arm to connect lever to hammer)
  5. Hammer (simulates hammer contact with string)
  6. Damper Arm (arm to connect lever to damper)
  7. Damper (simulates damper release from string)
  8. String (named in project as “wire” due to “string” library already existing)

Functions

There are many functions available for the user to interact with the model and they are printed to the console upon running the program. The model mirrors a simulation of the inner workings of a piano:
  • Upon pressing a piano key, the key and lever angle upwards, pushing the hammer/damper upwards towards/away from the string
  • Upon contact with the hammer, the string vibrates and the hammer/dampers are bounced back towards their initial starting position
  • The key and lever arm then angles itself back to a resting position

The vibration intensity of the string is dependent on the speed of the hammer; the faster the hammer, the tighter the vibration. This is comparable to the real functionality of a piano. The keys can move independently of one another and the hammer speed can be adjusted.

In terms of the program view, the user can rotate the view/object on all three axes and zoom in and out on the model.

Extensions

The global constants within main.cpp singlehandedly control the specifics for a singular model and its positioning; e.g. only a singular value needs to be altered in order to edit the number of piano keys within the overall model (MODELS on line 3 of main.h).

About

An OpenGL application written in C++, simulates the internal movements of a piano upon key presses.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 88.8%
  • GLSL 7.3%
  • C 3.9%