Monday, February 23, 2015

Music Theory for Conworlders: Scales and Culture

We're going to take a short break from the mathsy stuff, and consider some other things with regards to scales and music. The approach to scales I am taking is very much a western approach - although probably not unique to the west, it lacks things that are not present in the concept of scales in western music. It might be informative to look into what other cultures subsume into their concept of musical scales.

Many cultures consider scales not just a set of pitches, but a tuplet consisting of a set of pitches and a basic rhythm. Melodies or improvizations in a scale are expected to use that rhythm. The same pitch set can appear with another rhythm, but is then considered another scale. There's no guarantee that all rhythms are represented with all pitch sets. Examples of such systems are Indian ragas, Arabic maqamat and the ancient Greek scales.

Some Indian traditions also associate scales with time of day and other things - songs in some scales are supposed to be played in the morning, songs in others in the afternoon, etc.

In Europe, we tend to associate chords and progressions with keys, but since our keys are all identical copies that are transposed, the same chord progression can work in any key, provided it's been properly transposed. This is not necessarily the case in scales everywhere - even some renaissance instrument makers used temperaments that omitted parts of the gamut, and you can find some modern instruments even that lack several of the twelve tones usually expected - some harmonicas, for instance, or autoharps.

Some systems go further than that and approach their entire music's tuning like our harmonicas or autoharps - just pick one key, and don't bother making any other keys playable (duly note that the renaissance instrument makers that restricted the number of available keys still usually made their instruments have the full scales of C, F, G and a few others available). Indonesian Gamelan, to some extent, is an example of curtailing the available intervals in such a way. The Gamelan, however, further complicates things by having two entirely unrelated scales - one essentially five equal steps to the octave, the other close to a seven-note subset out of nine equal steps to the octave. Even then, variation between one village's gamelan and another may be drastic, and their tuning is thoroughly an art, and not an industrial standard.

Further, a scale may be somewhat flexible - lots of Chinese and Japanese music, as well as the American blues flex their tones' pitch considerable during the course of a song. This seems more common the smaller the size of the used tonal palette. Slightly comparable may be how the melodic minor is different when ascending from when it's descending. (In practice, the pitches that are altered - in Cminor, they'd be A and Ab, B and Bb - are not just altered when descending or ascending in actual compositions - it depends on chord choices, etc.)

Western music has been rather chord based for quite a while. Ancient Greek, Arab, Turkish and Persian music are rather more 'tetrachord'-based - a tetrachord is a span of subsequent tones , and the melody tends to weave melodies out of those four notes for quite a while, until switching to another tetrachord. From what I gather, they tend to switch tetrachords either so that the first scale and the last scale share the middle tetrachord - i.e. like going from GABC to CDEF to GABbC - CDEFGABc is C major, FGABbcdef is F major - CDEF is in both, or just switching between two tetrachords with the same end-points: GABC to GABbc. Playing around with such concepts (and extending them or retracting them), may provide some ways of making very 'culture-specific' music.

Unlike tetrachords, our chords tend to have the tones played simultaneously (although the practice of arpeggiation - sounding one chord tone at a time - can be played in a way that deviates from that), but they also form a very important melodic backbone; lots of melodies mostly consist of the tones of whichever chord is currently playing with the occasional tone outside of that set. We can of course come up with rather drastically different chords which might be used in similar ways.

Finally, other practices may be associated with different scales - working songs to ensure the right working rhythm, different scales for different religious uses, etc. There's a world of possibilities.

Sunday, February 22, 2015

Music Theory for Conworlders: Dissonance and Consonance

In monophony - music where only one voice is heard, or all voices do the exact same thing - dissonance and consonance mainly seem to relate to whether a note feels at rest or not with regards to the melody. Thus, a melody like C E D B' C, B' is likely not to be at rest, whereas C is quite restful. Why this is so is not the topic right now, but we'll go on to a more easily understood situation - that of consonance and dissonance in a situation where voices do not do the same thing.

A few centuries ago, the main hypothesis as to what causes dissonance is 'complexity of ratios'. Basically, a simple ratio such as 3/2 will regularly and often have waveforms 'coincide' - the tops (or troughs) of the waves will recur in the same position relative to each other often. With more complicated ratios they will recur less often, and therefore 'keep the ear in torment'. Thus 2/1 will be more consonant than 3/2, 3/2 more consonant than 5/4, 5/4 more so than 9/8, 9/8 more so than 11/8, and so on. The exact way of measuring 'complexity' of a ratio differed between scholars that held that hypothesis, but higher prime factors were more complex than lower prime factors; however, 25/16 probably was comparable to, say, 13/8, despite 25/16 having no factors higher than 5, and 13 having 13 and 2 as its only factors. (25/16 = 52/24, 13/8 = 13/23).

Nowadays, the main hypothesis deals with overtones. Ultimately, for regular overtone series, the results will be similar to the previous hypothesis - simple ratios will mostly be more consonant than complex ones. We noted previously that tones tend to consist of a whole stack of frequencies.

If you were to generate sinusoidal tones (i.e. tones lacking all overtones), you'd find that only when they're fairly close to each other do they cause dissonance - anything wider than (roughly) a minor third never sounds dissonant, even solidly dissonant intervals like the tritone and the major seventh sound kind of neutral and uninteresting.

Music File Hosting - Audio Hosting - differencetone_2sources
an example of two sinusoidal tones a bit too close to each other to be dissonant
Upload Music - Play Audio - Sinusoidal Dissonance
two sinusoidal tones that are further apart yet close enough to be dissonant
We introduce the concept of 'critical bandwidth', which is a range of intervals that by their very nature are dissonant - roughly, this corresponds to 'about ten hertz off' to 'about 6/5' (roughly A-C, the minor third)*. So, for A440, any frequency in the rough area of 450hz to 528hz will be dissonant. But any musician knows that there are intervals wider than the minor third that are dissonant - for instance, the major seventh (A-G#) and the tritone (A-D#).

The reason for these is dissonance between overtones. The dissonance of two notes played together is basically the sum of the dissonances between the overtones. Thus, tones whose overtones often are within the critical bandwidth of each other are very dissonant, tones whose overtones often are closer than 10hz from each other or further than 6/5 from each other will be consonant.
Let us compare the overtones of A440, E660 and D#622. Each of these tones gets a column, so A440 and its overtones are under A, E660 and its overtones under E, etc. The overtones are ordered wrt pitch:
AED#
A440
D#
622
E660
A880
d#1244
e13201320
a1760
a#1866
b1980
c2200
d#2488
e26402640
g*30803110
g#3300
.
.
.
A sample of how overtones serve to 'create' the timbre of a tone may serve to help at this point:
Play Music - Audio Hosting - Overtones

Looking at the table, we find that d# has way more "conflicts" with A than E does. Certainly, E will start having dissonances with A - heck, after a certain point, overtones will start clashing internally (which is why a note with very strong overtones far up the series will start coming off as noise!)

We would end up with something like this:
Music File Hosting - Listen Audio Files - Tritonus by overtones
vs. this:
Upload Music - Audio Hosting - Fifth in Overtones

However, this also explains why the very complex ratios that lightly detuned intervals produce do not strike us as very dissonant. Clearly 659/440 is more complex than 3/2, (659 is a rather big prime compared to 3 and 2!) yet it's quite a tolerable detuning. The reason is that the overtones now come within the tolerable range just before the critical bandwidth, where they previously perfectly synched. Of course, the volume of each overtone has an impact on the perceived dissonance.

This model also predicts that instruments with unusual overtone series may cause dissonance in other intervals than more regular instruments do, and we find that this in fact is the case. One can even make intervals like the octave come out as very dissonant by picking weird timbres.

I have no methods for efficiently finding the least dissonant intervals for two tones with arbitrary weird overtones, so I won't give you that kind of mathematicking right now.

In addition, we must note that consonance and dissonance are somewhat subjective - we perceive them in part due to conditioning. However, it does seem the main thing we condition is 'where' the line is drawn - how many conflicting overtones we can tolerate. We also seem to fill in some missing overtones - so functionally a tritone will sound somewhat dissonant even if the overtones that would usually cause the dissonance now are missing. The dissonance will be less acute, however.

Finally, most human musics have both dissonant and consonant intervals - the interplay between consonance and dissonance, or tension and release - seems to be fairly common. However, due to the way intervals work, we easily get dissonant intervals as a byproduct once we have a sufficient number of consonant intervals - the cracks in which consonances can fit without trampling into other tones' critical bandwidths quickly shrink.

* A more accurate description would be "6/5 or 50hz, whichever is bigger"; it seems the critical bandwidth is wider in the lower registers. In fact, go low enough and octaves and the like get dissonant. This is why most music with more detailed timbres and such tend to leave a lot of space around the bass - you don't want to crowd the lower registers.

Friday, February 20, 2015

Music Theory for Conworlders: Intervals

For most humans, the important thing when listening to music is not the absolute pitches. A song with A440hz, C528hz, D586hz, E660hz and G782hz is not identifiable on account of those pitches being at those particular hertz. A melody that goes ACACDED ACACDEGa aGaGEDCA is not recognizable for the reason that it plays those particular frequencies in that particular order, it is recognizable due to other reasons.

The thing that makes it recognizable is the relations between the notes. (Music is a bit tricky though, and it seems the rhythm of a melody is even more important for recognition - a piece of advice an old fiddler once gave me was that it's more okay to play a wrong tone at the correct time than the right tone too early or late.) Of course, our hearing has some leeway, but roughly speaking, the ratio between the involved pitches is the interesting thing. Not the absolute difference in frequency - a difference of a hundred hertz will sound very different in a motif that goes 100hz - 200hz - 100hz - 200hz (basically that's a disco bass octave thingy), or one that goes 800hz - 900hz - 800hz - 900hz (that's basically one part of the Rudolph the Red-Nosed Reindeer's main melody, although the sheet music I found for that puts it closer to ~330 - 371 - 330 - 371).

So, the distance between 100hz and 200hz is comparable to the distance between 800hz and 1600hz. The distance between 800hz and 900hz is comparable to that between 100hz and 112.5hz.

The scale I provided in the first paragraph - a version of the pentatonic minor scale - is basically this shape:
ACDEG
1/1  
6/5  4/3   3/2   16/9
6/510/9
9/832/279/8
The last ratio in the lower line is the remainder needed to get to the next 'a' at 2 times the frequency of the previous A.
Here, the upper series gives each note as its relation to our starting point, A. We could basically pick any frequency we like for A, at this point that does not matter at all. The second list is the intervals between each neighbouring pair of notes.

How do we combine the distance from A to C with the distance from C to D to calculate the distance from A to C? We multiply them! A/B * C/D = (A*C)/(B*D), and as it turns out, 6*10/5*9 = 60/45 = 4/3.

Multiplication is somewhat complicated, and it gets difficult to compare ratios at a glance - 32/27 and 6/5 are actually pretty similar intervals, but this is hard to spot. For this reason, the unit 'cents' has been invented. One cent is a hundredth of a semitone, but that doesn't tell us much of its mathematical properties. The cent is 1200 * log2A, where A is the interval we're looking at.

If you don't know logarithms, logarithms basically 'shift the gear' of the numbers we're considering in such a way that log(A*B) = log(A) + log(B). In log2 , if we deal with a doubling, we just add 1; in 1200*log2 we add 1200. log2(5/2) = log2(5/4) + 1; since we're dealing with the weird situation where we have a factor of 1200 everywhere, 1200log2(5/2) = 1200log2(5/4) + 1200. Stated simply, logarithms change gears so that multiplication turns into addition.

This gives us one further way of representing the scale given above (here rounded to integer cents):
ACDEG

316  498   702   996
316182
204294204

It is now easier to compare the sizes of the intervals. The size of the cent is picked to reflect the 12 tone equal temperament in a clear and simple way - each semitone is a hundred cents, and each tone of the western scale therefore is an integer multiple thereof. It is a relative measure, so it doesn't make sense to say that any particular tone is 0 cents - although we can decide for some context to use a certain tone as the starting point.

Another convenient fact is that an equal temperament of N tones to the octave will have steps that are 1200/N cents. This simplifies calculations a lot - if we live in the regular, non-logarithmic world, we need to take N:th roots, which is way more cumbersome.

Finally, any positive number is an interval: 11 is an interval, as is e5 or 36π/32. Human hearing stretches from about 20hz to somewhere a bit shy of 20 000hz, so intervals wider than 10 000 probably are not all that useful, since even if we pick the lowest possible point as one end of the interval, the other end will be outside our hearing range. Our hearing is not too precise, so differences in intervals of much less than a cent are probably not very useful either and therefore it might not make sense to distinguish 5 and 5 + 10-12. And finally, due to the octave equivalence we've previously seen, we will probably only really want to deal with intervals "inside" of the range of [1, 2] and use those to fill out a reasonable chunk of the audible space. We will, however, look at some other approaches as well.

Next installment: more on intervals, Pythagorean tuning

Tuesday, February 17, 2015

Music Theory for Conworlders: Introducing Overtones and the Octave

As an introduction, we'll look at the basic concepts of western music theory. Most people know there's seven distinct tones in the major or minor keys, and there's twelve distinct tones in total per octave. People might also know of chords.

But what do these things even mean, and what kind of structure is there to them? Why twelve? What is an octave? What are tones, even? [Assuming most readers come here from a facebook discussion, this will basically have been covered already. If people come here from other places, I might add a more detailed definition somewhere later.

Now, I will probably return to the physics of tones a bit later, but for now, we'll observe that a tone has a frequency. What we mean to say when we say that in the ISO16 tuning standard Ais 440hz we mean to say that the sound wave is characterized by something that repeats 440 times per second.

We could make a wheel with equally spaced spikes that beat against a flexible piece of plastic, and have 440 of those spikes. If it rotates a whole turn in one second, the sound generated by those impacts would sound like a tone of 440hz to us.

There is nothing intrinsically special about 440hz, it is an arbitrarily picked standard. Baroque organs in Germany have A varying from roughly under 400 to about 500 hz. It's only fairly recently A440 has been standardized (basically sometime during the 20th century), and we find music that deviates from it as well.

Almost all instruments have a secondary important frequency-related fact going on - overtones. Most things will not just have one frequency, they will emit sounds of several frequencies simultaneously. For instruments, it's quite common for these overtones to be integer multiples of the lowest frequency, the 'fundamental'. (And these will later on be important when we look at concepts like consonance and dissonance, and therefore also when we look at chords and scales.)

So, when you play A440 on a guitar, you also cause generate the frequencies 880hz, 1320hz, 1760hz, 2200hz, ... . These contribute to the sound of the instrument - in fact, it's one of the things that distinguishes the sound of an organ from that of a guitar or that of a saxophone from that of a trumpet. We will start out by looking at instruments with this integer-multiples structure to their overtones. Other possibilities exist - pianos have near-integer overtones that tend to be slightly too large for integers (1, 2.01, 3.009, ...), and bells and gamelans have weird non-integers where multiple numbers close together may appear combined with large gaps as well.

To hear a synthesized version of this phenomenon, listen to the sample here below:
Play Music - Audio Hosting - Overtones

The very first overtone, the doubling of the frequency, has a rather special role in music. It corresponds to the octave, and it is nearly an universal interval in human music. Let us consider what happens with the overtones when you play two tones, an octave apart.
We have two tones, frequencies X and 2X. Each of these further is multiplied by a series of integers:
X, 2X, 3X, 4X, 5X, 6X, 7X, 8X, ...
2X, 4X, 6X, 8X, 10X, ...

We find that each overtone of 2X is also present in the overtone series of X. Thus. they will resonate together. For this reason, Xhz and 2Xhz will interact in similar ways with some other tone at Yhz as well. This, in part, is why we perceive tones where one is double (or quadruple, or multiplied by 2n for any integer n) the other. This, we call octave equivalence, and it'll be somewhat important later on.