abcjs
abcjs copied to clipboard
Different "note.start" info
When logging "abcElem.abselem.abcelem.midiPitches" from clickListener, I should get "0" as start information at the first note at the first beat in the first bar, however some tunes doesn't show "0"
This one shows "4", how come?
X:1 T:Stave Stave Stenegård T:"Lilla pianoraketen" C:Nordisk folkmelodi %%printtempo 0 Q:1/4=60 L:1/8 M:2/4 I:linebreak $ K:Dmin V:1 treble nm="Piano" V:1 !5!AAGG | FF D2 | AAGG | FF D2 | %4 w: Sta- ve, Sta- ve|Ste- ne- gård.|Här är al- la|mi- na får.| DEFG | A2 A2 | FFEE | D4 :|] %8 w: U- tom lil- la|Lin- ka,|som i sko- gen|går.|
This is when running "editor-synth" beta 24

Well, the reason is that it is returning the position of the repeat. I guess it should return an array of both of them.
Aha, ok, yes it would be great to have both. Does this effect the millisecond timestamp as well?
The abcElem.currentTrackMilliseconds timestamp is an array with both values.
Ok, my looping setup is depending on userclicks timestamps and I started noticing that on some tunes the loops were not synced. So I started investigating if it would be better to use the note.start values instead of milliseconds I got from abcElem... That's how I noticed it. So what do you think would be the most safe (syncwise) way to setup the looping?
When using the abcElem....milliseconds I synced it to the totalTime from CursorControl.onBeat, divided with the current beat, would that be the most safe way to do it you think, or is it better to use the totalDuration value?
Maybe I should explain a little more how I had done it This is the way I used it so far for getting loopstart and end
if (typeof abcElem.currentTrackMilliseconds === 'object') { loopPoint = abcElem.currentTrackMilliseconds[0]; } else { loopPoint = abcElem.currentTrackMilliseconds; }
and in the CursorControl getting currentTime
let beatLength = totalTime/ totalBeats; let currentTime = beatLength * beatNumber;
so it's dependent on totalTime, totalBeats and beatNumber
and still in .onBeat(), because I set the loopoints to be the percentage of totalTime, I need to divide current with total to get the percentage to compare with, is it too muck calculations you think, it might disturb the playback?
if (currentTime / totalTime >= endLoop) { synth.seek(startLoop); timingCallbacks.setProgress(startLoop); }