Skip to content

Add similar scales analysis tab - #984

Merged
frostburn merged 7 commits into
xenharmonic-devs:mainfrom
narenratan:similar-scales
Jul 17, 2026
Merged

frostburn merged 7 commits into
xenharmonic-devs:mainfrom
narenratan:similar-scales

Conversation

@narenratan

Copy link
Copy Markdown
Contributor

I've been working on scalelibrary.org, a library of microtonal scales with sources attributed, and I've found the tables of similar, parent, and child scales super interesting (for example on this scale page). I thought it might be interesting to show these tables in Scale Workshop - I got something working so I thought I'd make a PR to at least have something concrete to talk about. I've attached a screenshot (there's a Child scales table off-screen).

screenshot

Comment thread src/stores/similar.ts
isFetching.value = true
fetchError.value = null
try {
const response = await fetch(SCALE_CENTS_URL)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not OK. We absolutely cannot add an unvetted dynamic dependency. Publish your library on npm and pull a versioned copy from there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that! I've published scale-cents.json as an npm package and pulled it from jsDelivr now.

Comment thread src/__tests__/similar-scales.spec.ts Outdated
})

describe('Maximum nearest-note distance', () => {
it('finds zero distance for a child which is a subset of the parent', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scale Workshop tries to follow XenWiki naming-conventions. Your parent-child-relationship is inverted compared to https://en.xen.wiki/w/MOS_scale_family_tree .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of the general sense of 'larger parent containing smaller child' - does that make sense? In fact the tables aren't about MOS; they're about general scales where one approximately contains the other.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's about tree-relationships. One small scale begets many larger scales.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I see what you mean - I've swapped parent/child now. Also I've swapped them on scalelibrary.org too, so everything will be consistent.

@frostburn

Copy link
Copy Markdown
Member

Please indicate external links with that rounded square with a northeast-pointing arrow or at least an unicode link symbol.

Add yourself to the About page.

After swapping parent/child naming, this should be good for a QA deployment. We'll let people test it for a week over at https://sw3.lumipakkanen.com/ before merging and deploying to production.

@narenratan

Copy link
Copy Markdown
Contributor Author

That sounds great - thanks very much! I've added unicode link symbols for the external links, added myself to the About page, and swapped parent/child naming. Thanks for all your help!

@frostburn

Copy link
Copy Markdown
Member

Deployed to https://sw3.lumipakkanen.com/ for testing.

Comment thread src/stores/similar.ts Outdated
import { computeSimilarScales, type LibraryScale, type SimilarResult } from '@/similar-scales'

const SCALE_CENTS_URL =
'https://cdn.jsdelivr.net/npm/@narenratan/scale-library@1.3.0/scale-cents.json'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would make more sense to have the dependency listed in package.json. I can host the data inside our distribution once it's pulled from a versioned package. Just don't want a dynamic dependency that's impossible to control or verify.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've added the dependency in package.json and updated SCALE_CENTS_URL to use it.

Comment thread src/views/AnalysisView.vue Outdated
:href="`https://scalelibrary.org/scales/${entry.stem}/`"
target="_blank"
rel="noopener"
>{{ stemBasename(entry.stem) }} 🔗</a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The link underline doesn't usually extend to the external link icon. You probably want to style this as an after pseudo element.

Comment thread src/views/AnalysisView.vue Outdated
:href="`https://scalelibrary.org/scales/${entry.stem}/`"
target="_blank"
rel="noopener"
>{{ stemBasename(entry.stem) }} 🔗</a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use a dedicated CSS class so that the link icon doesn't need to be repeated inline.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've used a CSS class for this now.

@frostburn

Copy link
Copy Markdown
Member

Looking good!
Update deployed to https://sw3.lumipakkanen.com/?version=3.5.0-rc.2

@frostburn

Copy link
Copy Markdown
Member

Got positive feedback from QA testing. Giving the code a final glance and merging.

@frostburn
frostburn merged commit 436a514 into xenharmonic-devs:main Jul 17, 2026
2 checks passed
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.

2 participants