Irrationale Taktarten mit \scaleDurations ausgeben

Begonnen von kleinlosen, Dienstag, 17. Oktober 2023, 14:27

« vorheriges - nächstes »

kleinlosen

Hallo in die Runde,

seit geraumer Zeit nun versuche ich schon, ein Problem, das die Ausgabe von LilyPond-Code betrifft, zu lösen – leider vergebens. Vielleicht kann mir hier jemand helfen?

Zur »Vorgeschichte«: Ich habe in Python zwei Algorithmen geschrieben. Zunächst einen, mit dem ich Taktarten und Metronomangaben generiere. Ich verwende hier »normale« wie auch irrationale Taktarten (wie z. B. 7/23 oder 5/12) und Metronomangaben mit bis zu drei Nachkommastellen. Der zweite Algorithmus wandelt die Listen an Taktarten und Metronomangaben dann in LilyPond-Code um.

Die Werte der einzelnen Funktionen des Codes (vgl. unten) berechnen sich wie folgt:

\scaleDurations = (notierter Notenwert * 60000) / (Notenwert * (Metronomangabe * 1000)). Notierter Notenwert ist der Notenwert, der bei irrationalen Notenwerten notiert wird (so werden 12tel-Noten gemeinhin als 8tel-Noten notiert usw.); Notenwert ist der eigentliche Notenwert (z. B. 12tel); und die Metronomangabe hat bis zu drei Nachkommastellen. Bei einem 7/23-Takt im Tempo Achtel = 62.375 ergibt das, wenn 23tel-Noten als 16tel notiert werden, (16*60000) / (23*(62.375*1000)).

\time = \scaleDurations * Taktart

Nun ist es so, dass die Ausgabe des Codes einwandfrei funktioniert – aber stets nur bis zu einem bestimmten Punkt. Ab einem bestimmten Takt bricht die Ausgabe einfach ab. Ich bin mir nun nicht sicher, ob das Problem an meinem Code liegt oder doch an Frescobaldi. (Ich benutze LilyPond Version 2.24.2 in Frescobaldi 3.3.0 auf einem macOS Verntura 13.4.1.)

Im Folgenden nun der Code insgesamt 24 solcher Takte. Frescobaldi gibt den Code korrekt bis zum inkl. ersten Ton des 6. Taktes aus, mehr nicht. Eine Fehlermeldung wird nicht generiert.

Wie ist es bei euch? Funktioniert die Ausgabe einwandfrei oder bricht sie auch irgendwo ab?

Vielen Dank schonmal für jedwede Hilfe!

\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) }     
   }
 }

kleinlosen

#1
PS: Kleiner Denkfehler: Bei den \repeat unfold Sektionen sollte wohl zuerst der notierte Notenwert und dann der Notenwert kommen. In Takt 2 also \repeat unfold 9 { c'32*32/47 }. (Habe das nun verbessert.) Aber auch, wenn man diesen Fehler behebt, funktioniert die Ausgabe nicht einwandfrei.

harm6

Hallo kleinlosen :)

willkommen im Forum.
Ich habe mich ein bißchen damit beschäftigt, aber letztlich keine Ahnung warum es nicht funktioniert, besonders ärgerlich finde ich das Fehlen jeglicher messages/warnings/errors...
Aber ich habe herausgefunden, daß Dein Code mit Version 2.20.0 vollständig kompiliert (abgesehen von \textMark ..., das gabs damals noch nicht). Natürlich gibts jede Menge:
warning: strange time signature found: ...

Nun kann 2.20.0 natürlich ein unbeabsichtigter Zufall sein (keine andere Version drüber oder drunter hat funktioniert).
An Deiner Stelle würde ich das Problem mal als potentiellen bug auf der internationalen Liste vorstellen.

Gruß,
  Harm


kleinlosen

Hallo Harm,
danke für die nette Begrüßung. Und natürlich für Deine Mühen. Ich habe mich jetzt an die englischsprachige Mailing Liste gewandt; vielleicht kann das Problem ja auf diesem Wege behoben werden.
Nochmals Danke und bester Gruß

kleinlosen

Hier ein kleines Update:

Die Antwort vonseiten der englischsprachigen Mailing Liste hat nicht lange auf sich warten lassen. Das Problem lag schlichtweg darin, dass die Nenner der Werte für \scaleDurations zu groß waren (Stichwort: "overflow issue"). Wenn ich sie auf <=9 reduziere (in Python mit der Methode limit_denominator(9)), funktioniert's.

Warum der Code mit Version 2.20.0 vollständig kompiliert, ist damit zwar nicht beantwortet. Aber jetzt geht's ja auch so (wenngleich die Ausgabe nicht ganz so genau ist – aber genau genug).

Herzlicher Gruß