by mvanga on 4/19/21, 7:18 AM with 188 comments
by WhompingWindows on 4/19/21, 2:23 PM
The most basic aspect of Western music theory overlooked here is the relationship between tonic and dominant. If you know the "home" chord aka "the I" aka "tonic" is C major, the dominant will be G major, aka the V chord. Add just the F major chord, and you'll know 1-4-5 in a "basic" key: C major. 1-4-5 is the simplest chord progression, you can play amazing grace, you are my sunshine, even The Beatles, you'll be rocking with 1-4-5.
Next level, if you add in the minor 6 (a minor) and minor 2 (d minor), you realistically know 95% of the chords you'll ever hear in C major pieces. And on the piano, this is ALL white notes, so even someone with zero musical knowledge can "solo" over your chords by just plunking any white notes while you play these chords (kids LOVE LOVE this btw, highly recommend trying with a kiddo).
I wouldn't consider double-sharps and double-flats "basic" music theory. They really aren't needed for beginners, since they're relegated to keys like C# major where you'll occasionally sharpen a note like E# (aka F) into E## (aka F#). I didn't run into these until around 5 years into my piano training, playing Chopin's F# major nocturne Op 15 No 2, there's a bunch of double sharps in that piece.
In any case, don't worry about double-flats and double-sharps or the precise notes of various modes and scales. Just learn pieces you enjoy, preferably with a mentor or teacher who can suggest improvements based on their trained ear.
by jancsika on 4/19/21, 12:51 PM
> The chromatic scale is the easiest scale possible
So far so good-- in both programming and music we're just stepping through the smallest values (half step for music, the integer "1" in programming). So "easy" definitely applies to both domains.
> We can generate a chromatic scale for any given key very easily
For programming, sure-- you just find your offset and go to town.
For music, however, this is a wrong warp. The chromatic scale is a special case of a symmetric scale which cannot be transposed. There's literally only one such scale-- each transposition brings you back to the same exact set of pitch classes.
Figuring out what it means to have a chromatic scale "for a given key" is advanced music theory. In fact, I can only think of a few places where that makes sense:
* studying the complex harmony of late-19th century Romantic music
* studying the choice of accidentals in chromatic passages of Bach, Beethoven, etc. to infer the implied harmony
Those are important things, but they are definitely advanced concepts.
Long story short for programming, the author moves logically from an array to stepping through an array. But in terms of music, they start with the simplest possible scale and then jump to a third year undergrad theory concept.
by sampo on 4/19/21, 10:33 AM
(1) Theory of how things sound like: Tones, melodies, scales, chords, based on the frequencies of individual sounds.
(2) How to name things.
(3) How to handle the mess of naming things in Western music theory, where things have 12 different names, depending on which note you choose as the base.
This post seems to focus on 3.
by sideshowb on 4/19/21, 8:49 AM
Deriving the piano keyboard from biological principles using clustering (Jupyter)
https://fiftysevendegreesofrad.github.io/JupyterNotes/piano....
by delineator on 4/19/21, 4:59 PM
You can define interval structure as a sequence of large L, small s, and optionally medium M steps.
For example, the Major diatonic scale - a 7 note scale from 12 EDO - in Ls notation is:
LLsLLLs with L: 2 s: 1 (12=2+2+1+2+2+2+1)
A 19 EDO, 7 note scale: LLsLLLs with L: 3 s: 2 (19=3+3+2+3+3+3+2)
And here's a 19 EDO scale with 9 notes (Godzilla-9): LLsLsLsLsLs with L: 3 s: 1 (19=3+3+1+3+1+3+1+3+1)
You can then explore frequency ratios beyond those available in 12 EDO: https://github.com/robmckinnon/pitfalls/blob/main/lib/ratios...And chords based on those ratios: https://github.com/robmckinnon/pitfalls/blob/main/lib/chords...
The above links are Lua code files for a monome norns library for exploring microtonal tuning: https://llllllll.co/t/pitfalls/37795
by algesten on 4/19/21, 12:32 PM
Plenty of music around that is recorded using actual perfect intervals, so why muddy the waters?
by codeulike on 4/19/21, 9:43 AM
by protoman3000 on 4/19/21, 8:57 AM
While true, I find this interpretation harmful to the understanding of modes. It didn't provide me with any insight and instead it seemed irregular to the other theoretical constructs we have and thus deterred and misled me in the beginning.
To me, it all clicked when I took all the modes, except Lydian, and constructed them by putting down the augmentations to the major scale in a circle-of-fifths sorted way:
Mixolydian: b7, Dorian: b7 b3, Aeolian: b7 b3 b6, ...
You can see that the modes appear walking left on the circle of fifths or walking along fourths (or going "darker", as some prefer to say). Try this out when starting at e.g. C and you see the pattern immediately.
Then take Lydian: #4
That's going right on the circle of fifths or going in fifths going "brighter".
Also, tangential comment: My music and my life has changed profoundly when I found out how to use the Lydian mode. I can't explain it, but it is just exciting.
by HorkHunter on 4/19/21, 12:45 PM
my brain kind of cannot accept this fact and I struggle with it
by pohl on 4/19/21, 4:54 PM
R ⟷ 5 (stable)
2 ⟷ 4 (unstable)
3 ⟷ ♭3 (modal)
7 ⟷ ♭6 (leading)
6 ⟷♭7 (hollow)
♭2 ⟷ ♯4 (uncanny)
[1] https://www.youtube.com/watch?v=et3CMn2oCsA
[2] https://www.youtube.com/watch?v=SF8CdxcdJgwby goto11 on 4/19/21, 12:29 PM
Come on, that is not for "historical reasons", that is because those notes are only one semitone apart!
by whiddershins on 4/19/21, 8:58 AM
Mmmm yes, and that’s also a bit confusing because it dodges around why the scale was and is 7 notes to begin with.
by pashariger on 4/19/21, 4:49 PM
by calebm on 4/19/21, 1:39 PM
by dvfjsdhgfv on 4/19/21, 11:56 AM
by bdenckla on 4/19/21, 10:09 PM
In my opinion (and experience) it is better to do a little work "up front" and "in the back" to convert to the line-of-fifths representation since that is more friendly to formalization. In other words you can take input in traditional musical notation and give output in traditional musical notation, but "in the middle," formalization should be done in the line-of-fifths representation.
Above I have used "formalize" to mean something like "mathematicize" (if that's a word) or "be precise" or "be able to compute" or "be able to express in a programming language (like Python)". For example, I consider the line-of-fifths representation to be a good one in which to formalize music theory because in line-of-fifths representation, transposition can simply be formalized as integer addition, and integer addition needs no further explanation or formalization, i.e. it can be taken as sort of axiomatic.
Here's another way of putting it: if you wanted to be able to add Roman numeral strings, would you write code that directly operated on the Roman numeral strings, or would you first convert to a compute-friendly representation like integers, and then do your adding from there? No doubt there are tradeoffs involved, but I tend to think that it is usually worth it to move to a compute-friendly representation, both with Roman numerals and music notation.
An added benefit of line-of-fifths representation is it provides a good basis to formalize many important historical European tuning systems.
by peterpostman on 4/19/21, 12:48 PM
by FabHK on 4/19/21, 9:21 PM
I vaguely understand that complications arise because we want nice harmonics, ie frequencies whose ratio is a "nice" rational number, such as 2/3 or 3/5 or so.
But our chosen notes should be invariant under doubling of frequencies ("shifting by an octave"), because that's basically the same note.
The problem then is that roots of 2 are irrational, that is, one cannot find (p/q)^2 = 2, or (p/q)^n = 2, or even (p/q)^n = 2^m. Therefore, one cannot find a "nice" interval that, applied several times, wraps around to an octave (or multiple octaves).
However, in a neat coincidence, (3/2)^12 = 129.7463378906... which is close to 2^7 = 128. So, based on that ("Pythagorean comma"), something something something, and we end up with 12 half notes that are basically of frequency f_i = f_0 * 2^(i/12), which are all horribly irrational, but apparently sound "nice" enough, largely (because they are close enough to some "nice" fractions), but only if we pick out some specific 7 of them.
And then the question becomes, which 7 of the 12 do we pick, approximately uniformly distributed. (Why not 6? Every second? I don't know.)
And then, you can transpose them somehow (ie multiply frequencies by 2^(j/12) for some j, but then you change the names for some reason, and everything gets complicated and tonic and Mixolidian double-sharp.
Also, instead of frequencies of the form f_i = f_0 * 2^(i/12) (which, clearly, have the advantage that any multiplication by a power of 2^(1/12) is just a shifting of the index i), you could also use non-equal tuning, with the powers of the 12th root of 2 replaced by some "nice" fraction, which means that any shifting then subtly changes the character of everything, I assume.
This is complicated, admittedly, but for me the nomenclature obscures, rather than elucidates, the issue.
ETA: I sympathise with what irrational wrote: "Is this what it is like when I talk to people who don’t know anything about programming about my work? Pure gibberish?"
by geekster777 on 4/19/21, 9:36 PM
For example, you may spend a while learning the major scale, and what can be done with it. Then you learn the minor scale, and it seems like a totally separate scale that sounds completely different. And after that you learn that there are five other scales (modes) to learn about! (Dorian, Phrygian, Lydian, Mixolydian, and Lochrian!). It can seem extremely overwhelming until you learn that they're all the same scale with different relative starting positions. Where major is [1,2,3,4,5,6,7], minor is [6,7,1,2,3,4,5], and the other modes are all the other permutations of starting positions.
My other gripe is that learning theory on piano puts a lot of bias on the notes themselves rather than the intervals. For example, the B major scale has 5 sharp notes (black keys) to remember whereas C major scale has none. These are pretty different shapes to remember. Learning these on guitar means taking the same exact shape and shifting it up a fret (so if you know one major scale, you know them all!). Not to say that guitar is the perfect instrument for learning this - folks will often learn scales as close to the 0th fret as possible, causing you to start on different strings and have slightly different patterns.
That being said, I wish there was a purely linear instrument (a piano with the black keys flattened?) for learning theory. The real magic comes from identifying the shapes and patterns, and how they're similar to each other. Like how major and mixolydian are identical except for one note, so it's very easy to modulate between them, or make a listener think they're in one mode when they're in another. Same with minor and phrygian. Being able to drop the baggage of "the second note of the B major scale is C# which is this black key here" and just focus on a floating set of intervals seems like it would make this all easier and less intimidating.
That all said, I still feel reasonably early in my theory journey. So maybe this is just my bias coming from guitar.
by ngcc_hk on 4/20/21, 1:35 PM
by valdiorn on 4/19/21, 2:18 PM
by markc on 4/19/21, 8:40 PM
https://github.com/overtone/overtone/blob/master/src/overton...
by njharman on 4/19/21, 8:54 PM
I've tried to grok music theory several times. I've never understood the scale/notes, notations. The 2nd array (with sharps and flats) and couple paragraphs made it "click" instantly. Because it was in a language and presentation I understand.
by dvh on 4/19/21, 1:13 PM
by diegoperini on 4/19/21, 8:59 AM
by muyanapar on 4/19/21, 2:02 PM
by starchild_3001 on 4/19/21, 7:43 PM
by noisem4ker on 4/19/21, 11:46 AM
Haskell School of Music http://www.euterpea.com/haskell-school-of-music/
by keymasta on 4/19/21, 10:41 AM
# Assuming note values are of Jazz style.. i.e, '1', 'b3', '#5', or '♭3' with unicode-sub after
jazzAllFlats = ['1','b2','2','b3','3','4','b5','5','b6','6','b7','7']
sharpStrs = ['#','♯']
flatStrs = ['b','♭']
accidentalStrs = sharpStrs + flatStrs
def stripAccidentals(note:str) -> str:
return ''.join([c for c in note if not c in accidentalStrs])
def jazzToDist(jazz:str) -> int:
dist = 0
degree = int(stripAccidentals(jazz))
while degree > 7:
dist += 12
degree -= 7
dist += jazzAllFlats.index(str(degree))
for c in jazz:
if c in sharpStrs:
dist += 1
elif c in flatStrs:
dist -= 1
#Here you could add support for double sharps and double flats if you want.. although unlikely as font support for these glyphs is horrible overall.
else:
break
return dist
print(jazzToDist('bb3')) # returns 2
print(jazzToDist('1')) # returns 0
print(jazzToDist('♭♭♭♭♭♭44')) # returns 68
print(jazzToDist('2')) # This one is strange as it's the only one where input == output
I started making stuff more like this as it just saves a lot of trouble in the long run. Once you have things made generic like these it's easier to think about going into ways that are not Jazz/Dist (which is semitone distance, or set notation), like Keys for example.. because it turns out the logic for that is really similar to what is in the jazz.The shape of the jazz system is the same shape as a change in the key of C. You would just separate the accidental part of the note's name like I did and look up let's say the index in all keys, giving you distance from C instead of what I showed there which is like distance from what is called 1 in Jazz.
So yes I prefer to make helper functions like this that actually kind of "get it" about what the languages/ways like Jazz or note names are actually saying.. then you can go one to another, or different keys really easily. If interested in more of my "Way Of Change" algorithms I can share.
I think your article is cool and I could comment more.. maybe if you want you could read my repo I could pm it to you. But it's long. In the meantime I have a new website using some of this type of logic. unfortunately js instead of python (where my bigger codebase resides).
Google thinks this site is a security threat and I literally posted it two days ago but it's got all scales/chords etc, and other stuff. Still in prototype phase. https://edrihan.neocities.org/wayofchange%20v14.html
by tarboreus on 4/19/21, 3:03 PM
by adamnemecek on 4/19/21, 3:51 PM
Launching soon http://ngrid.io.
by tomrod on 4/19/21, 1:16 PM
by vram22 on 4/20/21, 6:19 AM
Play the piano on your computer with Python:
https://jugad2.blogspot.com/2013/04/play-piano-on-your-compu...
The post got some interesting comments with info about Western music theory, which I knew nothing about. And suggestions on how to improve the program to make calculation of note frequencies more accurate.
by fatiherikli on 4/19/21, 9:45 AM