Open elsewhere37 opened 5 months ago
Hey there! Check ver 3.0.7 for my fix to this issue. I got it working with your example here.
As usual you found an elegant solution (using normalNotes), but on a more complex example (test.mscz) the program exits without warning. I post test.mscz on dirk.elseviers@gmail.com I also feel that thru the years your logic has become too complicated. Therefore I also mail WriteNoteSymStaff.qml. This private use plugin uses retrograde code to write out data from a table and the logic is much simpler, but feel free not to look at it. PS I'm getting old & confused. Not sure you can get the file from here. I vaguely know about We Transfer but how should I do this? I know: I post test.mscz at https://musescore.org/en/node/333755 and the qml here as .txt WriteNoteSymStaff.txt
Post a screenshot of the complex example and I'll reconstruct it in a new file. I want to know what crashes the app so I can fix that. I suspect it gets stuck in a loop from the tupReset.
Don't know if I've ever thanked you for breaking my code all these times so I can improve it. So thank you for your assistance debugging! The 3.0 of my plugin is so much better than my 1.0. I agree that there's probably a much simpler way to do a retrograde plugin, I just haven't sussed it out yet. Every time I've tried to simply create an element using the existing element in the array, MuseScore freaks out. It doesn't like that I'm trying to duplicate an element with the same ID. That's why my code as it is now goes through this absurd complicated logic to reconstruct the element from the array.
See my previous edited comment: I posted test.mscz at https://musescore.org/en/node/333755
Hmm... I think that crash might be related to the rests in voice 2 issue you reported. Retrograde works fine until measure 6 with the eighth rests in voice 2, and then CRASH. If I retrograde just measures 5 and 6, I get a whole bunch of extra rests that aren't supposed to be there.
There is something really bizar going on in test.mscz. When you switch to track 1 the code says tuplet = true. But this is only true in measure 2, but the cursor is at measure 1. So you would have to fill internal tracks with rests first thing, so that they also get incorportated in the retro array.
The way I discovered this is by replacing
for (var i in retro) { with var k = 0; for (var i = k; i < k + 20; i++){
In this way you can monitor the progress of the code gradually
To be clear: for debugging I comment out the reverse step
You have rivalry! https://musescore.org/en/project/pitch-and-rhythm-transformer This plugin does not handle the treacherous inner voices, but the logic for track 0 is good. See ‘function reWrite (Pitches,Rhythm){‘
Oh my glob. That looks fancy! And probably written by someone who actually knows programming. I'm just a hobbyist.
You can learn a lot from looking at other people's code (as I did looking at yours) if you are still interested...
Select measures 1-2 and run the plugin. Result shown in measures 3-4. To get the right duration for the half note in the first triplet you need to run addTuplet before addNote (around line 160). But actualnotes = 3 remains and you need another mechanism (than tupReset) based on duration to flag the end of the tuplet (counting notes won’t do). I attach a barely tested fix.txt. Feel free to ignore it if you rather find a solution yourself. fix.txt