[JW Lua] FCNoteentry methods...

Simon Leclerc simon at prodsl.ca
Thu Jun 23 01:59:41 CEST 2022


So I had time today to look into it a little bit more.
The solution you proposed Robert, worked perfectly with the 2 quarter notes becoming a tremolo of half notes.

Where I encounter a problem  is if I want to modify the horizontal beginning and end (offsets) of the beam. Like in the case of 2 half notes becoming a tremolo of whole notes. Obviously, I don’t want the beams to extend close to the notes.

To me, the 2 methods Left and Right HorizontalOffset have no effect what so ever. The vertical ones work as anticipated, though.

As in this exemple, with or without the 2 “horizontal" lines, the result is the same:


  for entry in eachentrysaved(finenv.Region()) do
    if entry.BeamBeat and not entry:CalcUnbeamedNote() then
      local beam_mod = finale.FCBeamMod(true)
      beam_mod:SetNoteEntry(entry)
      beam_mod:SetBeamNumber(3)
      beam_mod.LeftVerticalOffset = beam_mod.LeftVerticalOffset + 24 --- the whole chosen beam is moved up
      beam_mod.RightVerticalOffset = beam_mod.RightVerticalOffset + 24 --- the right side of the chosen beam is moved up
      beam_mod.LeftHorizontalOffset = beam_mod.LeftHorizontalOffset + 24 --- does nothing
      beam_mod.RightHorizontalOffset = beam_mod.RightHorizontalOffset + 24 --- does nothing
      beam_mod:SaveNew()
    end
  end

Has anyone got success modifying the actual horizontal beginning and ending of a beam? As when one does it manually with the beam extension tool?






¯\_(ツ)_/¯

Simon Leclerc
60, Mirabelle
Ste-Agathe-des-Monts, Québec
J8C 0W9
simon at prodsl.ca




> On Jun 21, 2022, at 21:20, Simon Leclerc <simon at prodsl.ca> wrote:
> 
> Thank you so much Robert for this very insightful answer. I’ll look into it having all that in mind.
> 
> Simon Leclerc
> Composer, conductor, arranger
> 
>> Le 21 juin 2022 à 20:35, Robert Patterson <robert at robertgpatterson.com> a écrit :
>> 
>> 
>> I'm fairly certain that these are calculated values provided by Finale so you don't have to constantly recalc them for yourself. (Same with the clef value on FCNoteEntry.) I don't really know why they are writable. That was done long before I got to the code base. Any new values you write will be retained for the life of the FCNoteEntry instance, but they will not be saved.
>> 
>> To copy TGTools Easy Tremolos you need to modify the Duration property and add an invisible tuplet. So, for example, to turn 2 consecutive quarters into a half-note tremolo with three beams, you would change the Duration of each note from QUARTER_NOTE to NOTE_32ND. Then you would add a new invisible tuplet to the first one that is 2 32nds in the time of 2 quarters. After the FCNoteEntry is saved, the next time you retrieve it the MeasurePos and ActualDuration properties will have been updated.
>> 
>> I don't at this moment recall how much Jari's documentation says about TGFs. The PDK Framework mostly hides them from Lua scripters, but it's a pretty important concept for working with note entries. Entries always come out of a TGF, which is an array of entries for a single layer in a single measure. To save an entry, you have to save the entire TGF. This can lead to possibly unexpected behavior, for example:
>> 
>> for e in eachentrysaved(region) do
>>    e.Duration = e.Duration / 2
>>    break
>> end
>> 
>> This would appear to halve the first entry in a region, but in fact the entry won't be saved because you broke out of the loop. To save the entry, the loop *must complete*. (You can see for yourself how eachentrysaved works, because I've posted all the built-in iterator functions to the lua-source <https://github.com/finale-lua/lua-source> repository. Or you can fish it out of the jwlua binary for yourself, like I did originally.)
>> 
>> 
>> On Tue, Jun 21, 2022 at 6:53 PM Simon Leclerc <simon at prodsl.ca <mailto:simon at prodsl.ca>> wrote:
>> Hi to all,
>> 
>> Am I right to understand that the 2 FCNoteentry methods “SetMeasurePos” and “SetActualDuration” have no effect?
>> 
>> I’m working on a plugin that deals with tremolos between whole notes and it does not seem possible to modify those 2 parameters.
>> 
>> I analyzed the result of the TGTool plugin “Easy tremolos” and I can see that the 2 parameters have been changed and saved.
>> 
>> Is there another class that needs to be addressed to make it work?
>> 
>> 
>> 
>> 
>> 
>> ¯\_(ツ)_/¯
>> 
>> Simon Leclerc
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu <http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20220622/478925c4/attachment.html>


More information about the JWLua mailing list