Abstract
Traditional harmonic analysis annotations can be represented in a computer model of a piece of music by plain text strings. But whenever automated processing like analysis, comparison or retrieval is intended, a formal definition is helpful. This should cover not only the syntactic structure, but also the semantics, i.e. the intended meaning, and thus adheres to the technique of mathematical remodelling of existing cultural phenomena. The resulting models can serve as a basis for automated processing, but also help to clarify the communication and discussion among humans substantially. This article proposes such a definition in four layers, which address different problems of encoding and communication: (a) relation of symbol sequences to staff positions, (b) combining functions, (c) chord roots, and (d) interval structure and voice leading. Only one of them is specific to functional (Riemannian) theory and can possibly be replaced to represent scale degree theory. The proposal is configurable to different interval specification methods and open to localisation. Syntax and semantics are defined by precise mathematical means, borrowed from computer science, and thus are unambiguously documented.
Keywords
1 Introduction
Symbol sequences representing harmonic analysis results can be attached to computer models of music as a mere auxiliary device for retrieval, analysis and comparison. Furthermore, in (historic or contemporary) documents from published music theory, such sequences may have a value on their own, as creative utterance by their author. In either case, automated processing requires clarification and specification of syntax and semantics of these symbol sequences and their different variants, by applying mathematical modelling. Such a clarification can also be helpful to add precision to communication and discussion among humans. The funCode proposal defines a framework in four layers, which address different problems of encoding and communication: relation of symbol sequences to staff positions, simultaneously sounding functions, chord roots, interval structure, and voice leading. funCode models the functional style of harmonic theory of Western music. Only the third layer must be exchanged for an adaptation to scale degree theory; selected layers can possibly be adapted to other cultures, whenever these employ the modelled concepts.
1.1 Harmonic Analysis Methods and Symbol Systems
Modern harmonic analysis of Western music began in 1726 with Jean-Phillipe Rameau ([1722]1965) and with the idea that particular patterns of interval structures and of chord sequences may have a characteristic effect on the listener, independent of most other aspects of a musical work like voice leading and instrumentation, and especially independent from transposition. Theories of musical harmony in the widest sense are already known from the times of antique Greek philosophy. But only when the keyboard became the leading instrument in practice and theory, and printing and publishing opened access to a wide range of diverse musical literature, could a debate about the harmonic structure of complex and elaborate compositions be conducted on an objective basis.
Various theories of musical harmony were proposed in the following centuries, with very different intentions: a theory can act as a mere description of a particular practice, or it can try to find reasons (based in physics or physiology) why a particular practice is sensible, or it can try to name and explain effects caused in the recipient’s mind; or, in the other extreme, a harmonic theory can act as a prescription, as a ‘cook book’ for correct accompaniment or effective composition, in a particular style. Most of the historic theories serve a certain mixture of these use cases.
A first milestone in the chain of reactions to Rameau was set by Weber (1817), who examined the triads on every step of the diatonic scale, in major and minor mode, and invented the roman numeral notation. Hugo Riemann started in 1877 with a large catalogue of possible chord interval structures and an even larger one of possible distances and relations between pairs of chords. (Riemann, 1877; Engebretsen, 2011) After many years filled with the tedious work of refactoring his system again and again, he finally arrived at the functional theory of harmony, which derives every chord from the three basic functions tonic, dominant and subdominant (Riemann, 1918). There were many others going also in this direction, even earlier, but it was him who found, at last, the clearest formulation and most comprehensible symbol system.
In the first half of the twentieth-century in particular, numerous further theories evolved, which can be strictly divided into the ‘roman numeral’ tradition on one side (also called ‘scale degree theories’, German ‘Stufentheorie’) and the ‘functional’ approach on the other. In more recent times, new theories have arisen beyond this dichotomy, based e.g. on the notion of pitch classes modulo enharmonics (Forte, 1973; Rahn, 1980), or based on even more advanced notions from mathematics like topologies (Vogel, 1975; Mazzola, 1990; Tymoczko, 2011; Cambouropoulos et al., 2014). 1 But in the traditional approaches, that dichotomy is still relevant, especially in education. 2
In all these theories the central means for discussing, explaining and analysing is some specially designed symbol system. This is given by a collection of rules governing how to create short-cut symbols for chords, their interval structures and their progressions, how to combine these symbols, and what these combinations should express. A first use case is to attach these symbols to selected time points in a sequence of notated music, which means that at these time points the harmonic situation corresponds to or is explained by the symbol. This is called a harmonic analysis and a symbol attached to a particular time point is a (harmonic or functional) label. A quite different use case is to employ a stand-alone sequence of such labels to mean an abstract sequence of harmonic situations or to represent any concrete fragment of music that matches it.
Each such theory comes with its own symbol system. Nevertheless there are pedigrees, variants, common subsets and families of systems, which treat many details in a similar or even identical way.
1.2 Possible Semantics of Harmonic Analysis Label Sequences
In practice there are very different kinds of semantics that can be assigned to a harmonic analysis label sequence, no matter whether functional symbols or roman numerals are used:
Making a psychological statement about the reception of a particular piece of music by ‘a listener’, like: ‘This sequence of chords will be recognised as Describing an (assumed) syntactical pattern, to make different scores (possibly in different keys) comparable, as in: ‘The sequence For talking about concepts in general, like in ‘Beethoven in his early works prefers the sequence For generating a concrete set of pitch classes. For example, when applied to the tonal key C, the first above-mentioned coding will produce this sequence of sets of pitch classes In the tradition of the older ‘figured bass’ notation, the interval numbers in the superscript of the functional symbol can be meant to indicate voice leading: two different numbers in the same stack position in subsequent superscripts indicate a change from the first to the second interval, executed by some voice of the score.
There are coarse as well as subtle differences between these use cases: ‘the listener’ in case S-1 can be (S-1-0) a theoretical construct, an ‘ideal listener’. Or it can simply stand (S-1-1) for the personal feeling of the author, without further claims. Or they can be (S-1-2) theoretic representatives of particular social groups with dedicated training, like ‘the average Telemann addict’ or ‘the hip-hop recipient’. Or they may be (S-1-3) concrete people from an empirical study. The real meaning of the symbol sequence is slightly different in each of these cases.
, but not before hearing the third chord.’
3
appears at these positions: …’
as nearer to the current tonic key than
.’
Semantics S-2 can be useful with different degrees of precision, for instance, one may want to address chord sequences without specifying the inversions.
Semantics S-3 can be relevant for encoding and automated processing e.g. when comparing, documenting and analysing analyses as such, i.e. works in music theory. It could be a fruitful attempt to translate the (approximately) 50 different publications on the harmonic structure of the first twelve measures of Tristan and Isolde into one format, strong enough to capture all intended semantics, and apply automated analysis.
Semantics S-4 has most of its relevance on the meta-level of discourse and practical work-flow: it shows which pitch classes are not covered, i.e. which are in the notes but not considered relevant by the author of the analysis, or, conversely, which are not present in the score but in the effective harmony, according to that author. Thus it can be used for correctness checks by author, editor, reviewer and reader.
Only the semantics of kind S-4 are currently computable by machines. It is implemented by funCode for the functional style of musical analysis, as it is done by Nápoles López & Fujinaga (2020) for the roman numeral style.
The differences between the semantics S-1 and S-4 are the widest: in S-1 the terms
1.3 Intended Use Cases
In the tradition of mathematical re-modelling (Lepper, 2021), our proposal does not invent anything new, but only tries to unify and simplify a family of historically evolved annotation styles, which are currently in wide use, and give them precisely defined mathematical semantics—to make them accessible for automated processing and to clarify their semantics unambiguously for human discourse. funCode is thus a contribution to practical data processing, not to music theory, but based on the theories of computer languages and harmonic analysis.
Even nowadays authors must still explicitly clarify their labelling system. The first footnote in the article by Heetderks (2015) (which is taken in the following as an example of a recent, typical and arbitrarily chosen publication using scale degree theory) starts: ‘In this article, major triads will be indicated by …’ In the context of more and more automated processing by digital systems, but also for human discussion, precisely defined but versatile and modifiable encoding standards are desirable. Therefore the authors of the recent ‘Annotated Beethoven Corpus’ (Neuwirth et al., 2018) added a formal definition of the syntax of their scale degree labelling system. For applications of funCode in the human discourse see the discussion of the abbreviation “
The formalisation of funCode is published in a technical report (Lepper et al., 2022) as a Prolog program which at the same time is executable and serves as a formal specification of syntax and semantics. The adaptability of this basic framework is intended to map different labelling systems, thus making them accessible e.g. to automated translation and comparison, and clarifying their semantics in human discussion.
The implementation is also maintained as open source, currently on
As a by-product, thousands of existing analyses in the European functional tradition can possibly be connected to contemporary analytical tools (from Neo-Riemannian and transformation theory) semi-automatically by aligning them manually to the precisely defined funCode language and processing them as described in detail in section 2.8.
The implementation additionally provides a layout algorithm to generate conventional two-dimensional rendering and an experimental
back-end, see section 2.2.
Integrating harmonic labels into a computer model of music is a non-trivial task not yet addressed, and is briefly discussed at the end of section 2.1.
A (semi-)automated annotation of music scores with functional symbols is currently out of reach. Nevertheless funCode is a first contribution: before attempting an automated translation, a precise and unambigious specification of a target language is required.
1.4 Design Principles of the funCode Approach
Not intending to invent something new, nevertheless in mathematical re-modelling always a certain ‘clean-up’ takes places. Any language found in cultural practice has evolved through history, but has not been designed ex ovo as a ‘Domain Specific Language’ with properties defined by the contemporary professional mathematical theory of language and parsing. Consequently, there are always some ‘rough edges’ which should not be taken over but straightened out, in particular, because these are often only small peculiarities that cause considerable damage to compositionality, general applicability, easier parsing, etc. Most of the corrections to apply are canonical continuations: they remove a particular restriction which evolved in practice as ‘professional blinker’ but which is not necessary from the mathematical viewpoint. 5 ‘Computational thinking’ (Broy, 2011) means to learn from automated processing for the preciseness and handiness of human communication.
Thus some basic properties have been clearly marked as indispensable:
Transposition-invariant symbols: every identical harmonic pattern must deliver identical symbol sequences, e.g. appearing in a key of c major, c sharp major and c flat major. The harmonic substance which shall be encoded must be readable independently from the transposition and always completely explicit.
6
Syntax and semantics must be easily readable and writable by humans and machines. Semantics must be recognised with minimal context information. (Nevertheless, littledependency may be allowed for ergonomic reasons. For example, Localisation and further adaptability: every harmonic notation system has its merits, and many scholars have been used to a particular system for decades, which they want to continue to use. Since in funCode all possible adaptations are formalised, complete automatic translation between these variants is feasible.
1.5 The Layered Syntax of funCode
All funCode specifications are organised by four hierarchically layered dimensions of addressing. They model the concrete practice when adding analytical labels to a piece of music, which has remained largely unchanged since its historic beginnings: the top part of Figure 1 shows the (simplified) music in staff notation. Below are the added labels (regardless of whether roman numerals or functional theory). The very last line (in teletype font) shows the funCode encoding of that complete analysis. The arrows and numbers in gray are not part of the analysis notation but added to indicate the dimensions of its organisation:

Typical appearance of a harmonic analysis by labelling. The top part shows a simplified staff notation of the music under consideration (Mahler, II/1, m.327ff). Below are two tracks in conventional two-dimensional arrangement (C2DA), aligning the functional labels vertically with the score positions. The gray layer is not part of the notation, but a comment on it, showing the four axes of semantics and their representation by graphical arrangement: (L1) tracks, (L2) score positions, (L3) simultaneous chords, and (L4) voice leading. The bottom line shows both tracks as funCode source text.
On the top level, one can have a vertical stack of tracks. In practice, the existence of more than one track can have very different meanings, see section 2.1 below. This is called conventional two-dimensional arrangement (C2DA) in the following and has existed from the very first beginnings till today, see Figure 3, cited from Heetderks (2015), a recent publication. Internally, each track is a horizontal sequence of labels. The graphical position establishes the relation between each label and a time point in the music. Each horizontal position in the track can carry zero to many function symbols. A label combining more than one function symbol stands for a compound chord (a case more frequently found with functional symbols than with roman numeral analysis).
7
The finest coordinate models the voice leading internal to the same chord: few voices change their pitch from on score position to the next, without altering the chord’s basic function.

Analysis from Schubert D 960 by Heetderks (2015), using sub-tracks. (a) = staff notation and roman numeral analysis from the publication; (b) = translation into functional style; (c) and (d) = application of the funCode L-1 linear encoding to (a) and (b).
Table 1 defines the syntax of all four layers of funCode completely; only the structure of the track names and of the interval modifiers are pluggable and appear as parameters T and M. The syntax is given as an ‘extended’ context free grammar (Wikipedia contributors, 2021), where on the right side regular expressions (Wikipedia contributors, 2022) may appear. Their operators
and
have the usual meaning of alternative, option, and arbitrary and non-empty repetition, respectively.
Complete syntax of all funCode layers.
The syntax and semantics of all four layers of the funCode architecture will be explained step by step in section 2.
1.6 Fundamental Entities of funCode Semantics
Figure 2 shows the fundamental semantic entities which result from parsing and evaluating a funCode label sequence as UML classes (UML, 2022). Please note that these correspond not always to concrete class definitions of implementation, but exist on the conceptual level; in the current implementation (Lepper et al., 2022) they are realised by term compounding or by facts in the Prolog data base. (This section is for orientation only, all these entities are explained in detail in the next section.)

Most important semantic entities seen as UML Classes. Simplified diagram: attribute definitions are not shown; boxes without attribute part are mere scalar data types or simple interfaces.
Each combination of
Each
The (optional) tonal center of a track, the root symbols, the explicit intervals, and all properties derived by their summation, evaluate into the
2 The Four Layers of funCode
2.1 Top-Level: Track Building and Horizontal Score Positions
As mentioned above, doing harmonic analysis can be seen as adding labels under the music, at selected time points. Assume all these time points are numbered consecutively, starting with 1. By which means this numbering is established is out of scope of funCode—in C2DA it is done by mere vertical juxtaposition. The relation from labels to the music is established only by this index, called score position in the following: the source text of a funCode expression is parsed from left to right and the recognised labels are consecutively assigned to the score positions. The next position to be assigned at a particular parsing state, i.e. when interpreting a particular position in the funCode source text, is called current score position in the following. 8
An analysis is often organised in several vertically stacked and horizontally extending tracks. Tracks can be employed for very different purposes:
To model psychological ambiguity during ‘modulations’ in one single (ideal) listener. This is the most frequent use case in the conventional text-book analysis. For describing different parts of the music which sound simultaneously, e.g. one track describing an organ point and the track above the changing upper voices. To document different interpretations by different listeners, found empirically or proposed in theory.
9
To represent different opinions by different scholars, for comparison and discussion, or in school lessons: different solutions by different pupils.
Printing and hand-writing normally use different vertical positions for different tracks (similar for interval stacking and voice leading, as described later). But this is tedious and possibly ambiguous, e.g. when reusing physical lines on the paper or at the line and page breaks. Conversely, the linear funCode syntax (see Table 1) is always unambiguous. It uses the characters “
The reserved character “
The braces “
One or more “
Figure 3 shows the transcription of a typical analysis from a recent publication: in the upper part is the staff and the roman numeral analysis as published by Heetderks (2015). Below is the same analysis rewritten by us in a functional style (using German pitch names), followed by both versions as a linear source text using the L-1 track syntax of funcode. (Only the functional part is really formalised by funCode; applying L-1 to roman numeral analysis is done here informally and left to future work.)
Each track can be given a title, which currently is any sequence of characters not containing the double quote ‘

Analysis of the ‘Schicksalsfrage-Motiv’ from ‘Die Walküre’. Above: simplified staff notation of the music; middle: traditional two-dimensional arrangement of labels, including the backward arrow; last two lines: the same in funCode encoding.
When an analytic annotation is already encoded as a computer model, e.g. as MusicXML or MEI, then tracks and labels are already separated into different ‘XML elements’ of the encoding. In this case the top-level L-1 funCode operators are not needed, but parsing and evaluation of the other layers L-2 to L-4 is applied directly to these elements’ contents. Then all data flow by inheritance (from parent track to sub-tracks, but also between adjacent chords, see below) must be provided for accordingly. These are non-trivial problems not yet addressed by funCode. Similar problems arise with the more abstract proposal by Hentschel et al. (2021), in which each piece of information is anchored at some particular chord object and contextual cross-references as required by the funCode layers L-1 and L-4 are not foreseen.
2.2 Details and Pitfalls With Tracks and Score Positions
While syntax and semantics of the L-1 layer seem rather simple, indeed subtle pitfalls and problems had to be solved by taking appropriate design decisions. Figure 4 shows examples (using dummy contents).

Examples of sub-track specifications. The upper case letters stand for function labels; the lines before the arrow are source text; the two-dimensional arrangement after the arrows shows the intended score positions. (The second example is not a correct C2DA, see the text.)
We want to give precise semantics to the common pen-and-paper practice. In C2DA a parent track is found by starting at the beginning point of the sub-track and searching upwards for the first track which starts earlier (= C2DA-subtracking). Thus a sub-track may not start earlier than its parent track which (possibly) defines a new tonic centre, to be recognisable in C2DA; therefore in funcode no tab stops earlier than its beginning are inherited by a sub-track. In the first example from Figure 4 this prevents the source variant “
Tab stops later than the beginning could be inherited if they are ignored as long as they are not yet overtaken by the current score position. But this would make the meaning of the “
In the functional style, larger segments can be put in parentheses, to make them relative to a preceding or the following label, see section 2.7 below. A sub-track may not start earlier than a containing relative section for a correct indication of the tonic reference point in C2DA. The second example source in Figure 4 cannot change its end “
C2DA-subtracking also forbids that a later sub-track is separated from its parent track by an earlier long sibling. The lines in the second example of Figure 4 show the x coordinates of the labels correctly, but are not a correct pen-and-paper rendering: label “

The funCode layout algorithm creates a conventional two-dimensional arrangement (C2DA), in which going upward from the head of each track first hits its parent track. The algorithm visits the tree of sub-tracks in the depth-first manner, siblings sorted by ascending start positions. The dashed box in the first graphic is the third sub-track of the topmost track. Its preceding sibling has already been allocated and is overlapping, thus must be shifted down. The next graphic shows the recursive application of this process, which may affect more than one track.
Please note that parsing of C2DA as an input would be even more complicated because you need a ‘micro x coordinate’ (finer than the mere score position) to distinguish
2.3 Track Items, Sequential Order and Compound Function
Each track is a sequence of items, see dimension L-2 in Figure 1. The source text of these items will be separated by the funCode parsing process. Most of the items will be function labels, which are assigned to the score positions consecutively.
In most cases, a function label is only one functional symbol, which stands for the simultaneously sounding pitches which realise this function. But for more advanced compositions it is sometimes useful to combine several of these. In C2DA this is simply done by vertical juxtaposition—in funCode by the operator “

Labelling the concepts of ‘Klangvertretung’ (sound substitution) and organ point.
Two further kinds of items are allowed in tracks: “
The special Eureka operator “
2.4 Function Symbols and Their Semantics
The next finer level of the funCode architecture defines the function symbols. Each one consists of a sequence of letters (case is significant, see the non-terminal rootAndMode in Table 1), followed by a sequence of numbers, each one possibly decorated (non-terminal intervalDecorated in that Table). Each function symbol describes and/or interprets one single chord appearing in the concrete music or abstract pattern under description.
In semantics S-4 (evaluating to pitch classes), the letter sequence merely defines the pitch class of the root of that chord, and whether its third is major or minor.
But in semantics S-1 different character sequences stand for different perceptive situations, different paths in the mental space of harmonic experience. Different character sequences which have identical S-4 semantics stand for different paths which reach the same ‘acoustic’ end point, see section 1.2 above. For instance “
Following these letters, a sequence of instances of intervalDecorated describes additional intervals added to the triad.
2.5 The Euler Net as the Semantic Domain for Roots and Intervals
As semantic domain for both chord roots and chord components funCode employs the Euler net (Tonnetz). This is a two-dimensional vector space of pitch or interval classes, i.e. pitches or intervals modulo octave. The first coordinate represents the exponent with which the interval of the pure fifth is applied, the second that of a pure major third. As usual, a point in this space is identified by a pair of integer numbers
First proposed by Euler (1774), it has since been used in very different variants of music theory. Please note that very different semantics can be assigned: originally it was used to explore the relationship between notation and tuning, and the axes were meant to represent the two intervals verbatim as pure frequency relations. Conversely, the functional theory uses the points to represent psychological situations, inner models or ‘situative feelings’ of the receiving mind: functional theory implies that the human reception of harmonic processes operates as if pure intervals ruled. Even when equal-tempered tuning is applied to produce the sounding physical frequencies of music performance, as it is mostly the case nowadays, the resulting mental representations are different when a process goes two fifths up (from
The Euler net can be used to represent pitch classes or intervals; both versions are easily convertible but should be distinguished.
Furthermore different notions of enharmonic identity can be applied: originally and in funCode there is none—the vector space is infinite in every direction. When used to model the equal-distance twelve tones, then a cyclic closure is defined after 12 steps on the fifth axis; more recent theories add a cycle after three steps on the third axis, etc.
The Euler net is more expressive than conventional notation, which identifies the pitch classes “
and
.
Figure 7 shows some typical variants of a graphical representation of the Euler net: the left version has orthogonal axes for the coordinates of the fifths and the major thirds, thus clearly showing the underlying construction. This form is especially useful when a third orthogonal axis for the pure seventh is added, see Vogel (1975). Its labelling uses one of the many variants to indicate the syntonic comma: the

An Euler net is a two-dimensional vector space with discrete points, addressed by integer coordinates. The two axes represent the exponents of the intervals ‘pure fifth’ and ‘pure major third’. Their multiplication originally gave a concrete frequency, but nowadays can also represent a pitch class (in very different tuning systems) or even an affective state in an abstract harmonic space. The left variant with perpendicular axes is the older and more convenient when a third axis shall be added; the right variant has the didactic advantage that all minimal triangles represent musical triads.
Nowadays the variant on the right side of the Figure is often preferred: its didactic advantage is that every set of labels that looks like a minimal triangle indeed represents a triad, which is not the case in orthogonal variant. On the other hand, major and minor thirds seem to be on equal terms, which contradicts the construction. (For a survey on literature about the Euler net see Cohn (2012, pg. 28, 29); see also Cohn (2011) and Gollin (2011).)
2.6 Labelling Root and Mode of Chords
The sequence of characters encoding the root pitch class and the major-minor-mode of the chord thus is interpreted as a vector in the Euler space. Applying this vector to the current tonic reference point, as defined by the context of the expression, yields the root pitch. Function
in Table 2 shows the mapping of the starting points (given by the tonicCenter at the start of the track) into the Euler net. Setting
Normalisation of functions codes and their Euler net semantics.
funCode re-models the most widely used system in continental Europe’s functional analysis. While historically there were fundamentally different alternatives (Marschner (1894), Oettingen (1913), Keller (1957), Erpf ([1927]1969), Karg-Elert (1931)), this system (in many slight variations) is the only one which survived and is the pre-dominant in German language literature and many other countries of the European continent. It is based on the works of Grabner (1923) and Maler (1931)
13
and has been further developed and modified by many theorists—for a survey see Imig (1970). Because of those alternatives, it should be called ‘GM-style notation’ or similar, but in the following, we simply write ‘functional’. (funCode itself only adds a few canonical continuations, for instance to allow the operators
Each instance of rootAndMode starts with S, T, or D, followed by arbitrary many P, G, S or D, all in upper or lower case. The upper and lower case indicate major and minor third, so the mode of the constructed triads is immediately visible for the reader. The vectors in the Euler net which correspond to these operator characters are depicted in the left part of Figure 8.

Relations between triads, according to Grabner (1923)/Maler (1931) and Cohn (2012).
While this calculus indeed is somehow similar to Neo-Riemannian achievements (see section 2.8 below), the main difference is that professionally educated ‘classical’ musicians in most parts of Europe carry in mind concrete experiences and mental and emotional associations with these symbols (not only semantics S-1 but also S-4, ‘intuited chains of intuitions’, see above). The remark of Clark (2011, pg. 297) ‘classical harmonic thinking [implies] Roman numerals’ is simply wrong.
The letter G stands for the German ‘Gegenparallelklang’, as introduced by Grabner (1923), or simply ‘Gegenklang’, which corresponds to the English ‘counter parallel’, and to the ‘Leittonwechselklang’ of Riemann. The letter P stands for the German ‘Parallele’, which corresponds to the English ‘relative chord’. The application of these operations per se always goes from a minor to a major triad or vice versa. If such a character follows a character of the same case, a change of the third is meant to be appended as a further operation. Writing a change from minor to major as “
Encoding of the tonic centers, i.e. of the starting points in the Euler net. The origin
is chosen arbitrarily.
Chord components affected by the global mode of the containing scale. The boxes show the scale degrees affected by a change from major to parallel minor (here: c) and their roles in the chords on all degrees of the scale. The numbers show the chord components affected by that change.
Examples for interval specifications and their idiosyncratic namings.
After these transformations have been applied as often as possible (a process which always terminates) a simple addition of the vector values given by the function
in the same Table delivers a vector. Applying this vector to the current tonic reference point delivers the root of the chord. The mode of the chord is simply indicated by the case of the very last character (
With the current tonic reference point set to c, the
2.7 Relative Sections
The Euler vector defined by an instance of rootAndMode is applied to the current tonic reference point to get the root of the chord, all again encoded as coordinates in the Euler net. Every track either declares a tonicCenter at its beginning, or it inherits it from its parent track.
But sequences of labels can also be included in parentheses. This means that the tonic reference of all these labels is not the track-wide value but the root of the immediately preceding or following label (= node type

Relative sections. The upper case letters stand for function labels.
Please note that the relative sections need not be properly nested for establishing the tonic reference, see lines f) to i) in the Figure. This is especially convenient for sequences of falling fifth, etc.
15
Relative sections are used in practice quite frequently. They correspond to the ‘slash notation’ like “
Of course, the track definitions (layer L-1) and relative sections (layer L-2) are designed for ‘full compositionality’ in the computer science meaning of the term, i.e. for being independently combinable. But some nasty cases of ‘feature interaction’ have to be treated by the implementation because sub-tracks should not extend beyond a containing relative section. See the technical report Lepper et al. (2022) for details and examples.
2.8 Relation to Neo-Riemannian Triad Transformations
The European GM-style of labelling and the more recent traditions of transformation theory and Neo-Riemannism have the same ancestors and thus much in common. (See Lewin ([1987]2007) and Hyer (1989) for the earliest works and Gollin & Rehding (2011) for a recent survey.) In a major publication from this field, Cohn (2012, pg. 2ff) describes as an initial motivating example verbosely the reception process of the beginning of the recapitulation section in the first movement of Schubert’s
major piano sonata D 960, measures 217–256. Applying the functional labelling (as taught in many European continental high schools) in a mere schematic way, would end up in measure 256 with the label
major. Vice versa, this label can be decoded by every pupil quite fluently as ‘
minor –
minor, writable as
minor – A major – d minor –
major’. The one enharmonic exchange is only for ease of spelling—it indicates that the final
major is a priori something different than the starting point. A second and closer look shows that we went three major thirds down (twice a step x
Provocatively we could say that the Neo-Riemannian theorists had to re-discover what is evident to every high school student who grew up with functional instead of scale degree labelling. (Fortunately they had to, because underways they discovered a plethora of new viewpoints, analytical tools and modes of presentation.) This is partly admitted by Cohn (2012, pg. xiii): ‘Although these [functional] labels are descriptively useful, they do not in themselves lead to an understanding of triadic syntax […] I view these labels as a bridge to a first approximation; what lies on the other side of the bridge […] is an understanding of how the moves designated by these labels behave as part of a compositional system.’
Indeed the functional labels can directly be translated into Cohn’s operations as shown in the right half of Figure 8. 16 See the Schubert result from above:
The current implementation of funCode provides automated translation of functional root expressions into L/P/R style coordinates (Lepper et al., 2022). The only strange character remaining in the last line is the “
2.9 Layer L-4: Chord Components and Voice Leading
The lowest level of the funCode architecture describes the sounding components of a chord by giving the interval from its root pitch.
With no explicit interval specification appended, the semantics S-4 realise the tonal function indicated by the function symbol as a concrete triad, with root tone, third and fifth. Further intervals can be added to that chord by appending numbers (with modifiers) to the symbol. The root tone can be explicitly suppressed by a “
As a by-product we get a notation for single-pitch chords, which can also be (ab-)used as a notation for a single chord component, like
The syntax and semantics for the additional chord components are configurable, in particular, those for iModifier, see section 2.10 for details. The examples used in this article show the variant preferred by its first author.
The top of Table 6 shows the data type of the configuration object, followed by some sample instances. The table at the bottom is a sample declaration of all supported combinations of interval numbers and modifiers.
Configuration and localisation of funCode.
Some added intervals suppress their default sounding neighbours implicitly; this is configured by the field suppressDefault of the configuration object.
Table 4 shows which components of the chords on the different steps of a fixed scale are affected when this scale changes between major and minor: the third, sixth and seventh step of the scale changes, and these pitch classes take descending interval roles when building chords on ascending steps, represented by the descending lines of boxes in the Table. Whenever the root of the chord is affected itself, all pitches not affected reflect the major/minor change and vice versa. This leads to a pattern which may be interesting to theoretical reflection but not suited for easy encoding. Indeed, it violates design principle D-2.
So we decided that only the third of each chord is determined by its mode. All further added intervals must be given their size explicitly, by an instance of iModifier. Therefore the data type of the ‘current tonic reference’ of each track is indeed only a pitch class, without any mode indication. As a consequence, tonal key does emerge from harmonies but is never given a priori, as such. This corresponds to the more modern ways of composition, starting with late Schumann, Liszt, and Bruckner, and to the notion of tonality as defined by Schenker (1906), which is always a mixture (‘Mischung’) of major and minor steps. As a consequence, only the size of the third is indicated by the (upper or lower case) of the functional symbol, all other intervals (suspensions, transitions or additions) must be qualified explicitly. 18
The configuration from Table 6 defines the modifiers
For mere convenience, a replacement text for a
Describing the components of a chord by combining numbers and modifiers had been invented by Riemann (1880) and called ‘Klangschlüssel’ (= ‘sound key’). First, he applied it not to function symbols but to names of concrete pitch classes, as it is nowadays widely done in ‘lead sheet’ notation in popular music. To eliminate any ambiguity, tone names may be followed by a colon character in the context of funCode. So
But also in pure theory, a compact and non-ambiguous notation of interval structure is desirable; see Table 5 for several examples of complex chord structures with very idiosyncratic names in German, taken from a standard text book on scale degree theory by Ganter (1975), and for the names of the chords of the augmented sixth in English theory.
The number stacks seem to be borrowed from the Baroque ‘figured bass’ notation, but indeed mean something fundamentally different, namely intervals relative to the root note, not to the bass note. The bass note and possibly the melody tone can be indicated by appending an underscore “
Another relic from figured bass is that the number stack is ‘abused’ to indicate voice leading: if the rootAndMode is verbatim the same as its predecessor (not regarding the case of the very last character) or even totally absent, then the number stack is related to the preceding number stack. Dots “
2.10 Localisation and Customisation
The evaluation process of chord bases and intervals is more or less controlled by a configuration object, see the data type Configuration in Table 6. It supports far-ranging customisation and localisation. This is important for the acceptance and practical usability of funCode, because a theorist might be used to a particular idiom which they want to keep as far as possible when switching to a digital and more formalised representation, see design principle D-4 in section 1.4.
funRenamings is applied to the input conceptually before the evaluation described by Table 3 takes place. This allows localisation of function symbols, like ‘
Similar, keyRenamings is applied before
from Table 2 is evaluated, allowing national pitch names like ‘la’ or ‘h’.
chordAbbreviations are added as further alternatives to the definition of the non-terminal rootAndMode in Table 1 and expanded according to their definition. These short-cut rules are not important for machine processing, but for readability and writability by humans.
The configuration object
in Table 6 contains two widely used abbreviations for the chord of the diminished seventh and the chord of the Neapolitan sixth. Please note that these abbreviations are expanded verbatim: they contain interval digits, so they put an end to the containing character sequence.
The customisation mechanism can be employed for more precision. In English literature we found for instance the abbreviation “
The further fields in the data type Configuration in have already been described above: the set of all intervals, which make up the concrete chord at the given score position, is calculated from the explicitly mentioned intervals and the defaults. The default mechanism is again not required by machine processing but for convenient reading and writing by humans.
The map intervals gives the external representations for the corresponding Euler values. (In Table 6 the example stdIntervals is printed as a two-dimensional table, but this means indeed a map of type String ↛ CEuler.)
All intervals in the set defaults are added to the the set of pitch classes, unless the interval’s number (stripped from the modifier) appears in the explicit intervals, or a suppressing interval appears there, as defined by the map suppressDefault. So in standard ‘classic’ usage of harmony, the third and the fifth are in every chord, but not if a ‘suspension’ is signalled in the intervals. Consequently
in Table 6, all chords contain a minor seventh by default and an explicit
The flexibility of interval encoding is necessary to cover different functional theories. For instance, there exist numerous different opinions about the (physical and psychological) nature of the seventh in the dominant function.
20
By defining for instance
three different variants can even coexist and be applied occasionally (as soon as CEuler has been embedded into the three-dimensional vector space CVogel to support the natural seventh).
2.11 Enharmonic Adjustments
Up to here, the semantics of one single annotation track (more precise: its S-4 semantics) have been calculated relative to an arbitrarily chosen starting point. As soon as two such tracks overlap, which are intended to be simultaneously valid (i.e. the T-0 use case from above), the Euler coordinates should be adjusted accordingly, to reflect their mutual relation.
The upper part of Figure 11 shows an example of the famous ‘syntonic mill’: simply evaluating the chord roots according to the annotation delivers the coordinates in large font. But since the first overlap in both tracks shows a difference of the syntonic comma (4,-1), the following coordinates should be adjusted to the sequence shown in the box, which does not return to the starting point.

Syntonic deviations.
The lower part shows the well-known text-book enharmonic modulation from c major to
major via the ‘German Sixth’. It shows that simply comparing the chord roots is not sufficient but must be extended to all notes. In this context, all kinds of enharmonic steps must be considered, like
3 Conclusion
Mathematical remodelling of existing cultural symbol systems aims at clarifying syntax and semantics for both human discourse and automated processing. It forces all conventional implicit assumptions to be discussed explicitly and encourages us to straighten out rough edges of historical origin, often by canonical continuations.
funCode applies mathematical remodelling to a widely used system of functional harmonic labelling (Grabner–Maler style = GM-style). It is intended as a target format for the transcription of existing analyses (e.g. for automated processing) and as a versatile and adaptive labelling system on its own.
In course of the analysis of existing practice, it first turned out that fundamentally different kinds of the semantics of harmonic labelling per se must be distinguished (section 1.2).
Transforming current practice into a mathematical model yields four more or less independent strata. Only one of them is specific to functional theory (see Figure 1 and section 1.5). The complete grammar for all four strata is specified in the 18 lines of text in Table 1. The complete semantics are specified as an ‘executable meta-model’ by some 800 lines of Prolog code in the accompanying technical report (Lepper et al., 2022).
On the top level L-1, the C2DA of tracks and labels is represented by a linear encoding using tab stops and braces (section 2.1). In spite of its seeming simplicity, numerous subtle pitfalls have been identified, concerning possible ambiguities of inheritance relations and the nesting of tracks and relative sections (section 2.2, Figure 5 and the technical report).
The next lower level L-2 is the horizontal sequence of items in one single track, each item related to one abstract score position. On this level the rules for relative references have been formalised (section 2.7, Figure 9).
Level L-3, the combination of more than one functional chord into one label, turned out as the least problematic.
The lowest level L-4 (covering functional symbols, root pitch classes and chord components) employs the Euler net as its semantic domain (section 2.5, Figures 7 and 8). A close relation of GM-style and Neo-Riemannian triad transformations is obvious which is discussed in section 2.8 and is supported by additional translation functions in the implementation.
To be acceptable by practitioners, all levels of the system’s architecture must be adaptive to the different usus of schools and even to personal styles of authors: different abbreviations of conventional pitch classes and of function symbols can be plugged into the system. Especially the modifiers for interval modes (major, minor, diminished, augmented, etc.) can be defined freely, together with the sets of both default intervals and suspension rules. This can make funCode useful also in ‘non-classical’ contexts (section 2.10, Table 6).
Footnotes
A Transcriptions of Neo-Riemannian Examples
The following lines give without any comment the transcriptions of examples from major publications of the Neo-Riemannian school, to demonstrate their combination of expressive power with concrete connotations in any practical musician’s mind. The transcriptions reflect the 'physical' semantics (see section 1.2); alternatives according to S-1 to S-3 are perhaps possible. An animated presentation as suggested by Cohn (2011, pg. 330) could easily be implemented based on the funCode implementation contained in Lepper et al. (2022).
Diagram ‘Ex. 10.8’ by Clark (2011):
“
Diagram ‘Ex. 10.9’ ibd., with “
“
Diagram ‘Ex. 10.12’ ibd.:
“
Engebretsen (2011, pg. 364): becomes “
Ibd., pg. 368, Riemann’s Example 85: “
Example 86: “
Example 87a: “
Example 88a: “
Example 89a: “
Example 90a: “
The newly defined mediant operations by Kopp (2011) have been covered by GM-style ever since: ‘USM’ = “
Acknowledgements
The authors thank all reviewers for their valuable suggestions to improve this article.
Action Editor
David Meredith, Department of Architecture, Design and Media Technology, Aalborg University.
Peer Review
Nick Harley, Vrije Universiteit Brussel, Artificial Intelligence Lab. Maximos Kaliakatsos-Papakostas, Athena Research and Innovation Center in Information Communication and knowledge Technologies.
Declaration of Conflicting Interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The authors received the following financial support for the research, authorship, and/or publication of this article: Open access publication of this article has been financially supported by Deutsche Forschungsgemeinschaft (DFG) and Open Access Publishing Fund of Osnabrück University.
