The formal language of music is the language of the pitch value alphabet A = 0, 1, 2,...N. The language is the set of all horizontal and vertical strings of pitch value letters (integers).

Formal language does not include any secondary elements in music like performance, volume, color, duration, rhythm, etc.

Since the alphabet is finite, the language is regular. It is that simple! (The free language is infinite but the number of states on musical instruments is finite.)

Regular languages are the simplest formal language in Chomsky's hierarchy.

The definition of a regular language clarifies the sense in which music is a formal language. Regular means the language has the property of recognizability You can recognize when music belongs to a key or tuning.

A regular language is the output of an automaton that reads music as input and writes music as output: a musical instrument is a finite state machine.

Music is a discrete-time finite-alphabet language. This defines the set of stochastic languages and regular languages are a subset of stochastic languages.

The automaton has a terminal state called the acceptor state which recognizes when music belongs to the musical key.

You can recognize when music is true to the theory of the key by ear and by analysis.

Then music that belongs to the musical key is true and music that does not belong to the musical key is false.

This true-false analysis is everywhere in music if you look.

If a guitar string is in tune, it is true; otherwise false.

A guitar can recognize when tablature is true to the tuning.

Consider a melody and suppose you change a note at random. Will you recognize the note is false? Almost always.

Everyone thinks music is mathematical but no one thinks music is formally mathematics. That is because ordinary mathematics does not have a musical key, so it seems that mathematic is not an adequate foundation for music.

Think of the set of all 6-line tablature written in fret numbers. Don't you think that is a formal language?

I think that mathematicians, linguists, and physicists do not understand music properly because they think it is a Chomsky natural language like English, that evolved by human use without a plan. Nothing to see here.

But if that is true, why did music converge on the common tonal practice which is the terminal state on musical instruments. The musical key has been conserved for hundreds of years, while English continues to evolve.

  • 4
    I’m voting to close this because it's an essay, not a question.
    – Tetsujin
    Dec 14, 2023 at 17:15
  • 3
    Wish I could understand half of it. There are several misapprehensions, and hardly a question. Vtc.
    – Tim
    Dec 14, 2023 at 17:30
  • 2
    You already start going wrong at "Formal language does not include any secondary elements in music like performance, volume, color, duration, rhythm, etc." Differences in note duration already make quite the difference. In fact, it is the only way the beginnings of the melody of Beethoven's 5th and the main melody of the Imperial March are different. Duration and volume differences also let repeated-note melodies be distinguishable from each other (e.g. "Mars" from The Planets, the 4th movement of Mendelssohn's Italian Symphony, the Live at the Acropolis version of Yanni's "Santorini").
    – Dekkadeci
    Dec 14, 2023 at 20:19
  • 3
    I’m closing this question because it’s not on-topic; it’s not even really about music. Dec 14, 2023 at 20:51
  • 3
    "Then music that belongs to the musical key is true and music that does not belong to the musical key is false": what does it mean to "belong to the musical key"? There are at least 24 keys depending on how you count, and far more if you include modes. Tonal pieces belong to only one key. Also, recognizability means that there is an algorithm that determines whether a string is grammatical. Yet you defined the grammar without reference to key, or tuning, so how can an algorithm "recognize whether music belongs to a key or a tuning"?
    – phoog
    Dec 14, 2023 at 23:42

1 Answer 1


I'm assuming your A is the notes on a piano from low A = 1 to high C = 88

You seem to be confusing the entire gamut of musical sounds A* with real music — you don't have to be very musically literate to recognize that Bach, Mozart, Beatles and Ravi Shankar are different. In formal language theory, Σ* for any finite Σ, is trivially regular whereas interesting subsets like aⁿbⁿ for a,b ∈ Σ are not regular.

Here is Σ* music without the guiding hand of Bach et al. More precisely that's a Mozart too young to be Mozart.

Besides there are other issues

  • You don't account for 'verticality' of notes ie. chords
  • A piano violin and drum are very different in quality
  • The musicality of the player — that's why we (still) prefer a musician to musescore
  • The cultural assumption that music can be shoe horned into the 12 tone system. See Dagars for micro tonal nuance

Etc etc

  • "A piano violin and drum are very different in quality ... The musicality of the player — that's why we (still) prefer a musician to musescore": these are not necessary features of a formal grammar describing music. "Romeo, wherefore art thou Romeo?" is a grammatical (early modern) English question no matter who speaks it or how.
    – phoog
    Dec 15, 2023 at 0:14
  • @phoog Try Beowulf then 😎. More seriously I think you're mixing up the music text (paper lilypond whatever) with the actual music. In western musical milieu "My version of Beethoven sonatas" could mean Tovey edition of the book or Brendel edition of the audio. This would be a bizarre polysemy in most other musical cultures. When I am talking of the music above I am talking of the music. Literally. Not a notational system for approximate representation
    – Rusi
    Dec 15, 2023 at 8:49
  • But the question is asking about the application of Chomskyan syntactic analysis to music. This kind of analysis doesn't capture every element of language, nor does it attempt to, so pointing out that it doesn't capture those elements when applied to music isn't a particularly significant criticism. It's like responding to a question about whether a bridge design can withstand a certain load by saying "the structural calculations don't account for the color of the bridge as reflected in the water." It's true, but irrelevant.
    – phoog
    Dec 18, 2023 at 3:42
  • @phoog To an extent your criticism of my criticism is valid. It's just that we have different gradation of irrelevance. I could, as a comp. scientist, have made a much more detailed and nuanced answer. Given that a mod thinks it's irrelevant(!) to this site I stopped. (I don't but then as I said I'm a CSist professionally, musician at best amateur-ly)
    – Rusi
    Dec 18, 2023 at 4:36

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