

Musical Scale Generator - bozho
http://techblog.bozho.net/?p=1523

======
mrcactu5
Have you considered examining Jazz scales?
[https://en.wikipedia.org/wiki/Jazz_scale](https://en.wikipedia.org/wiki/Jazz_scale)

They start with the modes - Ionian, Phrygian, Lydian... - and they were
embellished with certain accent notes.

* [https://en.wikipedia.org/wiki/Bebop_scale](https://en.wikipedia.org/wiki/Bebop_scale) * [https://en.wikipedia.org/wiki/Lydian_augmented_scale](https://en.wikipedia.org/wiki/Lydian_augmented_scale) * [https://en.wikipedia.org/wiki/Aeolian_dominant_scale](https://en.wikipedia.org/wiki/Aeolian_dominant_scale) * [https://en.wikipedia.org/wiki/Altered_scale](https://en.wikipedia.org/wiki/Altered_scale)

Many examples in Jazz recording and later classical composers like Debussy and
Ravel

~~~
showman
Good call on these scales.

For those who are new to music theory basics, the easy way to remember your
Modes is to relate them to their first step.

For example. C D E F G A B is a C major scale also known as the IONIAN MODE.

Beginning this scale on the 2nd note: D E F G A B C is the Dorian mode.

So continue in this ++ manner and get the rest: PHRYGIAN, LYDIAN, MIXOLYDIAN,
AEOLIAN (The natural minor scale), and LOCRIAN. These are all "Natural Modes"

The significant one here is the 6th Mode or AEOLIAN. That is the minor key
enharmonic (using the same notes) as the 1st Mode, our Major Scale.

Why is it significant? Because the minor was a target for early composers to
modify. Primarily the Melodic Minor and Harmonic Minor are based on the
Natural Minor by using accidentals ( sharp notes and flat notes (a
modification up or down by a half step)).

Once we take our Modified Minor scale and play it starting on each individual
scale step, we get our Fancy Jazz Scales. Voila. New Scales. So easy it is
criminal. But, for some, very pleasing to the ear.

------
pierrec
The scale generation algorithm described here is really interesting - it
starts from the natural core of harmony (using rational relationships between
frequencies), and gives you the option to keep the resulting natural-tempered
notes, or to adapt them to the modern-day 12-tone equal temperament (12TET)
and its irratonal, twelvth-root frequencies.

The question of whether 12TET is "natural" or not is an interesting one, and
in my opinion, it was great for a few centuries, but at some point music will
move beyond 12TET. Take a look at one of richest websites exploring this
question [1], whose author has a different opinion from mine.

As for skipping the 7th harmonic -- i'd say you shouldn't do it. If you scroll
down [1] until you get to the "n-tone equal temperament" graph, you'll find
one of the nicest ever justifications for 12TET. However, if you added more
harmonics to that graph, you'd find that the 7th does not fall anywhere close
the 12TET frequencies: that's why we're not used to hearing it, and it sounds
the most alien to us.

[1]:
[http://www.geocities.jp/imyfujita/wtcpage004.html](http://www.geocities.jp/imyfujita/wtcpage004.html)

~~~
TheOtherHobbes
It's an oversimplification to suggest that scales are based on the harmonic
series. Many instruments have slight non-linearities in their overtones, and
intervals that sound consonant aren't usually mathematically perfect. E.g.
pianos don't even have perfect octaves. The major and minor scales seem to be
based on very specific ratio sets, not on the general overtone series.

But 12TET has 12 tones for a very practical reason - instruments with more
tones are difficult to build and damn near impossible to play, because human
hands are only so wide and finger movements have limited precision.

There were experiments with more tones per octave back in the middle ages, but
the idea never caught on because the musical benefits aren't obvious. So 12TET
is a 'good enough' compromise between flexibility and expressiveness.

Performers on instruments with an infinite pitch range vary their pitches
anyway. Intonation problems drive conductors insane, and the reality is that
orchestral and choral pitches tend to drift slightly towards consonance and
away from the nominal ET ratios.

Of course, with a computer you can do what you like. Here's some recent
microtonal music written with SuperCollider:

[http://composerprogrammer.com/pitchdeviations.html](http://composerprogrammer.com/pitchdeviations.html)

~~~
theOnliest
> E.g. pianos don't even have perfect octaves.

This isn't true (at least in theory). Octaves on piano are (or should be)
exact, otherwise the 12-tone equal tempering doesn't work out. A4 is 440 Hz,
A5 is 880 Hz, and A3 is 220 Hz (using the Acoustical Society of America
designations, where middle C = C4). If the octaves weren't pure, the piano
would be more in tune in the middle than it would be at either end, which
usually isn't the case.

> There were experiments with more tones per octave back in the middle ages,
> but the idea never caught on because the musical benefits aren't obvious.

The history of scales and how they came to be in the Western classical system
is long and complicated (too long for here, certainly), but I wanted to point
out my favorite of these weird old instruments the archicembalo.[1] It was
designed by one of the most out there theorists, Nicola Vicentino, in Ferrara,
a hotbed of weird music at the time (see Carlo Gesualdo's "Moro lasso" [2], a
really chromatic madrigal).

1\.
[http://en.wikipedia.org/wiki/Archicembalo](http://en.wikipedia.org/wiki/Archicembalo)
2\.
[http://www.youtube.com/watch?v=s_q3EJNUKis](http://www.youtube.com/watch?v=s_q3EJNUKis)

(I'm ABD on a Music Theory PhD, so if anybody has more specific questions I'm
happy to help!)

~~~
analog31
It's been my understanding that the tuning of a piano is "stretched" compared
to perfect 2:1 octaves -- at least this is what I heard from one piano tuner.
Some details are suggested by all-knowing Wikipedia;

[http://en.wikipedia.org/wiki/Piano_tuning](http://en.wikipedia.org/wiki/Piano_tuning)

~~~
TheOtherHobbes
Yes, exactly. Stretch tunings are also standard on some other keyboard
instruments, including the Rhodes electric piano. There's some evidence that a
preference for stretched octaves is innate:

[http://www.mmk.e-technik.tu-
muenchen.de/persons/ter/top/scal...](http://www.mmk.e-technik.tu-
muenchen.de/persons/ter/top/scalestretch.html)

But stretch tuning is also used as a deliberate musical effect. Some tuners
exaggerate it slightly, and some professional pianists ask for it.

Simple harmonic theory only really makes sense if you're making music with
pure sine waves. The sounds made by non-electronic instruments are very rich
and complicated.

Describing them with simple math has intuitive appeal, but it doesn't model
what really happens.

(There should be a name for the bias towards using simple but misleading
models, but I'm not sure there is one.)

------
baddox
This looks neat. I wish I could try it on my iPad.

There is a lot of interesting mathematics behind music. I particularly enjoy
reading about different temperaments, which are our attempts to compromise
between just intonation (the harmonic-based scales the article mentions, which
ostensibly sound the most "natural" and "correct" in a given key), and
physical instruments, which we usually want to be able to play in multiple
keys without significant adjustment. Twelve-tone equal temperament is the most
common temperament in Western music, where the frequency of each semitone is
the frequency of the previous semitone multiplied by the twelfth root of two.
With equal temperament instruments, the error between just intonation
intervals is the same regardless of the key.

There is a rich history of temperaments. A early attempt, attributed to
Pythagoras, illustrates the impossibility of constructing a temperament
perfectly from the simple ratios generates by harmonics:

[http://en.wikipedia.org/wiki/Pythagorean_tuning#Method](http://en.wikipedia.org/wiki/Pythagorean_tuning#Method)

The Wikipedia article on the tuning of Bach's aptly-titled Well-Tempered
Clavier is also fascinating:

[http://en.m.wikipedia.org/wiki/Well-
Tempered_Clavier#Intende...](http://en.m.wikipedia.org/wiki/Well-
Tempered_Clavier#Intended_tuning)

[http://en.wikipedia.org/wiki/Musical_temperament](http://en.wikipedia.org/wiki/Musical_temperament)

Edit: this video is a great demonstration of the errors between just
intonation intervals and our equal temperament compromise:
[http://youtu.be/6NlI4No3s0M](http://youtu.be/6NlI4No3s0M).

~~~
shemol
Constructing a perfect temperament is impossible if you require each logical
tone to be mapped to a constant frequency. I've long been curious about what
would happen if you allowed the specific frequencies to drift in order to keep
the ratio between concurrently sounding tones perfect (well, closer to
perfect, as you add more tones). No idea whether the shift would be
perceptible, or to how many ears.

~~~
baddox
Do you mean shift the frequencies when the key changes, e.g. between songs or
when a song modulates? That certainly works, at least with electronic or
continuously variable instruments. But even within one diatonic scale in a
single key, it's impossible to have a fixed set of frequencies such that the
intervals are correct in all of the diatonic triads.

I suppose you could shift individual frequencies based on the _chord_
currently being played, but I'm not sure how that would sound.

~~~
shemol
Per-chord is what I meant, not per-key. 3:2 means you can't have a coherent
set for all tones in a key, full stop.

But you could slightly shift the frequencies of the notes in a given chord to
make _that chord_ perfectly tempered.

There'd be a million details; making sure the melodic voice, bass, or both
avoided wolf intervals; figuring out what to when some voices are moving over
a sustained chord in others; keeping the main anchor frequency from drifting
"too far" from the original (and probably determining "too far" in the first
place); figuring out whether the resulting sound was going to be anywhere near
distinguishable enough to be worth all the effort of hacking through all this
rigamarole.

~~~
baddox
Yeah, it sounds complicated. I wonder what a cappella groups like barbershop
quartets do, or if they even think about it.

~~~
shemol
Complicated, no doubt, but agree it's probably not far from how any non-
tempered instrument player harmonizes already, with little or no thought.

Thanks for the link to Gary's blog. Good read.

------
dharma1
-soundcloud link or mp3s would be nice

-how do i run the java app?

-I grew up playing several instruments from age 5, and love the vocabulary of chords and harmonies 12-TET gives us. It has a strong internal logic. But something bothers me about the fact that it's a man made system, not aligned with natural overtones that are rooted in physics

-This guy is nuts. But I really want one of these big pythagorean monochords [https://www.youtube.com/watch?v=tbCZO6rPcY8](https://www.youtube.com/watch?v=tbCZO6rPcY8)

-using an ipad as a playable instrument with harmonic tuning - [https://www.youtube.com/watch?v=o965af7w6_o](https://www.youtube.com/watch?v=o965af7w6_o)

------
gtani
That's interesting. I've always suspected that the rules/heuristics governing
intonation for voice, wind and (unfretted) string instruments is free form,
depending on whether they're carrying the melody or playing in the "corps" of
small or large ensembles. This vid, by (I think) a respected violin prof
addresses this: carrying melodies in Pythagorean, ensemble playing in Just
intonation, and ET if you have to (playing with piano).

[https://www.youtube.com/watch?v=QaYOwIIvgHg](https://www.youtube.com/watch?v=QaYOwIIvgHg)

