Hi
Great work. Music theory is definitely not an easy subject. It was a while ago, but if I’m not mistaken, I used a formula for natural scales and major/minor chords, (not harmonic, diminished or dominant, but I wouldn’t be surprised if there was also an error in my implementation somewhere ;)
I think that CEGBD is the correct order for a major ninth:
https://en.wikipedia.org/wiki/Chord_letters
What scale and chord do you prefer?
It is great if you have improved the code. I propose that you add a pull request in github so anyone can use your solution and compare the changes!