Live data from Hacker News

Basic Music Theory in ~200 Lines of Python

mvanga.com

81–90 of 192 posts

Re: Basic Music Theory in ~200 Lines of Python

#81

Earlier quoted context omitted.

People have had this idea before but I've never seen a version of it that is better than our existing notation systems. Most of our music is diatonic, and we named the notes in our scale A B C D E F G. Seven notes in the scale, seven letters. Seven positions on the staff. Our harmonies are built on stacked thirds, and the stacked thirds line up perfectly on a staff. Line, line, line; or space, space, space. Three dot…

I appreciate most of your points and I appreciate the conciseness of the stave notation for example. But ... A B C D E F G. Seven notes in the scale, seven letters. Seven positions on the staff. Thats fine as long as you're in C Major. As soon as you depart from C Major it all starts going wonky. Why is C Major baked into the notation as if you'd never want to use anything else?

> Thats fine as long as you're in C Major. As soon as you depart from C Major it all starts going wonky. Why is C Major baked into the notation as if you'd never want to use anything else?

Actually, it works for every major scale and natural minor scale!

What are the notes in E major? E F# G# A B C# D# E.

It's still the same letters, E F G A B C D. Now, you may think that this is CHEATING because I've added sharps. But when you write it out on staff paper, the sharps get shoved off to the side on the far left in the key signature, and you basically forget that they are there. You really still just care about seven notes, so you still have seven letters, and seven spaces on the staff, they're just a different seven notes from the C major scale.

You have to know which key the song is in... but you have to do that anyway.

When I say that you basically forget that they are there... I mean it. This does not even require an especially advanced level of musical skill. People with even a passing interest in music theory should be able to breeze past it.

Re: Basic Music Theory in ~200 Lines of Python

#82

A perfect 5th is not the same as a diminished 6th unless we assume equal temperament tuning. Granted it is the dominant tuning, but it irks me when this is just silently assumed. Plenty of music around that is recorded using actual perfect intervals, so why muddy the waters?

I think going out of equal temperament into other modes of tuning/intonation would definitely be considered outside of "basic music theory". It feels like grumping about some inaccuracies/glossing over in elementary school mathematics because of the existence of imaginary numbers.

[deleted]

Re: Basic Music Theory in ~200 Lines of Python

#83
post #24

Earlier quoted context omitted.

Agreed. I whinge about this all the time. The C-based system is convenient for piano players but it's a mess for guitar players, violinists, and other instruments where there are no There have been many attempts at a chromatic music notation, but nothing has caught on so far [1]. Things are a little better with solfege -- there is "chromatic fixed do" solfege, where every note has its own name, rather than only havin…

I find the paino-roll notation on DAWs to be a lot more intuitive. Not much good for perfomers of course, but it helped me understand things better. Each semitone is given the same amount of space.

I find piano roll a lot easier to write/produce but a lot harder to sight-read.

I actually find hooktheory's system, where it's diatonic and accidentals are based on the active chord, not the current key, to be the easiest to understand relationships, but also hardest to translate into concrete notes to play.

Re: Basic Music Theory in ~200 Lines of Python

#84
post #72

Earlier quoted context omitted.

I've been programming for 40 years and playing music for 50. My original background was classical and I play jazz today. I'm a fluent reader. I think that historically, people were already familiar with "standard" notation and terminology before they learned theory, so it wasn't a major hurdle. Not only do theory students (i.e., at the college level) know how to read, but they are also required to learn keyboard. I'v…

This is the first time I heard of the Nashville number system - what's the difference to Roman Numeral Analysis? Is it essentially the same concept, but with Arabic numerals instead?

My take: It's a communication issue.

If you tell me you're going to make my life easier by teaching me "Roman numeral Analysis", I'm gonna run away. That sounds scary and vaguely reminds me of Latin class.

"Nashville number system" sounds easy to master. It's country, and country has a well-known self-imposed reputation as simple. (In truth, country can be just as complicated as anything else. But I'm talking about first impressions.)

I used to be a part of a congregation whose band spoke in 5ths and 7ths and I had no idea what they were going on about. And then I learned that part of joining the band was learning the Nashville system. It's just the simplest way to get everyone on the same page, and when you say "Nashville" musicians immediately relate to what you're saying.

Re: Basic Music Theory in ~200 Lines of Python

#85
post #64

Not a musician here but are scales really necessary? Why not just play any frequency I want?

> Why not just play any frequency I want? reply

You're more than welcome to. If you try to discover what intervals between these random frequencies tend to be pleasing, or displeasing, you'll rediscover some of the intervals and scales covered above

Re: Basic Music Theory in ~200 Lines of Python

#87

It would be awesome to add short audio clips. I mean, the examples are correct and all, but it's like discussing painting or photography without a single picture.

As a musician, I’d say no. Sure, you don’t get the significance of “what is this Dorian thing” unless Scarborough Fair is playing, but nothing in the article really applies to hearing music.

> As a musician, I’d say no. Sure, you don’t get the significance of “what is this Dorian thing” unless Scarborough Fair is playing, but nothing in the article really applies to hearing music.

I don't know what's with the current flagging/downvoting trends on HN, comments get dead before I can reply.

That said, your view seems rather extreme. What would be the downside of illustrating at least some of the samples with audio clips?

Re: Basic Music Theory in ~200 Lines of Python

#89
As a primer for music theory, this post doesn't teach much. It's using Python to derive various sets of notes in scales and modes, which is already easily available via google search, and in a more learnable format than Python code.

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.

Re: Basic Music Theory in ~200 Lines of Python

#90

It can be tricky to deal with the intersection of music and programming. For example: > 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, sur…

> The chromatic scale is a special case of a symmetric scale which cannot be transposed.

I would not agree here. I think you can transpose a chromatic scale, but you end up with the same "set" of pitches. (So you _can_ transpose, but if you only consider the _set of pitches_ you end up with a invariant.

But scales are not just a set of pitches, but also have a root note.

You can establish the key of C and play a chromatic scale from c' up to c'' and there would be the feeling to accept C as the root of the scale.

So the chromatic scale is kind of a _total_ (all 12 pitch names) and _trivial_ example, as you pointed out, very symmetric and usually not so interesting for analysis if you want to detect and describe structure.

In general it depends on the music. If the music is based on diatonics, then a major scale or it's modes will be a fitting primitive for analysis, considering chromatic notes something like side notes.

On the other hand 12-tone music uses a chromatic scale as a basis, negating the structure and hierarchy of diatonic scales.

So I don't see a problem with transposing a chromatic scale, it's useful and necessary for mathematical sound systems (helpful for computation) to define operations, even if there is no direct gain (functionally speaking - identity / mempty etc.) :

1 + 0 = 1

Post reply on HN