Music and math. Search for a natural-scale generator. The best way?

I wrote this post Music and Mathematics, Finding the Natural and Pentatonic Scales.

I want to find a better software approach. The solution may be:

<script> function getScaleIntervals(c) { var tot = 0; var scale = []; while(tot <= 12){ scale.push(Math.round(tot)); tot += c; } return scale; } var natural_scale = getScaleIntervals(12/7); document.write(natural_scale + " \n"); // ==> 0, 2, 3, 5, 7, 9, 10, 12 var pentatonic_scale = getScaleIntervals(12/5); document.write(pentatonic_scale + " \n"); // ==> 0, 2, 5, 7, 10, 12 </script> 

Resulting intervals start with D (Re) at 0, so you have DEFGABCD This is Dorian mode

+7
javascript math music
source share
3 answers

Your question (as written) is ambiguous. If you mean "can your algorithm be used to generate natural scales?" (those that contain all natural notes, that is, notes that are neither sharp nor flat), then yes, but only one (if you do not take into account different rounding methods, in which case you get one natural scale for the rounding method ) and only the choice of cherry tonic. If you mean β€œdoes your algorithm in itself produce a result on a natural scale?”, Then the answer is no, because it does not generate scale by itself; It generates a mode.

Note: in this answer, all named modes (e.g. Ionian) refer to modern definitions.

In terms of halftones, your algorithm gives intervals (from tonic ) of 0,2,3,5,7, 9,10,12, which corresponds to a halftone sequence (i.e. steps of the scale) 2-1-2-2-2-1 -2 or Dorian mode . Note that the algorithm does not define tonic (the first note in scale), so it does not give you a specific scale , which is a sequence of steps, such as C-major or Dorian mode in D.

In terms of these tonic intervals , the Dorian regime contains the basic 2nd, minor 3rd, perfect 4th, perfect 5th, major 6th, minor 7th and perfect 8th. C major M2, M3, P4, P5, M6, M7, P8 (all basic or perfect intervals).

Creating Other Modes

Your choice of rounding function is arbitrary. If you always round ( ⌈i*12/7βŒ‰ ), you get the intervals 0,2,4,6,7,9,11,12 and the halftone sequence 2-2-2-1-2-2-2-1, which makes up Lydian mode . Rounding down ( ⌊i*12/7βŒ‹ ) gives you the intervals 0,1,3,5,6,8,10,12 and steps 1-2-2-1-2-2-2-2, which are Locrian mode . None of them is the interval or grayscale sequence for the natural scale in C (i.e., the Ionian regime in C or C), which is 0.2,4,5,7,9,11,12 and 2-2- 1 -2-2-2-2-1, respectively.

If you parse the algorithm to use a different rounding function for each term, and not for the same rounding function for everyone, you can generate other named modes (e.g. (_, ceil, ceil, floor, ceil, ceil, ceil, _) , where _ means "do not care"), ion will be generated), but you will also create many other modes that cannot lead to a natural scale. So you can generate a total of 2 n-1 where n is the number of tones (I cover n=7 or heptatonic ). The number of heptatonic modes is equal to the number of compositions 12 of length 7, which is 11 C 6 = 462, so this method will not generate all modes. If we define round r (x) = floor(x+r) , we can only generate diatonic modes (7 named modes or Heptatonia Prima that maximize the semitone steps) using this rounding function, limiting r to i/7 , where i ∈ [0, 7) βŠ‚ β„•. For example, Ionian roundTo 5/7 (i*12/7) for i ∈ [0, 7) (note: from circular to the nearest - roundTo 0.5 (x) ). With this last approach, we can generate modes that can generate all 7 natural scales.

Diatonic(n) = <roundTo n/7 (x*12/7) for x in ∈ [0, 7)>

where <...> indicates the tuple (i.e., the final sequence).

Generating Scales

Your algorithm generates only modes, but they can be used to generate scales. Depending on which note you choose to start (tonic), you will get different scales for the given mode. Dorian leads to an insignificant scale because it includes a minor third (the first two halftone steps in Dorian are 2-1, the sum of which is 3, secondary) and a perfect fifth (the sequence starts from 2-1-2-2, which gives 7 halftones over the tonic). Lydian gives you a big scale because it includes the main third (its halftone sequence starts with 2-2, which is 4,) and the perfect fifth (2-1-2-2). Locrian does not include the perfect fifth, so he is neither major nor junior.

Natural weight generation

To find out what natural scales your algorithm can generate, let ADLO(n, round, tonic) denote the scale obtained as a result of the generalized version of your algorithm, where n is the number of steps per octave, round is the rounding function, and tonic is the tonic for the scale . If none is specified, the result is a collection of all possible values ​​(thus, ADLO(7, nearest) - all scales in Dorian mode). The named mode and tonic will be used for the scale in this mode with this tonic (for example, Ionian('C') is C-major); a named mode without a tonic (for example, Ionian() ) will indicate a set of all scales in this mode. {} denotes a set and <> sequence.

     ADLO (7, nearest) = Dorian () = Diatonic (3)
       {
         <C, D, D #, F, G, A, A #, C>,
         <D, E, F, G, A, B, C, D>,
         <E, F #, G, A, B, C #, D, E>,
         <F, G, G #, A #, C, D, D #, F>,
         <G, A, A #, C, D, E, F, G>,
         <A, B, C, D, E, F #, G, A>,
         <B, C #, D, E, F #, G #, A, B>
       }
     ADLO (7, ceil) = Lydian () = Diatonic (6)
       {
         <C, D, E, F #, G, A, B, C>,
         <D, E, F #, G #, A, B, C #, D>,
         <E, F #, G #, A #, B, C #, D #, E>,
         <F, G, A, B, C, D, E, F>,
         <G, A, B, C #, D, E, F #, G>,
         <A, B, C #, D #, E, F #, G #, A>,
         <B, C #, D #, F, F #, G #, A #, B>
       }
     ADLO (7, floor) = Locrian () = Diatonic (0)
       {
         <C, C #, D #, F, F #, G #, A #, C>,
         <D, D #, F, G, G #, A #, C, D>,
         <E, F, G, A, A #, C, D, E>,
         <F, F #, G #, A #, B, C #, D #, F>,
         <G, G #, A #, C, C #, D #, F, G>,
         <A, A #, C, D, D #, F, G, A>,
         <B, C, D, E, F, G, A, B>
       }

Thus, we see that

       if you and pick
 * round to nearest D
 * round down B
 * round up F
 * ...
                      as the tonic, you get a natural scale.

Besides,

     ADLO (7, roundTo 5/7 (x)) = Ionian () = Diatonic (5)
     ADLO (7, roundTo 3/7 (x)) = Dorian () = Diatonic (3)
     ADLO (7, roundTo 1/7 (x)) = Phrygian () = Diatonic (1)
     ADLO (7, roundTo 6/7 (x)) = Lydian () = Diatonic (6)
     ADLO (7, roundTo 4/7 (x)) = Mixolydian () = Diatonic (4)
     ADLO (7, roundTo 2/7 (x)) = Aeolian () = Diatonic (2)
     ADLO (7, roundTo 0/7 (x)) = Locrian () = Diatonic (0)

What note to choose as a tonic can also be called a β€œwhite note” in the Wikipedia article on the modes in modern music .

Computational Correctness

The reason the code works to generate the mode is because the notes in the diatonic scale are as distributed among the halftones as possible, i*n/m , for i ∈ [0, m), is an even distribution of m things among n things. Round these values ​​and you will get the distribution that is the maximum possible among integers from 0 to n. Thus, your algorithm leads to diatonic mode. This is not a very important result; this is a fairly simple consequence of rounding.

+9
source share

I don’t know if the theory is correct on the blog page, but if for some crazy reason I put 18 notes in 12 semitones, the upper limit of tot will be 13; also the pentatonic scale will not include the last 12.

Programmatically, to translate material on a blog page, use

 while (tot <= 12) { 

The rest is good, but I don’t know why if(scale.length == 8) { needed.


To justify the theory of music, ask elsewhere.

+3
source share

From reading your article, it seems to me that you are seriously confusing minors with flat and large with sharp, respectively.

So, from β€œ2 rounded to the ceiling, minor note”, you conclude that the second note in the scale should be a flat version of the second white key on the piano, starting with D. That is, E β™­. Basically, you start with Dorian mode (i.e. all white keys starting with D), and then increase or decrease the keys depending on the result of your rounding.

However, it should be noted that the Dorian scale is already a scale; therefore, the most natural scale that you get from the beginning with Dorian will be the same Dorian scale. And you achieve this without any apartments or sharp objects (or small and large notes, as you call it).

The launch of this whole theory on the Dorian scale is already such a strong assumption that for this it will be necessary to diligently do this work in a reasonable way. And this hard work would ultimately lead to a real scale theory. And not the number you make after that.

When you write, you β€œbelieved that the midtones are between some notes where there is some kind of adjustment” - it really seems to me that this is still the case, otherwise you will not ignore them, evenly tempered scales. If you want to get even more, this scale should be your starting point:

 c – cβ™― – d – dβ™― – e – f – fβ™― – g – gβ™― – a – aβ™― – h 

(To avoid further confusion, you should drop your names and refer to them at 1, 2, 3, ... 12.)

Or in frequency fractions :

 1 – 2^(1/12) – 2^(2/12) – 2^(3/12) – … – 2^(11/12) – 2^(12/12) = 2 1 – 1.059 – 1.122 – 1.189 – … – 1.888 – 2 

You can make your game numbers at an equal pace and see what happens. Some theory regarding the definition of the main chords is performed by viewing the overtone series in musical instruments. In this series you will find several notes that naturally lead to some basic chords and a basic scale if you accept some compromises. One of the trade-offs is that what you find is actually not quite uniformly tempered ...

0
source share

All Articles