go-music-theory / music-theory

Go models of Note, Scale, Chord and Key
https://gopkg.in/music-theory.v0
GNU General Public License v3.0
440 stars 44 forks source link

originalKey.Diff(targetKey) or originalNote.Diff(targetNote) returns nearet +/- semitones #22

Closed charneykaye closed 8 years ago

charneykaye commented 8 years ago

Key

originalKey := key.Of("Db minor")
targetKey := key.Of("F# major")
shiftSemitones := originalKey.Diff(targetKey) // equals +5

Which implements Note:

originalNote := note.Fs
targetNote := note.Cs
shiftSemitones := originalNote.Diff(targetNote) // equals -5