Code not doing what I want it to do

For one thing you only set key in setup(). This only runs once

In loop() you never look for other keys, so unless your play test is satisfied in setup() your tune will never play.

Allan