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

Build Scale Logic Refactoring #2537

Closed
pikurasa opened this issue Aug 24, 2020 · 3 comments
Closed

Build Scale Logic Refactoring #2537

pikurasa opened this issue Aug 24, 2020 · 3 comments

Comments

@pikurasa
Copy link
Collaborator

There have been some discussions about how build scale works and how to improve it such that it better follows the logic that musicians use to spell pitches for scales.

Sketching out here; will refine later. We may add this to the docs (for users as well as developers):

Spelling Pitches in a Scale

Regardless whether we are finding accidentals for modes with greater than or fewer than 7, we must first figure out the 7 note framework by the following method:

  1. Each letter class position (A, B, C, D, E, F, and G) is occupied for a single pitch.

(This is regardless of any accidentals.)

  1. Then the sharps or flats (or double-sharps, double flats) are determined according to the geometry of the scale (i.e. sequence of Whole/Half Steps).

e.g. We are in G# major, we need pitches spelled out for letter class placements G, A, B, C, D, E, F, and G.

Because Major is W, W, H, W, W, W, H as its "scalar geometry", we choose the following pitches and accidentals:

G#, A#, B#, C#, D#, E#, Fx

We chose B# instead of C because we need to use that letter class for the C# in the forth scale degree.

@pikurasa
Copy link
Collaborator Author

@aviral243 can you please provide some feedback on this proposal as you know buildscale very well?

@aviral243
Copy link
Member

aviral243 commented Aug 26, 2020

Adding on to this:

  • We have no support for any double flat/double sharp keys.

  • Edge cases like B# and Cb fail.

  • More issues can be thought of but they're more or less the result of not being able to generate a proper scale and rethinking the function should solve most of them. e.g weird Lilypond export for some projects.

How to get started:

  • The issue of multiple pitches falling in the same letter class for a scale occurs due to en-harmonics i.e pitches that sound the same. e.g C# and Db. So there's no scale that doesn't "sound" correct but representational errors occur.

  • More insights can be gained analyzing _buildScale, NOTESFLAT, and NOTESSHARP inside musicutils.js and subsequently understanding how "scalar geometry" for a particular mode works.

@walterbender
Copy link
Member

G# major now resolves to: ["G♯", "A♯", "B♯", "C♯", "D♯", "E♯", "F𝄪", "G♯"]
Are there more test cases we can check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants