Parsons code is a notation of the overall shape of a melody. Wikipedia describes it thus:
The Parsons code, formally named the Parsons Code for Melodic Contours, is a simple notation used to identify a piece of music through melodic motion—the motion of the pitch up and down. Denys Parsons developed this system for his 1975 book, The Directory of Tunes and Musical Themes. Representing a melody in this manner makes it easy to index or search for particular pieces.
Given a sound file containing a melody, how would a program calculate its Parsons code?