I recently developed an algorithm in Python that allows me to generate time signatures and metronome markings and output them as LilyPond code. I use metronome indications with up to three decimal places and also irrational time signatures (such as 7/23).
Now, unfortunately, LilyPond is not very reliable when it comes to outputting that code. Sometimes it works, sometimes it doesn't, sometimes it only works up to a certain point and then it doesn't. I believe that this is due to the \scaleDurations function, but I am not sure. What would support this assumption is that if I change the denominator of a fraction where the output stops - for example, 57/40 instead of 57/41 in the last measure of the following example - the output works again.
Perhaps someone knows the cause of the problem?
Here is an example of a musical expression that works for me up to the 12th measure, but no longer works at the 13th:
\version "2.24.2"
musicone = {
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 1 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 41/47 {
\time 7/22
\set Staff.timeSignatureFraction = #'(7 . 22)
\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note {8} #1 " = 50.0 " } } }
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 7 { c'16 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 2 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 6/5 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 3 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 6/5 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 4 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 41/47 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note {8} #1 " = 68.753 " } } }
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 5 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 41/47 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 6 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 37/28 {
\time 7/16
\set Staff.timeSignatureFraction = #'(7 . 16)
\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note {8} #1 " = 45.4 " } } }
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 7 { c'16 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 7 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 37/28 {
\time 17/64
\set Staff.timeSignatureFraction = #'(17 . 64)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 17 { c'64 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 8 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 38/33 {
\time 5/14
\set Staff.timeSignatureFraction = #'(5 . 14)
\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note {8} #1 " = 59.55 " } } }
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 5 { c'16 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 9 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 1 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 10 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 1 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 11 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 59/47 {
\time 15/53
\set Staff.timeSignatureFraction = #'(15 . 53)
\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note {8} #1 " = 57.804 " } } }
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 15 { c'64 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 12 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 27/26 {
\time 2/8
\set Staff.timeSignatureFraction = #'(2 . 8)
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8 }
|
}
\once \set Staff.whichBar = "|"
%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 13 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 57/41 {
\time 23/64
\set Staff.timeSignatureFraction = #'(23 . 64)
\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note {8} #1 " = 43.164 " } } }
% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 23 { c'64 }
|
}
\once \set Staff.whichBar = "|"
}
\score { \musicone
\layout {
\context {\Voice
\remove "Forbid_line_break_engraver"
}
\context { \Score
measureBarType=#""
proportionalNotationDuration = #(ly:make-moment 1 64) }
}
}