# A little scales and music theory

Now, we have a little aside on music theory. At the end of the day, music is just sound and sound comes in an infinite number of pitches, of notes. But some of these various pitches of sound are better to our ears than others, which brings us to scales. Scales are groups of human-pleasing pitches that sound good together, like if you heard them all in a song they’d sound like they all belonged.

In terms of the commonly used western tradition of tuning instruments and defining scales, it’s useful to imagine a piano keyboard.

Each octave of a piano has a total of 12 keys in it. We call these twelve keys semitones. If you’re starting with this model of music, then you can make a scale by picking some number of those 12 keys in the octave: usually 7. In the pentatonic and minor pentatonic scales, you pick just 5 keys out of this 12.

The scale that says “heck it, we’re using all the notes” is called the chromatic scale. By default when you’re working in Tidal and defining patterns of notes you’re working in the chromatic scale, with no restrictions. That’s why the following two ways for writing the same melody were equivalent to each other: the numbers are just the codes for f a c e in semitones

``````n "f a c e"
n "5 9 0 4"``````

If you want to prove it to yourself, stare at a piano

But what if you want to make sure that you’re staying within a scale, even when you’re trying to improvise off the top of your head? You could try to remember what scale you’re in and what notes to include, but that’s work the computer can do for us. Fortunately, Tidal has a scale function that will do just that.

Since our f a c e melody is in major scale, then we can also just write it as

``n (scale "major" "3 5 0 2")``

The advantages of using the `scale` function are going to be really obvious in certain applications, like randomized chords, so we’re going to switch back and forth between the letter-note notation and numbers combined with `scale` depending on what’s most convenient.