Skip to content

Commit 0fb7ffc

Browse files
chore: autopublish 2022-03-27T17:53:56Z
1 parent 788debb commit 0fb7ffc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+6799
-408
lines changed

dist/chord_baseline_move_down.lua

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
function plugindef()
2+
finaleplugin.Author = "Nick Mazuk"
3+
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
4+
finaleplugin.Version = "1.0.0"
5+
finaleplugin.Date = "March 26, 2022"
6+
finaleplugin.CategoryTags = "Chord"
7+
finaleplugin.AuthorURL = "https://nickmazuk.com"
8+
finaleplugin.Notes = [[
9+
Select system staves for which you want to move the chord baseline down, then run this script
10+
]]
11+
return "Move chord baseline down", "Move chord baseline down", "Moves the selected chord baseline down one space"
12+
end
13+
14+
-- A measurement of helpful JW Lua scripts
15+
-- Simply import this file to another Lua script to use any of these scripts
16+
local measurement = {}
17+
18+
function measurement.convert_to_EVPUs(text)
19+
local str = finale.FCString()
20+
str.LuaString = text
21+
return str:GetMeasurement(finale.MEASUREMENTUNIT_DEFAULT)
22+
end
23+
24+
25+
26+
27+
function chord_baseline_move_down()
28+
local region = finenv.Region()
29+
local systems = finale.FCStaffSystems()
30+
systems:LoadAll()
31+
32+
local start_measure = region:GetStartMeasure()
33+
local end_measure = region:GetEndMeasure()
34+
local system = systems:FindMeasureNumber(start_measure)
35+
local last_system = systems:FindMeasureNumber(end_measure)
36+
local system_number = system:GetItemNo()
37+
local last_system_number = last_system:GetItemNo()
38+
local start_staff = region:GetStartStaff()
39+
local end_staff = region:GetEndStaff()
40+
41+
for i = system_number, last_system_number, 1 do
42+
local baselines = finale.FCBaselines()
43+
baselines:LoadAllForSystem(finale.BASELINEMODE_CHORD, i)
44+
for j = start_staff, end_staff, 1 do
45+
local baseline = baselines:AssureSavedStaff(finale.BASELINEMODE_CHORD, i, j)
46+
baseline.VerticalOffset = baseline.VerticalOffset + measurement.convert_to_EVPUs("-1s")
47+
baseline:Save()
48+
end
49+
end
50+
end
51+
52+
chord_baseline_move_down()

dist/chord_baseline_move_up.lua

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
function plugindef()
2+
finaleplugin.Author = "Nick Mazuk"
3+
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
4+
finaleplugin.Version = "1.0.0"
5+
finaleplugin.Date = "March 26, 2022"
6+
finaleplugin.CategoryTags = "Chord"
7+
finaleplugin.AuthorURL = "https://nickmazuk.com"
8+
finaleplugin.Notes = [[
9+
Select system staves for which you want to move the chord baseline up, then run this script
10+
]]
11+
return "Move chord baseline up", "Move chord baseline up", "Moves the selected chord baseline up one space"
12+
end
13+
14+
-- A measurement of helpful JW Lua scripts
15+
-- Simply import this file to another Lua script to use any of these scripts
16+
local measurement = {}
17+
18+
function measurement.convert_to_EVPUs(text)
19+
local str = finale.FCString()
20+
str.LuaString = text
21+
return str:GetMeasurement(finale.MEASUREMENTUNIT_DEFAULT)
22+
end
23+
24+
25+
26+
27+
function chord_baseline_move_down()
28+
local region = finenv.Region()
29+
local systems = finale.FCStaffSystems()
30+
systems:LoadAll()
31+
32+
local start_measure = region:GetStartMeasure()
33+
local end_measure = region:GetEndMeasure()
34+
local system = systems:FindMeasureNumber(start_measure)
35+
local last_system = systems:FindMeasureNumber(end_measure)
36+
local system_number = system:GetItemNo()
37+
local last_system_number = last_system:GetItemNo()
38+
local start_staff = region:GetStartStaff()
39+
local end_staff = region:GetEndStaff()
40+
41+
for i = system_number, last_system_number, 1 do
42+
local baselines = finale.FCBaselines()
43+
baselines:LoadAllForSystem(finale.BASELINEMODE_CHORD, i)
44+
for j = start_staff, end_staff, 1 do
45+
local baseline = baselines:AssureSavedStaff(finale.BASELINEMODE_CHORD, i, j)
46+
baseline.VerticalOffset = baseline.VerticalOffset + measurement.convert_to_EVPUs("1s")
47+
baseline:Save()
48+
end
49+
end
50+
end
51+
52+
chord_baseline_move_down()

dist/expression_add_opaque_background.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ Returns the horizontal EVPU offset for a smart shape endpoint to align exactly w
15111511
]]
15121512
function expression.calc_handle_offset_for_smart_shape(exp_assign)
15131513
local manual_horizontal = exp_assign.HorizontalPos
1514-
local def_horizontal = 0
1514+
local def_horizontal = 0
15151515
local alignment_offset = 0
15161516
local exp_def = exp_assign:CreateTextExpressionDef()
15171517
if nil ~= exp_def then

dist/expression_remove_enclosure.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ Returns the horizontal EVPU offset for a smart shape endpoint to align exactly w
15111511
]]
15121512
function expression.calc_handle_offset_for_smart_shape(exp_assign)
15131513
local manual_horizontal = exp_assign.HorizontalPos
1514-
local def_horizontal = 0
1514+
local def_horizontal = 0
15151515
local alignment_offset = 0
15161516
local exp_def = exp_assign:CreateTextExpressionDef()
15171517
if nil ~= exp_def then

dist/expression_reset_positioning.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ Returns the horizontal EVPU offset for a smart shape endpoint to align exactly w
15081508
]]
15091509
function expression.calc_handle_offset_for_smart_shape(exp_assign)
15101510
local manual_horizontal = exp_assign.HorizontalPos
1511-
local def_horizontal = 0
1511+
local def_horizontal = 0
15121512
local alignment_offset = 0
15131513
local exp_def = exp_assign:CreateTextExpressionDef()
15141514
if nil ~= exp_def then

dist/expression_set_to_parts_only.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ Returns the horizontal EVPU offset for a smart shape endpoint to align exactly w
15111511
]]
15121512
function expression.calc_handle_offset_for_smart_shape(exp_assign)
15131513
local manual_horizontal = exp_assign.HorizontalPos
1514-
local def_horizontal = 0
1514+
local def_horizontal = 0
15151515
local alignment_offset = 0
15161516
local exp_def = exp_assign:CreateTextExpressionDef()
15171517
if nil ~= exp_def then

dist/expression_set_to_score_only.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ Returns the horizontal EVPU offset for a smart shape endpoint to align exactly w
15111511
]]
15121512
function expression.calc_handle_offset_for_smart_shape(exp_assign)
15131513
local manual_horizontal = exp_assign.HorizontalPos
1514-
local def_horizontal = 0
1514+
local def_horizontal = 0
15151515
local alignment_offset = 0
15161516
local exp_def = exp_assign:CreateTextExpressionDef()
15171517
if nil ~= exp_def then

dist/layers_swap_1_2.lua

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
function plugindef()
2+
finaleplugin.Author = "Nick Mazuk"
3+
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
4+
finaleplugin.Version = "1.0.0"
5+
finaleplugin.Date = "March 26, 2022"
6+
finaleplugin.CategoryTags = "Playback"
7+
finaleplugin.AuthorURL = "https://nickmazuk.com"
8+
finaleplugin.Notes = [[
9+
Swaps layers 1 and 2 for the selected region.
10+
]]
11+
return "Swap layers 1 and 2", "Swap layers 1 and 2", "Swaps layers 1 and 2"
12+
end
13+
14+
--[[
15+
$module Layer
16+
]] --
17+
local layers = {}
18+
19+
--[[
20+
% copy(source_layer, destination_layer)
21+
22+
Duplicates the notes from the source layer to the destination. The source layer remains untouched.
23+
24+
@ region (FCMusicRegion) the region to be copied
25+
@ source_layer number the number (1-4) of the layer to duplicate
26+
@ destination_layer number the number (1-4) of the layer to be copied to
27+
]]
28+
function layers.copy(region, source_layer, destination_layer)
29+
local start = region.StartMeasure
30+
local stop = region.EndMeasure
31+
local sysstaves = finale.FCSystemStaves()
32+
sysstaves:LoadAllForRegion(region)
33+
source_layer = source_layer - 1
34+
destination_layer = destination_layer - 1
35+
for sysstaff in each(sysstaves) do
36+
staffNum = sysstaff.Staff
37+
local noteentry_source_layer = finale.FCNoteEntryLayer(source_layer, staffNum, start, stop)
38+
noteentry_source_layer:Load()
39+
local noteentry_destination_layer = noteentry_source_layer:CreateCloneEntries(
40+
destination_layer, staffNum, start)
41+
noteentry_destination_layer:Save()
42+
noteentry_destination_layer:CloneTuplets(noteentry_source_layer)
43+
noteentry_destination_layer:Save()
44+
end
45+
end -- function layer_copy
46+
47+
--[[
48+
% clear(layer_to_clear)
49+
50+
Clears all entries from a given layer.
51+
52+
@ region (FCMusicRegion) the region to be cleared
53+
@ layer_to_clear number the number (1-4) of the layer to clear
54+
]]
55+
function layers.clear(region, layer_to_clear)
56+
layer_to_clear = layer_to_clear - 1 -- Turn 1 based layer to 0 based layer
57+
local start = region.StartMeasure
58+
local stop = region.EndMeasure
59+
local sysstaves = finale.FCSystemStaves()
60+
sysstaves:LoadAllForRegion(region)
61+
for sysstaff in each(sysstaves) do
62+
staffNum = sysstaff.Staff
63+
local noteentrylayer = finale.FCNoteEntryLayer(layer_to_clear, staffNum, start, stop)
64+
noteentrylayer:Load()
65+
noteentrylayer:ClearAllEntries()
66+
end
67+
end
68+
69+
--[[
70+
% swap(swap_a, swap_b)
71+
72+
Swaps the entries from two different layers (e.g. 1-->2 and 2-->1).
73+
74+
@ region (FCMusicRegion) the region to be swapped
75+
@ swap_a number the number (1-4) of the first layer to be swapped
76+
@ swap_b number the number (1-4) of the second layer to be swapped
77+
]]
78+
function layers.swap(region, swap_a, swap_b)
79+
local start = region.StartMeasure
80+
local stop = region.EndMeasure
81+
local sysstaves = finale.FCSystemStaves()
82+
sysstaves:LoadAllForRegion(region)
83+
-- Set layers for 0 based
84+
swap_a = swap_a - 1
85+
swap_b = swap_b - 1
86+
for sysstaff in each(sysstaves) do
87+
staffNum = sysstaff.Staff
88+
local noteentrylayer_1 = finale.FCNoteEntryLayer(swap_a, staffNum, start, stop)
89+
noteentrylayer_1:Load()
90+
noteentrylayer_1.LayerIndex = swap_b
91+
--
92+
local noteentrylayer_2 = finale.FCNoteEntryLayer(swap_b, staffNum, start, stop)
93+
noteentrylayer_2:Load()
94+
noteentrylayer_2.LayerIndex = swap_a
95+
noteentrylayer_1:Save()
96+
noteentrylayer_2:Save()
97+
end
98+
end
99+
100+
101+
102+
103+
function layers_swap_1_2()
104+
layers.swap(finenv.Region(), 1, 2)
105+
end
106+
107+
layers_swap_1_2()

dist/mmrest_widen_to_tempo_mark.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ Returns the horizontal EVPU offset for a smart shape endpoint to align exactly w
18481848
]]
18491849
function expression.calc_handle_offset_for_smart_shape(exp_assign)
18501850
local manual_horizontal = exp_assign.HorizontalPos
1851-
local def_horizontal = 0
1851+
local def_horizontal = 0
18521852
local alignment_offset = 0
18531853
local exp_def = exp_assign:CreateTextExpressionDef()
18541854
if nil ~= exp_def then

dist/note_automatic_jete.lua

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ function plugindef()
1717
To use the script, you enter the notes you want to display, and it removes the noteheads in between the first
1818
and last notehead, adjusts any staccato dots, and adds a gliss mark (tab slide) between the first and last notes,
1919
unless there is one already there. If you want a slur as well, add it manually before or after running the script.
20-
20+
2121
The steps to use this script are:
2222
2323
1. Add the notes you want to display, with or without accidentals. Normally you choose notes with noteheads
24-
that follow a straight-line path as closely as possible. They can be reduced size or grace notes.
24+
that follow a straight-line path as closely as possible. They can be reduced size or grace notes.
2525
2. Add staccato dots if you want them.
2626
3. Add a slur if you want it.
2727
4. Run the script on the pattern you just entered.
@@ -35,7 +35,7 @@ function plugindef()
3535
if the articulation is set to avoid staff lines.)
3636
5. Adds a gliss mark (tab slide) between the first and last notes, if one does not already exist.
3737
If you have entered parallel chords, it adds a gliss mark for each note in the chord.
38-
38+
3939
By default, the script does not hide the last selected note (or any accidentals it may have). You can override
4040
this behavior with a configuration file or if you are using RGP Lua 0.59 or higher, you can cause the script
4141
to hide the last note by holding down Shift, Option (Mac), or Alt (Win) when you invoke it.
@@ -1488,11 +1488,11 @@ end
14881488

14891489

14901490

1491-
local max_layers = 4 -- this should be in the PDK, but for some reason isn't
1491+
local max_layers = 4 -- this should be in the PDK Framework, but for some reason isn't
14921492

14931493
local config = {
1494-
dot_character = 46, -- ascii code for '.'
1495-
hide_last_note = false
1494+
dot_character = 46, -- ascii code for '.'
1495+
hide_last_note = false,
14961496
}
14971497

14981498
if library.is_font_smufl_font() then
@@ -1528,7 +1528,7 @@ function add_gliss_line_if_needed(start_note, end_note)
15281528
local smartshape = finale.FCSmartShape()
15291529
smartshape.ShapeType = finale.SMARTSHAPE_TABSLIDE
15301530
smartshape.EntryBased = true
1531-
smartshape.BeatAttached= false
1531+
smartshape.BeatAttached = false
15321532
smartshape.MakeHorizontal = false
15331533
smartshape.PresetShape = true
15341534
smartshape.Visible = true
@@ -1614,7 +1614,7 @@ function note_automatic_jete()
16141614
local lpoint = nil
16151615
local rpoint = nil
16161616
local dot_artic_def = 0
1617-
for entry in eachentrysaved(staff_region) do -- don't use pairs(entries) because we need to save the entries on this pass
1617+
for entry in eachentrysaved(staff_region) do -- don't use pairs(entries) because we need to save the entries on this pass
16181618
if nil ~= entries[entry.EntryNumber] then
16191619
if entry.EntryNumber == first_entry_num then
16201620
local last_entry = entries[last_entry_num]
@@ -1653,15 +1653,17 @@ function note_automatic_jete()
16531653
-- shift dot articulations, if any
16541654
if lpoint and rpoint and (lpoint.X ~= rpoint.X) then -- prevent divide-by-zero, but it should not happen if we're here
16551655
local linear_multplier = (rpoint.Y - lpoint.Y) / (rpoint.X - lpoint.X)
1656-
local linear_constant = (rpoint.X*lpoint.Y - lpoint.X*rpoint.Y) / (rpoint.X - lpoint.X)
1656+
local linear_constant = (rpoint.X * lpoint.Y - lpoint.X * rpoint.Y) / (rpoint.X - lpoint.X)
16571657
finale.FCNoteEntry.MarkEntryMetricsForUpdate()
16581658
for key, entry in pairs(entries) do
16591659
if (entry.EntryNumber ~= first_entry_num) and (entry.EntryNumber ~= last_entry_num) then
16601660
local artic, arg_point = find_staccato_articulation(entry, dot_artic_def)
16611661
if nil ~= artic then
1662-
local new_y = linear_multplier*arg_point.X + linear_constant -- apply linear equation
1662+
local new_y = linear_multplier * arg_point.X + linear_constant -- apply linear equation
16631663
local old_vpos = artic.VerticalPos
1664-
artic.VerticalPos = artic.VerticalPos - (note_entry.stem_sign(entry) * (math.floor(new_y + 0.5) - arg_point.Y))
1664+
artic.VerticalPos = artic.VerticalPos -
1665+
(note_entry.stem_sign(entry) *
1666+
(math.floor(new_y + 0.5) - arg_point.Y))
16651667
artic:Save()
16661668
end
16671669
end

0 commit comments

Comments
 (0)