The Programming Language of Music – Hacker Noon


A musical scale is a subset of notes from the full range of 12, played either in ascending or descending order. There are many kinds of scales, and we will see three types: the major, the minor, and of course my favourite, the pentatonic. Every scale has a root. For example, the A major scale has the root at ‘A’. The C# minor pentatonic scale has the root… you guessed right, at ‘C#’.

Perhaps we can visualise a scale as a circular doubly linked list. At least during the phase of learning a scale, it makes sense to know the sequence of notes in both the ascending and descending order. At the time of execution, when you’re playing on stage with the spotlight on you, you will obviously not be playing the notes of the scale in sequence, but knowing the structure well gives you the freedom to execute with excellence.

The Major Scale

The major scale consists of seven notes, arranged as follows.

Let us try to derive the the notes in the C major scale. 
– The root would of course be ‘C’. 
– For the second note, one step up would be, counting two half steps from C… C#… D. 
– Then for the third note, another step up would be, counting two half steps from D… D#… E
– For the 4th tone on a major scale, remember it is only a half step up. So half step up from E would be E#? 
Aha! Rule 1, E’s and B’s don’t have sharps! So the 4th note would be an F. And so on… Here’s the C major scale.

C →D →E →F →G →A →B →C

That was easy. Here is the C Major scale in action.

Let’s try one more. Say, A. 
– The root, of course, is A
– 2nd note is a full step up. That is, counting two half steps from A…A#…B
– 3rd note is again a full step up, and that is, B…C…C#
And so on… Here’s the A major scale.

A →B →C# →D →E →F# →G# →A

Hope you’re getting a hang of this. Maybe, try deriving some on your own. Perhaps, D# major and G major. You might want to take some time here because if you get this, you’ve cracked the rest of it, really.

The Minor Scale

There are several kinds of minor scales, and here we will see the ‘Natural Minor’. The natural minor scale is derived from the major. Take a happy sounding major and turn it into a sad sounding minor. Example:


To derive the minor, the root remains the same, but some small shifts to the major scale transforms it into an entirely new monster. Easy: take the happy major scale, and throw a bucket of flats at the 3rd, 6th and 7th notes to make it sad.

Deriving for the C natural minor scale: 
– you take the root as C
– A full step up from C is, as you count, C…C#…D
– A half step up from D is D# (or E♭), and so on. 
The C natural minor scale is:

C →D →E♭ →F →G →A♭ →B♭ →C

See? Just put in a flat at the 3rd, 6th and 7th positions to get the natural minor scale. This scale is not so intuitive in the language of sharps, but that would be:

C →D →D# →F →G →G# →A# →C

That’s it. Try a couple on your own, if you like (Say, the B minor and the F# minor scales). And here is a video of the C natural minor in action.

The C Natural Minor Scale

The Minor Pentatonic

This beautiful scale has only 5 notes, and therefore the name pentatonic. Technically, there are many kinds of pentatonic scales, but people usually refer to two kinds: the Major Pentatonic scale and Minor Pentatonic scale. But when the major/minor is not specified, it is pretty safe to assume minor.

I could go on all day about why the pentatonic scale is so special, but I will let Bobby McFerrin demonstrate instead.

Bobby McFerrin Demonstrates the Power of the Pentatonic Scale

The Pentatonic scale has 5 notes, derived as the positions 1, 3, 4, 5, 7 on the natural minor scale. No need to scroll up, here is the C minor scale again, but this time, the pentatonic positions have been highlighted.


Simply, the C minor pentatonic scale consists of, by picking positions 1, 3, 4, 5 and 7 from above,

C →E♭ →F →G →B♭ →C

Here is Marty Schwartz showing you how to play the A minor pentatonic on his beautiful red stratocaster.

Marty Schwartz: instructional video on the A Minor Pentatonic

Although in practice this is one of the simplest scales to learn and master, in theory, it’s simplicity and beauty can be appreciated only if the student has rigorously followed the progression from major to natural minor and only then has arrived at the minor pentatonic. Does this remind you of something from work?

I used to wonder back in school why we needed to know how to draw a circle using the dastardly mid point algorithm, when one could always just use some DrawCircle() kind of function. Well now I appreciate the advantages of academic rigour. Just last week, I spent hours debugging a really gruesome bug, and found the root cause to be some dodgy application of De Morgan’s laws deep inside an if..elseif rabbit hole.

read original article here