# Analyzing Beethoven without preassuming existence of major/minor scales



## comethalley (Oct 7, 2016)

Hi,

I am doing my bachelor's thesis in Computer Science and Music, and I'm working on automatically analyzing music. I've already developed methods for determining what key a given piece is in assuming that it's in either a major or minor key, and that it is in the same key for most of the piece. Of course, this opens up the door to analyzing harmony in all the classical ways.

What's difficult is that I am now analyzing music that changes key (such as Beethoven piano sonatas), and that may or may not be in minor and major modes (such as Debussy and non-Western music). As far as I can tell, most harmonic and even melodic analytical methods that were developed for tonal music depend on knowing what the current scale is, but without preassuming that scales are either major or minor and/or are constant, it is harder than one would think to teach a computer to guess what scale is prominent at any moment in the piece (the tonic is not always statistically used more than other notes, borrowed notes might appear to be a member of the current scale, a passage which modulates from C to G might seem like an 8-note scale that is equivalent to C major with the addition of an F#, a passage might happen to use only 6 distinct notes even if it should be considered the same as a passage with 7 distinct notes, etc.).

The way I see it, there are two possible paths I can take: I can develop some method for guessing the scale at any given time (which seems impossible, but maybe there's a simpler way that I'm not seeing), or I can forget about talking about scale degrees and start adapting terminology used in analyzing atonal music, such as pitch set theory (or redefine scale degrees in terms of pitch class theory). However, I haven't seen anybody writing about Classical and Romantic-era music using the language of pitch classes. 

(In case you're curious, the reason I have to come up with something so general is because I will be doing a mathematical analyses of the relationships between different types of music, so I need some universal metrics to analyze them).

Do you have any suggestions for resources/advice in trying to understand Beethoven without assuming that we already know he uses major and minor scales?


----------



## Weston (Jul 11, 2008)

I'm just a layman thinking out loud but I find this stuff interesting. 

You've probably already rejected or included this, but couldn't rhythm and especially accent - the slightly louder notes - and the end or destination note of a phrase come into play to help determine borrowed notes or passing notes and then disregard them? A phrase is not likely to end on a non-scale note or a note other than the root, third or fifth in common practice music. Of course I have trouble myself determining where a phrase begins or ends. I have no idea how a computer might determine this. Phrases don't always begin and end neatly at the measure markings, do they? 

What a brain twister! My hat's off to you for attempting this.

:tiphat:


----------



## MarkW (Feb 16, 2015)

My problem with what you are doing (using the word "problem" non-judgmentally) is that what key a (usually) post-1750 work is in, is less important for its effects than whereto and how it modulates away from the home key and by what subterfuges it gets back. Identifying a starting and ending key is relatively unimportant and the modulations in between sometimes go by so quickly they can barely be recognized before it's on to something else. Beethoven developments can be full of these. It's more a question of being able to identify the likely key of a particular chord in context -- although these can be ambiguous, and you've got things like enharmonic modulations to contend with. You also have archaic modes to deal with, and ...)

I'm not saying what you're doing can't be done, but I think you need a little more background in how harmonically-based music works. You need to read program notes and analytic essays to get a sense of what kinds of things to look for. The program essays of Donald Francis Tovey and Michael Steinberg are good places to start. Good luck!


----------



## millionrainbows (Jun 23, 2012)

> I've already developed methods for determining what key a given piece is in assuming that it's in either a major or minor key, and that it is in the same key for most of the piece.



You have? What method is that? Tell me in detail. What are the things about a "key" that you have already figured out? List them.

You seem to be thinking in terms of scales; but changes of key are based on root movement. You need to develop a way to identify root movement separately, even in your first version of the software, before you can ever hope to go further into modulations.

You need to be able to identify chord functions, as functions of root movement. Can your software tell what the root of a chord is, and what function (I-ii-iii-IV-V-vi-vii) it performs?


----------



## comethalley (Oct 7, 2016)

Hi,

Thank you all for your responses. 

Weston - I am taking into account emphasized notes, and I would like to be able to identify cadences/phrase boundaries. Obviously that is not a simple endeavour! I will definitely try to identify passing tones based on these cadences if I am able to identify them - thanks for the suggestion!

MarkW - thank you for your advice and reading suggestions. I know there's always more to learn about how harmony works, and that's especially true for me as I have only been studying music for two years! That being said, I am super aware that key is nowhere near as important as key in context. (In fact, that's the reason most pre-existing computer analyses of music fail - they don't see the similarities between similar things happening in different keys). The reason I need to know what key music is in is 1) to do any harmonic analysis across time (how many times/how quickly does he modulate (as you mentioned), does he return to a key he's been in before, does he tend to use II-V-I progressions, etc.) and melodic analysis - I can't identify if something is a transposition of something else if I don't know the scale being used. 

Millionrainbows - You're right, my tool for figuring out major/minor scales is far from perfect. It is a probabilistic algorithm that looks at features concerning the relative prominence of different notes, and compares them to pieces that have already been determined to be in a given key. I do try to identify the function of a chord based on the key I believe the chord is in - doing that badly is very simple, doing it well is probably beyond the scope of my project. I never thought about the difference between scales and root motion - would you mind elaborating on that?


----------



## EdwardBast (Nov 25, 2013)

I doubt scale is going to be a reliable indicator of key and I suspect it is a poor place to begin the computer analysis of works by Beethoven. Among other problems with the scale approach is that the minor mode does not reduce to a consistent scale, as the sixth and seventh degrees are variable. The first order of business should probably be recognizing cadences, which, in my experience, is what savvy humans tend to do. This would require that the computer recognize the roots of harmonies. Solving this problem should probably be the central priority. Once the important cadences are identified, I would then set your scale algorithm to work examining the pitch content immediately preceding each cadence.


----------

