The Mathematics of Musical Set Theory
Author
Jim Arlow
Title
The Mathematics of Musical Set Theory
Description
Musical set theory applies some key ideas from set theory and other fields of mathematics to the analysis of (mostly) atonal music in twelve tone equal temperament. Its goal is to achieve an understanding of the structure of music by first reducing it to fundamental musical objects that can be related using relatively simple set theoretical ideas.
Category
Books & Supplements
Keywords
math, musical set theory, visualizations, pitch
URL
http://www.notebookarchive.org/2020-07-alqx8cj/
DOI
https://notebookarchive.org/2020-07-alqx8cj
Date Added
2020-07-23
Date Last Modified
2020-07-23
File Size
5.38 megabytes
Supplements
Rights
Redistribution rights reserved
This notebook is optimized for desktop only.
Download
Open in Wolfram Cloud
The Mathematics of
Musical Set Theory
The Mathematics of
Musical Set Theory
Musical Set Theory
by Dr. Jim Arlow
© 2019, 2020, Clear View Training Limitedwww.clearviewtraining.comTHIS BOOK CONTAINS SOFTWARE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THIS BOOK CONTAINS LIVE CODE. BE SAFE AND EXAMINE ALL CODE BEFORE EXECUTING IT. ONLY USE COPIES OF THIS BOOK OBTAINED LEGITIMATELY FROM WWW.CLEARVIEWTRAINING.COM OR THE WOLFRAM NOTEBOOK ARCHIVE.
Table of contents
■
The Mathematics of
Musical Set Theory
Musical Set Theory
■
Table of contents
■
Introduction
■
Reading mathematical notation
■
Reading the code
■
Getting started
■
1 Pitches & Scientific Pitch Notation (SPN)
■
1.1 What is a pitch?
■
1.2 Scientific Pitch Notation (SPN)
■
1.3 Enharmonic equivalence
■
1.4 Twelve tone equal temperament (12TET)
■
1.5 Fretted instruments - a digression
■
1.6 Chapter summary
■
2 Introduction to set theory
■
2.1 What is a set?
■
2.2 Set builder notation
■
2.3 The cardinality of a set |S|
■
2.4 Set membership ∈
■
2.5 Set complement A^C
■
2.6 Subset ⊂ and superset ⊃
■
2.7 Proper subset ⊆ and proper superset ⊇
■
2.8 Generating subsets
■
2.9 Set union ⋃
■
2.10 Set intersection ⋂
■
2.11 Set difference \ (relative complement)
■
2.12 Symmetric difference
■
2.13 Venn diagrams
■
2.14 Set equality
■
2.15 Cartesian product ×
■
2.16 The partition of a set
■
2.17 Equivalence relations
■
2.18 Equivalence classes
■
2.19 Chapter summary
■
3 Pitch classes
■
3.1 What is a pitch class?
■
3.2 Pitch class notation
■
3.3 Parsing pitch class names into letter and accidental
■
3.4 Parsing Scientific Pitch Notation into a pitch class and octave
■
3.5 Pitch class representatives
■
3.6 Converting between pitch classes and pitch class representatives
■
3.7 Equality of pitch classes
■
3.8 MIDI numbers
■
3.9 Chapter summary
■
4 Pitch class collections and pitch class sets
■
4.1 What are pitch class collections and pitch class sets?
■
4.2 The number of pitch class sets of cardinality N
■
4.3 Integer representation of pitch class sets
■
4.4 Chapter summary
■
5 Visualising pitch class sets - the 12TET pitch clock
■
5.1 Defining a 12 tone equal temperament pitch clock
■
5.2 Pitch class color space
■
5.3 Pitch clock coordinate space
■
5.4 Pitch clock graphics language
■
5.5 Pitch class set geometry
■
5.6 Pitch class set polygons
■
5.7 Pitch class set piano
■
5.8 The musical staff
■
5.9 Discussion of the 5 line treble staff
■
5.10 Chapter summary
■
6 Intervals, prime forms and interval vectors
■
6.1 Pitch class intervals
■
6.2 Interval classes
■
6.3 Pitch class directed intervals
■
6.4 Pitch class range
■
6.5 What is total interval content?
■
6.6 Interval vectors
■
6.7 Integer representation of interval vectors
■
6.8 Chapter summary
■
7 Pitch class transposition and group theory
■
7.1 Pitch class transposition
■
7.2 Transpositional equivalence of pitch class sets
■
7.3 The major/natural minor controversy
■
7.4 What is a group?
■
7.5 Group property 1: Closure
■
7.6 Group property 2: Associativity
■
7.7 Group property 3: Identity
■
7.8 Group property 4: Inverse
■
7.9 Group property 5 (Abelian groups): Commutativity
■
7.10 The Cayley table
■
7.11 How many groups are there for a given set?
■
7.12 Group operations as transformation rules
■
7.13 Chapter summary
■
8 Inversion and transposition-inversion
■
8.1 What are pitch class and pitch class set inversion?
■
8.2 Symmetric pitch class sets
■
8.3 Generalizing pitch class inversion - reflection
■
8.4 Transposition-inversion
■
8.5 When inversion is equivalent to one or more transpositions
■
8.6 Transposition-inversion and group theory
■
8.7 Chapter Summary
■
9 Normal and prime forms of pitch class sets
■
9.1 Introduction
■
9.2 Normal and prime forms
■
9.3 Permutations
■
9.4 Combinations
■
9.5 Number of ordered pitch class sets
■
9.6 Number of unordered pitch class sets
■
9.7 Cyclic permutations of an ordered set
■
9.8 Visualizing permutations of pitch class sets
■
9.9 Circular permutations of a set
■
9.10 Permutations as a compositional tool
■
9.11 Chapter summary
■
10 Calculating normal forms and prime forms
■
10.1 Introduction
■
10.2 Forte and Rahn normal forms
■
10.3 Forte and Rahn prime forms
■
10.4 Comparing Forte and Rahn normal and prime forms
■
10.5 Chapter summary
■
11 Calculating and naming the Forte prime forms
■
11.1 Creating a table of all the prime forms
■
11.2 Symmetric sets
■
11.3 Z related sets
■
11.4 Forte set names and FDataset database
■
11.5 Forte prime form database
■
11.6 Canned queries
■
11.7 Prime forms and set names
■
11.8 Interval vectors
■
11.9 Z related sets
■
11.10 Listing the pitch class sets for a prime form
■
11.11 Chapter summary
■
12 Interval vector properties
■
12.1 The importance of interval vectors
■
12.2 Unique interval vector entries
■
12.3 Maximum number of an interval class
■
12.4 Equal distribution of entries in the interval vector
■
12.5 Near equal distribution of entries in the interval vector
■
12.6 Chapter summary
■
13 Subsets, supersets, complementary sets and invariance
■
13.1 Prime form proper subsets and supersets
■
13.2 The complementary set
■
13.3 Invariant pitch classes (intersection)
■
13.4 Invariant pitch classes on transposition
■
13.5 Total invariance under transposition
■
13.6 Transpositionally invariant subsets
■
13.7 Total invariance under inversion followed by transposition
■
13.8 Subsets invariant under transposition following inversion
■
13.9 Chapter summary
■
14 Similarity relationships between prime forms
■
14.1 Similarity relationships,
R
S
■
14.2 Tools for working with relationships
R
S
■
14.3 Maximum similarity,
R
p
■
14.4 Minimum similarity,
R
0
■
14.5 Maximally similar
R
1
■
14.6 Maximally similar
R
2
■
14.7 Mutual exclusivity of , and
R
0
R
1
R
2
■
14.8 Combining relationships
■
14.9 The R relationship
■
14.10 Mathematical properties of the similarity relationships
■
14.11 Transitive tuples
■
14.12 Chapter summary
■
15 Set complexes and order relations
■
15.1 Pitch class set complexes and subcomplexes
■
15.2 Ordered sets, interval pattern and basic interval pattern (BIP)
■
15.3 Chapter summary
■
Bibliography
Introduction
This is a book about the mathematics of musical set theory.
Musical set theory applies some key ideas from set theory and other fields of mathematics to the analysis of (mostly) atonal music in twelve tone equal temperament. Its goal is to achieve an understanding of the structure of music by first reducing it to fundamental musical objects that can be related using relatively simple set theoretical ideas. Although it is perhaps mostly associated with atonal music, many of the ideas in musical set theory were first elaborated by (1960) [Hanson1] in connection with tonal music. The ideas were developed by other theorists such as Milton Babbitt, John Rahn and Allen Forte (1973). Most of this book is concerned with the mathematical ideas of musical set theory as set forth in Allen Forte’s book, “The Structure of Atonal Music” [Forte1]. We follow the development of ideas in this text very closely.
From our perspective, there are two distinct aspects to musical set theory:
■
Mathematics - a wide variety of interesting mathematical concepts are involved in the formulation of musical set theory. We will cover this here.
■
Analysis - musical set theory can be used as a powerful tool for the analysis of different types of music. We will not cover this here.
As the title of this book indicates, our emphasis here is almost exclusively on the mathematical aspects of the theory. One could easily write another book, probably much longer than this one, on the use of the theory in analysis, but there are already several good texts listed in the bibliography that do that. However, we have not found any other book out there that focuses on the mathematics of the theory in the way we do. This lack has meant that the would-be musical set theorist has had to consult a wide range of mathematics books, or take courses in mathematics, in order to acquire the necessary mathematical know-how. We aim to address that issue by discussing each of the mathematical principles used in musical set theory as, and when, they are needed. As such, the book includes primers on set theory, group theory, symmetry, modulo arithmetic and permutations and combinations.
Musical set theory provides some very useful and powerful concepts that can help give a real insight into the structure of music. These concepts are mostly very simple, and quite logical when considered from the mathematical and musical points of view. Unfortunately, we have found that when these mathematical concepts are embedded in a dense text such as [Forte1], they can appear quite obscure. This is one of the reasons for writing this book - to simplify the presentation of the key concepts by separating the mathematics from the analysis aspects of the theory.
As well as mathematics, this book incorporates a lot of code. In fact, the text is fully executable. One of the main ideas of this book was to show how you can use the Wolfram Language to explore the concepts of musical set theory. Every concept in musical set theory, is, where possible, implemented in Wolfram Language code and there is also often one or more demonstrator programs to elucidate the concepts. If you are reading a PDF of this book, the code will not be executable within the PDF, but you can download a completely free executable version of this book from the Wolfram Notebook Archive (search on Arlow). We strongly advise you to get the executable version of this text so you can play with the demonstrations. The code also provides a very complete toolkit that theorists can use in their own investigations.
Reading mathematical notation
Reading mathematical notation
If you are a musician or programmer with a limited amount of mathematical background, then one of the challenges of musical set theory is reading mathematical notation. Firstly - don’t panic! Mathematical notation is often dense, and even experienced mathematicians can take a long time to read it. Reading mathematical notation is different to reading text, or even code. You may have to go back and forwards several times through an expression before you understand it. This is normal! According to [Alcock1] the best way to learn to read mathematical notation is to say it out loud (or silently to yourself if that is not possible). We will try to help you with this. For example, whenever we introduce a mathematical expression, we will often on the next line say, “This reads as: ...”, and then we will explain the notation. For example:
{ x ∈ | x > 0 }
“This reads: the set ( { ...} ) of x, where x is a member (∈) of the set of real numbers () such that ( | ) x > 0. So this is the set of positive real numbers. ...”
Even though you can read it, to understand it, you need to know what a set is, and what real numbers are, so there are both symbols and concepts that you need to know. All the concepts we use will have a clearly highlighted definition, and all symbols will be defined and explained, often several times, so that as you read the book, you slowly build up a working knowledge of the mathematical concepts and notation you need for musical set theory. However, it is important to either read the “This reads as:...” text out loud or say it to yourself silently, as this is a proven way to rapidly become comfortable with mathematical notation [Alcock2] .
Reading the code
Reading the code
The code is written in the Wolfram Language. This uniquely elegant, powerful and expressive language is probably best known as the language of Mathematica, but it has also made possible innovations such as the voice assistant Siri and the knowledge engine Wolfram Alpha. We assume that you will have some working knowledge of programming, possibly in another programming language such as Java, JavaScript or Python (if not, then this book may not be for you!). You will find that Wolfram Language code is a bit different, because it comes from the Lisp family of languages. Whilst you generally read programs in conventional languages more or less top to bottom, you read all of the Lisp-like languages inside out! This is because programs in these languages are generally structured as nested functions, rather than as a sequence of functions. Start with the innermost function, work out what that does, and proceed outwards, through the nested functions, until you get to the top level. You should soon get the hang of this, because we have used indentation to make the reading easier and most of the code in this text is just a few lines long. Any longer code is generally for demonstration programs, which have a certain irreducible complexity around providing a user interface and a display, and you don’t necessarily have to understand the full details of these. Reading Lisp style code is a bit like reading mathematical notation, because it is very concise. You may need to spend some time understanding a single line, but that single line would equate to many lines in a non-Lisp language.
We are not going to provide an introduction to the Wolfram Language here, because there is already an excellent, free, online tutorial. If you are not familiar with the language then we suggest you take some time to do the tutorial before going further:
(If you are reading the PDF and the hyperlink doesn’t work, just Google this and you will go right there)
There is also a free book by Stephen Wolfram, the inventor of the Wolfram Language, and this is well worth reading:
The other key thing you need to know about the Wolfram Language is that is has exemplary online help in the form of the Wolfram Language & System Documentation Center. For convenience, we have begun almost all of our function names with lowercase letters, so when you see a function name in uppercase, you know that this is a built-in Wolfram Language function, and you can find full details with examples etc. in the Documentation Center.
Once you get used to it, reading Lisp style code is actually a lot simpler than reading conventional code, and you may come to prefer it.
Getting started
Getting started
Before we get into the main text, there is a bit of housekeeping that we have to do.
Clearing the namespace
Clearing the namespace
The first thing we have to do is to set up the Wolfram Language to execute the code in the rest of this text. When we define a symbol in the global namespace of the Wolfram Language, that symbol is there for the whole session. This can lead to unexpected results, so it is a good idea to begin with a call to ClearAll[...] in order to purge the namespace of unwanted, unknown or unexpected symbols:
In[]:=
ClearAll["Global`*"]
If you are developing software with the Wolfram Language, a good tip is to do a ClearAll[...] every now and then to make sure there are no older versions of your code cluttering up the namespace. As an exercise, we suggest you look up ClearAll[...] in the Wolfram Language & System Documentation Center so you get used to looking up any functions you do not understand. Just type ClearAll into the search box. Look under the subheading, “Generalizations & Extensions”, to find the meaning of ClearAll[...] as we have used it here.
Displaying examples with formValue and gridFormValue
Displaying examples with formValue and gridFormValue
We will often need to show a piece of Wolfram Language code and its value. By default, the code will appear on one line in an input cell, and the result (value) will appear in the output cell below it. That’s OK, but it is sometimes not very neat. The utility function below takes a Wolfram Language expression, and returns a List where the first element is the unevaluated expression (in Wolfram Language terminology, the form of the expression), and the second element is the result of evaluating the expression. This is useful for constructing tables of examples that show forms and then the results of evaluating them.
In[]:=
formValue[exp_]:={HoldForm[exp],exp}formValue[comment_,exp_]:={comment,HoldForm[exp],exp}SetAttributes[formValue,{HoldAll,Listable}]
In the Wolfram Language, functions can have attributes that specify their properties. In this case, we give the formValue[...] function the attribute HoldAll, which means that it does not immediately evaluate its arguments, and Listable, which means that the function will be automatically applied to each element when given a List of arguments. In that case it will return a List of results. Here is an example of this function in use:
In[]:=
formValue[1+1]
Out[]=
{1+1,2}
You can see that the first item in the returned List is the unevaluated expression, and the second item is the result of the expression. We will almost always use formValue[...] to create a table of results, so here is a convenience function to encapsulate that:
In[]:=
gridFormValue[exp_]:=Grid[formValue[exp],FrameAll,AlignmentLeft]SetAttributes[gridFormValue,{HoldAll}]
For example:
In[]:=
gridFormValue[{1+1,2+2}]
Out[]=
1+1 | 2 |
2+2 | 4 |
Another useful utility is a simple labelling function for our demo programs. You will see this in action shortly:
In[]:=
topLabel[text_String]:={{"",""},{"",Style[text,Medium]}}
1
In this chapter, we will look at frequencies and pitches and how to represent pitches using Scientific Pitch Notation (SPN). We will cover the important topics of enharmonic and octave equivalence leading on to a discussion of 12 tone equal temperament (12TET), which is the basis of musical set theory. We will then take a digression into the mathematics of fretted instruments and show how their fret patterns are derived directly from 12TET.
1.1 What is a pitch?
1
.1
What is a pitch?If you are reading this book, then you are a musician or musical theorist, and will certainly have a good intuitive understanding of the notion of pitch. However, a formal definition is always useful. According to the Oxford English Dictionary:
Pitch:
1. The quality of a sound governed by the rate of vibrations producing it; the degree of highness or lowness of a tone.
1.1 A standard degree of highness or lowness used in performance.
1. The quality of a sound governed by the rate of vibrations producing it; the degree of highness or lowness of a tone.
1.1 A standard degree of highness or lowness used in performance.
Pitch is the sensation caused by sound of a particular rate of vibration, or frequency. Frequency is expressed in Hertz (Hz) which is the number of times the medium vibrates per second. Humans are very sensitive to differences in frequency, and can detect differences as little as 2 Hz. However, we are rather less sensitive to absolute frequencies, and most of us (except those with perfect, or absolute, pitch) have difficulty identifying the pitch of note when heard in isolation.
As far as we are concerned in this book, definition 1.1 above is the most pertinent. We will be considering the set of standard pitches used in Western music that comprise the 12 tone equally tempered scale. We will see precisely what 12 tone equal temperament means shortly.
1.2 Scientific Pitch Notation (SPN)
1
.2
Scientific Pitch Notation (SPN)Scientific Pitch Notation (also known as American Standard Pitch Notation or International Pitch Notation) is a way of notating a pitch as a combination of a letter, l, an optional accidental, a, and an octave, o. It is important to realize that SPN does not specify pitches - it only specifies a notation for pitches. The notation is mapped to pitches by the convention that the SPN notation C4 represents Middle C on the piano. C5 is an octave above middle C, C3 an octave below middle C and so on. Assuming that the piano is tuned to concert pitch, A440 (which means that the note A4 is 440Hz) then C4 corresponds to 261.62Hz.
Scientific Pitch Notation is normally used over a 10 octave range from C0 (16.35Hz) via middle C, which is C4 (261.62Hz), to C9 (8372.02Hz). However, it can also specify pitches below C0 such as C-1 etc. and pitches above C10. For a young person, the range of hearing is about 20Hz to 20kHz, so you can see that C0 is just below the lower threshold of hearing, and C10 is about an octave or so below the upper threshold.
The Wolfram Language already understands Scientific Pitch Notation to some degree, so we can easily write a couple of utility functions to play sequences of notes and chords:
In[]:=
playSequence[notes_,duration_:1]:=Sound[SoundNote[#,duration]&/@notes]playChord[notes_,duration_:1]:=Sound[SoundNote[notes,duration]]
For example:
In[]:=
gridFormValue[{playSequence[{"C4","E4","G4"}],playChord[{"C","E","G"},4],playChord[{0,4,7},4],playSequence[{"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"},0.5],playSequence[{"C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"},0.25]}]
Out[]=
In the first row above, we play a C Major arpeggio starting on C4 where each note has a duration of 1 second (the default). In the second row, we play a C Major chord starting on C4, but we have omitted the octave and set the duration to 4 seconds. When the octave is omitted, the Wolfram Language defaults to the octave starting on middle C (C4). In the third row, we have specified the notes as numbers. As we will see shortly, in musical set theory, notes without an octave correspond to pitch classes and integers 0 to 11 correspond to pitch class representatives (i.e. numbers that represent a pitch class). The note/integer mapping is simply C↔0, C#↔1, D↔2... A#↔10, B↔11. Whilst (as we will see) pitch classes and pitch class representatives have no specified pitch in musical set theory, we can get an idea of the sounds they indicate by mapping them into the Middle C octave, and this is precisely what the Wolfram Language does by default if the octave is omitted. The final two rows in the table are chromatic scales in sharps and flats just to show you how to write accidentals. If you want to know what sounds any of the pitch classes or collections of pitch classes in this book indicate, you can modify the above examples to play them.
One feature of the way the Wolfram Language deals with sound is that it generates the waveforms of the sounds on demand. This is obviously computationally expensive, and so we have not provided many auditory examples in this book. However, by using the functions given above, you can listen to anything you want just by entering in a few letters or numbers. If you are running the interactive text in Mathematica, you might want to have a separate, “scratch pad”, notebook open in which you can use these functions to listen to things.
1.3 Enharmonic equivalence
1
.3
Enharmonic equivalenceIn musical notation, the same pitch can have different names or spellings. For example, the pitch specified by F#4 can be spelled as F#4 or as Gb4 depending on the function of the pitch in a particular scale or piece of music. In equal temperament, the different spellings sound exactly the same and are said to be enharmonically equivalent. In the example in the previous section, you can see that the chromatic scales in sharps and flats have different enharmonic spellings, but sound exactly the same. We have to deal with enharmonics in every aspect of music, and musical set theory is no exception. Here is a table of enharmonics. No octave is specified:
In[]:=
Grid[{{"C"},{"C#","Db"},{"D"},{"D#","Eb"},{"E"},{"F"},{"F#","Gb"},{"G"},{"G#","Ab"},{"A"},{"A#","Bb"},{"B"}},FrameAll]
Out[]=
C | |
C# | Db |
D | |
D# | Eb |
E | |
F | |
F# | Gb |
G | |
G# | Ab |
A | |
A# | Bb |
B | |
Here are some common scales that we will use quite a lot. Again, notice that we have not specified an octave. Technically speaking, this means that these scales are really comprised of pitch classes (which we will look at shortly), rather than pitches:
In[]:=
gridFormValue[{CMajor={"C","D","E","F","G","A","B"},CNaturalMinor={"C","D","Eb","F","G","Ab","Bb"},CHarmonicMinor={"C","D","Eb","F","G","Ab","B"},CMelodicMinorUp={"C","D","Eb","F","G","A","B"},CMelodicMinorDown=CNaturalMinor,CChromaticSharps={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"},CChromaticFlats={"C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"}}]
Out[]=
CMajor={C,D,E,F,G,A,B} | {C,D,E,F,G,A,B} |
CNaturalMinor={C,D,Eb,F,G,Ab,Bb} | {C,D,Eb,F,G,Ab,Bb} |
CHarmonicMinor={C,D,Eb,F,G,Ab,B} | {C,D,Eb,F,G,Ab,B} |
CMelodicMinorUp={C,D,Eb,F,G,A,B} | {C,D,Eb,F,G,A,B} |
CMelodicMinorDown=CNaturalMinor | {C,D,Eb,F,G,Ab,Bb} |
CChromaticSharps={C,C#,D,D#,E,F,F#,G,G#,A,A#,B} | {C,C#,D,D#,E,F,F#,G,G#,A,A#,B} |
CChromaticFlats={C,Db,D,Eb,E,F,Gb,G,Ab,A,Bb,B} | {C,Db,D,Eb,E,F,Gb,G,Ab,A,Bb,B} |
The melodic minor scale is unusual because it has a different sequence of notes going up and going down. When you go down, it is the same as the natural minor scale.
1.4 Twelve tone equal temperament (12TET)
1
.4
Twelve tone equal temperament (12TET)Just about all Western music is written in a system of tuning known as 12 tone equal temperament. Before we move much further into musical set theory, we need to understand exactly what this means. Musical set theory is predicated on 12TET, and will not work in its current form in other temperaments. We can define 12 tone equal temperament as follows:
12 tone equal temperament: a system of tuning in which the octave is divided into 12 semitones of equal size.
By, “equal size”, we mean that the difference between any two consecutive semitones sounds the same regardless of their absolute pitches. In fact, to human hearing, this “equal size”, occurs when the ratio of the frequencies of any two consecutive semitones is the same. This is because our response to sound is more or less logarithmic. So in 12TET, the octaves sound the same, and so do the differences between consecutive semitones. It is a very regular tuning that has some interesting properties that we will look at shortly.
It is well worth pointing out that there is nothing particularly special about 12 tones - other cultures (and periods in history) have had more or less than this. The only truly special thing about equal temperament is its uniformity. This allows instruments that have fixed pitches to play in tune any key, because in equal temperament, keys only differ in a matter of absolute pitch - the sequence of tones and semitones is always the same, the distance between semitones is always the same, and the intervals in any chord are the same in any key. Historically, non-equal temperaments have been the norm, and whilst they have disadvantages, they also have the significant advantage that different keys can have completely different characters. This is because the semitones have different distances between them so the sequence of distances in say a C major scale is different to the sequence of distances in a F major scale. When the old music masters talk about the inherent characters of different keys such as C Major or Eb Major, this can only apply to historic non-equal temperaments. In equal temperament, C Major and Eb Major are precisely the same scale, only differing in absolute pitch. As an aside, it is unclear to us why so many avant-garde composers seem to have a predilection for exotic key signatures - it is a difference that doesn’t make a difference as it amounts merely to a difference in absolute pitch that few people will even be aware of. It may cause some instruments to shift into a different register, leading to a subtle change in timbre, but we doubt that this is a primary motivating factor. Non-equal temperaments have other advantages also. Some of them have purer consonances than 12TET, provided you don’t modulate too far from the tonic. With 12TET we are reduced to uniformity and, as well as (arguably) slightly poorer consonances, we have lost one of the key dimensions of meaning, the character arising from the different spacings between semitones, that key signatures used to have. In terms of this, it is worth pointing out that “well-tempered” tuning, as used by, for example, J. S. Bach in The Well-Tempered Clavier is not 12TET, but it does allow one to play in tune in all keys. Nevertheless, as we will see, the uniformity of 12TET has many advantages which far outweigh these shortcomings for most musicians.
The example below takes the frequencies in Hz of some consecutive semitones in the 12TET scale, and calculates the ratio. As we said above, the ratio is always the same for any two consecutive semitones, and it is in fact equal to the 12th root of 2. This is shown in the example below for A4 and A#4 and C5 and C#5:
In[]:=
Block{A4=440,ASharp4=466.16382334539463`,C5=523.2512`,CSharp5=554.3653354792145`},gridFormValueASharp4A4,CSharp5C5,N
12
2
Out[]=
ASharp4 A4 | 1.05946 |
CSharp5 C5 | 1.05946 |
N[ 1/12 2 | 1.05946 |
Of course, it is no coincidence that the ratio of consecutive semitones in 12 tone equal temperament is the 12th root of 2. You can understand this by considering a chromatic scale. Let’s take a C chromatic scale in octave N staring on CN. Let the frequency of CN be f. Let the ratio between consecutive semitones be r. Then we have:CN = fC#N = r(CN) = r(f)DN = r(C#N) = r(r(f))D#N = r(DN) = r(r(r(f)))EN = r(D#N) = r(r(r(r(f))))FN = r(EN) = r(r(r(r(r(f)))))F#N = r(FN) = r(r(r(r(r(r(f))))))GN = r(F#N) = r(r(r(r(r(r(r(f)))))))G#N = r(GN) = r(r(r(r(r(r(r(r(f))))))))AN = r(G#N) = r(r(r(r(r(r(r(r(r(f)))))))))A#N = r(AN) = r(r(r(r(r(r(r(r(r(r(f))))))))))BN = r(A#N) = r( r(r(r(r(r(r(r(r(r(r(f)))))))))))C(N+1) = r(BN) = r(r( r(r(r(r(r(r(r(r(r(r(f)))))))))))) = f = 2f
12
r
You can see that when we get to the octave at C(N+1), we have:
12
r
Therefore:
r =
12
2
As we pointed out above, there is nothing special about the number 12, and we can generalize the calculation to a d division equal tempered scale, in which case the ratio between consecutive smallest intervals is . The value of d determines what type of scale we have:
d
2
■
d < 12, a macrotonal scale, where the smallest interval is greater than a semitone.
■
d = 12, a normal scale where the smallest interval is exactly 1 semitone.
■
d > 12, a microtonal scale where the smallest interval is less than a semitone.
As we saw above, we can generate the next frequency a smallest interval up as follows:
f
1
d
2
f
0
And for the previous frequency, we divide by the root of 2:
th
d
f
1
-d
2
f
0
We can implement this as follows:
In[]:=
nextF[f_Real,d_:12]:=
d
2
fSetAttributes[nextF,Listable]prevF[f_Real,d_:12]:=-d
2
fSetAttributes[prevF,Listable]Here is a function to calculate the next n smallest intervals above a starting frequency f when the scale is equally tempered and has d divisions:
In[]:=
chromaticScaleFreqs[f_Real,n_Integer,d_:12]:=NestListN
d
2
#&,f,nLet’s try this out for a 2 octave major scale starting at Middle C which is C4 in scientific pitch notation and which has a pitch of 261.63 Hz:
In[]:=
BarChart[chromaticScaleFreqs[261.6256,24],GridLines->Automatic,ChartLabels{"C4","","","","","","","","","","","","C5","","","","","","","","","","","","C6"},PlotLabel"Frequencies for 2 octave major scale on C4",AxesLabel{"Note","Frequency"}]
Out[]=
You can see from the above chart that the octaves, C5 and C6, are at the 12th and 24th position respectively.
We must emphasize that the above mathematical treatment is only applicable to equal temperament. Non-equally tempered tunings may be based on other mathematical principles, or even on purely subjective matters of consonance and dissonance that depend on culture and history. In fact, there is no consensus about the consonance or dissonance of any interval apart from the octave, which seems to be a human given.
1.5 Fretted instruments - a digression
1
.5
Fretted instruments - a digressionA good way of getting an intuitive understanding of 12TET is by taking a look at a fretted instrument such as a guitar. Fretted instruments have a thin string stretched over a fretboard between two fixed points called a nut and a bridge. The distance between these two fixed points is called the scale length. The nut fixes the strings at the head of the instrument (usually where the tuning pegs or tuning machines are), and the bridge at the other end of the instrument transmits the string vibrations to the soundboard for amplification. The string is free to vibrate between these two fixed points (open string) unless it is pressed down on to a fret (fretted) in which case the fret replaces the nut as a fixed point, and the vibrating length of the string is shortened accordingly.
The fundamental frequency of a vibrating string, is:
f
0
■
Inversely proportional to the vibrating length of the string, L, so the longer the string, the lower the frequency.
■
Proportional to the square root of the stretching force (tension) in the string, F, so the higher the tension, the higher the frequency.
■
Inversely proportional to the square root of the mass per unit length, μ, so the thicker and heavier the string the lower the frequency.
This is encapsulated in Mersenne's Law as follows:
f
0
1
2L
F
μ
For a given string on a given instrument, F and μ are fixed, so:
f
0
1
L
In other words, the frequency of vibration of the string is inversely proportional to its length. By pressing the string down to a fret, its length is shortened and therefore its frequency goes up. We can calculate how much we need to shorten the string to get a particular frequency, and this determines the position of the frets because of the proportionality with length. Let correspond to a vibrating string of length , and the next semitone up , correspond to the string length , then using the proportionality:
f
0
L
0
f
1
L
1
L
1
1
12
2
L
0
This formula allows us to calculate the positions of the frets. We can implement this very directly in the Wolfram Language as follows (note that scaleLength is the distance from the nut to the bridge and this is the vibrating length of the open string):
In[]:=
fretsFromBridge[numFrets_Integer,scaleLength_]:=NestListN1
12
2
#&,scaleLength,numFretsfretsFromNut[numFrets_Integer,scaleLength_]:=scaleLength-fretsFromBridge[numFrets,scaleLength]The first function calculates the fret positions measured from the bridge, and the second function, the fret positions measured from the nut. If we consider a classical guitar, the standard scale length length is 660mm, and there are 21 to 24 frets:
In[]:=
fretsFromBridge[24,660]
Out[]=
{660,622.957,587.993,554.992,523.842,494.441,466.69,440.497,415.774,392.438,370.412,349.623,330.,311.479,293.997,277.496,261.921,247.221,233.345,220.249,207.887,196.219,185.206,174.811,165.}
The following function draws a side view of a fretboard to illustrate this:
In[]:=
fretboard[numFrets_,scaleLength_]:=Graphics[{(*Frets*)Gray,Disk[{#,1.5},3]&/@fretsFromNut[numFrets,scaleLength],(*Nut*)Blue,Triangle[{{-10,0},{10,0},{0,10}}],Text["Nut",{0,-20}],(*Bridge*)Red,Triangle[{{scaleLength-10,0},{scaleLength+10,0},{scaleLength,10}}],Text["Bridge",{640,-20}],(*Fretboard*)Brown,Rectangle[{-10,-10},{scaleLength+10,0}],(*String*)Black,Line[{{0,10},{scaleLength,10}}],(*Octavemarker*)Dashed,Line[{{scaleLength/2,-30},{scaleLength/2,30}}],Text["Octave",{scaleLength/2,-40}]},ImageSizeLarge]
If we consider our classical guitar:
In[]:=
fretboard[24,660]
Out[]=
The octave occurs at the 12th fret, which is half the string length. You can see that the fretboard gives an exact representation of the 12TET scale frequencies. The distance between the frets decreases in a completely regular way. Non-equally tempered instruments, such as lutes, which have moveable frets, have slightly irregular fret spacings making the size of semitones different at different places on the fretboard.
Here is a useful 12TET fret position calculator utility that we have used on many stringed instruments:
In[]:=
ManipulateGridPrependTransposeRange[0,numberOfFrets],NRoundfretsFromNut[numberOfFrets,scaleLength],,NRoundfretsFromBridge[numberOfFrets,scaleLength],,{"Fret","From nut","From bridge"},FrameAll,{scaleLength,640.0},{numberOfFrets,Range[12,40]},{{decimalPlaces,2},{1,2,3}},FrameLabeltopLabel["12TET fret position claculator"],SaveDefinitionsTrue
-decimalPlaces
10
-decimalPlaces
10
Out[]=
You can find an online version of the utility, with some extra information about how to fret various stringed instruments, here: .
You can find an example of how to fret a non-equally tempered instrument, according to the scheme set out in John Dowland's, "A Varietie of Lute Lessons" [Dowland1], here:.
1.6 Chapter summary
1
.6
Chapter summaryThis short chapter has set the scene by introducing the ideas of pitch, standard notation for pitches, and enharmonic and octave equivalence. We considered 12 tone equal temperament, the logarithmic response of human hearing to sound frequency, and implemented some functions to calculate frequency scale. We have also touched on the notions of pitch class and pitch class representative that we will look at in much more detail once we have established the necessary background in set theory in the next chapter. As an illustrative aside, we considered the fretting of stringed instruments according to 12TET.
2
3
4
5
6
7
8
9
11
12
13
14
15
Bibliography
Cite this as: Jim Arlow, "The Mathematics of Musical Set Theory" from the Notebook Archive (2020), https://notebookarchive.org/2020-07-alqx8cj
Download