Deciding whether to use sharp or flat
-
- KVRist
- 74 posts since 9 Feb, 2007
Hi everyone,
I'm planning to write a computer program that translates midi into ABC (a music notation scheme) and I'm wondering if there are some kind of rules that dictates when to use a sharp and when to use a flat, eg. when to notate a C# instead of a Db.
For example in Dm I would use C# rather than Db to describe the note between C and D, but I'm not sure why. So are there any general rules?
I would be very grateful for some help in this area.
/Nils
I'm planning to write a computer program that translates midi into ABC (a music notation scheme) and I'm wondering if there are some kind of rules that dictates when to use a sharp and when to use a flat, eg. when to notate a C# instead of a Db.
For example in Dm I would use C# rather than Db to describe the note between C and D, but I'm not sure why. So are there any general rules?
I would be very grateful for some help in this area.
/Nils
-
- KVRist
- 407 posts since 23 Oct, 2006 from Northern New England
Assuming you're talking about diatonic scales, the general rules are (1) that you want to use only one letter per note of the scale (thus, C# instead of Db in the key of Dm (I guess that'd be either harmonic or melodic minor), and in conjunction with that (2) use the accidentals that appear in the key signature you're in (thus, in D minor, you'd use Bb rather than A#).
As for notating chromatic notes, however, I'm not sure there's a widely-accepted rule. If I were doing it, I would generally avoid altering the the root so as to avoid confusing the reader about what the key is. Thus, if I were notating a chromatic line going from C to D, I'd use C - C# - D rather than C - Db - D.
But that may just be me. Other than that, I generally try to notate chromatic notes in such a way to minimize the number of accidentals. Thus, for example (to take some fairly random notes):
C - Eb - F - D - G
would be preferred over
C - D# - F - D(nat) - G
But again, that's all just my own practice.
As for notating chromatic notes, however, I'm not sure there's a widely-accepted rule. If I were doing it, I would generally avoid altering the the root so as to avoid confusing the reader about what the key is. Thus, if I were notating a chromatic line going from C to D, I'd use C - C# - D rather than C - Db - D.
But that may just be me. Other than that, I generally try to notate chromatic notes in such a way to minimize the number of accidentals. Thus, for example (to take some fairly random notes):
C - Eb - F - D - G
would be preferred over
C - D# - F - D(nat) - G
But again, that's all just my own practice.
"Enough Spyro Gyra and you're hoping you'll be killed in a knife fight."
-- Chris in the morning
-- Chris in the morning
-
- KVRian
- 1116 posts since 18 Jan, 2004 from Los Angeles, California, USA
Hi Nils,kotori wrote:Hi everyone,
I'm planning to write a computer program that translates midi into ABC (a music notation scheme) and I'm wondering if there are some kind of rules that dictates when to use a sharp and when to use a flat, eg. when to notate a C# instead of a Db.
For example in Dm I would use C# rather than Db to describe the note between C and D, but I'm not sure why. So are there any general rules?
I would be very grateful for some help in this area.
/Nils
I have a B.A. in Music Theory and Composition and I am sorry to say that one of the reasons that this hasn't been done before is that it is a contextual issue, especially if a piece does not have a key.
In many modern pieces, the accidental (whether it's a flat or a sharp) is primarily a function of voice leading. In other words, if the passage leads to the note above, then the accidental is a sharp. If it leads to the note below, then it's a flat.
In more traditional music, it is a function of the key or the key being modulated too. For instance, if I am in the key of C Major, then when I transition to the key of G Major, I start to use the F Sharp accidental since that's the leading tone for G Major.
It gets more complicated though: in traditional compositions "borrowed chords" are frequently employed. In the case of the key of C Major, for instance, chords could be borrowed from the parallel minor of C Minor without modulating to a new key. In cases where you borrow from the parallel minor, the standard use of the accidental is to "flatten" the notes to make them fit the scale. So the B Natural would be made into a B Flat if you were borrowing from the parallel natural minor. And let's not even get started on the topic of enharmonic re-spellings of chords.
In summary: difficult to implement in a standardized fashion because of the complexity of the variables involved, but you might be able to come up with a "guesstimate", or semi-logical default based upon the key.
One common software practices is to define it based upon consistency with the accidentals in the key. In other words, using sharps in a key defined by sharps (such as G Major) or flats in a key defined by flats (such as F Major) but using a natural, sharp or flat instead of what matches with the key signature where a double sharp or double flat would be required. This is of course a highly imperfect compromise as it tends to incorrectly translate chords borrowed from the parallel minor...
In other words: pretty much no matter how you slice it, the notation tends to need to be edited again after conversion from MIDI. If MIDI is ever expanded to differentiate between Eb and D#, then it may become more practical to deal with issues of notation.
Last edited by Per Lichtman on Sat Jun 14, 2008 1:26 am, edited 1 time in total.
-
- KVRist
- 407 posts since 23 Oct, 2006 from Northern New England
Per Lichtman makes excellent points that may make your job pretty hard; however, you mention ABC notation which in my experience usually means basic, diatonic stuff, which may simplify things somewhat. (Although it must be said I'm most familiar with ABC notation when it comes to celtic traditional music which is almost always strictly diatonic and in a single key. I'm not sure if it is used for music that is more "complex", tonally speaking.)
As far as I know, standard midi files do not contain any indication of key, so to code your translation software, it seems to me you need a good algorithm, and even then it would have to rely on an input file that was pretty strictly diatonic. But if you're dealing with strictly diatonic midi files in a single key, I think this could work.
As far as I know, standard midi files do not contain any indication of key, so to code your translation software, it seems to me you need a good algorithm, and even then it would have to rely on an input file that was pretty strictly diatonic. But if you're dealing with strictly diatonic midi files in a single key, I think this could work.
"Enough Spyro Gyra and you're hoping you'll be killed in a knife fight."
-- Chris in the morning
-- Chris in the morning
-
- KVRian
- 1116 posts since 18 Jan, 2004 from Los Angeles, California, USA
I started composing my post before this one went up and didn't see it until just now.tboulette wrote:Assuming you're talking about diatonic scales, the general rules are (1) that you want to use only one letter per note of the scale (thus, C# instead of Db in the key of Dm (I guess that'd be either harmonic or melodic minor), and in conjunction with that (2) use the accidentals that appear in the key signature you're in (thus, in D minor, you'd use Bb rather than A#).
As for notating chromatic notes, however, I'm not sure there's a widely-accepted rule. If I were doing it, I would generally avoid altering the the root so as to avoid confusing the reader about what the key is. Thus, if I were notating a chromatic line going from C to D, I'd use C - C# - D rather than C - Db - D.
But that may just be me. Other than that, I generally try to notate chromatic notes in such a way to minimize the number of accidentals. Thus, for example (to take some fairly random notes):
C - Eb - F - D - G
would be preferred over
C - D# - F - D(nat) - G
But again, that's all just my own practice.
Last edited by Per Lichtman on Sun May 18, 2008 4:17 pm, edited 1 time in total.
-
- KVRian
- 1116 posts since 18 Jan, 2004 from Los Angeles, California, USA
Well said: I should work on keeping things simple.tboulette wrote:Per Lichtman makes excellent points that may make your job pretty hard; however, you mention ABC notation which in my experience usually means basic, diatonic stuff, which may simplify things somewhat. (Although it must be said I'm most familiar with ABC notation when it comes to celtic traditional music which is almost always strictly diatonic and in a single key. I'm not sure if it is used for music that is more "complex", tonally speaking.)
As far as I know, standard midi files do not contain any indication of key, so to code your translation software, it seems to me you need a good algorithm, and even then it would have to rely on an input file that was pretty strictly diatonic. But if you're dealing with strictly diatonic midi files in a single key, I think this could work.
-
- KVRAF
- 6519 posts since 13 Mar, 2002 from UK
Code: Select all
C D E F G A B
C# D# E# F# G# A# B#
Db Eb F Gb Ab Bb C
D E F# G A B C#
D# E# F## G# A# B# C##
Eb F G Ab Bb C D
E F# G# A B C# D#
F G A Bb C D E
F# G# A# B C# D# E#
Gb Ab Bb Cb Db Eb F
G A B C D E F#
G# A# B# C# D# E# F##
Ab Bb C Db Eb F G
A B C# D E F# G#
A# B# C# D# E# F## G##
Bb C D Eb F G A
B C# D# E F# G# A#-
- KVRer
- 5 posts since 13 Jun, 2008 from Southern California
