Browse Source

more time signatures with better lilypond export

master
Nils 2 months ago
parent
commit
5b7f9bb0d3
  1. 86
      engine/api.py

86
engine/api.py

@ -1972,22 +1972,31 @@ def setInitialMetricalInstruction(treeOfInstructions, lilypondOverride:str=None)
def commonMetricalInstructionsAsList():
"""for musical reasons 5/4 and 7/8 and other a-symetrical
metrical instructions cannot be in here since it is unknown which
internal version the user wants. And we don't want to pollute this with all possible
permutations like 5/4: 3+2+2; 5/4: 2+3+2 etc."""
"""This is the order in which they appear in various GUI menus"""
return [
"off",
"2/4",
"4/4",
"8/4 (2x 4/4)",
"3/4",
"6/8",
"2/4",
"12/8",
"6/4",
"3/2",
"6/4 (3x 2/4)",
"6/4 (2x 3/4)",
"3/8",
"6/8 (2x 3/8)",
"12/8 (4x 3/8)",
"7/8 (3+2+2)",
"7/8 (2+3+2)",
"7/8 (2+2+3)",
"5/4 (3+2)",
"5/4 (2+3)",
"1/1",
"3/2",
"8/4",
]
def insertCommonMetricalInstrucions(scheme, setInitialInsteadCursorInsert=False):
@ -1995,29 +2004,52 @@ def insertCommonMetricalInstrucions(scheme, setInitialInsteadCursorInsert=False)
they will not work when exported."""
schemes = {
"off" : (),
"2/4" : (D4, D4),
"3/4" : (D4, D4, D4),
"4/4" : ((D4, D4), (D4, D4)),
"6/8" : (int(D4*1.5),int(D4*1.5)), #aka 2/4 with triplet sub-level
"12/8" : ((D8, D8, D8), (D8, D8, D8), (D8, D8, D8), (D8, D8, D8)), #aka 4/4 with triplet sub-level
"6/4" : ((D4, D4, D4),(D4, D4, D4)),
"8/4 (2x 4/4)" : (((D4, D4), (D4, D4)), ((D4, D4), (D4, D4))), #combination of two 4/4 but the "second measure" is not as important.
"3/4" : (D4, D4, D4),
"3/2" : (D2, D2, D2),
"6/4 (3x 2/4)" : ((D4, D4),(D4, D4),(D4, D4),),
"6/4 (2x 3/4)" : ((D4, D4, D4),(D4, D4, D4)),
"3/8" : (D8, D8, D8),
"6/8 (2x 3/8)" : (int(D4*1.5),int(D4*1.5)), #aka 2/4 with triplet sub-level
"12/8 (4x 3/8)" : ((D8, D8, D8), (D8, D8, D8), (D8, D8, D8), (D8, D8, D8)), #aka 4/4 with triplet sub-level
"7/8 (3+2+2)" : ((D8, D8, D8), (D8, D8), (D8, D8)),
"7/8 (2+3+2)" : ((D8, D8), (D8, D8, D8), (D8, D8)),
"7/8 (2+2+3)" : ((D8, D8), (D8, D8), (D8, D8, D8)),
"5/4 (3+2)" : ((D4, D4, D4), (D4, D4)),
"5/4 (2+3)" : ((D4, D4), (D4, D4, D4)),
"1/1" : (D1,),
"3/2" : (D2, D2, D2),
"8/4" : (((D4, D4), (D4, D4)), ((D4, D4), (D4, D4))), #combination of two 4/4 but the "second measure" is not as important.
}
lilypond = {
"off" : "\\mark \"X\" \\cadenzaOn",
"2/4" : "\\cadenzaOff \\time 2/4",
"3/4" : "\\cadenzaOff \\time 3/4",
"4/4" : "\\cadenzaOff \\time 4/4",
"6/8" : "\\cadenzaOff \\time 6/8",
"12/8" : "\\cadenzaOff \\time 12/8",
"6/4" : "\\cadenzaOff \\time 6/4",
"3/8" : "\\cadenzaOff \\time 3/8",
"1/1" : "\\cadenzaOff \\time 1/1",
"3/2" : "\\cadenzaOff \\time 3/2",
"8/4" : "\\cadenzaOff \\time 8/4",
"off" : "\\mark \"X\" \\cadenzaOn",
"2/4" : "\\cadenzaOff \\time 2/4",
"4/4" : "\\cadenzaOff \\time 4/4",
"8/4 (2x 4/4)" : "\\cadenzaOff \\time 8/4",
"3/4" : "\\cadenzaOff \\time 3/4",
"3/2" : "\\cadenzaOff \\time 3/2",
"6/4 (3x 2/4)" : "\\cadenzaOff \\time 2,2,2 6/4",
"6/4 (2x 3/4)" : "\\cadenzaOff \\time 3,3 6/4",
"3/8" : "\\cadenzaOff \\time 3/8",
"6/8 (2x 3/8)" : "\\cadenzaOff \\time 6/8",
"12/8 (4x 3/8)" : "\\cadenzaOff \\time 12/8",
"7/8 (3+2+2)" : "\\cadenzaOff \\time 3,2,2 7/8",
"7/8 (2+3+2)" : "\\cadenzaOff \\time 2,3,2 7/8",
"7/8 (2+2+3)" : "\\cadenzaOff \\time 2,2,3 7/8",
"5/4 (3+2)" : "\\cadenzaOff \\time 3,2 5/4",
"5/4 (2+3)" : "\\cadenzaOff \\time 2,3 5/4",
"1/1" : "\\cadenzaOff \\time 1/1",
}
if setInitialInsteadCursorInsert:

Loading…
Cancel
Save