0

Pondering about a yet-to-implement feature in a DIY software tool, also to be yet well-documented for other computer musicians who might be interested in the future.

The tool is an interpreter or converter from code text to audio file complying to the Unix philosophy (no builtin GUI, like ABC or lilypond for MIDI or sheet music), loosely being inspired by MIDI conventions and restrictions, but covering also the internals of sound to the tiniest detail as well. The question is not a technical programing issue, it rather relates to the language the tool "understands".

I have enabled, but not forced, me "the user" to declare the root note and mode for all voices playing within a region of ticks in a (couple of) measure(s).

However, what every voice plays is presently indicated only by "A0" or 1 to "C8" or 88, and if a scale has been explicitly selected any key of an off-scale pitch class would be handled as an error. These absolute indications are not always appropriate. You members of music stack exchange seem to like to indicate steps in a given scale, but relative to it, by using ^n. This grade indication does not include the octave, though, so (key) step or grade is rather inappropriate and prone to misunderstandings and ambiguities.

Precisely I want to denote 1 to 88 not strictly numbering the keys of a keyboard but the steps of the currently selected key/mode, with "chromatic" just being the initially assumed default equal to omittable explicitly "0chr" = chromatic scale with root C. By selecting "+3hm" all numbered indications are assumed to accord to D#/Eb harmonic minor, with 1 being the leftmost in-scale key "Bb0" up to 50 = "Cb8". Saving a motif indicated with numbered pitches under a name, it can be reproduced by using white and/or black keys in the same region of the piano keyboard, depending on the scale.

So, does established music theory provide a term unambiguously denoting a specific key of the piano keyboard in a subset of keys covered by a "soon to tell" (musical) key/mode/scale? If there is none, would anybody question me coining "in-scale key index (number)" with a righteous reason?

I am not quite optimistic I managed to describe my issue, so I consider rather a composed ^{grade}@{octave} indication but that would rise other issues related to where an octave starts, and octave 0 (sometimes indicated -1) on the piano keyboard can only cover ^7 and maybe ^6. Some expensive grands also provide "^1@0" and onward, I know, but the numbers I prefer can be fingered up and found on the standard piano keyboard people are used to.

As you requested, a use case:

I want a motif referenced by name to "adapt itself" to the scale of a measure region it is used in. Say, from inclusively the fourth beat of measure n to the end of measure n+1 all notes – except those with an off-scale flag – of all voices belong to the scale Eb harmonic minor. I assign a name to the motif for later use, lets name it "myost" (my ostinato). When I use it later or when I change the scale that "reigns" the first occurrence of the motif, which may be its naming definition together, it cannot normaly adapt to the new scale.

Because it normally has got a pitch like "C4" as its anchor, hence would likely raise an error because the pitches of all relative indications of dependent notes are calculated to it without consideration of the context scale, but checked afterwards for accordance. "C4", recognized from its beginning with a non-number character, is a label of a specific key, namely the white one in the keyboard center. The label is read from a file, mapped to a static key number, the file could also provide aliases like c' for those who prefer german note names.

I deem an ostinato complies to the current harmony context but it perhaps does not like to follow big changes, it does not jump, it may be lazy. If it consists of the notes C, E, and G and I want it to occur later when D-major "reigns", it would not change to D, F# and A, but it would (in my music) just augment C to C# but keeping E and G as they are in D major as well. Instead of big changes of its root note, it risks changing harmonic function.

I ask you for a term musicians can understand. Current thought while I am editing this post is fuzzy notes. While normal notes are an error when a scale is selected to reign a measure/subdivisible region for all voices and they happen to be off, the user (me) needs to decide:

  • are I misreading notes on a sheet? Do I need to re-consider the identified harmony context at a position?
  • (appending a flag like !) Do I need to force the note to the pitch because I have checked and listened, and trusted my ear and judged it alright i.e. declare the pitch validly off-scale
  • (appending a flag like ?) flag the note fuzzy, me lazy: Instead of raising an error, let the software infer from the current scale context the closest neighbour that belongs into the scale declared for a region beyond the scope of a "voice's part" of the measure for it is common to all voices playing. Ignore harmony function, i.e. risk that tonic regions are rather perceived dominant. The accepted answer proposed to allow by that indication context-sensitive chromatic alteration to a specific note or group of notes.
11
  • I can't answer yet because it's not clear enough to me what your needs are. (Maybe they're not entirely clear to you either?) You've mentioned several ways of naming notes—letter names (i.e. "pitch class"), scientific pitch notation, scale degree, and an integer corresponding to keys of a keyboard. Each of these is useful for certain purposes and not for others. By the time you "compile" the audio, all you need to care about is the exact frequency, so scientific pitch notation (or even Hz) would do. But... Apr 3 at 14:25
  • ... But it seems you want to let the user input their ideas in another form, and that's what's not clear. Some of these methods are objective (scientific pitch notation), but others are typically tools of analysis (scale degree). Numbering the keyboard is problematic, since keyboards vary. The grand piano has become standardized, but since it's not an input or output device, it's just another abstract framework. Perhaps ask yourself what need you're trying to meet for the user, and then edit to make your question clearer. Apr 3 at 14:28
  • It is a matter of different ways of addressing notes. I found out that addressing keys by their names like "C2" is very neat if you have sheets of music in front of you for transcription. This adressing method is especially useful to convey the meaning of repositioning the thought hand in another keyboard region Adressing notes like this is tedious if you compose. The user should be able to change the harmony (key, scale, whatever) of a region in playing time by changes at one position in the text file and all voices would obey and play tones shifted by half tones as appropriate. Apr 3 at 15:50
  • So the goal is to easily enable transposition ("change this passage from C major to D major" = "raise all pitches by two semitones") and perhaps also changes of mode ("change this from C major to C melodic minor" = "flat all the Es, and only some of the As and Bs, according to their context")? This still seems like scale degree should suffice. Note, existing notation software titles can already do this (though I'm not sure they're that nuanced about the distinction between melodic and natural minor). I'm guessing they represent the notes internally with a combination of scale degree and octave Apr 3 at 16:13
  • "if a scale has been explicitly selected any key of an off-scale pitch class would be handled as an error" - this suggests an off scale pitch class would be handled as an error, which would be a major usability flaw for whatever this software is supposed to do. Hardly any music at all would not generate a huge number of errors with such a system - basically only first year easy music for children would be error free. Apr 3 at 17:35

4 Answers 4

1

If you want a term that musicians understand, then I would use "chromatic alteration." And "alteration" might hold the key to a better understanding of what's going on. Instead of looking at notes that are outside the key and treating them as inexplicable mysteries, we can ask questions about how they came to be, and what relationship they have to the notes of the key.

For instance, if we are in the key of C major and encounter an F sharp—then why is it an F sharp and not a G flat? There could be good reasons to choose one or the other. For instance, if we play a C major chord, C E G, and then change the top note to be a semitone lower, we use G flat to show how the chord has been compressed. But if we have a melody that goes "G F# G" we use F# to show that it is the lower neighbor of G and has been raised to hug it more tightly.

So I would not treat these notes as "errors," subject to "validation." Rather I would model them as alterations of the diatonic notes. Then, when you transpose, they could be altered correctly. For instance, if F sharp is just "a raised fourth scale degree," then if I transpose to D flat major, it's a natural instead of a sharp, G natural. Or if I change the mode from C major to C minor, it remains an F sharp because the fourth degree is still F.

3
  • +1 as for the off-scale error thing. Validation and error handling is helpful given my ears are not musically educated, but I was nevertheless eager to realize classical literature with pure programmers' means and this includes automatic double-checking. A programmer is toughly occupied with educating his ears to pianist level, the way to theoretical understandings are easier. Apr 5 at 7:19
  • @musiklanger There are many musical contexts, and some do have very strict rules. You may want to learn about "species counterpoint," which has various rule sets, which could apply these rules as validation and view certain notes as errors. In general, you might enjoy an introductory music theory course, which would typically start with this counterpoint and progress to more complex practices. Apr 5 at 13:54
  • plus, whatever the rules, what their strictness and scope and reason (from "some big share of music of the past and our part of the world is characterized by them according to that expert or another" to "I just like my music to be like this") it is my pleasure to design the tool so that I, its user, can decide and re-consider any time to have them checked if not by my ears then by some algorithm and when the latter has detected a problem, how it is handled. We programmers can choose from standardized error levels from "fatal" over "warning" to "debugging info". Apr 5 at 16:31
3

A subset of notes is a 'scale'. The notes within that scale are 'diatonic' to that scale.

But, beware. Scales, modes etc. are a framework but not a restriction. Music departs from them ALL the time, without implying a change of key or mode.

2
  • Thanks for your answer, which however is one to a related question. To realise off-scale tones in a "diatonic-scaled" region, without an error being raised, I will need an indication of "let this pitch be off scale". Apr 3 at 16:51
  • 2
    @musiklanger There will be so many "off scale" pitches in much music that having it be a separate flagged category isn’t really worth it. Why are you trying to restrict pitch classes to a diatonic scale in the first place? Apr 3 at 17:37
3

EDIT for use case:

When I use it later or when I change the scale that "reigns" the first occurrence of the motif, which may be its naming definition together, it cannot normaly adapt to the new scale....Because it normally has got a pitch like "C4" as its anchor, hence would likely raise an error because the pitches of all relative indications of dependent notes are calculated to it without consideration of the context scale...

I sense you're struggling with some of the musical terminology. I guess that is the reason for your question.

...the scale that "reigns"...

In normal music analysis you would simply call this "the key". You should think of it in terms of key signatures, not scales.

...likely raise an error because the pitches of...without consideration of the context scale...

The word "error" really should not be used this way. It is not an error to have a pitch that doesn't belong to a key signature.

If there is a pitch outside of the key signature, and the key does not change, those are simply chromatic pitches.

If the pitch outside of the key signature results in a change of key, that is called a modulation, or for brief passages, tonicization.

If it consists of the notes C, E, and G and I want it to occur later when D-major "reigns", it would not change to D, F# and A...

That particular type of can be called a transposition. In that particular example all pitches are transposed up two half steps.

...but it would (in my music) just augment C to C# but keeping E and G as they are in D major as well. Instead of big changes of its root note, it risks changing harmonic function.

The procedures which could result in that change could be called either modulation or mode change.

Getting back to the part of your question about piano key numbering. I think it best to handle the data about pitch first and then map those pitch data to piano/MIDI keys as a final step. For example, motif C4 E4 G4, transpose it to D4 F#4 A4, to play the transposed motif in MIDI, numbers 62 66 69. If you do it the other way around, you would start with a number, like 66, and then need to figure out whether the pitch is spelled F# or Gb. That's clumsy and contrary to how pitch data is managed in notated music.

There are so many ways you could implement these kinds of musical procedures. However you do that, however you decide to encode the musical data, I see no reason why your data and programming methods cannot be given standard music names like pitch-letter, accidental, octave-number, transpose, modulate, change-mode, etc.


My original reply.

So, does established music theory provide a term unambiguously denoting a specific key of the piano keyboard...

Yes, but maybe it isn't quite "music theory". MIDI provides keyboard key numbering. https://en.wikipedia.org/wiki/Piano_key_frequencies. For example, the "middle C" key in MIDI is numbered 60.

...in a subset of keys covered by a given (musical) key/mode/scale?

I'm not sure I understand your wording, but you could have, for example a C major scale, in Scientific Pitch Name that is C4 D4 E4 F4 G4 A4 B4 C5, and the MIDI numbering would be 60 61 62 63 64 65 66 67.

What is not clear in your wording is whether you want the numbering, for example, the C4, to be a different number in different scales. C4 is common to C major, F major, etc. Does "unambiguous" mean each of those C4 to specific key relationships would have unique, unambiguous numbers? For example C4 in C major is numbered 60.1 while C4 in F major is 60.2, etc.

If there is none, would anybody question me coining "in-scale key index (number)" with a righteous reason?

There is none that would number like my 60.1, 60.2, example. None that I've ever seen.

The reason that there isn't any such numbering is because in tonal music, the music of the major/minor key system, is mostly concerned about associating scale degrees to the locally active key in a composition.

Before elaborating on that, let's understand that music theory can designate scale degrees by numerals 1-7, the prefix or superscript ^, and sharp/flat prefixes. For example, ^1 or ^♭7 etc. Notice that system makes no reference to piano keys or to octaves, because for harmonic analysis those aspects are not needed. The only additional element needed is a key signature. So you might write something like Cm:^♮7 to show a raised leading tone in C minor.

The relative relationship of scale degrees is the main harmonic concern, so an absolute numbering for all the pitches/piano keys, especially one that separately indexes for each key, isn't needed.

I'm not sure what your trying to do with your software, but it's hard for me to imagine you can't write an application about standard scales that can't be done using existing numbering/naming systems like pitch letters, MIDI, scientific pitch notation, scale degree number, and interval class and sizes.

I've written some scale and chord generators applications using those existing systems. The will work. Just keep track of tonic (or chord root) along with the data that enumerates the scale members. How to handle the details depends on the specific functions you expect to perform.

One final caveat is to watch out for inappropriately thinking scale degree data can be properly represented with only something like MIDI or piano key numbering. MIDI key 60 is middle C, but the number 60 alone is note able to account for enharmonic equivalents like B♯. If, for example, your given key was C♯ minor, and you want to know what the leading tone is, 60 is not the answer. You need pitch letters with appropriate sharp/flat spellings to indicate the properly named pitch.

3
  • Thanks, I upvoted your answer not because it provides a solution but it outlines what I already have implemented, the base onto which to integrate the feature under conception. I hopefully have made my issue clearer with my last edit: Frankly, I want (to use sometimes, not always) the possibility to explicitly leave the software the choice among a key and its left and right semi-tone neighbours depending on the scale declared as the harmonic restriction context. Implementation is my affairs, I ask you for the right term to explain it. Apr 4 at 17:18
  • C4 D4 E4 F4 G4 A4 B4 C5 is 60 62 64 65 67 69 71 72. (C4 C#4 D4 D#4 E4 F4 F#4 G4 is 60 61 62 63 64 65 66 67.)
    – Bavi_H
    Apr 4 at 19:26
  • By error I do not mean a mistake in terms of application of some prescribing red book of music theory. It may be rather that I misread notes from sheet or did not identify harmonic context (scale, key) alright. Apr 5 at 7:38
2

I tried my best to understand your question, but as others have noted it's not immediately clear what you want. One way of notating things would be to first create the mapping like this, which represents "real" notes:

note mapping

With this you can then define structures for scales (which we can call interval collections) where each number represents a shift (modulo 12) with respect to the root note measured in semi-tones. (These are NOT real notes, just semitone distances)

+------------------+----------------+
|       Major      | 0 2 4 5 7 9 11 |
+------------------+----------------+
|       Minor      | 0 2 3 5 7 8 10 |
+------------------+----------------+
|  Harmonic Minor  | 0 2 3 5 7 8 11 |
+------------------+----------------+
|   Melodic Minor  | 0 2 3 5 7 9 11 |
+------------------+----------------+
| Whole Tone Scale |  0 2 4 6 8 10  |
+------------------+----------------+
|  Acoustic Scale  | 0 2 4 6 7 9 10 |
+------------------+----------------+

Then for example you can specify the notes by specifying a root note, and an interval collection eg:

(3*, [0, 2, 3, 5, 7, 8, 11])

(we can denote this as a "rooted interval collection")

Under this system (and previous example) we can specify notes in the scale by simply stating 8, with the understanding that eventually if we want to produce a sound we will have to do 3* + 8 = 11* which can then be used to produce a frequency later on in the program.

Under this notation we can at most specify 12 notes, so we can also extend this notation to represent shifts by octaves:

8' : represents the note 3* + 8 + (1) * 12 = 23* 8'': represents the note 3* + 8 + (2) * 12 = 35*

8,,,; represents the note 3* - 8 * (3) * 12

With all this in place we can then specify the arpeggiation of an F major triad ending an octave above in the rooted interval collection (5*, [0, 2, 4, 5, 7, 9, 11]) using 0 - 4 - 7 - 11 - 0' (or however you'd like to delimit your intervals)

Using this system you can easily verify if something is within your current interval collection (r*, I) simply by getting a number and checking if it is a value in I, at the same time the notation doesn't restrict you from writing such a number either.

1
  • My comment to Michael Curtis' answer applies to yours as well. All this and more (n-TET, tuning systems, scale and chord intervals etc., off-topic here though) is implemented, fundamental to which I consider the feature in question worth adding. From the bottom to the top, from the floating-point numeric frequency in Hz to the component to a chord like, say, C4mmaj7+1k. We are dealing with several layers of abstraction linked indirectly by configurable mapping and relation "tissues" that calculate things on-demand. Apr 4 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.