Advertisement

Formula for Primes (And Music Tangent)

Started by May 06, 2009 10:42 PM
17 comments, last by Zahlman 15 years, 6 months ago
Quote: Original post by mhamlin
Quote: Original post by anothrguitarist
About that music blurb in the OP, it interests me because when I learned about musical modes and that there are only twelve notes used in western music, I was incredibly disappointed. I had always thought music was much more elaborate than it actually is. I used to think there were "infinite" possibilities.


There are of course many many different tunings than the Western 12TET--Indian classical music, for example, uses 22 or 23 microtones depending on who you ask. There's also a lot of interesting work going on as far as Western microtonalists are concerned.

There are a lot of tuning possibilities that haven't been explored yet. Of course, there is our inherent limitation (precision of our ears to hear extremely small intervals).


I had no idea. Thank you.

I bet one day soon we'll be able to improve out senses too.

--------------------Enigmatic Coding
Frequency is continuous, so it doesn't make sense to talk about "primes" here at all - prime number theory belongs to the realm of integers.

Two frequencies harmonize (per Archimedes) when they are in a ratio that can be described as a "simple" rational number (i.e. the numerator and denominator are small when reduced to lowest terms). Practically speaking, it tends not to bother us much if things are very slightly off - although sometimes one can hear "beat frequencies" as a result.

Instruments used to be tuned to emphasize harmony based on certain keys. For example, the G on a piano might be tuned to exactly 1.5 times* the frequency of the C below it (correspondingly, .75 times the frequency of the C above it, as an octave always represents an exact doubling in frequency). This would make pieces written in C major sound perfectly "harmonious", and others nearly so, at the expense of other keys being rather muddled in sound. Historical associations of keys to "types" of music (e.g. military marches, and Chopin's Polonaise No. 1, being in D major and/or A major) are largely based on the character of the sound that resulted from the historical tuning.

In the modern era, instruments are "well-tempered", meaning that the frequency ratio between any two adjacent semitones is the same: the 12th root of two (or at least, as near as the tuner can get it). Thus every key sounds equally good (at least in theory), and you can transpose things freely (typically, in order to best suit the instruments and/or vocalists that will be performing the arrangement). See also. ("Traditional" selection of keys for pieces evidently continued for a long time after the development of the "well-tempered clavier", and may even be consciously thought about today.)

Of course, electronic music holds itself free to throw all of that out the window, and other world cultures have differently divided scales. It's very difficult to train yourself to sing with a new scale-division once you can use one of them well, BTW. :) It seems that one develops a very strong "muscle memory" in the vocal cords.

* Note that there are 7 semitones between C and G.
Advertisement
Another side topic: How difficult would it be to create a program that generates melodies in the key of C Major and its modes?

Very superficially, I'm thinking of rules such as:
- Start song on root note
- Determine available melodic paths to get to the __ interval at the start of the next measure
- Store rhythms for each measure/run
- Create variations on the stored rhythm, after the pattern has been established
- Store the melody for each measure/run
- Create variations on the melody, while adhering to the stored rhythmic pattern.

Along with constraints:
- Max number of octaves
- Max number of note duration subdivisions
- Max number of measures per song
- Key (which notes can be played. I.E. CDEFGAB)

When going from note to note, I think there are some notes that shouldn't be played because they don't sound good, some notes that shouldn't be played because they would ruin the timing, and some notes that shouldn't be played because they'd ruin the main theme/pattern. After the notes that shouldn't be played are removed, there will probably be a selection of notes that would fit, each with a "weight" of how well they'd fit.

Obviously, in the context of a larger song, going from note to note is not as important as adhering to a certain form. There are patterns on the micro scale as well as the macro scale.

Once I get the song down, I could probably output it in power tab format and play the music.

Has anyone tried something like this or heard of this being done? What artificial intelligence paradigms were used (I.E. fuzzy logic)?

[Edited by - anothrguitarist on May 8, 2009 6:11:52 PM]
--------------------Enigmatic Coding
Riemann (PDF) used analytical methods to find an expression for a prime counting function. He calls it f(x), and it is defined by f(0) = 0 and the condition that it jumps in value by 1/n at each prime power pn. This paper also contains the first statement of the Riemann hypothesis.

Also, I suspect you may enjoy reading this.
Speaking of the "music of the primes," this metaphor is useful in describing the proof of the prime number theorem. One first starts with the von Mangoldt function, which is a useful "prime detector"--it spikes up at the primes and prime powers and is 0 elsewhere. One then applies the Mellin transform to more fully understand this "music." The limitations in the music deduced from this method yield an asymptotic bound on the prime counting function (which gives the number of primes less than or equal to a given real number).

Further, back on the topic of generating primes, one can show with an elementary argument that there is no polynomial P(x) = a_n * x^n + ... + a_0 of degree 1 or greater and with integer coefficients such that P(0), P(1), ... are prime. Suppose the contrary so that P(0) = p for some prime p. Then a_0 = p, which implies that P(pk) is divisible by p for k >= 1. But since pk is a positive integer, P(pk) is by assumption prime; therefore P(pk) = p for k >= 1. But P cannot take on the same value infinitely many times.
Zahlman, I've been listening to classical music all evening because of your post. It's so balanced, especially compared to my primary musical taste: Dream Theater. This is definitely a good source of variety in my palette.
--------------------Enigmatic Coding
Advertisement
The classic proof that there are infinite primes is often used to generate large primes.

Based on the fundamental theorem of arithmetic, numbers can be composed of a unique series of primes. So given the sequence of prime numbers P, compose a number as: (2 * 3 * 5 * 7 * ... * Pn) + 1.

As pointed out above, this is relatively basic stuff in number theory.
Just Intonation is an interesting topic. It's used by a few artists i listen to.

Also, for those "craving math", i would recommend The Mathematical Tourist. Really interesting to read, but doesn't contain much actual math. It "reads as English" but it dives into many interesting fields of math. Even the boring chapters were interesting! Pick it up at the library if you can.
Quote: Original post by frob
The classic proof that there are infinite primes is often used to generate large primes.

Based on the fundamental theorem of arithmetic, numbers can be composed of a unique series of primes. So given the sequence of prime numbers P, compose a number as: (2 * 3 * 5 * 7 * ... * Pn) + 1.


That number isn't necessarily prime. It simply has only prime factors greater than Pn.

This topic is closed to new replies.

Advertisement