enharmonic
- pitchtools.enharmonic(n, maxcents=50, diatonic_enharmonics=False)[source]
Returns the enharmonic variant of notename
For simplicity, we considere a possible enharmonic variant a note with the same sounding pitch and an alteration smaller than 150 cents from the note without any alteration (no double sharps or flats). If diatonic_enharmonics is False, enharmonics like Fb or E# are not returned.
- Parameters:
notename (str) – the note to find an enharmonic variant to
maxcents – the returned enharmonic has a cents deviation lower than this. For example, “4A+30” has no enharmonic and is returned as is, since the only possible enharmonic would be “4Bb-70”, but a cents deviation of 70 is not allowed
- Return type:
str- Returns:
either the enharmonic variant or the note itself
Note
Enharmonic
Has Enharmonic?
4#
4Db
✓
4C+
4Db-
✓
4E
4E
–
4E#
4F
✓
4A+10
4A+10
–
4E-25
4E-25
–
4E-
4D#+
✓
See also