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

Implement constant structure checkers #17

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Conversation

frostburn
Copy link
Member

One for equal temperaments and one with a margin of equivalence.

@frostburn frostburn force-pushed the constant-structure branch from db85648 to d80bd3c Compare April 5, 2024 12:15
src/index.ts Outdated
* @param steps Musical intervals measured in steps not including the implicit 0 at the start, but including the interval of repetition at the end.
* @returns `true` if the scale has constant structure `false` otherwise.
*/
export function hasConstantStructure(steps: number[]) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be more useful if it returned the counter-example instead.

@frostburn frostburn force-pushed the constant-structure branch from d80bd3c to 1bf22f0 Compare April 5, 2024 17:08
@frostburn
Copy link
Member Author

Preliminary benchmarks indicate that pre-checking for CS in 5407372813edo is around 8 times faster than the exact search.

One for equal temperaments producing a counter-example and one with a margin of equivalence.
@frostburn frostburn force-pushed the constant-structure branch from 1bf22f0 to 5b292b5 Compare April 6, 2024 18:02
@frostburn
Copy link
Member Author

Fixed a corner case and made both variants accept the empty scale. (The first one couldn't reject it even if it wanted to.)

@frostburn frostburn merged commit e1da747 into main Apr 7, 2024
1 check passed
@frostburn frostburn deleted the constant-structure branch April 7, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant