1. A method for extracting melodic patterns in a musical piece, the method comprising: receiving data which represents the musical piece; segmenting the data to obtain musical phrases; recognizing patterns in each phrase to obtain a pattern set; calculating parameters including frequency of occurrence for each pattern in the pattern set; and identifying desired melodic patterns based on the calculated parameters.