Are there any mathematical methods for identifying melodic shape, identifying motifs and general pattern recognition?

closed as too broad by David Bowling, Tim, ggcg, Doktor Mayhem Jan 25 at 13:33

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Perhaps this addresses the idea, dmitri.mycpanel.princeton.edu/sciencearticle.html – ggcg Jan 10 at 19:20
  • Almost all of music theory is ultimately concerned with numbers in one way or another, albeit often disguised... – topo morto Jan 10 at 21:31
  • I have worked on this issue in the other direction, i.e. generating convincing melodies using a set of mathematical principles. That was difficult but feasible. The other way around, i.e. what was asked in the question, seems to me impossible without making a number of a priori assumptions that in turn would make the result not too interesting. In other words, if you want to analyze music mathematically, you will only discover what you already know. – MMazzon Jan 11 at 1:03
  • @MicrologusSupport I get what you're saying, instead of analysis let's say we want to express our analysis mathematically? Can that be done?given that melodies, more often that not, contain patterns. – user36492 Jan 11 at 8:22
  • @AmanTrivedi Yes, you can definitely use math, statistics, graphics, charts, and so forth to express your musical analysis. And in this way you may be able to highlight certain aspects that are otherwise difficult to express. And seeing certain mathematical and statistical aspects may stimulate some original insights and stimulate new ideas. So it can help a lot from certain points of view, why not. But even in all these cases, the real work ,the real added value, comes from your own mind, from your own musical intelligence. IMHO – MMazzon Jan 11 at 11:36

You might be interested in checking out "Relating Musical Contours: Extensions of a Theory of Contour," a highly influential article in the study of musical contour. As a brief introduction, they consider a cseg (contour segment) to be an ordered representation of a musical line; <502314> is the cseg of the following excerpt:

enter image description here

(In short, you just take the available pitches, order them from lowest to highest starting on 0, and then list each pitch's placement. See the discussion of "c space" in the article.)

From there, you can then relate contours through constructions of matrices:

enter image description here

There's much more to it than that, but hopefully that whets your appetite if you're interested in studying further.

Since this sounds like it's for a high school lecture, you may want to stop there; the math in that article isn't rough at all. But if you're interested in getting into some more advanced math (or just checking out what else is available), I'll also recommend "New Directions in the Theory and Analysis of Musical Contour" and "Fuzzy Extensions to the Theory of Contour."


You actually should consider checking out the work of Guerino Mazzola and Jan Beran. Both come from Switzerland and seem to have a different approach. Jan Beran teaching at University of Konstanz nowadays, was studying records of different people playing one piece of music and was using analytical methods to study how a piece would sound. Guerino Mazzola seems to concentrate more on how the theory works and is using more algebraic methods to describe music.

"identifying melodic shape, identifying motifs and general pattern recognition" is a question of data analysis and data science, which is using different data sets. So yes, of course, something like this does exist with the right underlying statistical model. Maybe you can find some statistical models in Jan Beran's Statistics in Musicology.