This line is writing out of bounds and trashing memory:
songnum[2]=0;
songnum[] is a two element array and arrays are indexed starting from 0.
Delete this line. It does nothing useful.
key == NO_KEY;
By the time loop() is executed, the variable "currentlength" is always 2. Did you fix the ==1 as suggested above? If so, the tune will be played ONLY if the last valid key entered is '1'.
if ((currentlength==2)&&(songnum[1]==1)){