Your question (as written) is ambiguous. If you mean "can your algorithm be used to generate natural scales?" (those containing all natural notes, i.e. notes that are neither sharp nor flat), then yes, but only one (unless you allow for different rounding methods, in which case you get one natural scale per rounding method) and only by cherry picking a tonic. If you mean "does your algorithm, by itself, result in a natural scale?", then the answer is no because it does not, by itself, generate a scale; it generates a mode.
Note: in this answer, all named modes (e.g. Ionian) refer to the modern definitions.
In terms of semitones, your algorithm results in intervals (from the tonic) of 0,2,3,5,7,9,10,12, which corresponds to a semitone sequence (i.e. scale steps) of 2-1-2-2-2-1-2, or Dorian mode. Note that the algorithm doesn't determine the tonic (the first note in a scale), so it doesn't give you a specific scale, which is a sequence of pitches, such as C-major or Dorian mode in D.
In terms of the named intervals from the tonic, the Dorian mode contains the major 2nd, minor 3rd, perfect 4th, perfect 5th, major 6th, minor 7th, and perfect 8th. C major is M2, M3, P4, P5, M6, M7, P8 (all major or perfect intervals).
Generating Other Modes
Your choice of rounding function is arbitrary. If you always round up (⌈i*12/7⌉
), you get the intervals 0,2,4,6,7,9,11,12 and semitone sequence 2-2-2-1-2-2-1, which is Lydian mode. Rounding down (⌊i*12/7⌋
) gets you intervals 0,1,3,5,6,8,10,12 and steps 1-2-2-1-2-2-2, which is Locrian mode. None of these are the intervals or semitone sequence for the natural scale in C (i.e. Ionian mode in C, or C major), which is 0,2,4,5,7,9,11,12 and 2-2-1-2-2-2-1, respectively.
If you expand the algorithm to use a different rounding function for each term rather than the same rounding function for all, you can generate the other named modes (e.g. (_, ceil, ceil, floor, ceil, ceil, ceil, _)
, where _
means "don't care", will generate Ionian), but you will also generate many other modes that can't result in a natural scale. You can generate a total of 2n-1 modes this way, where n
is the number of tones (I'm covering n=7
, or heptatonic modes). The number of heptatonic modes equals the number of compositions of 12 of length 7, which is 11C6=462, so this method won't generate all modes. If we define roundr(x) = floor(x+r)
, we can generate only the diatonic modes (the 7 named modes, or Heptatonia Prima, which maximally separate the semitone steps) using this rounding function by limiting r
to i/7
, where i ∈ [0, 7) ⊂ ℕ. For example, Ionian is roundTo5/7(i*12/7)
for i ∈ [0, 7) (note: round-to-nearest is roundTo0.5(x)
). With this last approach, we can generate modes that can generate all 7 natural scales.
Diatonic(n) = <roundTon/7(x*12/7) for x in ∈ [0, 7)>
where <...>
indicates a tuple (i.e. a finite sequence).
Generating Scales
Your algorithm only generates modes, but those can be used to generate scales. Depending on which note you pick to start on (the tonic), you'll get different scales for a given mode. Dorian results in a minor scale because it includes the minor third (the first two semitone steps in Dorian are 2-1, which sum to 3, the minor third) and perfect fifth (the sequence starts with 2-1-2-2, giving 7 semitones above the tonic). Lydian gives you a major scale because it includes the major third (it's semitone sequence starts with 2-2, which sums to 4, the major third) and perfect fifth (2-1-2-2). Locrian doesn't include the perfect fifth, so it's neither major nor minor.
Generating Natural Scales
To see which natural scales your algorithm can generate, let ADLO(n, round, tonic)
stand for the scale resulting from the generalized version of your algorithm, where n
is the number of pitches per octave, round
is the rounding function and tonic
is the tonic for a scale. If any is unspecified, the result is a collection of all possible values (thus ADLO(7, nearest)
is all scales in Dorian mode). A named mode and tonic will be used for the scale in that mode with that tonic (e.g. Ionian('C')
is C-major); a named mode with no tonic (e.g. Ionian()
) will stand for the set of all scales in that mode. {}
denotes a set, and <>
a 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.
Also,
ADLO(7, roundTo5/7(x)) = Ionian() = Diatonic(5)
ADLO(7, roundTo3/7(x)) = Dorian() = Diatonic(3)
ADLO(7, roundTo1/7(x)) = Phrygian() = Diatonic(1)
ADLO(7, roundTo5/7(x)) = Lydian() = Diatonic(6)
ADLO(7, roundTo4/7(x)) = Mixolydian() = Diatonic(4)
ADLO(7, roundTo2/7(x)) = Aeolian() = Diatonic(2)
ADLO(7, roundTo0/7(x)) = Locrian() = Diatonic(0)
Which note to pick as the tonic is also given as the "white note" in the Wikipedia article on modes in modern music.
Computational Correctness
The reason the code works to generate a mode is that the notes in a diatonic scale are as evenly distributed among the semitones as is possible. i*n/m
, for i ∈ [0, m), is an even distribution of m things among n things. Round those values and you get a distribution that's as even as possible among integers from 0 through n. Thus your algorithm results a diatonic mode. This isn't all that significant a result; it's a rather simple consequence of rounding.