Live data from Hacker News

Basic Music Theory in ~200 Lines of Python

mvanga.com

101–110 of 192 posts

Re: Basic Music Theory in ~200 Lines of Python

#101

Unreadable code,considering the subject should have been written in either in c, c#, d, f or f#.

Interesting that there are no languages with "flat" names. I can think of two reasons: - the word "sharp" has more positive connotations - if you're limited to the keys on a usual keyboard "flat" would be denoted by "b".

Jazz musicians (and brass players) generally prefer playing in flat keys (because of transposition making the reading easier) so while "sharp" has a more positive connotation in normal use, if you asked a tenor saxophone player to play something in F# or C# they would generally not be pleased :-)

Re: Basic Music Theory in ~200 Lines of Python

#102

Earlier quoted context omitted.

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.

I firmly disagree. I learned about staying "in tune" with those that I was playing with in an ensemble long before I learned about equal-temperament and its concessions to multi-key harmony. I'd say removing the beats from your partials is way more fundamental to both music making and music theory than chromaticism. Chromaticism is the next step, beyond basic music theory.

> I learned about staying "in tune" with those that I was playing with in an ensemble long before I learned about equal-temperament and its concessions to multi-key harmony.

I'd consider that a performance technique before a theory aspect, like vibrato speed and control or enharmonic fingerings.

Consider this: If you were in a duet as a beginner and the sheet music had your partner playing a C and you playing an A double-flat, how would you be instructed to play it?

You'd be told it was enharmonic to a G, and play it as a G.

Until you start reaching deep into historical re-enactment or advanced theory, it's very safe to assume equal temperament and leave the ear-adjustment to performance.

Re: Basic Music Theory in ~200 Lines of Python

#103

I've worked on music theory coding for a while. I originally used a dict-lookup style like you have done, but found a simpler way (for me). The problem with that approach is you have to maintain values for enharmonics of note names. It's hardwired. Also what if you gave it something like ♭♭♭♭♭♭44? Why shouldn't it "theoretically" be able to handle that. It is "theory" after all. I use something like this to convert t…

From your link, I followed to the music of Lotus Helix:

https://lotushelix.bandcamp.com/

Wow, I'm very captivated by it, such high musical weirdness! Excellent stuff.

Re: Basic Music Theory in ~200 Lines of Python

#105
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?

Pretty much the same, adapted to the specific purposes. For instance, Nashville charts also include some notations for the form of a song, such as Intro, Verse, Chorus, etc.

A reason for the usefulness was how recorded music was made. The recording musicians had to be able to choose a key that accommodated the singer's range, on the spot. So a transpose-able format was ideal.

I think the industry in New York had a different scheme, which was to write for a "standard" male tenor voice, and rely on the musicians to handle exceptions.

Re: Basic Music Theory in ~200 Lines of Python

#106
post #17

There are maybe three aspects to music theory: (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.

> 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.

You are missing the point.

Re: Basic Music Theory in ~200 Lines of Python

#107

Earlier quoted context omitted.

I firmly disagree. I learned about staying "in tune" with those that I was playing with in an ensemble long before I learned about equal-temperament and its concessions to multi-key harmony. I'd say removing the beats from your partials is way more fundamental to both music making and music theory than chromaticism. Chromaticism is the next step, beyond basic music theory.

> I learned about staying "in tune" with those that I was playing with in an ensemble long before I learned about equal-temperament and its concessions to multi-key harmony. I'd consider that a performance technique before a theory aspect, like vibrato speed and control or enharmonic fingerings. Consider this: If you were in a duet as a beginner and the sheet music had your partner playing a C and you playing an A do…

I guess my response to this is that basic music theory is roughly equivalent with basic acoustics, has more bearing on generalized musical practice than what you are implying, and that even reading sheet music is an abstraction that requires foundations in a musical culture that has a prerequisite of certain assumptions that may not actually hold.

If you listen to CPE Bach knowing that each note can be bent (as on a guitar, because it is a clavichord), then the written music makes more sense because each note can be tuned to be harmonic with the fundamental. The sheet is just a sketch. The presumed required bend in each note totally changes the expectations of the key it is written in.

Or, if you are listening to a gamelan, then the beating of notes becomes an essential rhythm of the instrument, informing the tempo of the ensemble as a whole.

Music theory is a combination of acoustics and music history, but the acoustic part is more fundamental/basic. Like knowing "Clueless" is based on "The Taming of the Shrew" is informative, but the fundamentals of quality movie making or movie consuming do not require you to know anything about Shakespeare.

Re: Basic Music Theory in ~200 Lines of Python

#108
post #17

There are maybe three aspects to music theory: (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.

It would be interesting to go through a modern college level music theory textbook and break it down into which of those 3 things each concept falls into. I can't imagine getting past maybe the first chapter.

Re: Basic Music Theory in ~200 Lines of Python

#109

Is there a (really) accessible book on music theory that anyone would recommend?

I'm going to go in a slightly different direction and recommend starting with a book on music history. There will probably be enough theory in there, as it's needed to explain many developments. And then, don't try to study it, but start out by just reading it as a narrative.

Modern college textbook writers are doing a decent enough job of not focusing strictly on classical music. You could find out what your local university uses.

Post reply on HN