Thursday, May 6, 2010

tonos

Copperbox revision 1308.

Work on enharmonic spelling.

Notionally, the enharmonic spelling I have to do is simpler than typical results presented in research papers. I know the key I'm in, all I have to do is account for all 12 pitches when I'm converting from one pitch representation to another. Usually I'd expect pitches to be spelled correctly but the initial pitch rep represents accounts for accidentals as an integer - the final pitch rep has them as an enumeration with 5 levels - Natural Sharp, Flat, Double Sharp, Double Flat. So I want a total function that can eliminate non-representable accidentals.

I've worked out an 'on paper' algorithm to map the Z12 pitch numbers to particular spellings, though I don't know how to compute it:

Firstly account for the notes in the scale - taking G major

G 7, A 9, B 11, C 0, D 2, E 4, F# 6

Sorted gives: [0, 2, 4, 6, 7, 9, 11]

Secondly, "prefer naturals" - so as we have F# in the scale we take F at 5 rather than E#.

[0, 2, 4, 5, 6, 7, 9, 11] - are now accounted for.

For the remaining numbers calculate the interval from the tonic G to the challengers for the number:

For 1 - C# and Db are the challengers; G -> C# is Aug4, G -> Db is dim5 - no winner.

For 3 - D# and Eb are the challengers; G -> D# is (5,8) an unnamed interval; G -> Eb is min6 so Eb wins.

For 8 - Ab and G# are the challengers; G -> Ab is min2, G -> G# is unnamed (1,1); Ab wins.

For 10 - A# and Bb are the challengers; G -> A# is unnamed (1,3); G -> Bb is min3; Bb wins.

As all the winners are flats - I resolve the no winner (C# or Db) as Db for consistency.

This accounts for all the numbers in Z12.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.