# Math In Music

Smurf
Anyone ever tried writing down the number of tones between all the chords in a song and finding out if there's any way to express music numerically/mathematically?

Because.. I don't think I restrain myself any longer.

It would sure make song writing a lot easier if I could do it mathematically

## Answers and Replies

Kazza_765
I don't think there is a mathematical formula for song writing, I hope there isn't, it would take away so much of the magic. I can't remember where I read it or who did the study but I remember reading that someone found that when 1/f was averaged throughout a wide variety of music, from classical through to pop, it came out close to constant.

Smurf
Kazza_765 said:
I don't think there is a mathematical formula for song writing, I hope there isn't, it would take away so much of the magic.
Heh, I'm sure it'd be impossible to completely write a good song from math, you need at least a small degree of creativity too.
when 1/f was averaged throughout a wide variety of music, from classical through to pop, it came out close to constant.
Ah, great. What does that mean?

zoobyshoe
There are actually popular chord progressions that you can use almost as formulas. If all else fails, just take any piece by Bach, go through it and write down the chord progessions, and write your own piece with the same ones. Pick any composer for that matter. Transpose the key or something, no one will know the difference.

neurocomp2003
douglas hofstader. "Godel escher bach"

Nomy-the wanderer
Logarithms

Bladibla
Smurf said:
Heh, I'm sure it'd be impossible to completely write a good song from math, you need at least a small degree of creativity too.

Ah, great. What does that mean?

*small* degree you say? Since when was it required for Mozart to learn mathematicas to create the Jupiter symphony?

And plus, is there any *need* to express it mathematically? Music has enough scales/ types of chords/ time signatures to suffice.

Because.. I don't think I restrain myself any longer.

Do it yourself then.

Jelfish
Music by itself doesn't have much math involved. It's when you introduce structure, such as the Western major scale that math becomes involved. Between two adjacent frets on a guitar or two adjacent notes on a piano, there is a specific frequency interval. In music theory, this is called a half step. The difference in frequency between the two notes is dependant on the frequency of one of the notes. Say I call one of the notes E and one of them F. If E to F is a half step interval, then the frequency of F is tuned to:

F = E * 2^(1/12)

Where E is the frequency of E. This is because the scale is broken down into 12 notes, the half step being the smallest unit interval (other than the same note twice). In reality, the intervals between the scale are made by dividing a string into rational fractions (1/2, 2/3, 3/4, etc) as they are on a string instrument. On many quantized instruments, that interval is squished a bit to allow for instruments to play in different keys without retuning, resulting in the above formula. Pianos are purposely slightly out of tune for this reason.

Chords are built on harmonies of several notes and the intervals between the notes define the chord. For example, a major triad has three notes, the tonic, the third (which is 4 half steps above the tonic) and the fifth (which is 7 half steps above the tonic). If you play that shape on any starting note, you'll get a major triad.

Now all of that may seem 'mathy' but where the math ends is when musicians play sounds that intentionally make use of the brains ability to associate and fill in holes. For example, if you play a tritone, like E and A#, to most people, it sounds dissonant and somewhat unpleasant. But if you then augment the interval and play D# and B, your brain instantly recognizes that progression as a dominant 7 to I chord. Then, if you play the tritone again, it doesn't seem that dissonant anymore because your brain has established a key. No matter how much math is involved in music, its quality is ultimately decided upon by human brains, which are less rigidly structured than math.

Last edited:
Kenneth Mann
Math In Music
Smurf said:
Anyone ever tried writing down the number of tones between all the chords in a song and finding out if there's any way to express music numerically/mathematically?

Because.. I don't think I restrain myself any longer.

It would sure make song writing a lot easier if I could do it mathematically

There's good news and bad news here! The good news is that there is a very definite set of mathematical relationships between notes within a chord, and within the diatonic (7-note) scale. It's all rooted in the 'Overtone Series'. The bad news is that there are a large number of mathematical relationships that can be derived. They all will generate a small subset of quite beautiful melody fragments, along with a huge set of the very mundane. The only way to find these 'gems' among the 'trash', is to go painstakingly through these nearly infinite sets. This would be hugely time-consuming, and by and large, not justifiable. A decent composer, using knowledge, experience and intuition, would run rings around you (and this assumes that you would even recognize the 'gems' from the mundane). I think the sheer drudgery of it would restrain you after not too long.

Did you really think that this hadn't been thought of before? There was even a little commercial device made several years ago that did something similar to what you are describing. It was called the http://userwww.sfsu.edu/~hl/c.muse.html an interesting diversion but not of too much value commercially.

There is also a software package apparently, that emulates that device.

Smurf said:
Heh, I'm sure it'd be impossible to completely write a good song from math, you need at least a small degree of creativity too.

You've got it! About 99%!

zoobyshoe said:
There are actually popular chord progressions that you can use almost as formulas. If all else fails, just take any piece by Bach, go through it and write down the chord progessions, and write your own piece with the same ones. Pick any composer for that matter. Transpose the key or something, no one will know the difference.

What you're really saying is "Learn the basics of composition"!

Nomy-the wanderer said:
Logarithms

Right! This is what defines the "Well Tempered" scale (Chromatic scale), but it won't give 'Smurf' what he's looking for.

Bladibla said:
*small* degree you say? Since when was it required for Mozart to learn mathematicas to create the Jupiter symphony?

Actually, Mozart's mathematical sense was very, very good. He simply exercised it within musical convention.

Bladibla said:
And plus, is there any *need* to express it mathematically? Music has enough scales/ types of chords/ time signatures to suffice.

I'd say you're right-on, unless he is planning to write music notation/handling software, something to make life easier for musicians. (Maybe Smurf should look into this area.) The caveat here, is that there is already a lot of it out there.

Jelfish said:
Music by itself doesn't have much math involved. It's when you introduce structure, such as the Western major scale that math becomes involved. Between two adjacent frets on a guitar or two adjacent notes on a piano, there is a specific frequency interval. In music theory, this is called a half step. The difference in frequency between the two notes is dependant on the frequency of one of the notes. Say I call one of the notes E and one of them F. If E to F is a half step interval, then the frequency of F is tuned to:

F = E * 2^(1/12)

Where E is the frequency of E. This is because the scale is broken down into 12 notes, the half step being the smallest unit interval (other than the same note twice). In reality, the intervals between the scale are made by dividing a string into rational fractions (1/2, 2/3, 3/4, etc) as they are on a string instrument. On many quantized instruments, that interval is squished a bit to allow for instruments to play in different keys without retuning, resulting in the above formula. Pianos are purposely slightly out of tune for this reason.

Chords are built on harmonies of several notes and the intervals between the notes define the chord. For example, a major triad has three notes, the tonic, the third (which is 4 half steps above the tonic) and the fifth (which is 7 half steps above the tonic). If you play that shape on any starting note, you'll get a major triad.

Now all of that may seem 'mathy' but where the math ends is when musicians play sounds that intentionally make use of the brains ability to associate and fill in holes. For example, if you play a tritone, like E and A#, to most people, it sounds dissonant and somewhat unpleasant. But if you then augment the interval and play D# and B, your brain instantly recognizes that progression as a dominant 7 to I chord. Then, if you play the tritone again, it doesn't seem that dissonant anymore because your brain has established a key. No matter how much math is involved in music, its quality is ultimately decided upon by human brains, which are less rigidly structured than math.

There is some mathematical relationship also in the basic music as has passed from antiquity to now. It is the basic Overtone relationship, which also defines consonance within our chord structures. This relationship, to be sure, is a bit strained, because music, after all, is a subjective exercise of the emotion. These notes of the overtone series are pretty much common around the world, though different cultures include different subsets of them.
When you relate the scales derived from overtone series, you find that there is a definite (but not exact) mathematical relationship between the Diatonic scale (derived initially in the West from overtone series) and the Diatonic Scale subset of the Chromatic scale (the Well Tempered scale that you've described). The Well Tempered Scale was an attempt to define an overarching scale that contained the Diatonic scale relationship (from Overtone series) and at the same time allowed that diatonic scale (Like C, D, E, F, G, A, B, C) to relate directly from one key to another.
Still, we might note that Today's 7-note Diatonic scale is only an approximation of that (Diatonic Scale) derived from the more natural Overtone series. All this said though, as you have pointed out, it is nearly impossible to derive a meaningful mathematical relationship that will generate good compositions.

KM

zoobyshoe
Kenneth Mann said:
What you're really saying is "Learn the basics of composition"!
No. I was basically recommending a kind of plagiarism: steal a successful composers chord progressions, and write your own variations.

Science Advisor
Jelfish said:
Music by itself doesn't have much math involved.
I beg to differ on that. You are referring to the structure of music, i.e. chords and scales. However, the moment that you put two notes together the mathematical implications of those two notes in relationship to one another is apparent. The mere act of subdivision of a phrase is simple math at work. quarter note, half note, sixteenth note, etc...

Jelfish
FredGarvin said:
I beg to differ on that. You are referring to the structure of music, i.e. chords and scales. However, the moment that you put two notes together the mathematical implications of those two notes in relationship to one another is apparent. The mere act of subdivision of a phrase is simple math at work. quarter note, half note, sixteenth note, etc...

Well, perhaps my definition of music is slightly different than yours. Of course you can find the frequency and waveform of all sound and music, and that would be 'math' I suppose. I referred to the structure as the math portion (which includes the 7-tone scale pattern, melody, harmony and rhythm). However, I refer to music not as the structure, but for how it's defined humanly. Do you consider a child banging on random piano keys to be music? I suppose some may. Many do not. Try listening to some atonal pieces. A lot of people detest it because its progressions aren't familiar like those found in classical music theory. Music is defined seperately from general sound by humans, not math. That is what I meant.

Kenneth Mann
zoobyshoe said:
No. I was basically recommending a kind of plagiarism: steal a successful composers chord progressions, and write your own variations.

You'd be surprised how much people can pick out. One of my favorite examples is the introductions from three symphonies, one by Haydn, one by Mendelssohn and one by Schumann, and in these cases, I don't believe there was any copying, but the parallels are noticeable, key notwithstanding. On the other hand, if a progression is varied enough, it becomes something new anyway. I'm convinced that this is what the brain of a composer does subconscoiusly anyway when a sudden revelation appears. Variation is almost infinite and the remaining resemblances can be quite subtle.

KM

Kenneth Mann
FredGarvin said:
I beg to differ on that. You are referring to the structure of music, i.e. chords and scales. However, the moment that you put two notes together the mathematical implications of those two notes in relationship to one another is apparent. The mere act of subdivision of a phrase is simple math at work. quarter note, half note, sixteenth note, etc...

This was responded by:

Jelfish said:
Well, perhaps my definition of music is slightly different than yours. Of course you can find the frequency and waveform of all sound and music, and that would be 'math' I suppose. I referred to the structure as the math portion (which includes the 7-tone scale pattern, melody, harmony and rhythm). However, I refer to music not as the structure, but for how it's defined humanly. Do you consider a child banging on random piano keys to be music? I suppose some may. Many do not. Try listening to some atonal pieces. A lot of people detest it because its progressions aren't familiar like those found in classical music theory. Music is defined seperately from general sound by humans, not math. That is what I meant.

I believe that structure includes more than just frequencies/waveforms. It also includes the relationships between notes (frequencies/waveforms) and which of these progressions of notes are found to be acceptable or desirable. This acceptability derives from how certain notes within a scale fit within the 'Overtone Series' (That I mentioned in an earlier insertion). It also includes the timing relations between these note progressions. (This is more difficult to define in a "formula", and is usually grouped into patterns. This, of course, makes the idea of writing a program to do it more daunting.)

KM

zoobyshoe
Kenneth Mann said:
You'd be surprised how much people can pick out. One of my favorite examples is the introductions from three symphonies, one by Haydn, one by Mendelssohn and one by Schumann, and in these cases, I don't believe there was any copying, but the parallels are noticeable, key notwithstanding.
Yes, I'm sure musically knowledgeable people would catch on if you did it often enough.
On the other hand, if a progression is varied enough, it becomes something new anyway.
This might be a good strategy for smurf: borrow a chord progression to start, but then actually alter that progression before fleshing it out into a piece.
I'm convinced that this is what the brain of a composer does subconscoiusly anyway when a sudden revelation appears. Variation is almost infinite and the remaining resemblances can be quite subtle.
I think you are quite right.