MegaArman / toscanini

A JavaScript module for searching music scores.
https://megaarman.github.io/toscanini
MIT License
16 stars 3 forks source link

Toscanini.Iterator #17

Open MegaArman opened 7 years ago

MegaArman commented 7 years ago

What: An iterator to make iterating over a score simpler.

Why: Per Dr. T's request, this abstraction should simplify the process for a new programmer to start developing new queries. New programmers need not know about XML parsing techniques. This makes collecting information about chords and melodic sequences much easier for example.

Concerns: -chords or multiple voices? MuseScore and seems like the MusicXML standard require two voices to be used when a note of a chord has different duration from other notes of the chord.

Chords not voices will be considered. If two notes are played by one part at a single point in time, then they are to be considered a chord of one instrument as opposed to two voices under any circumstance. It would be impractical to code otherwise. Guitar music where notes in a chord have different durations require multiple voices to be used according to the MusicXML standard and MuseScore, but in reality it's clearly meant for one instrument.

-How do you represent a chord that is spread across multiple parts? Should the iterable contain all notes of all parts at a given point in time for harmonic analysis across instruments?

MegaArman commented 7 years ago

Draft spec 6/24/17: Iterator.selectInstrument(instrumentName);

Iterator.nextMeasure(); //takes you to the first beat of the next measure Iterator.next(); //takes you to the next note or set of notes or rest ... of a measure or across measures? Iterator.nextBeat(); //takes you to the next beat of the measure or across measures?? Iterator.nextChord(); //should this just beat went multiple notes are hit at once- what if it's a canon?

Iterator.prevMeasure(); Iterator.prev(); Iterator.prevBeat(); Iterator.prevChord();

Iterator.nextTimeSignature(); Iterator.nextKeySignature();

Iterator.getMeasureNum(); Iterator.setMeasureNum();

Iterator.getSelectedInstrumentName() ....

MegaArman commented 7 years ago

Iterator 1.0 coming soon. Concerns:

MegaArman commented 7 years ago

I.next().notes[0].duration I.next().notes[0].pitch

MegaArman commented 7 years ago

Iterator 1.1.0: -user can listen for key and time signature changes -setMeasureNum -need to improve test code coverage overall