Currently octaveless notes/pitches are first-class objects. You can create an F# and not specify the octave (.octave = None) -- it matches all F#s for certain searches. Great for music-theoretical representation. It throws errors on F# >= F? because who knows which F# and which F.
It's a pain for music notation layout and a frequent source of bugs -- where people expect .octave to be an int.
(You've probably forgotten about .implicitOctave which returns .octave if it's an int, and defaults.pitchOctave otherwise, which I don't think anyone has ever changed from 4 in the history of music21...)
Proposal
.octave becomes an int. Always. If not specified at object creation time it defaults to 4.
.octaveIsImplicit is a new bool that stores whether the octave was not specified. The few places that are truly None-octave aware can consult .octaveIsImplicit first. Is True at object creation but becomes False the first time octave is set.
.implicitOctave becomes a perfect synonym for .octave. It will become deprecated no earlier than v.12 (probably v.13) and removed a version or two later.
Thoughts?
Currently octaveless notes/pitches are first-class objects. You can create an F# and not specify the octave (
.octave = None) -- it matches all F#s for certain searches. Great for music-theoretical representation. It throws errors on F# >= F? because who knows which F# and which F.It's a pain for music notation layout and a frequent source of bugs -- where people expect .octave to be an int.
(You've probably forgotten about
.implicitOctavewhich returns.octaveif it's an int, anddefaults.pitchOctaveotherwise, which I don't think anyone has ever changed from 4 in the history of music21...)Proposal
.octavebecomes an int. Always. If not specified at object creation time it defaults to4..octaveIsImplicitis a new bool that stores whether the octave was not specified. The few places that are truly None-octave aware can consult.octaveIsImplicitfirst. Is True at object creation but becomes False the first time octave is set..implicitOctavebecomes a perfect synonym for.octave. It will become deprecated no earlier than v.12 (probably v.13) and removed a version or two later.Thoughts?