-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Output [Int: Pitch.Spelling] from spell() #166
Conversation
For now I can try wrapping |
@bwetherfield, good question. What is the reason not to return the full I think what I was thinking for this would be to return all of the data you would need to notationally represent the input I see the types kind of like this:
I could definitely hear the argument that this feels clumsy / crooked. At some point In this case, I could imagine defining this operation roughly as (where
Otherwise, the user would have to bind it back themselves. Could you imagine a scenario where a user would not want the full bundle of info? Are your concerns re: |
So, in this commit the octave term in |
Could |
Yeah. I was thinking this would always be used to spell real-wold
So you are thinking that we should really define the
Where each of the left column elements would map to right column elements? I am starting to catch your drift, I think. And I like it. However, could this be a generalization we make after we make some more concrete progress? |
See #168 (proposal to add |
Yeah - this idea can definitely wait! Using octaves is good as a workaround for now! |
I think we should keep the current design as is for now, as it is in some sense the most information-preserving version. In the self-pivot test, I would perhaps change the input Perhaps this is testing too much at once, but perhaps the self-pivot test could be implemented as: for letterName in LetterName.allCases {
let octave = Array(0..<11).randomElement()!
let pitchSpeller = PitchSpeller(pitches: [0: Pitch(letterName.pitchClass + octave)], parsimonyPivot: Pitch.Spelling(letterName))
let result = pitchSpeller.spell()
let expected: [Int: SpelledPitch] = [0: SpelledPitch(Pitch.Spelling(letterName), octave)]
XCTAssertEqual(result, expected)
} |
(Off-topic) It would probably be nice to create a composable random generator for |
I'm gonna close this for now. But let's keep #168 on deck! |
This is how code and testing would look if
spell()
outputPitch.Spelling
rather thanSpelledPitch
values. What do we think, @jsbean?Could octave information be something we inject?
I think it could be nice if
spell()
had a generic parameter, that bothPitch.Spelling
andSpelledPitch
conformed to, and hence could potentially spit out one or the other...?