music-notation-swift / music-notation-core

Music Notation Library in Swift (Deprecated. See `music-notation` instead)
MIT License
115 stars 16 forks source link

Implement MeasureDurationValidator #29

Closed drumnkyle closed 8 years ago

drumnkyle commented 8 years ago

See Duration Calculator document.

drumnkyle commented 8 years ago

@robtimp feel free to give feedback on the design in that document.

drumnkyle commented 8 years ago

We need to think about Irrational Meters like 4/3 and see how these changes the validation logic. Look at https://en.wikipedia.org/wiki/Time_signature.

drumnkyle commented 8 years ago

This seems to be a good explanation of Irrational Meters: http://www.paulsteenhuisen.org/irrational-time-signatures.html.

From what I can tell it seem like fir the MeasureDurationValidator all that is relevant for telling if the measure is full or not, is to round the bottom number down to the next lowest power of 2 number. Then take that type of note and ensure there are the top number amount of them in the measure.

Examples: 1) 3/6. Round 6 down to 4. Make sure there are 3 quarter notes in the measure to be full. 2) 4/10. Round 10 down to 8. Make sure there are 4 eighth notes in the measure to be full.

Also, for these irrational time signatures in general, for this library since it is just notation, it doesn't seem like we will have to worry about this much. However, when it comes time to actually playing the music, that engine, which would probably just be MIDI or something, would need to worry about that.

Let me know if you guys think this seems incorrect @robtimp, @migue48.