Zachacious / MusicTheoryJS

A Simple, Lightweight, Extendable Music Theory Library For Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Scale asString output

Delapouite opened this issue · comments

Hello

Thanks for this great library, it is a pleasure to use.

The following code:

console.log(MT.Scale.Major(new MT.Note('C#')).asString)

currently ouputs:

Scale: C#/Db D#/Eb F F#/Gb G#/Ab A#/Bb C

Which is correct but not really what I was expecting:

Scale: C# D# E# F# G# A# B#

Looking at the related snippet:

    get asString() {
      let names = 'Scale: ';
      this.mNotes.forEach((item) => {
        names += `${item.asString} `;
      });

      return names;
    }

each note is stringified in its default representation, lacking the context of which form it should adopt to conform to the more natural way to write a scale.

What could be the approach to improve this situation?

Thanks!

Apologies for the late response. Been away for a while.
The current system is kinda lazy, meaning, It doesn't try to determine the proper note names for the scale.

I look at improving this soon.