You will need to have the STK static library installed. To do this, move the file named libstk.a into the '/usr/bin/' directory. After that, navigate to the PianoPong directory and type 'make' (you will need the Mac developer tools installed). Hopefully everything will compile smoothly. If you do not have a MIDI Keyboard you can run MidiKeys as a virtual MIDI keyboard. At this point you can type ./PianoPong and the game should start. Good luck!

Project Description

This game was made as a final project for Music 256a: Music, Computing, and Design I, at Stanford's Center for Computer Research in Music and Acoustics (CCRMA). For the class, we were programming in C/C++, and using the RtAudio (real-time audio) and STK (synthesis toolkit) libraries. The graphics us GLUT and OpenGL.

The idea was to take a simple pong-like game but to map the paddle control to a midi keyboard. The player must form a major or minor triad to create a paddle that can block the ball. At the bottom of the screen, you can see a list of notes - only when three those consecutive are played does a paddle form. The paddle positions correspond to all 24 possible triads (12 major, 12 minor).

I found that it was actually quite difficult to react in time with the correct triad. I decided to make the game a bit easier by calculating where the ball was going to land after each hit, and projecting a "ghost ball" in the correct location. This frees the player from having to both guess where the ball will land and prepare the triad at the same time.

To add a bit of fun/challenge to the game, I had the screen height shrink with each paddle hit. Only by collecting the "gems" can the player restore the screen height to it's full size. However, you may notice that collecting a "gem" increases the ball speed!

Sorry! the Youtube compression put the audio and video out of sync a little bit! It looks and sounds better on an actual screen.


Not only did I want to create a fun game, but I to to provide the opportunity for learning about music theory and about playing piano. There have not been many games (that I am aware of) that use a piano keyboard as a game controller and I think it is definitely an avenue worth exploring. If nothing else, this program will assist a new player in identifying note names and learning how different triads feel under their fingers.