playEvent lengths in MuseScore 4 scores are always 1000
Hello,
A few years ago I wrote an Arduino library with corresponding MuseScore 3 plugin for encoding sheet music in a space-efficient form that can be replayed by a microcontroller. I'm finally getting around to making the plugin work with MuseScore 4 and have hit a bit of a snag with playEvents
.
The output from the microcontroller is typically a square wave of the note's frequency, with what fraction of each note that sound is generated being one of the few voicing / articulation options. The plugin currently uses playEvents
to determine if the note should be played as staccato (50% of the time), slurred / legato (100% of the time) or normally (87.5% of the time).
In MuseScore 3 and scores created using MuseScore 3 that are opened in MuseScore 4, the playback events for each note have varying lengths. In documents created using MuseScore 4, all playEvents
have length 1000 regardless of articulation / lines added.
As an example with the following bar, playEvents[0].len
for each note is:
Created with MS3: [ 950, 1000, 950, 500]
MS4: [1000, 1000, 1000, 1000]
I've tried adding:
curScore.startCmd();
curScore.createPlayEvents();
curScore.endCmd();
This doesn't seem to make any noticeable difference. The plugin file itself with some debugging to print playevent lengths is here. I've been testing with MuseScore 3.6.2 (appimage) and MuseScore 4.3.1 (flatpak). I'm not sure if the difference in behavious between MuseScore 3 and 4 is intentional or not with the various changes to the voicing. Does anyone have any suggestions of things to look at please? Thanks.
Comments
If it's any help / use with reproducing and demonstrating what I'm experiencing, this file has a cut down version of the plugin that only shows the length of the play event for each note: NoteLengths.qml.
In reply to If it's any help / use with… by JMusicG
added to dev handbook https://musescore.org/en/node/337468/
related to ms3 cap at 2000 https://musescore.org/en/node/347270
In reply to added to dev handbook https:… by msfp
Thanks for the pointers. I'll see if I can work out an alternative method / approach.