Sunday, December 24, 2017

Christmas Eve Post: Coding the Bohlen-Pierce Musical Scale

1. Pappas and the Christmas Eve Snowflake
2. A Few More Properties of the New 7-Limit Scale
3. The Bohlen-Pierce Musical Scale
4. Coding "Deck the Hall" (Mannheim Steamroller)
5. Coding "Rise Up, Shepherd an' Follow" (Vanessa Williams)
6. Coding "I Saw Three Ships" (Nat King Cole)
7. Coding "Santa Baby" (Eartha Kitt)
8. Coding "Hard Candy Christmas" (Dolly Parton)
9. Coding "O Holy Night" (Bohlen-Pierce)
10. Conclusion: "Fassung 1" (Heinz Bohlen)

Pappas and the Christmas Eve Snowflake

This is what Theoni Pappas writes on page 54 of her Magic of Mathematics:

"This beautiful geometric fractal was created in 1904 by Helge von Koch. To generate a Koch snowflake curve, begin with an equilateral triangle."

This is the subsection "Finding the Area of a Snowflake Curve." Today is Christmas Eve, and so let's make it a white Christmas by looking at the Koch snowflake fractal.

Here's an interactive link to the first nine stages (labeled as Levels 0-8) of the Koch snowflake:

http://www.shodor.org/interactivate/activities/KochSnowflake/

Pappas states and proves an area formula for the snowflake curve. I reproduce her entire proof here, even though it extends into page 55.

Theorem: The area of the snowflake curve is 8/5 of its generating triangle.

Proof:

I. Assume the area of equilateral Triangle ABC is k.

II. Divide Triangle ABC into nine congruent equilateral triangles of area a. Thus k = 9a.

Now concentrate on determining the limit of the area of one of the 6 initial points of the snowflake curve. We know the area of the large point is a, since it's one of the nine triangles. The next set of points generated from it have area (a)(1/9) each, just like the original triangle had been divided into 9 congruent triangles it also is. In fact, each successive point is broken into nine congruent triangles with the two triangles springing from it.

STEP III shows the summation of the various areas of this point:

III. [a + 2(a/9) + (a/(9*9))8 + (a/(9*9*9))32 + ...]
(Notice there are 8 "Level 2" points and 32 "Level 3" points.)

STEP IV: Now, by adding up the areas created by each of the 6 points plus the hexagon in the interior of the original generating triangle, we get expression IV:

IV. [a + 2(a/9) + 2(a/(9*9))4 + 2(a/(9*9*9))4^2 + 2(a/(9*9*9*9))4^3 + ...]6 + 6a

STEP IV is changed to STEP V:

V. [1 + 2/9 + 2*4/9^2 + 2*4^2/9^3 + 2*4^3/9^4 + ... + (2/9)(4/9)^(n - 2) + ...]6a + 6a

The resulting series in the brackets is a geometric series with ratio 4/9 and 2/9 as its initial term, so we can calculate its limit: (2/9)/(1 - (4/9)) = 2/5.

STEP VI. Substituting the 2/5 for the limit of the series, we get:

[1 + 2/5]6a + 6a = 72a/5

Now we need to express the area of the snowflake curve in terms of k, the area of the original generating triangle. Since k = 9a, we get a = k/9. Substituting this for a in 72a/5, we get:

(72/5)(k/9) = (8/5)k. QED

A Few More Properties of the New 7-Limit Scale

Since it's Christmas Eve, let's return to coding more music -- specifically holiday music -- on the computer emulator. Since creating the New 7-Limit Scale, I've noticed a few of the new scale's special properties.

Again, let's look at the scale itself:

The New 7-Limit Scale:

Key     Sound     Degree     Note     Ratio     Interval (from root note)
1.         51           210          G+7      1/1         tonic
2.         69           192          A           35/32     neutral second
3.         81           180          Bb+       7/6         subminor third
4.         93           168          B7         5/4         major third
5.         99           162          C           35/27     semidiminished fourth
6.         117         144          D           35/24     semidiminished fifth
7.         121         140          D+7       3/2         perfect fifth
8.         135         126          E7          5/3         major sixth
9.         141         120          F+          7/4         harmonic seventh
0.         153         108          G           35/18      semidiminished octave

I was thinking about back to the 22 sruti scale. If you recall from my June 30th post, this 5-limit scale contains many seconds (two major and two minor), many thirds (two major and two minor), and so on and so forth. But the scale contains only one fifth (the perfect fifth) and only one tonic (which appears as either the first note or the octave).

Our New 7-Limit Scale is the opposite. This scale has two tonics and two fifths, but only one of every other interval -- except the third, which can be either major or minor.

We notice that this new scale isn't quite a major scale since there's no major seventh, yet it's not quite a minor scale either since there's no minor sixth. I've mentioned in earlier posts that in addition to the major and minor scales, there are extra scales called modes:

C Major: C, D, E, F, G, A, B, C
G Mixolydian: G, A, B, C, D, E, F, G
D Dorian: D, E, F, G, A, B, C, D
A Minor: A, B, C, D, E, F, G, A

This is one way to think of the modes -- as a series of white keys on the piano, but starting at other notes rather than just C. It's also possible to look at all the modes starting with a single note -- such as G, the root of the New 7-Limit Scale. Then sharps and flats are needed:

G Major, G, A, B, C, D, E, F#, G
G Mixolydian: G, A, B, C, D, E, F, G
G Dorian, G, A, Bb, C, D, E, F, G
G Minor: G, A, Bb, C, D, Eb, F, G

Depending on which third we use, either G Mixolydian or G Dorian can be played in New 7-Limit, but not major or minor. The Extended 7-Limit Scale adds the notes Eb and F#, so that G Major and G Minor can also be played.

Of course, songs aren't just meant to be played -- they're meant to be sung, as well. This is my scale, so we ask, is it possible for me to sing any song in the New 7-Limit Scale?

Singers are generally classified by their vocal range:

• Soprano
• Mezzosoprano
• Alto
• Tenor
• Baritone
• Bass
Because I am male, my range must be one of the lower three types -- tenor, baritone, or bass. It's said that baritone is the most common male voice, but how about mine? I'm not quite sure, but I believe that I'm either a baritone or a bass. We look at the following link:

http://www.differencebetween.com/difference-between-baritone-and-vs-bass/

Clearly both baritones and basses sing notes below middle C. There are two ways to indicate notes:

• Notes in the octave below middle C can be written with small letters -- c, d, e, f, g, a, b -- while notes in the next lower octave can be written as capital letters. Middle C itself is written as c', to be followed by one line notes d', e', f', g', a', b'. I used this notation earlier on the blog, when describing the Google Fischinger player.
• Notes can also be written using piano octaves. The three lowest notes of the piano are in Octave 0, written A0, Bb0, B0. Then Octave 1 ranges from C1 to B1, and then Octave 2 from C2 to B2, and Octave 3 from C3 to B3. Middle C is C4 under this system, and the two highest notes of the piano are B7 and C8.
Notice that in both systems, all octaves have C as the lowest note and B as the highest. The link above uses the piano notation. According to that link:
• The baritone range is A2 to A4.
• The bass range is E2 to E4.
For me this is tricky, because for me, E2 is a bit too low for me to sing, but A4 is a little to high. My optimal range -- the range where my singing voice carried best in the classroom -- seemed to be where the bass and baritone ranges overlap, from A2 to E4. In the other notation, my range is from A to e' -- and this range includes the entire small octave from c to b. Therefore it's more convenient for me to use small letter notation for my singing range -- with a few great and a few one-line notes -- and switch to piano notation when writing about notes outside my singing range.

On the other hand, the computer emulator must be classified as a high soprano. The PLAY command used by the emulator has a five octave range, but Middle C is in Octave 2. The computer manual claims that the octaves run in alphabetical order -- from A to G -- but when I actually use the emulator, the octaves run actually from C to B as usual. This means that the computer can play four octaves above middle C but only one octave below middle C. Its highest note is the second highest on the piano, but its lowest note is more than three octaves above the piano's lowest note.

To convert from piano notation to computer notation, subtract two octaves. To convert from line notation to computer notation, add one to the number of lines:

PLAY "O1;C" plays C3 or c
PLAY "O3;F" plays F5 or f"
PLAY "O5;B" plays B7 or b""

The SOUND command is even more biased towards the soprano side. Sound 1 (Degree 260) is known as ocher-green e (Sound 5 is white e), so small c and d can't be reached via SOUND. On the high side, Sound 255 (Degree 6) is white A8, which is even higher than can be reached via PLAY or a piano.

The tricky part is when I try to sing the New 7-Limit Scale. This scale runs from greenish g to white g' -- and this high note is slightly above my optimal range (A to e'). On the other hand, if I try to sing one octave below the computer, the low note becomes G, which is a bit below my optimal range. So there is only one g note that I can sing strongly -- and yet the New 7-Limit Scale contains two g notes (either G to g, or g to g'). In practice, I'd sing either the bass G-g octave or the baritone g-g' octave depending on whether the low (greenish) tonic or high (white) tonic is stronger in the song -- making sure that small g is the stronger note. (In the previously posted songs, I must use 70 N=2 in these songs, since 70 N=1 is the g'-g" octave, which is well above my range.)

When I created songs for class, I often used G major as this is convenient for the guitar. In practice, I often sang the octave from d to d' -- the tonic g appears only once in this octave.

The Bohlen-Pierce Musical Scale

I remember my old computer manual making a little joke in explaining the PLAY command:

"One further note: No, we're not going to spring a new note like H or J on you...."

As it turns out, there's a real scale that contains an H and a J. This scale is named for its co-inventors, Heinz Bohlen and John Pierce. They developed the scale independently, just as Isaac Newton and Gottfried von Leibniz developed Calculus independently. (Bohlen passed away nearly two years ago.)

The reason this scale needs an H and a J is because it's not based on the octave -- which, if you recall, is a 2/1 harmonic ratio. Instead, the Bohlen-Pierce scale is based on the tritave, or 3/1 ratio (also known as a perfect twelfth). This means that two notes with the same name, such as C and C, are a tritave apart, not an octave. Because of this, we need more letters to complete the scale, H and J.

We've actually seen tritaves on this website before. Recall that the 5-limit minor scale is playable using both 70 N=1 (which plays from D5 to D6) and 70 N=2 (which plays an octave lower than N=1, from D4 to D5). It's also possible to use 70 N=3 instead. This multiplies all degrees by three, so it actually plays a tritave lower than N=1 -- from G3 to G4. This is the same as the New 7-Limit Scale based on white g. (If I were singing, I'd use N=2 and then sing an octave below the emulator.)

Here's a link to the Bohlen-Pierce scale:

The Bohlen-Pierce Scale:

Step     Note     Ratio     Interval
0          C          1/1         tonic
1          Db        27/25    great limma
2          D          25/21    quasi-tempered minor third
3          E          9/7         supermajor third
4          F          7/5         lesser tritone
5          Gb        75/49    Bohlen-Pierce fifth
6          G          5/3        major sixth
7          H          9/5        minor seventh
8          Jb         49/25    Bohlen-Pierce eighth
9          J           15/7       subminor ninth
10        A          7/3        subminor tenth
11        Bb        63/25    quasi-tempered major tenth
12        B          25/9      augmented eleventh
13        C          3/1        perfect tritave

• Not only does 2/1 not appear, but all numerators and denominators are odd. The Bohlen-Pierce scale is clearly a "no twos" scale. According to its creators, the major BP triad is not the usual 4:5:6 major triad but the 3:5:7 triad, which appears above as C-G-A. Thus it is a 7-limit scale.
• The alphabet starts with C here. This is probably to mimic the octave system, where all octaves begin with C.
• Not every note has a letter name. On the piano, white keys have names, but black keys require sharps or flats. BP has nine "white keys" and four "black keys."
The BP creators often use the name "Lambda" to refer to the scale played on the white keys. (Yes, I know I complained about having to use the Greek letter lambda in a Putnam problem three weeks ago, and now suddenly we're using "Lambda" as the name of a scale.

Since Lambda contains only nine notes (ten if we count the final tonic), we would want to code our computer emulator to play Lambda using INKEY\$ and the ten keys from "1" to "0." But is this scale even possible.

One problem with BP is that it uses primes 3, 5, 7 instead of 2, 3, 5 -- and multiplying 3's, 5's, and 7's takes us past Bridge 261 very quickly. Observe the scale as written above. We can ignore Db since this has nothing to do with Lambda, so we start with note D, ratio 25/21. Note E is ratio 9/7, so our common numerator is already 25 * 9 = 225. And this doesn't have the factor of 7 needed for Note F, at ratio 7/5. So not only can't we play a just Lambda scale, we can't even play C-D-E-F.

Since BP is so different from PLAY and the 12EDO scale, it is definitely desirable to approximate BP using the SOUND command. I decided to use trial and error to determine the best possible EDL in which to approximate BP. It turns out that 63EDL is the best. Using 63EDL, we obtain:

The Bohlen-Pierce Scale, approximated in 63EDL:

Step     Sound     Degree     Note     Ratio     Interval
0           198         63            C          1/1        tonic
1           203         58            Db        27/25*  large limma
2           208         53            D          25/21*  quasi-tempered minor third
3           212         49            E          9/7         supermajor third
4           216         45            F          7/5         lesser tritone
5           220         41            Gb        75/49*  Bohlen-Pierce fifth
6           223         38            G          5/3*      major sixth
7           226         35            H          9/5        minor seventh
8           229         32            Jb         49/25*  Bohlen-Pierce eighth
9           232         29            J           15/7*     subminor ninth
10         234         27            A          7/3        subminor tenth
11         236         25            Bb        63/25    quasi-tempered major tenth
12         238         23            B          25/9*    augmented eleventh
13         240         21            C          3/1        perfect tritave

* -- approximate. Ratios whose numerators which don't divide 63 can't be played exactly.

Fortunately, more than half of the notes needs for Lambda are exact. We might make a different choice if we considered 5 to be more important than 7, but let's stick to 63EDL for now.

And now we can write our Lambda program:

10 DIM S(9)
20 FOR X=0 TO 9
40 NEXT X
50 DATA 21,63,53,49,45
60 DATA 38,35,29,27,23
70 N=1
80 A\$=INKEY\$
90 IF A\$="" THEN 80
100 A=VAL(A\$)
110 SOUND 261-N*S(A),2
120 IF A\$>="0" AND A\$<="9" THEN 80

In line 70, N can equal 1, 2, 3, or 4, since 63 * 4 is still less than 261. In this case, N=2 drops the scale by an octave, N=3 by a tritave, and N=4 by two octaves. Of course, BP purists might argue that we should avoid N=2 and N=4 since BP has nothing to do with octaves.

The Bohlen-Pierce Scale (Lambda only):

Key       Sound     Degree     Note     Ratio     Interval
1.           198         63            C          1/1        tonic
2.           208         53            D          25/21*  quasi-tempered minor third
3.           212         49            E          9/7         supermajor third
4.           216         45            F          7/5         lesser tritone
5.           223         38            G          5/3*      major sixth
6.           226         35            H          9/5        minor seventh
7.           232         29            J           15/7*     subminor ninth
8.           234         27            A          7/3        subminor tenth
9.           238         23            B          25/9*    augmented eleventh
0.           240         21            C          3/1        perfect tritave

Of course, how should we convert BP tritaves to 12EDO octaves? It's useless to say, for example, that C in Bohlen-Pierce should correspond to C in 12EDO, since at most only one C can correspond. The next higher C in BP would correspond to G a tritave higher, and the next lower C in BP would correspond to an F. This is why I made such a big deal about octave notation earlier -- it is indeed unambiguous to say that Middle C (that is, C4) is C in BP. Then G5, D7, F2, Bb0, and so on would also be C's in the BP scale.

At this point there is no BP standard conversion. I've sometimes seen the suggestion that A4 should correspond to A in BP. If this is done, then other A's would be E6, B7, D3, and G1.

The above chart declares Sound 198 (Degree 63) to be C in BP. This would be red E5. Other C's would be red B6, red A3, and red D2.

It's also possible to assign Kite colors and Heathwaite solfege to the entire just BP scale. For the Kite colors, let's make it easy by assuming that the low C of the BP scale is white C, so that the scale ends on G (also white, since 3/1 is Pythagorean). Then this produces:

Step     Note     Ratio     Kite note
0          C          1/1         white C
1          Db        27/25    deep green Db
2          D          25/21    reddish-yellow D#
3          E          9/7         red E
4          F          7/5         bluish Gb
5          Gb        75/49    deep reddish Fx (F double-sharp)
6          G          5/3        yellow A
7          H          9/5        green Bb
8          Jb         49/25    deep bluish Dbb (D double flat)
9          J           15/7       reddish C#
10        A          7/3        blue Eb
11        Bb        63/25    bluish-green Fb
12        B          25/9      deep yellow F#
13        C          3/1        white G

Some of these names sound convoluted, like "deep bluish Dbb," but they are perfectly logical. For example, two 5/3's combine to form a 25/9. As C-A is a major sixth, so is A-F#, and "yellow" plus "yellow" is "deep yellow," hence "deep yellow F#." Likewise, two 7/5's combine to make 49/25, and 7/5 is the bluish fifth ("bluish" means blue-green -- blue due to the 7 in the numerator and green due to the 5 in the denominator). "Bluish" plus "bluish" is "deep bluish," and C-Gb is a diminished fifth, so a diminished fifth above Gb is Dbb (which is not enharmonic to C in just intonation).

As for Heathwaite solfege, it's often noted that the BP scale is approximately equivalent to 8EDO -- in fact, it's almost exactly 8.2EDO, or (41/5)EDO. This means that we can take the Heathwaite solfege for 41EDO and count only every fifth note. The scale can begin with do, which means that it ends a tritave higher at sol:

http://xenharmonic.wikispaces.com/41edo

Step     Note     Ratio     Heathwaite solfege
0          C          1/1         do
1          Db        27/25    ru
2          D          25/21    meh
3          E          9/7         mo
4          F          7/5         fi
5          Gb        75/49    si
6          G          5/3        la
7          H          9/5        te
8          Jb         49/25    da
9          J           15/7       ra
10        A          7/3        ma
11        Bb        63/25    maa
12        B          25/9       fu
13        C          3/1        sol

(You'll have to ask Heathwaite how to pronounce "ma" vs. "maa.") These solfege names help us compare the BP scale to other scales, such as the New 7-Limit Scale. For example, both scales begin with "do" and "ru" (though the N7LS "ru" is 35/32, not 27/25 as in BP). Also, both scales have "da" just shy of an octave. Even though BP has nothing to do with octaves, the BP eighth is actually closer to a just octave than the N7LS near-octave is. (N7LS is 36/35 or 49 cents shy of an octave, while the BP is only 50/49 away or 35 cents.)

In fact, it's interesting to extend the N7LS scale to a tritave (or 36/35 shy of a tritave, in order to maintain the pattern):

The New 7-Limit Scale:

Key     Sound     Degree     Note     Ratio     Interval (from root note)
1.         51           210          G+7      1/1         tonic
2.         69           192          A           35/32     neutral second
3.         81           180          Bb+       7/6         subminor third
4.         93           168          B7         5/4         major third
5.         99           162          C           35/27     semidiminished fourth
6.         117         144          D           35/24     semidiminished fifth
7.         121         140          D+7       3/2         perfect fifth
8.         135         126          E7          5/3         major sixth
9.         141         120          F+          7/4         harmonic seventh
10.       153         108          G           35/18      semidiminished octave
11.       156         105          G+7       2/1         perfect octave
12.       165         96            A           35/16     neutral ninth
13.       171         90            Bb+       7/3         subminor tenth
14.       177         84            B7         5/2         major tenth
15.       180         81            C           70/27     semidiminished eleventh
16.       189         72            D           35/12     semidiminished tritave

If we then invert the notes within this scale (so that Note 1 becomes 16, 2 becomes 15, 3 becomes 14, 4 becomes 13, and so on), then notice that greenish notes become white upon this scale inversion and vice versa (for example, greenish G inverts to white D), while green notes become red and vice versa (for example green Bb inverts to red B).

Here is the link to the computer emulator:

http://www.haplessgenius.com/mocha/

Coding "Deck the Hall" (Mannheim Steamroller)

Let's now start coding some Christmas songs. Most of these songs will be written in the New 7-Limit Scale, but we will boldly try the Bohlen-Pierce scale for one of the songs.

The simplest song we will attempt today is "Deck the Hall." In my music book, "Deck the Hall" is written in C major, but we convert it to the key of G in order to fit New 7-Limit scale. And by G, we actually mean G Mixolydian, since the new scale doesn't have F# required for the full major scale.

On the radio (recall that KOST-FM is our local Christmas music station), an instrumental version of "Deck the Hall" by Mannheim Steamroller is often played. This version is in F major, but sometimes it ventures into Mixolydian mode as an Eb is often played instead of the expected E. So we can capture this version in the New 7-Limit Scale by playing F instead of F# (and by doing so, we suggest the harmonic seventh chord G-B-D-F).

But the F needed is often a low F, below the lowest G of the octave. Indeed, many songs don't have a span of an octave from the lowest to highest note, but venture slightly beyond the octave. And so "Deck the Hall" in the key of G requires a low F# (traditional) or F (Mannheim) below the low G.

And so in BASIC, we will set up the DIM S(9) array by using low F as S(3) instead of Bb, which we do in line 55 below. (None of the songs we'll code today will actually require the minor third.)

But what should we do about the two D's in the New 7-Limit Scale? (The two G's aren't a problem, since we'll always make the low G greenish and the high G white.) To me, it depends on the song. I decided that most D's in this song will be greenish, since our harmonic seventh chord 4:5:6:7 uses greenish G and D. But there is one point in the song where D is followed by white A. I like to keep our fourths and fifths perfect, and so this D will be white instead of greenish.

Here is the program:

10 DIM S(9)
15 FOR V=1 TO 2
20 FOR X=0 TO 9
40 NEXT X
50 DATA 54,105,96
55 DATA 120
60 DATA 84,81,72,70,63,60
70 N=1
80 FOR X=1 TO 68
100 SOUND 261-N*S(A),T
110 NEXT X
120 RESTORE
130 DATA 7,6,5,2,4,4,2,4,1,4,2,4,4,4,1,4
140 DATA 2,2,4,2,5,2,2,2,4,6,2,2,1,4,3,4,1,8
150 DATA 7,6,5,2,4,4,2,4,1,4,2,4,4,4,1,4
160 DATA 2,2,4,2,5,2,2,2,4,6,2,2,1,4,3,4,1,8
170 DATA 2,6,4,2,5,4,2,4,4,6,5,2,6,4,2,4
180 DATA 4,2,5,2,7,4,8,2,9,2,0,4,9,4,8,4,7,8
190 DATA 7,6,5,2,4,4,2,4,1,4,2,4,4,4,1,4
200 DATA 8,2,8,2,8,2,8,2,7,6,5,2,4,4,2,4,1,8
210 NEXT V

Notice that, as in many songs, the notes repeat. Lines 130, 150, and 190 are identical, and lines 140 and 160 are also identical.

Of course, the real Mannheim Steamrollers song doesn't merely drop F# to F, but makes several other instrumental changes. But we won't program all of that into the computer -- not when we have so many other Christmas songs to code.

Coding "Rise Up, Shepherd an' Follow" (Vanessa Williams)

In previous posts, I mentioned the song "Rise Up, Shepherd an' Follow" as an example of a song whose melody is pure Mixolydian. This means that it fits the New 7-Limit Scale very well.

No version of this song is regularly played on my radio station, but I do know that singer Vanessa Williams includes it on her Christmas album. Vanessa sings the song in the key of C, and my music book gives it in the key of F, but of course we'll play it in the key of G Mixolydian.

This song also extends slightly below the octave -- a low E is given in my music book. We could change line 55 above to 55 DATA 126 to reach the low E, or we could actually keep it as 90 for the actual minor third Bb (which doesn't sound too terrible in this song). Or we could keep the same low F from "Deck the Hall" -- which is how Vanessa sings it.

The format of this song is ABABA (with A the refrain and B the verse). To play this, our FOR loop will iterate three times, but will skip to the end after the 30th note (the end of the A part, just before the third B would have played). The B part ends with a quarter rest, which we play by having the computer iterate an empty loop 400 times. (According to my manual, 460 is more exact, but since our loop sets up the scale array again, it's easier to use 400 to account for extra set-up time.)

Again, since the harmonic seventh chord is hinted at in this song, greenish D is used unless the D is adjacent to a white A or G, when a white D is used.

10 DIM S(9)
15 FOR V=1 TO 3
20 FOR X=0 TO 9
40 NEXT X
50 DATA 54,105,96
55 DATA 120
60 DATA 84,81,72,70,63,60
70 N=1
80 FOR X=1 TO 87
100 SOUND 261-N*S(A),T
110 IF V=3 AND X=30 THEN 270
120 NEXT X
130 FOR I=1 TO 400:NEXT I
140 RESTORE
150 DATA 1,6,4,2,7,8,7,6,4,2,7,8
160 DATA 7,2,7,6,9,2,9,2,8,4,7,4,7,12
170 DATA 1,4,4,3,4,1,7,4,7,4,8,4,7,4,4,2,2,2,1,4
180 DATA 4,4,4,4,2,2,2,2,1,4,3,4,1,8
190 DATA 0,3,8,1,0,4,0,2,8,2,0,4,8,4,8,4
200 DATA 7,4,7,8,7,2,7,6,9,2,9,2,8,4,6,4,6,8
210 DATA 0,3,8,1,0,4,8,2,8,2,0,4,8,2,5,2
220 DATA 7,4,8,4,4,2,2,2,1,4
230 DATA 4,4,4,4,2,2,2,2,1,4,3,4,1,12
240 DATA 1,4,4,4,7,4,7,4,8,4,8,4,7,8
240 DATA 7,2,7,6,9,2,9,2,8,4,7,4,7,12
250 DATA 1,4,4,4,7,4,7,4,8,4,8,4,7,8
260 DATA 4,4,4,4,2,2,2,2,1,4,3,4,1,8
270 NEXT V

Some lines end with a dotted half note of length 12, so don't think that this is a typo for 1,2. Lines 160 and 240 are identical, as are lines 180 and 260. Line 230 differs from these last two only in the length of the last note, while lines 190 and 210 differ only in the last few notes.

Coding "I Saw Three Ships" (Nat King Cole)

I mentioned before that not every song has a span from tonic to tonic. So a song in C major might have a span ranging from G to G rather than C to C. "I Saw Three Ships" is such a song. And so it's best to play it in the key of C, so that it fits the New 7-Limit Scale (including F). Of course this isn't how I intended the scale to be played -- the C in our scale is white, but the F is green. If we tried to play an F triad, it would sound dissonant. Fortunately, this song doesn't have any F chords.

Notice that in my song book, the authors try to keep the melody in the octave from C4 (middle C) to C5 as much as possible. Because of this, a song in the dominant-to-dominant octave would never be written in the key of C in my book. Instead, the key of F is used in the book. Notice that if I were singing, it's actually easier for me to sing it one octave below the book (so that it fits the c-to-c' octave, my wheelhouse) than it is to sing the G-G computer octave, but right now I'm in the middle of coding, not singing.

(Sometimes a dominant-to-dominant song might appear in the key of G major in my book, which is also how I used to sing my G major songs in class. Every song in my book is in one of the three keys easiest to play on the piano -- C, F, or G major -- except for a single song in Bb major.)

"I Saw Three Ships" is not often played on the radio. In past years, I might have heard Nat King Cole's version being played. Barenaked Ladies is another group that sings a version. (Yes, it must be vacation time if I'm posting the word "Barenaked" on an education blog! I justify it by pointing out that a children's choir accompanies the "Ladies" as they perform this song.) Nat King Cole sings the song in F major, while the Barenaked Ladies sing it in G major.

Since our version is in the key of white C, white D sounds better in this song. Notice that the red E in this song technically makes this the key of C supermajor. I switch to greenish D when a G chord is being implied. (Ordinarily a dominant seventh, the G chord here becomes a harmonic seventh.)

Unfortunately, the first two notes of this song ("I saw...") are greenish G-white C. Since the low G is always greenish, the song begins with a dissonant semidiminished fourth rather than a perfect fourth.

10 DIM S(9)
15 FOR V=1 TO 2
20 FOR X=0 TO 9
40 NEXT X
50 DATA 54,105,96,90
60 DATA 84,81,72,70,63,60
70 N=1
80 FOR X=1 TO 68
100 SOUND 261-N*S(A),T
110 NEXT X
120 RESTORE
130 DATA 1,2,5,4,5,2,6,4,8,2,0,4,8,2,7,4
140 DATA 9,2,8,4,5,2,5,4,8,2,7,4,4,2,1,4
150 DATA 1,2,5,4,5,2,6,4,8,2,0,4,8,2,7,4
160 DATA 9,2,8,4,5,2,5,2,6,2,8,2,7,6,5,4
170 NEXT V

Coding "Santa Baby" (Eartha Kitt)

The next song also follows the dominant-to-dominant octave span, "Santa Baby." In my book, it appears in the key of G major, but of course we'll code it in C major.

This song is a bit more complicated than our other songs thus far. Even when written in the key of C major, three black keys are used in the song -- C#, D#, F#. Therefore we will write this song in the Extended 7-Limit Scale, with the two extra notes Eb and F#. Technically, Eb is not enharmonic to D# in just intonation. The appearance of D# in our song is to create a leading tone D#-E, while Eb-E is officially a dissonance (an "augmented unison"). But Eb-E doesn't actually sound too bad. (In fact, if we wanted to, we could have a song in E minor with B-Eb-F#-A used as a near-harmonic seventh chord, but the Am chord would be dissonant. Oh, and of course either of the songs written above in G Mixolydian could be converted to G Major if we use F# from the extended scale, but I chose not to.)

But then again, the note C# is still missing from the scale. One use of C# is intended to suggest an A major chord (but as noted above, all A chords are dissonant because white A-red E is definitely not a perfect fifth). By dropping this first C# note, the resulting sequence becomes red E-red B, which is a descending perfect fourth. The other appearance of C# is to create a leading tone, C-C#-D. I decided to make this sequence white C-white D-greenish D. Of course this is a dissonance as white D isn't supposed to be a leading tone to greenish D, but it sounds good here. (The first rule of music, again, is to play what sounds good, not slavishly follow mathematical consonances.)

The note Eb in the New 7-Limit Scale is Sound 126 (Degree 135). Since this is an odd degree, it can't be raised an octave. Therefore the array is set up for the lower g-to-g' octave with N=1, and so line 70 can't be changed to any other octave.

The song is in AABA format and requires three rests (with one right at the start of the song). It is set up to loop three times, with the second loop including the bridge (B part), which starts after the third (half) rest. (Actually, the program loops six times, so that two verses can be sung as AABA AABA.)

Eartha Kitt is the original singer of "Santa Baby." Madonna and Taylor Swift have also recorded versions of this song.

10 DIM S(11)
15 FOR V=1 TO 6
20 FOR X=0 TO 11
40 NEXT X
50 DATA 108,210,192,180,168,162
60 DATA 144,140,135,126,120,112
70 N=1
75 FOR I=1 TO 400:NEXT I
80 FOR X=1 TO 15
100 SOUND 261-N*S(A),T
110 NEXT X
120 FOR I=1 TO 400:NEXT I
130 FOR X=1 TO 19
150 SOUND 261-N*S(A),T
160 NEXT X
170 FOR I=1 TO 800:NEXT I
180 FOR X=1 TO 34
200 SOUND 261-N*S(A),T
210 NEXT X
220 RESTORE
230 DATA 1,2,5,2,2,2,5,2,6,4,8,2,9,2
240 DATA 8,2,9,2,7,2,5,2,2,4,1,4,5,4,2,8
250 DATA 8,4,9,2,7,2,5,2,2,2,1,4
260 DATA 1,2,5,2,2,2,5,2,6,4,0,2,0,2
270 DATA 10,2,10,2,9,2,1,2,2,4,5,24
280 DATA 9,6,4,2,9,6,4,2,9,4,10,4,11,8
290 DATA 9,2,9,2,2,2,2,2,9,2,9,2
300 DATA 2,2,2,2,9,4,9,4,4,8,6,2,6,2
310 DATA 2,4,6,6,2,2,6,4,8,4,9,8,6,2
320 DATA 0,4,11,4,10,4,2,4,9,4,8,4,7,8
330 NEXT V

Yes, the A part of the song ends with a long note of length 24, so don't code this as 2,4.

Eartha Kitt and Madonna sing the song in the key of Db major, which would be played a semitone higher than our version here. But Taylor Swift's version is different -- she sings it in the key of F major, and the bridge has a much simpler chord progression. Swifties might wish to change the following lines to play Taylor's version of the song:

280 DATA 6,6,2,2,6,6,2,2,6,4,8,4,9,8
290 DATA 7,2,7,2,1,2,1,2,7,2,7,2
300 DATA 1,2,1,2,7,4,4,4,2,8,5,2,5,2
310 DATA 1,4,5,6,1,2,5,4,6,4,7,6,5,2

My book begins the song with a few opening lines:

Mister "Claus," I feel as tho' I know ya,
So you won't mind if I should get familya, will ya?

But none of the three divas sing these opening lines, and it would take extra work to code these notes in, and so we don't.

"Hard Candy Christmas" (Dolly Parton)

Many songs in my music book have a span of slightly more than an octave. But this doesn't always mean that the span adds the low B or high D to the C-C octave (assuming C major). A fairly common span for a C major song in my book is to go from G-A -- that is, the song adds high A to a G-G song.

One such song is "Hard Candy Christmas." I've never listen this song before, until I was surprised to hear a version of it on the radio. The singer is Dolly Parton, and thus the song has a country twang.

As usual, we'll use S(3) to reach the high A in this song. But what makes this song so complicated is that it has so many rests. Instead of coding the rests in one at a time as in "Santa Baby," this time I decided to include them right in the DATA lines. When a value of 100 or greater is READ, it is interpreted as a rest and then an empty loop begins to represent the rest.

As in many country songs, the so-called "eighth note triplet" occurs. In this triplet, three "quavers" add up to a quarter note. So technically these are twelfth notes. Using PLAY, we could write:

PLAY "L12;GFE"

to play the triplet G-F-E and:

PLAY "L8;GF"

for ordinary eighth notes. To simulate this in SOUND, I use length 2 for twelfth notes (or triplets) and then length 3 for ordinary eighth notes. This slows down the song a little -- but it's perfect to match the slow pace at which Dolly sings the song. The whole note is now of length 24. A whole rest appears later on -- and to make it simple, we multiply 24 by 100 to obtain 2400 as the approximate size of the empty loop needed to generate a whole rest. Thus 2400 is not a typo.

Regarding the choice of two D's, I chose greenish D for the first D and white D for all the rest.

10 DIM S(9)
15 FOR V=1 TO 2
20 FOR X=0 TO 9
40 NEXT X
50 DATA 54,105,96
55 DATA 48
60 DATA 84,81,72,70,63,60
70 N=1
80 FOR X=1 TO 68
100 IF A>99 THEN FOR I=1 TO A:NEXT I:GOTO 130
120 SOUND 261-N*S(A),T
130 NEXT X
140 RESTORE
150 DATA 4,12,600,7,2,5,2,4,2,4,6,5,6,1,6
160 DATA 2400,7,2,5,2,4,2,4,6,5,6,1,6
170 DATA 0,2,9,2,8,2,8,6,9,6,6,6
180 DATA 0,2,9,2,8,2,8,6,9,6,6,6
190 DATA 0,3,9,3,8,12,1200,8,6,5,6,4,6,1,6
200 DATA 4,12,600,7,2,5,2,4,2,4,6,5,6,1,6
210 DATA 2400,7,2,5,2,4,2,4,6,5,6,1,6
220 DATA 0,2,9,2,8,2,8,6,9,6,6,6
230 DATA 0,2,9,2,8,2,8,6,9,6,6,6

240 DATA 0,3,9,3,8,12,1200,8,6,5,6,4,6,1,6
250 DATA 0,18,0,6,0,3,9,3,600,9,3,9,3
260 DATA 9,3,6,3,600,9,6,0,9,9,3
270 DATA 9,3,8,3,1,6,1,3,2,3,5,3,6,3
280 DATA 0,18,0,6,0,3,9,3,600,9,3,9,3
290 DATA 9,3,6,3,600,9,3,0,3,8,3,5,3,5,6,5,12,1200
300 DATA 0,18,0,6,0,3,9,3,600,9,3,9,3
310 DATA 9,3,6,3,600,9,6,0,9,9,3
320 DATA 9,3,8,3,1,6,1,3,2,3,5,3,6,3
330 DATA 0,18,0,6,0,3,9,3,600,9,3,9,3

340 DATA 9,3,6,3,600,9,3,0,3,8,3,5,3,5,6,5,12,1200
350 NEXT V

Lines 200-240 match lines 150-190, and lines 300-340 match 250-290. This allows the song to match the pattern AABB. To me, it's annoying how DATA can't be repeated unless we RESTORE it -- and then all the data are restored, not just the data we want. It would be more convenient if, say, we could list DATA in a FOR loop and then RESTORE only the data within the loop.

In the original song, Dolly actually modulates from Db to Eb major for the last B part (AAB-B). This is fairly common in popular music, when the song modulates up a semitone or whole tone. My book simulates this by modulating from F to G major.

In our version, the B part doesn't contain the high A (in C major), and so its highest note remains A if we were to modulate to D major. But then we'd need more notes -- F# from the extended scale, and C# which isn't even in the extended scale. Modulation isn't easy to do on the computer (unless we multiply the degrees by a certain fraction), and so we don't do it in this version.

Coding "O Holy Night" (Bohlen-Pierce)

It's now time to attempt converting a song to the Bohlen-Pierce scale. Since this scale is based on tritaves, let's search a Christmas song with a tritave range.

In my book, the song "O Holy Night" is written in the key of F major, with a range of a major tenth, from F up to high A. But in other books, the highest note is a high C instead. This would make the span equal to a tritave.

Since our song in 12EDO mostly respects the major scale (except with a lone B in place of the Bb needed for F major), I'd like to respect the BP Lambda scale. But unfortunately, the major scale doesn't map onto Lambda very well.

Look up above at the conversion chart from BP to Kite's colors. Let's say we want a major triad -- C major (C-E-G), since that chart begins with C. The BP note E corresponds to red E, so we already have two notes of the major triad. But, while there is no G, there is an Fx (F double-sharp). While Fx isn't enharmonic to G in just intonation, it's nonetheless BP's best approximation to G. But the note Fx is Gb in the BP scale -- and Gb, unfortunately, isn't part of Lambda.

According to Bohlen and Pierce, Lambda is actually a mode -- just as Dorian, Major, and so on, are modes in 12EDO. So perhaps there's a BP mode that's closer to 12EDO's major scale.

Fortunately, there is -- it's called Walker I. It is equivalent to a BP Lambda scale, but starting on F rather than C. Let's write out the Walker I scale in F -- with the 12EDO major scale also starting with F in order to match "O Holy Night":

Key     Note     Ratio     Kite note
1          F          1/1         white F
2          G          25/21    reddish-yellow G#
3          H          9/7        red A
4          J           75/49    deep reddish B#
5          A          5/3        yellow D
6          B          49/25    deep bluish Gbb
7          C          15/7      reddish F#
8          D          63/25    bluish-green Bbb
9          E          25/9      deep yellow B
0          F          3/1        white C

This scale has two approximate F major triads -- F-H-J (which sounds as F-A-B#) and B-D-F (which sounds as Gbb-Bbb-C).

Now I'd love to say that I am the Walker for whom the Walker I scale is named. But actually, the Walker in this case is Elaine Walker:

http://www.ziaspace.com/elaine/BP/Modes_and_Chords.html

According to this above link, Elaine was trying to approximate 12EDO chords, and then she stumbled upon the Walker I mode. Another mode, called Walker A, begins on D in BP. It includes a near-minor triad and is thus the best approximation to the 12EDO Minor scale. (Is there a 12EDO mode to which the Lambda mode is the best approximation? Yes, it's the Locrian mode -- B-C-D-E-F-G-A-B. This mode contains a diminished triad, B-D-F, which Lambda approximates as C-D-F.)

There's one more thing we must do before we can convert "O Holy Night" to Walker I. Our song as written in the book has two tonics, low F and high F, an octave apart. But tonics in Walker I, like all BP, has tonics a tritave apart, not an octave apart. So I changed the song to add the high F in BP, but it's at the end of the song to represent the final tonic. All the other notes are near-approximations of the original song in F major.

10 DIM S(9)
20 FOR X=0 TO 9
40 NEXT X
50 DATA 21,63,53,49,41
60 DATA 38,32,29,25,23
70 N=1
80 FOR X=1 TO 21
100 SOUND 261-N*S(A),T
110 NEXT X
120 FOR I=1 TO 400:NEXT I
130 FOR X=1 TO 75
150 SOUND 261-N*S(A),T
160 NEXT X
170 DATA 3,4,3,2,3,2,4,6,4,2,5,2,5,2
180 DATA 4,2,5,2,6,8,4,2,4,2,3,2,2,2
190 DATA 1,4,2,2,3,2,4,4,3,2,2,2,1,12
200 DATA 3,4,3,2,3,2,4,6,4,2,5,2,5,2
210 DATA 4,2,5,2,6,8,4,2,4,2,3,2,2,2
220 DATA 6,4,4,2,5,2,6,4,7,2,6,2,3,12
230 DATA 4,4,4,4,5,4,2,4,4,4,5,2,4,2,6,2,3,2,5,4
240 DATA 4,4,4,4,5,4,2,4,4,4,5,2,4,2,6,2,3,2
250 DATA 4,8,6,12,5,2,4,2,5,12,5,4
260 DATA 7,8,5,4,5,2,5,2,6,8,6,6,6,2
270 DATA 8,8,7,6,4,2,6,12,6,2,5,2
280 DATA 4,8,4,4,5,2,4,2,4,12,6,4
290 DATA 7,12,4,4,8,12,7,12
300 DATA 6,8,7,2,7,2,8,2,9,2,0,8

Yes, we're now declaring Sound 198 (Degree 63 or red E) to be F in BP, since it's convenient.

But this version would be difficult for me to sing, since it's well above my singing range. If we change the line to 70 N=4, then the tritave runs from red e to red b', and b' is definitely above the baritone range (well into the tenor range). If I had to sing it, I'd try 70 N=3 and then sing an octave below it, which would be the tritave A to e' -- my wheelhouse.

Yet there aren't supposed to be octaves in BP. If I'm hearing a song on the radio and it's too high to sing, I just sing it an octave lower. But if I want to sing a song in BP -- like Elaine's "Love Song", which, as it's sung by a woman, is too high for me to sing -- I should sing it a tritave lower. This requires me not only to sing an unfamiliar scale, but be able to identify tritaves by ear. That's the problem with any BP song -- the computer's range is too high for me to sing, and I'm not proficient enough with hearing a BP song by ear and singing it a tritave lower.

Conclusion: "Fassung 1" (Heinz Bohlen)

By the way, according to the following link, Heinz Bohlen was originally trying to write Christmas music in the new scale he devised:

http://www.huygens-fokker.org/bpsite/tonality.html

We ought to try playing this song on the emulator. The song is in the key of "s-delta," but there is no longer a note called "s," nor a scale called "delta." Fortunately, the following link explains how to convert this "s-delta" into the Bohlen's modern version of the scale:

https://www.mail-archive.com/abcusers@yahoogroups.com/msg00153.html

10 DIM S(9)
20 FOR X=0 TO 9
40 NEXT X
50 DATA 21,63,58,49,41
60 DATA 38,35,29,27,23
70 N=1
80 FOR X=1 TO 31
100 SOUND 261-N*S(A),T
110 NEXT X
120 DATA 1,4,1,8,1,4,3,8,3,4,5,4,7,4,8,4
130 DATA 8,8,8,4,3,8,3,4,1,8,3,4,5,12,5,4
140 DATA 8,4,9,4,0,4,0,4,9,2,8,2,7,2,6,2
150 DATA 5,4,3,4,5,4,3,4,3,4,2,4,1,12

Of course, now our red E has been mapped to the note "s." But I wouldn't even bother trying to sing this song in any tritave, since I don't speak German.

This concludes my Christmas Eve post. I'll continue to sneak music on the computer emulator into the remainder of my winter break posts, but I'll be writing about other topics too. Merry Christmas!