[JW Lua] Hairpins

Martin Marris mmarris at notecraft.com
Thu Dec 24 16:12:09 CET 2020


So here is the slightly more sophisticated version, which only adjusts hairpin end-points if they come close to a barline. I think I am mixing a lot of apples with a lot of oranges, but it seems to work. The numbers are pretty arbitrary and would not work except in this tightly controlled project where I already know what the scores generally look like. So that’s it for now (crossing fingers!).

 

musicregion = finale.FCMusicRegion()

musicregion:SetFullDocument()

local marks = finale.FCSmartShapeMeasureMarks()

marks:LoadAllForRegion(musicregion, true)

for mark in each(marks) do

    local smartshape = mark:CreateSmartShape()

    if smartshape:IsHairpin() then

        local segment = smartshape:GetTerminateSegmentRight()

        measureID = segment.Measure

        measure = finale.FCMeasure()

        measure:Load(measureID)

        measureDuration = measure:GetDuration()

        hairpinMeasurePos = segment.MeasurePos

        if measureDuration - hairpinMeasurePos < 80  then                        --test for hairpin ending close to barline

            segment.EndpointOffsetX = segment.EndpointOffsetX - 30       --pull it back a bit

            smartshape:Save()

        end

    end

end

 

Martin

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20201224/15e1d8d9/attachment.htm>


More information about the JWLua mailing list