I'm working on a virtual keyboard player and I've got it playing a ditty, but I'm unsure how to structure the music data so that it's easy to read/write the sheet music, and to later add more info without cluttering the music data. Currently my 1st few notes look like this:
var notes = [ [9], [12,5], [12,7,9], [12,5], [12,7,9,"a"], [14,"a"], [13,5,"a"], [12,"a"], [11,7,9], [12,5], [7, 9], [12,3], [12,7,5],
[10,3, "a"], [12,"a"], [11,7,5,"a"], [10,"a"], [11,0], [9,7,4], [8,-3], [4,1,-1] ];
It only stores keys and the "a" signifes 1/2 notes (quite clumsily), Ideally I'd like to be able to store all info present on sheet music. but the array is quite an obtuse mess already (and it's only the 1st few notes).
Any ideas for how to hold the music data (like key, duration rests, etc) in a somewhat more readable format?