# Are there any rules of thumb for shifting the key signature within a tone net?

[ ... struggling with giving this a better title ]

I'm working out the algorithmic bases for generation of a tone-net (tonnetz) in preparation for programming the presentation layer.

The problem is primarily with a keyed tone-net (Key of Db or Gb), but it extends to showing degrees as well (I,II,III, etc.).

Basically as the spectrum of the tone net expands away from its arbitrary tonic center, the notation shifts into flats, then double-flats, then triple-. Or (as with the current state of my spreadsheet algorithms) I see things like B# displayed as C, or the scale becomes like this: D E Gb G A B Db D (the keys of Db or Gb are going to be of particular concern... ).

I could select the most-correct notation from a hash table, but I still need to know when to pivot into another key. If I follow the Circle of Fifths rules, adding flats & sharps as it radiates away from "C". But then there's the problem of starting with Gb Major, where in the Co5ths we find it at a zone of enharmonic phase transition (at the bottom of the Co5ths).

I know it's arbitrary to pick a center, but following the rectilinear circle-of-fifths on a tone-net, when's the most opportune point to start shifting the key signature?

see:

(I can adjust the algorithm so it shifts into sharps in the positive-Y axis, & flats in the bottom quadrant, but the key signatures are still going to float , esp. with the placement of bb or ## adjectives )

[ed.]

Another presentation-layer scenario: • Have you considered just using pitch class integer notation (i.e. C=0, C#/Db=1,…, A#/Bb=T, B=E)? This kind of application is pretty much what it was designed for. That way triads like F# and Gb (and for that matter Ex and Abbb) major could all just be represented by 6–T–1. Tonnetz were designed specifically to evaluate chord progressions outside of diatonic progressions anyway; the initial relative or leittonwechsel move can stay in a key but any move past that—and just one parallel move—shift key dramatically very quickly. – Pat Muchmore Jun 26 '14 at 1:56
• I must admit I'd been at an impasse, using absolute chromatic values (A110=13, A220=26 ). I had considered early on changing to hexadecimal notation but didn't see the advantage. Modulo isn't a big impediment, converting back to the std notation/solfege names ... I just need to track the tonic offset. One goal is to preserve enharmonic degrees of any tonal center (?TET vs. Just/Pythog?). So I'd like to be able to follow the tonal center as it shifts & reassign the relative degree space accordingly. But as you point out, anything past known relative moves should incite a reassignment. – L. Rodgers Jun 26 '14 at 15:51
• See 1st answer: music.stackexchange.com/questions/17318/… – L. Rodgers Jun 26 '14 at 16:01
• AND: theory.esm.rochester.edu/temperley/papers/temperley-ma00.pdf "...Voice-Leading Rule (final version). Given two events that are adjacent in time and a semitone apart in pitch height: if the first event is remote from the current centre of gravity, it should be spelled so that it is five steps** away from the second." ** [ on the circle of fifths ? ] – L. Rodgers Jun 26 '14 at 16:08
• Oh, and I think the explanation of the line from the Tempereley paper you quoted in your comment is that it should be spelled so that it is five steps away on the line of 5ths, not the circle. – Pat Muchmore Jun 26 '14 at 16:46

I'm not 100% sure what your goals are since I see a conflict between using the tone net, which just goes off in all directions with more and more sharps/flats, and your goal of limiting/manipulating the number of sharps and flats. In conventional music the key signatures are (usually) selected so as to avoid double-flats/sharps and the use of chromatic notes that are enharmonic with natural notes (e.g. E# or F♭) so I'd just setup a rule-base to replace those keys with their enharmonic equivalents.

However, since you're using the tone net, I have to assume that you want to do something that is capable of representing some aspects of the tone net without just remapping enharmonic notes. Maybe you need something where, the note F occurs as the 3rd of the key of D♭ major and the note E# appears as the 3rd of the key of C# major. Since I can't tell how far away from the selected root you are going to get, I'm going to start with some general considerations, and then narrow it down to a specific set of requirements, that are hopefully relevant.

General

First, explicitly represent intervals as `(major-3rd, perfect-5th)` pairs, i.e. a major 3rd is `(1,0)` a perfect fourth is `(0,-1)`, minor third is `(-1,1)` etc. These directly represent the motions in the tone lattice. If I were concerned about octaves, I'd append them as a third field to the tuple.

Second, I would define a function that takes a root-note, and an interval, and returns the note name. This can be achieved with a restricted lookup table:

• `A+(1,0)=C#`, `A+(-1,0)=F`, `A+(0,1)=E`, `A+(0,-1)=D`
• `B+(1,0)=D#`,...
• same for C
• ...

Note that from the table for the natural notes we can get the results for chromatic notes, `D#+(1,0)=[D+(1,0)]#=F##`. Note that a sharp-flat combination cancels: D♭+(1,0)=[D+(1,0)]♭=[F#]♭=F. This function is important in translating from the `(M3,P5)` representation in the model into the names displayed in the presentation layer. Also note movement in the lattice is associative (and commutative) so that `A+(-1,2)=A+(-1,0)+(0,1)+(0,1)=[[F]+(0,1)]+(0,1)=C+(0,1)=G` so you only need to pre-compute the table for the shifts `(1,0),(-1,0),(0,1),(0,-1)` and can compute the rest with appropriate logic. So far, this is just the mechanics to produce the infinite tone net, i.e. just doing this will, for large intervals, produce notes with many sharps/flats.

To fold the tone-net back in on itself, I'd use to pair representation of intervals, and try to reduce those. First off, I'd consider the octave reductions:`(0,+/-12)=>(0,0)` or `(+/-3,0)=>(0,0)`, and set up logic to see if a given interval can be "simplified" by applying these octave reductions. One would need to define "simplfied" -- off the top of my head, I'm not sure if the Euclidean (sum-of-squares) or Manhattan (sum-of-absolute-values) (or something else?) metric is more useful. Basically, one would have a list of reduction rules, and then you'd need to see if applying the reduction rules makes the interval smaller (more simple).

If these octave equivalent's don't do everything you need, I'd look into other intervals that can produce notes that can be enharmonically reduced. For example, the diagram in your question has a yellow D♭ a fifth above a F# -- a note that would usually be written C#. This can be reproduced by a rule that allows for the substitution `(0,7)=>(-1,-2)`.

Specific

We can see how this general approach would apply by considering the differently colored areas in your figure in your question. Rooted at C this gives:

```A  E  B  F#                           (+1,-1) (+1, 0) (+1,+1) (+1,+2)
F  C  G  D                            ( 0,-1) ( 0, 0) ( 0,+1) ( 0,+2)
D♭ A♭ E♭ B♭                           (-1,-1) (-1, 0) (-1,-1) (-1,+2)
```

so the idea is that we're saying "When rooted at C use these notes, when rooted somewhere else use the notes in the same relative positions as above". Then you can look at the set of intervals that this set of notes corresponds to (right hand side above) and use this as a template for generating the note names via the logic outlined above when the template is rooted at a different note.

To limit consideration to this block we need two reduction rules: `(0,4)=>(1,0)`, identify the C-G-D-A-E E with the E a major third above C, and `(3,0)=>(0,0)` i.e. a chain of 3 major thirds spans an octave (more accurately, it's instead of going up two M3rds, go down 1 M3rd). Then given a pair `(M3,P5)` we can use the following logic:

``````<pre>
while P5>3  : P5-=4, M3+=1
while P5<-1 : P5+=4, M3-=1
while M3>1  : M3-=3
while M3<-1 : M3+=3
</pre>
``````

once we've used this to reduce the interval, we can then use the note-name logic to compute the note name given the root note that we have chosen.

Finally, this particular block of notes around a given root has a special significance in that it exactly describes quarter comma meantone tuning, and thus is particularly relevant for describing common practice music, which was primarily performed in tunings that descended from quarter comma meantone.