11

Formal languages

In language-theory and grammar-theory, a language is the output generated by a grammar.

Let's say "the grammar" is the rules and "the language" is the sentences and words that may be produced by those rules.

For example, we can say that this text "The some the although are is about over on under thin then over we the when." is not part of the English language although punctuation is correct and the words belong to English. That expression is not a sentence in the English language because cannot be generated with the grammar rules (ie: Sentence => subject + predicate, Subject => xxxx, Predicate => [complements] + verb + [complements]) etc.

Music theory

In terms of chord-progression, I know that "what sounds good" will depend on the "culture" you are, the style of music, what epoch/century is your analysis corpus is located and so on. It's not the same Flamenco, than Jazz, than Chinese popular music. Completely agree. Narrow this question down to western classical music.

So... there are chord sequences that would "violate classical rules". Hey, I already know that one can use whatever chord sequence one wants. But there are chord-sequences that are considered "grammatically correct" and others "not correct".

For this question, I don't care if "the rules existed centuries ago" or the rules are discovered now that we analyzed music from centuries ago. For this question, let's assume the rules just exist in classical music theory books.

Question

I would want to know if the "generative rules" of a "formal grammar" able to tell if "the next chord in a sequence" is "part of the language or not" (ie: Belongs to the set able to be generated by the grammar rules) belong to language level 0, 1, 2 or 3 in the Chomsky's categorization and WHY those rules are in that level.

For more concrete references:

References on chord-progression compiled rules

There's this old VST plugin "Harmony Improvisator" that was able to "generate" chord suggestions in function of the current chord. I don't know if the suggestion was also conditioned by the previous chords before the current one.

My interest in this question is only limited to a set of rules that might have been the one that the authors of "Harmony Improvisator" could have used.

They say in their page:

Composing with the rules of classical harmonic theory

and

learn functions and rules by heart in order to create classically correct, colorful music

Related questions in this site

There are other questions on this SE site that reference Noam Chomsky's grammar theory:

This one asking about generative music: What are the newest innovations in generative theories of music?

This other one comparing "learning music" with learning your "mother language": Why is music is taught by reading sheet music?

Chomsky's work

Chomky devoted his life to the theory of any grammar for any language invented or to invent. This encompasses the human-languages like English, French or Catalan, the computer languages like C++ or Java, or many other languages that are made of "sequences of things".

So Question

How can I tell what Chomsky's hierarchical level is the "classical rules of chord progressions" in?

11
  • 2
    Since this is a question about the expressive capability of a formal language, I think you're going to have to specify your algorithm precisely before it can be answered. (NB when talking about "levels" here, you're referencing Chomsky's work in mathematical logic, not natural languages). It could well be that the VST you mention is using, e.g., a Markov model and isn't using a "generative grammar" in any useful sense.
    – helveticat
    Commented May 28, 2020 at 14:23
  • 3
    The basic premise that music is a language , therefore it must obey certain rules is flawed. Take any three diatonic notes or chords, and they can go into 6 different orders, and still be acceptable. With words, you do can't that!
    – Tim
    Commented May 28, 2020 at 14:38
  • 1
    @Tim, I kicked the red ball. The red ball I kicked... The ball I kicked was red. You can re-arrange word order. And certain chord progression are not reversible. iv6 Fr+6 V cannot be randomly re-ordered. Commented May 28, 2020 at 14:56
  • 2
    @MichaelCurtis - for every one of those examples, there's dozens of examples that do work. The red ball kicked I. And your 3rd example cheated! I was the kicked red ball.
    – Tim
    Commented May 28, 2020 at 15:01
  • 2
    Cheated? The ball I kicked: red. I suppose you need to punctuate with a colon to use only the words of the original line. I would also say that re-orderings aren't all equivalent, they can have different implications. The point is there is some degree of flexible reordering in both language and music. Commented May 28, 2020 at 15:10

9 Answers 9

9

First, there are not the rules of classical music. Different people have put forth different rules. I would also rather think of these rules as strong suggestions instead of invariable laws. Therefore, if you would use formal language theory to create a classical music parser, you will most likely fail to apply that parser to all but a tiny fraction of pieces.

Now, let's pick an example of rules, for example Percy Goetschius's Exercises in melody writing. Here, chords are grouped in different classes. For example, a chord of the Tonic class may progress into any other class whereas a chord of the Dominant class most likely progresses into the Tonic class. And so on. What you should see here is that every chord (i.e., the literals of our formal language) has some associated state (the class). This class is clearly finite and it is easy to construct a finite automaton that accepts these rules (if one would really want to do that, which I find rather questionable). This shows that this formal language of chord progression rules is regular (or Type 3).

Musical form aside (since it is not mentioned in the question), I cannot think of a reason why a formal language of chord progressions should not be regular. It is after all not that difficult to tell which chord progessions sound good. And, more important, you do not need knowledge of a possibly infinite number of decisions for chord progressions that you have done in the past. So you can encode all the information needed to decide which chord to use next into a finite number of states. If we want to conform to some musical form, however, things will be more complicated.

Last, I agree with the comment by helveticat that for use cases like the Harmony Improvisator, Markov Chains seem much more applicable. After all, the rules are often phrased with words like “tendency“. And I would take the advertisement of the Harmony Improvisator with a grain of salt. :)

6

Not being familiar with Chomsky's work I cannot directly answer this but I would point out that in the case of Language the example sentence you wrote does not invoke any coherent ideas in the mind of the reader or listener. I do not know if Chomsky's rules predict this and never lead to an ambiguity but it would seem that this mapping of words to ideas in the mind is a requirement for a language to be useful. This is how I communicate my thoughts to others so that they can replicate what I am thinking based on the signals I provided them. Their replica may not be a faithful representation of the original thought.

Some musicians do refer to music as "a language". This serves many useful purposes one of which is to express to new students that it is more important to "play" and come to an understanding of why some ideas work rather than others than to learn a set of rules then try to play. However, this is an analogy and not necessarily confirmation that music is in fact a legitimate language. Even in western classical music these "rules" are really guidelines for best practices that have evolved over centuries (perhaps the rules of grammar are the same, a set of best practices that have evolved over millions of years).

A non standard chord order is not the same thing as a disallowed word order. No chord order is capable of invoking a coherent thought like "Feral dogs are approaching and will attack us in less than 4 minutes". The only thought I can think of is "Hey, that chord progression sounds like most others I've been told follow the "rules" of music", or "That is an interesting choice of chord order". But in both cases a string of words in my language come to mind to describe whatever state of mind I find myself upon experiencing the chords. The "chords" themselves do nothing to convey this or that idea.

Also, I would not necessarily say that chords are the words and their order dictated by grammar. Chords, even in classical music are secondary to melodic theme. That has more of a linguistic character if anything. One can also have 2 part harmony, parallel or counterpoint, homophonic or polyphonic. Why single out the chords as being the musical equivalent of words?

I realize that you have framed the question "in terms of chord-progression" and "western classical music" but this very constraint might be a huge red herring.

4

Well, when you get into fugues and symphonies and operas you are definitely beyond a context-free grammar. In a computer language like Java, the meaning of a + b depends on the declarations of a and b; i.e. integer addition or floating-point addition? Making sense of a Beethoven symphony or Wagner opera requires noticing the declaration of the motif, like the first four notes of Beethoven's Fifth or Siegfried's Horn Call, and noticing how it pops up later in changed form. This is getting into the semantics of music, but for me, syntax and semantics are tied together in music just as in literature.

4

I like the analysis in the other answers here, but considering the concepts of key and modulation in a classical context I think chord progressions must be at most Type 2 (Context-Free Grammar) or lower. A Context-Free Grammar is more powerful than a Regular Grammar which can only encode sequences and repetitions since it can encode local context or bracketing (like the previous Key during a modulation section).

Classical works up into the Romantic period predominantly have a prescribed key or tonal center which determines a set of harmonies. Deviating from this set is either a small ornament (passing chord which would be grouped into a phrase with its surrounding chords) or an extended section which is a modulation to a new key. In the classical style, a modulation normally returns to the previous key so there is a sort of local context that is carried through the section.

I'm assuming that a modulation to a new key is always paired with a modulation back to original key later on, forming a phrase structure. Since these structures can also be nested (ie. A modulates to E which modulates to B before modulating back to E and then finally back to A), representing this structure in the grammar is beyond the power of a Regular Language.

Using the chord categories from Goetschius, here's a stab at such a grammar:

<tonic> := I | vi
<dominant> := V | V7 | V9 | vii° | vii°7 | iii
<subdominant> := ii | ii7 | IV | ii9 | IV7
<from-tonic> := <tonic>
              | <tonic> ( <from-tonic> | <from-dominant> | <from-subdominant> )
<from-dominant> := <dominant> <from-tonic>
<from-subdominant> := <subdominant> ( <from-dominant> | <from-tonic> )

So far, this is a Regular Grammar. I'm thinking about how to tackle the rest... (to be continued).

6
  • I'm not quite sure if I understand you correctly, but since there is only a finite number of possible modulations (and an even smaller number that ”makes sense“) shouldn't it be possible to just stick the automata for the different new keys together with transitions back to the original key? That would still be a finite automaton. Maybe I'm missing something, but I don't see anything distinctly context-free here.
    – mka
    Commented May 29, 2020 at 5:28
  • I'm considering modulation-away and modulation-back as a bracketing structure, like balanced parentheses. In a finite automata you can't carry along the memory of "original key" more than a finite number of steps. You could certainly construct finite automata for any finite list of examples, but it doesn't have the power to describe the balanced structure in general. Hence the common wisdom that regular expressions are the wrong tool for parsing html or any text with brackets or parens that must be balanced. Commented May 29, 2020 at 6:07
  • 1
    But detecting balanced parentheses is not regular only because there may be an infinite number of those parentheses, so you cannot construct a finite automaton that detects an arbitrary number of these nested levels (you would need an infinite number of states). This is, however, the core of my objection: There is no infinite number of possible modulations so sooner or later you must return to the original key.
    – mka
    Commented May 29, 2020 at 6:23
  • I think my point is more about the nesting than the number of possibilities per se. Suppose you have a piece that starts in A then modulates to E and then within that section modulates to B before going back to E and then back to A. The recursive nature of the phenomenon IMO requires a grammar with the power to describe that structure. ...But, I'm pretty persuaded by @MarkLutton's answer. Describing a theme or motif (and recognizing its recurrence) seems to require more memory than even a CFG has. Commented May 29, 2020 at 8:23
  • 1
    I think you should state in your answer that you assume that each modulation requires an inverse modulation (like blocks in a structured programming language). I assumed that you regard modulations more like a journey (you needn't travel back exactly the same way). Regarding the recursion: Let's assume we have a LISP-like SExpr grammar that we want to limit to a depth of 3. Then we can introduce nonterminals sexpr0, sexpr1, sexpr2, sexpr3 for each depth. Thus, we can eliminate the recursion if we have a bounded depth (my assumption). But I agree that dealing with motifs etc. changes everything
    – mka
    Commented May 29, 2020 at 9:24
3
+50

To start, there is a pretty significant difference between classical harmonic theory and Classical harmonic theory. It sounds like you're asking the question with respect to Classical harmonic theory (the harmonic theory characteristic of European Classical music) but they capitalize "classical" in the screenshot you posted. You could take this any number of ways but I'm willing to guess that they mean classical music theory in the way that most people would simple describe as "music theory". Swing rhythms and the blues scale are both fair game in classical music theory but not so much in Classical music theory. "Classical" is one of the slipperiest words available for regular use.

I'm gonna push back, though, against the instinct to cry "music is a mystical force incompatible with the mundane machinework of language theory" and try to actually see if it might fit. Like any other reasonable pedestrian, I'd never heard of the Chomsky hierarchy but wikipedia tells me that you need terminal, non-terminal, and start symbols. It seems like a pretty good place to start to figure out what our non-terminal elements would be in this model. If you're just talking about the chord progressions and not actually the music, then we can ignore:

  1. the fact that chords are made up of notes
  2. amplitude (and thus sound, dynamics, etc)
  3. time (and thus tempo, rythmn, etc)

It might sound like I'm sidestepping your question here but I think you're only asking about the chord progressions, which are a drastic layer of abstraction, and not the music itself. If I remember my Music History class properly, the composers of classical music were guided by rules relating to harmony, which has already been abstracted away if our atomic unit here is the chord, so the language in question would not be the same as the ones the composers were "speaking".

It would, however, be recursively enumerable, as any chord progression is comprised solely of chords by definition and none of them, to my knowledge, are infinitely long.

I have to stop here because I'm beginning to realize the time commitment, but everybody feel free to tear this to shreds or build on it, as you see fit.

1
  • This is a good start. Can you add a little more? Commented Jul 12, 2020 at 5:32
2

My first guess would be that music can only be described by a Type 0 language. However, I couldn't think up a quick example. Also, it depends on what is included in the question; is only a chord progression needed or rhythm (which we can impose on chord sequences by requiring or allowing harmonic rhythm in addition to the nominal rhythm of the music.) And to reference Goetschius, with respect to melody, almost any irregularity (something rejected by the grammar) can be made regular by repetition. I would think that most irregular rhythms can be regularized by repetition. I think that (as irregularities may occur in an irregular type of repetition), description of melody or rhythm is at least unboundedly context-sensitive; it's not clear that chord progressions cannot be treated similarly. Irregular "atonal" or serial composition may not count as chord progression need not be part of their description.

Several attempts have been made to make the connection over the last few years. Most of these papers seem to go with Type 1 at least (context bounded is too restrictive).

https://royalsocietypublishing.org/doi/10.1098/rstb.2014.0097 https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3367686/ http://webprojects.eecs.qmul.ac.uk/marcusp/papers/RohrmeierPearce2018.pdf https://puredata.info/groups/pd-graz/label/book/bang_10_juri_80-89.pdf https://mtosmt.org/issues/mto.15.21.2/gjerdingen_bourne_structure.html

One example of problems in such a description is exhibited by the Folia progression: i-V-i-VII-III-VII-i-V-i where the first V-i isn't really a cadence (or need not be) but if the composition ends as here, the last V-i is. The cadential quality of of the VII-III can be modified (I tend to end the phrase on the first VII so the VII-III doesn't occur in cadential position.

Similarly, examples of a cycle of fifths in minor may have a minor v chord until the last couple of measures then switch to V-i. There's an arrangement of Greensleeves as a Romanesca in Bukofzer's book on Baroque Music which goes i-VII-i-v-i-VII-i-V-i-III-VII-i-v-III-VII-i-V-i. Others use an opening i-VII-i-V. The point is that the usual i-VII-i-V isn't necessarily a cadence but one needs a possibly unbounded context to figure this out.

Also contributing to the analysis problem (and why I like Type 0) is that certain features may be omitted. The "trio" section of marches (or polkas) is traditionally in the subdominant but the music often ends there. Is this an omitted I in I-IV-I overall structure or a I-IV or a V-I deceptively written as I-IV?

0

I think none.

That's because there's no way to encode rhythm in any of them, and it's absolutely crucial. You would need to do a lot of bookkeeping on the side (count beats) which would not "embed" nicely into your grammar.

It's similar to how you cannot parse C++ source without actually keeping track of semantics (available constructors vs functions).

0

Try using the Mingus module in Python (use pip install mingus to get it). [Mingus is a package for Python used by programmers, musicians, composers and researchers to make and investigate music.] You 'll get all you need from it (I believe). Thus, you needn't be worried about programming a language for music.

2
  • Welcome to Music.SE, @Sam! Thanks for contributing. This question isn’t about programming; it’s about possible similarities between harmony and linguistics. Hopefully everyone will be kind, but be prepared for quite a few down-votes... Commented Jul 14, 2020 at 10:21
  • Thanks for the warning... I haven't learnt of such a relation, but when I read through the question I felt it was mostly related to programming than anything else. No worries ! I have always been scoring downvotes for most of my answers (except on Quora) ☺ .. Commented Jul 15, 2020 at 2:16
0

Short proof that context-free is not enough:

  • suppose you have a song that simply repeats a verse V. That makes your language V^n, which is regular.
  • Let's say that the verse consists of three lines, so that makes it (abc)^n which is context-free.
  • But now in the final verse you repeat the last line 3 times (before the final chord, but let's ignore that), a very common device. Now you have (abc)^n abccc and that's no longer context-free because it does not satisfy a pumping lemma.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.