I'm interested in computer music, where there are approaches to treat pieces of music as sentences in generative grammars or L-systems. Instead of composing, one could then specify a grammar and let the computer generate the music. E.g. the Yale group around the late Paul Hudak are very strong in that.

It has struck me that we use seemingly one-dimensional representations of information to represent higher-dimensional things, like plant growth with L-systems. Music, to me, seems to have at least two dimensions: The obvious time dimension and the "instrument" dimension, i.e. the ability to have several different sounds at the same time. And indeed, music notation has exactly these two dimensions.

There are 2-dimensional programming languages like Befunge, which didn't strike me as very useful (yet), but I couldn't find anything about generative grammars, where the sentences are 2-dimensional.

By a 2-dimensional sentence I mean that the characters are spread on a 2-dimensional grid, e.g. like this:

ab cde
dca  b

Production rules could have 2-dimensional sentences on either side of the rule as well:

a -> bc

b -> cd
e    ab

Has something like this been studied before?

For example in computer music, this could be quite useful. Pieces like Ravel's Boléro could be generated by a 2-dimensional production rule like this:

t -> tt

This should be read as "If in a piece, the theme t is played by instrument 1 at some time, then we can produce a new piece in which t is played by instrument 1 at the same time, and immediately after by instrument 1 and 2."

  • 2
    $\begingroup$ There are "graph grammars" which may be at least related or useful. $\endgroup$
    – usul
    May 1, 2015 at 14:06
  • $\begingroup$ your concept of "n-dimensional" seems to be your own & not to be defined in those terms in CS, & its not formally defined & seems to be used in multiple different ways above. $\endgroup$
    – vzn
    May 2, 2015 at 15:54
  • $\begingroup$ @vzn, I'm asking whether this idea has been defined somewhere rigorously. I'm only giving a motivation why it might be useful. Why do you think it has been used in different ways here? $\endgroup$
    – Turion
    May 2, 2015 at 16:26
  • $\begingroup$ actually thinking over your ideas, fourier analysis can sometimes isolate separate instruments and the "dimensions" you refer to and there is some CS/ algorithmic research on separating separate instruments or voices from a "mix" (eg multiple voices at a party). the question also reminds me of the way separate instruments have unique "overtone signatures". as for all grammars, they have aspects relating to "dimensions" you refer to... eg derivations take place in a 2-dimensional space or grid of symbols (or tree/ graph, etc) so in some ways the question is not clear or too broad (wrt SE stds). $\endgroup$
    – vzn
    May 2, 2015 at 16:53
  • $\begingroup$ @vzn, fair enough, I've tried to clarify what I mean. $\endgroup$
    – Turion
    May 2, 2015 at 16:59

2 Answers 2


Yes, there are n-dimensional grammars and in some cases specifically applied to music, see for example Grammar-based music composition by Jon McCormack, which talks about parametric extensions to L-grammars, or more generally, Regulated Array Grammars of Finite Index, Part I: Theoretical Investigations by Henning FERNAU, Rudolf FREUND and Markus HOLZER which talk about n-dimensional array grammars.

  • $\begingroup$ n-dimensional array grammars is exactly what I was looking for! Thanks! $\endgroup$
    – Turion
    Jul 30, 2018 at 18:06

there is some theoretical/ scientific/ applied research into modelling music with CS formal grammars. see eg

however grammars may generally be too "regular" to generate interesting music. for that there are different approaches being explored eg genetic algorithms & there are many references on that. following, one highly cited article. this now known as the field of evolutionary music

  • $\begingroup$ see also computer music composition cs.se $\endgroup$
    – vzn
    May 1, 2015 at 20:30
  • 2
    $\begingroup$ I don't see where 2-dimensional grammars come in here. $\endgroup$
    – Turion
    May 2, 2015 at 11:00

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.