Hello guys, I'm trying to get some information of the notes, but I'm having problem to define which fingering is for each note and what is the bpm also.
What I have so far:
const readNotes = this.osmd.cursor.NotesUnderCursor();
for (const note of readNotes) {
console.log(note);
if (note.halfTone > 0) {
var finger: string;
note.ParentVoiceEntry.TechnicalInstructions.forEach(instruction => {
if (instruction.type == TechnicalInstructionType.Fingering) {
finger = instruction.value;
console.log(finger);
}
})
const noteInfo = {
"note": note.halfTone + 12, // see issue #224
"hand": note.ParentStaff.Id, // staff
"finger": finger,
"bpm": 60,
};
}
}
The problem is note.ParentVoiceEntry.TechnicalInstructions contains all the fingerings for the Staff and I cant match them with the correct note.
I managed it doing this, but i think I`m doing the difficult way, not sure.
```
const voicesUnderCursor = this.osmd.cursor.VoicesUnderCursor();
const notesInfo = [];
for (const voice of voicesUnderCursor) {
console.log(voice);
let satrtNotes = this.notesInfo.length;
voice.Notes.forEach( note => {
console.log(note);
this.notesInfo.push({
note: note.halfTone + 12, // see issue #224
hand: note.ParentStaff.Id, // staff
time: 0,
});
});
let count = voice.Notes.length;
voice.TechnicalInstructions.forEach(instruction => {
if (instruction.type == TechnicalInstructionType.Fingering) {
if (this.notesInfo[satrtNotes] != null) {
this.notesInfo[satrtNotes].finger = Number.parseInt(instruction.value);;
}
count--;
satrtNotes++;
}
})
}
``
I pushed a fix to develop that makes this easier. (will be in the next release)
A Note now has Note.Fingering, and voiceEntry.TechnicalInstructions[i] has a sourceNote if it's a fingering.
I also fixed a bug where the fingering was assigned to the wrong note, because the middle note didn't have a fingering:

This is how it's supposed to look:

sample:
chord_fingering.zip
This shows how you can easily get each note's fingering now:

Saving the fingering per note made me notice that bug and made solving it easier, thanks for the suggestion!
@conde2 for BPM, each measure has a measure.TempoInBPM, e.g.:
osmd.cursor.NotesUnderCursor()[0].sourceMeasure.TempoInBPM
Thank you !
That makes it alot easier, great additiion.
Most helpful comment
I pushed a fix to develop that makes this easier. (will be in the next release)
A Note now has Note.Fingering, and voiceEntry.TechnicalInstructions[i] has a sourceNote if it's a fingering.
I also fixed a bug where the fingering was assigned to the wrong note, because the middle note didn't have a fingering:

This is how it's supposed to look:

sample:
chord_fingering.zip
This shows how you can easily get each note's fingering now:

Saving the fingering per note made me notice that bug and made solving it easier, thanks for the suggestion!