[Pitch] Let Pitch store center pitch and scale-factor (fractional) / interval
bwetherfield opened this issue · comments
Ben Wetherfield commented
@jsbean, I wonder if you have thoughts on this, or how to put it into practice.
At its most basic, I am imagining something like this:
public struct Pitch: NoteNumberRepresentable {
// MARK: - Instance Properties
/// The `NoteNumber` representation of this `Pitch`.
public let value: NoteNumber
/// The `scaleFactor` by which this pitch is scaled
public let scaleFactor: Fraction
// MARK: - Initializers
/// Creates a `Pitch` with the given `NoteNumber` value.
public init(_ value: NoteNumber, _ scaleFactor: Fraction = Fraction.one) {
self.value = value
self.scaleFactor = scaleFactor
}
}
Alternatively, the Fraction
could be an interval - the rational case, is the same as using some just interval... I'm not too sure how the interval ecosystem works !
Ben Wetherfield commented
Use cases are e.g. instantiating two pitches that are a just perfect pitch apart, with one equal-tempered and the other not...
Ben Wetherfield commented
discussed offline