Skip to content
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

Interval constructor from just a number of semitones #475

Closed
plammens opened this issue Apr 2, 2024 · 0 comments · Fixed by #476
Closed

Interval constructor from just a number of semitones #475

plammens opened this issue Apr 2, 2024 · 0 comments · Fixed by #476
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@plammens
Copy link
Collaborator

plammens commented Apr 2, 2024

I propose adding a constructor to Interval that just takes an integer number of semitones representing the distance.

Use cases

The Size is, after all, just a human label, from the point of view of physical information there isn't much difference between a "fourth" and an "augmented third", similar to how there is no physical difference between an E# and an F, they are just human labels that allow us to work more easily with these things.
So I can imagine a simple program that just takes some MIDI input and transposes it by a variable number of semitones, and it doesn't really care about the denomination of the new notes.
In such use cases it would be useful to have a "machine friendly" Interval constructor that just takes an integer distance in semitones.

Proposed implementation

Rename:

  • fromQualitySemitones -> fromSizeAndQualitySemitones
  • fromSemitones -> fromSizeAndSemitones

Add:

  • fromSemitones(int)

The size is inferred as the nearest to the given distance.

See the attached draft PR for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants