# compiling irrational time signatures with \scaleDurations

Hello to all,


for quite some time now I've been trying to solve a problem concerning the
output of LilyPond code - unfortunately in vain. Maybe someone can help me
here?

About the "back story": I have written two algorithms in Python. First one,
with which I generate time signatures and metronome markings. I use
"normal" as well as irrational time signatures (like 7/23 or 5/12) and
metronome markings with up to three decimal places. The second algorithm
then converts the lists of time signatures and metronome markings into
LilyPond code.

The values of the individual functions of the code (attched) are calculated
as follows:

\scaleDurations = (notated note value * 60000) / (note value * (metronome
marking * 1000)). Notated note value is the note value that is notated for
irrational note values (for example, 12th notes are commonly notated as 8th
notes, etc.); note value is the actual note value (e.g., 12th notes); and
the metronome marking has up to three decimal places. For a 7/23 measure
with a metronome marking of eight note = 62.375, if 23rd notes are notated
as 16th notes, this gives (16*60000) / (23*(62.375*1000)).

\time = \scaleDurations * time signature

Now the output of the code works fine - but always only up to a certain
point. After a certain measure the output simply stops. I'm not sure now if
the problem is with my code or with Frescobaldi after all. (I am using
LilyPond version 2.24.2 in Frescobaldi 3.3.0 on a macOS Ventura 13.4.1).

Attached now is the code for a total of 24 such bars (once as a LilyPond
file and once as a text file). (I know, minimal examples are better in
principle, but in this case it would not make sense, because the output
stops after a couple of bars). Frescobaldi outputs the code correctly up to
the first note of the 4th bar, nothing more. An error message is not
generated.

How is it with you? Does the output work correctly or does it also break
off somewhere? I have already asked the same question in the German
LilyPond forum. A LilyPond user pointed out to me that the code seems to
work only in version 2.20.0, but not in any other version.

Thanks a lot for any help!

Kind regards,


\version "2.24.2"

musicone = {

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 1 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 49/50 {
\time 98/400
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 49/50)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 61.213 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 2 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 2/3 {
\time 18/141
\set Staff.timeSignatureFraction = #'(9 . 47)
\set baseMoment = #(ly:make-moment 2/3)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 9 { c'32*32/47 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 3 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 35/38 {
\time 70/304
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 35/38)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 65.073 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 4 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 37/33 {
\time 296/1683
\set Staff.timeSignatureFraction = #'(8 . 51)
\set baseMoment = #(ly:make-moment 37/33)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 67.176 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 8 { c'64*64/51 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 5 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 25/42 {
\time 100/504
\set Staff.timeSignatureFraction = #'(4 . 12)
\set baseMoment = #(ly:make-moment 25/42)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 4 { c'8*8/12 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 6 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 15/13 {
\time 30/104
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 15/13)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 52.0 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 7 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 15/13 {
\time 30/104
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 15/13)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 8 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 19/14 {
\time 247/448
\set Staff.timeSignatureFraction = #'(13 . 32)
\set baseMoment = #(ly:make-moment 19/14)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 44.195 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 13 { c'32*32/32 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 9 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 19/14 {
\time 323/896
\set Staff.timeSignatureFraction = #'(17 . 64)
\set baseMoment = #(ly:make-moment 19/14)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 17 { c'64*64/64 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 10 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 15/13 {
\time 30/104
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 15/13)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 52.0 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 11 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 11/14 {
\time 231/658
\set Staff.timeSignatureFraction = #'(21 . 47)
\set baseMoment = #(ly:make-moment 11/14)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 21 { c'32*32/47 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 12 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 10/7 {
\time 20/56
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 10/7)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 42.006 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 13 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 10/7 {
\time 20/56
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 10/7)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 14 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 8/9 {
\time 16/72
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 8/9)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 67.414 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 15 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 8/9 {
\time 16/72
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 8/9)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 16 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 33/23 {
\time 231/736
\set Staff.timeSignatureFraction = #'(7 . 32)
\set baseMoment = #(ly:make-moment 33/23)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 41.827 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 7 { c'32*32/32 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 17 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 24/25 {
\time 48/200
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 24/25)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 62.482 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 18 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 24/25 {
\time 48/200
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 24/25)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 19 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 15/13 {
\time 30/104
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 15/13)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 52.0 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 20 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 14/11 {
\time 126/319
\set Staff.timeSignatureFraction = #'(9 . 29)
\set baseMoment = #(ly:make-moment 14/11)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 9 { c'32*32/29 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 21 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 37/38 {
\time 74/304
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 37/38)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 61.641 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 22 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 37/38 {
\time 74/304
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 37/38)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 23 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 15/13 {
\time 75/208
\set Staff.timeSignatureFraction = #'(5 . 16)
\set baseMoment = #(ly:make-moment 15/13)

\textMark \markup {\left-column {\line { \smaller \general-align #Y #DOWN \note
{8} #1 " = 52.0 " } } }

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 5 { c'16*16/16 }
|
}

\once \set Staff.whichBar = "|"

%%%%%%%%%%%%%%%%%%%%%%% MEASURE : 24 %%%%%%%%%%%%%%%%%%%%%%%
\scaleDurations 15/13 {
\time 30/104
\set Staff.timeSignatureFraction = #'(2 . 8)
\set baseMoment = #(ly:make-moment 15/13)

% The music will later be put here. For now, use the \repeat unfold expression
\repeat unfold 2 { c'8*8/8 }
|
}

\once \set Staff.whichBar = "|"

}

\score { \musicone
\layout {
\context {\Voice
\remove "Forbid_line_break_engraver"
}
\context { \Score
measureBarType=#""
proportionalNotationDuration = #(ly:make-moment 1 32) }

}
}

scaleDurations.ly
Description: Binary data