Thanks Mark and Hans. This is so helpful!
I sometimes need to find the value of two or more of the objects for example I want to evaluate a note in a certain ‘stave’ in a certain ‘measure.’
Would Han’s library be recommended or is there a more basic way to do this?
For example, how would I target the second note in the second stave in the second measure of this:
{ "staves": [ { "measures": [ { "noteSets": [ { "position": 0, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 55, "step": 4, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 1, "duration": 0.5, "voice": 0, "beam": true, "notes": [ { "pitch": 57, "step": 5, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 1.5, "duration": 0.5, "voice": 0, "beam": false, "notes": [ { "pitch": 59, "step": 6, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 2, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 60, "step": 0, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 3, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 64, "step": 2, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] } ] }, { "noteSets": [ { "position": 0, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 62, "step": 1, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 1, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 59, "step": 6, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 2, "duration": 2, "voice": 0, "beam": false, "notes": [ { "pitch": 60, "step": 0, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] } ] } ] }, { "measures": [ { "noteSets": [ { "position": 0, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 53, "step": 3, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 1, "duration": 0.5, "voice": 0, "beam": true, "notes": [ { "pitch": 55, "step": 4, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 1.5, "duration": 0.5, "voice": 0, "beam": false, "notes": [ { "pitch": 57, "step": 5, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 2, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 59, "step": 6, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 3, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 62, "step": 1, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] } ] }, { "noteSets": [ { "position": 0, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 60, "step": 0, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 1, "duration": 1, "voice": 0, "beam": false, "notes": [ { "pitch": 57, "step": 5, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] }, { "position": 2, "duration": 2, "voice": 0, "beam": false, "notes": [ { "pitch": 59, "step": 6, "alteration": 0, "accidental": null, "noteHead": null, "tied": false } ] } ] } ] } ] }Check Note
Would I edit Mark’s code somehow:
var pitch = scoreData.staves[0].measures[0].noteSets[0].notes[0].pitch;
Where the stave array is 0 for first stave and 1 for second stave etc.
I believe the array for measure would be the same, 0 for measure 1 and 1 for measure 2.
“position” is the offset for each measure so position: 1 would target the second note.