Deutsches Lilypond Forum (Archiv)
Allgemein => Fragen zu Funktionen => Thema gestartet von: trulli am Samstag, 7. Mai 2011, 08:07
-
Hallo Leute,
nach langem Probieren mit den üblichen \paper Prametern, wie page-count oder system-count bin ich in einem Stück einfach zu keinem befriedigenden Layout Ergebnis gekommen.
Jetzt möchte ich, dass in jeder Zeile zwei Takte stehen, bis auf eine Zeile, dort sollen 4 Takte stehen.
Meine Frage: kann ich direkt im Notencode etwas setzen wie \TakteProZeile = 2 ?
Vielleicht habt ihr ja einen Rat für mich... wenn nicht könnte ich mit vielen \pageBreak auch noch zum Ziel kommen.
Danke schon mal und Grüße von Mat
-
ich verwende jeweils folgendes konstrukt:
\context Staff <<
\context Voice = "umbruch" {
\repeat unfold 7 {s1 * 2 \break}
}
\context Voice = "1" {
c4 d e f | g a b c |
c4 d e f | g a b c |
c4 d e f | g a b c |
…
}
>>
-
zusätzlich kann man noch verhindern, dass an unpassender stelle weitere umbrüche passieren:
umbrüche = \context Voice = "umbrüche" {
\override NonMusicalPaperColumn #'line-break-permission = ##f
\repeat unfold 7 {s1 * 2 \break}
s1 * 4 \break
\repeat unfold 7 {s1 * 2 \break}
}
-
Hallo Trulli,
ding-dong's Weg klappt natürlich sehr gut.
Ich habe mal eine Funktion gebaut, die das macht:
\version "2.12.3"
takteProZeilen =
#(define-music-function (parser location barlength lines-bars )(integer? pair?)
#{
\repeat unfold $(car lines-bars) {
\repeat unfold $(cdr lines-bars) {
\repeat unfold $barlength { s16 } }
\break
}
#})
one = {
\relative c' {
\time 4/4
c4 d e f | g a b c |
c, d e f | g a b c |
\time 3/4
c, d e | g a b |
c, d e | g a b |
\time 6/16
c,16. d e f | g a b c |
c, d e f | g a b c |
c, d e f | g a b c |
c, d e f | g a b c |
\time 2/4
g8 a b c |
c, d e f |
\time 4/4
g4 a b c | \break
c4 d e f | g a b c |
}
}
two = {
\takteProZeilen #16 #'(2 . 2) % 2 Zeilen zu 2 Takte, die jeweils 16 16-tel lang sind (also 8/8 4/4 2/2 etc.)
\takteProZeilen #12 #'(1 . 4) % 1 Zeile zu 4 Takte, die jeweils 12 16-tel lang sind (also 3/4 6/8 etc)
\takteProZeilen #6 #'(4 . 2) % 4 Zeilen zu 2 Takte, die jeweils 6 16-tel lang sind (also 3/8 etc)
s2*8
}
\score { \new Staff \with { \override NonMusicalPaperColumn #'line-break-permission = ##f }
<<
\new Voice \one
\new Voice \two
>>
}
Anwendung:
\takteProZeilen #16 #'(2 . 2) in eine eigene Stimme setzen.
\takteProZeilen #16 #'(2 . 2) ist die Länge der Takte in 16-teln
\takteProZeilen #16 #'(2 . 2) ist die Anzahl der Zeilen im gewünschten Modus
\takteProZeilen #16 #'(2 . 2) ist die Anzahl der Takte pro Zeile
Anmerkungen:
Exotische Takte wie 1/32 sind jetzt nicht durch meine Funktion umbrechbar, da ich glaubte, daß sie zu selten vorkommen. Durch minimale Veränderung der Definition wäre es aber natürlich machbar.
Am Praktischsten wäre es die Länge des Taktes automatisch auslesen zu lassen, das habe ich aber nicht hinbekommen. Insofern werden auch keine Taktwechsel innerhalb einer Zeile erfaßt. Als work-around geht dann der manuelle Umbruch: \takteProZeilen dort eben nicht setzen und mit dem üblichen \break arbeiten.
Gruß,
Harm
-
Hallo,
das Taktwechsel-Problem kann gelöst werden, indem man nicht die Länge des Taktes, sondern die Länge der Zeile berücksichtigt. Diese kann ja gar nicht von lily ausgelesen werden, da wir sie ja erst zu setzen wünschen. Die Methode ist hier wieder das Abzählen der 16-tel.
Das ist allerdings mühsam!! Wie kann man das verbessern?
Taktwechsel (wo auch immer) haben jetzt keine Bedeutung mehr. Der Code ist auch einfacher geworden:
\version "2.12.3"
zeilenLänge =
#(define-music-function (parser location lines-length)(pair?)
#{
\repeat unfold $(car lines-length) {
\repeat unfold $(cdr lines-length) { s16 }
\break
}
#})
one = {
\relative c' {
\time 4/4
c4 d e f | g a b c |
c, d e f | g a b c |
\time 3/4
c, d e | g a b |
c, d e | g a b |
\time 6/16
c,16. d e f | g a b c |
c, d e f | g a b c |
c, d e f | g a b c |
c, d e f | g a b c |
\time 2/4
g8 a b c |
c, d e f |
\time 4/4
g4 a b c |
c4 d e f | g a b c |
}
}
two = {
\zeilenLänge #'(2 . 32) % 2 Zeilen, die jeweils 32 16-tel lang sind
\zeilenLänge #'(1 . 48) % 1 Zeile, die 48 16-tel lang ist
\zeilenLänge #'(4 . 12) % 4 Zeilen, die jeweils 12 16-tel lang sind
\zeilenLänge #'(2 . 32)
}
\score { \new Staff \with { \override NonMusicalPaperColumn #'line-break-permission = ##f }
<<
\new Voice \one
\new Voice \two
>>
}
Gruß,
Harm
-
Wow, was ihr wieder so alles wisst :o
Vielen Dank an euch beide (besonders an harm6 für die Funktion)!!!
Damit bin ich bereits am Ziel. :)
Grüße von trulli
-
Bei mir funktioniert der von harm6 vorgestellte Code nur anfangs und anschließend nimmt Lilypond wieder das Standardverhalten bei den Systemlängen an.
An Beispiel meines Problems erkennt man an folgendem Code:
\version "2.16.2"
\paper {
}
\layout {
}
zeilenLänge =
#(define-music-function (parser location lines-length)(pair?)
#{
\repeat unfold $(car lines-length) {
\repeat unfold $(cdr lines-length) { s16 }
\break
}
#})
PartPOneVoiceOne = \relative d' {
\clef "treble"
\key d \minor
\time 4/4 | % 1
\tempo "Allegro risoluto" 4=144
\stemNeutral
\tieNeutral
<d a'>8\( \mf [ <f d'>8 ] <a f'>8 <d a'>8 ~ <d a'>8 <a f'>8 <d a'>8
[ a8 ]\) | % 2
<cis, a'>8\( [ <f cis'>8 ] <a f'>8 <cis a'>8 ~ <cis a'>8 <a f'>8 <cis a'>8 [ a8 ]\)
| % 3
<c, a'>8\( [ <e c'>8 ] <a f'>8 <c a'>8 ~ <c a'>8 <a f'>8 <c a'>8 [ a8 ]\) | % 4
\slurDown <d, b'>8 _>( [ b8) <g' d'>8 _>( d8) ] \slurNeutral <b' g'>8 ^>( [ g8) <d' b'>8( ^> b8) ]
| % 5
\mergeDifferentlyHeadedOn
\mergeDifferentlyDottedOn
d8 [ bes8 f8 d8 ] e'8 [ bes8 f8 e8 ] | % 6
\stemUp f'8 [ c8 a8 f8 ] g'8 [ c,8 a8 g8 ] | % 7
a'8 [ d,8 bes8 a8 ] bes'8 [ g8 d8 bes8 ] | % 8
cis'8 [ a8 e8 cis8 ] e'8 [ cis8 ] a4 | % 9
\stemNeutral \mergeDifferentlyHeadedOff
\mergeDifferentlyDottedOff <bes,, d a'>4\( \mf \arpeggio f'8 f4 d8 f8 [ e8 ~
] | %10
e8 [ f8 ] g2\) d8\( [ d8 ] | % 11
<c e>4 c8 g'4 c,8 e8 [ e8 ] | % 12
d2\) d4\( f4 | % 13
<bes, d g>4 a'8 g8 ~ g4 g8 [ g8 ] | % 14
<c, a'>4 e8 e4 c8 g'8 [ g8 ] | % 15
f8\) [ <c c'>8 _> <cis cis'>8 _> <d d'>8 _> ] b'8 \rest <a a'>8 ^> ^. [ <g
g'>8 ^> ^. <f f'>8 ~ ^> ] ~ | % 16
\time 6/4 <f f'>4 <f f'>8 ^> [ <g g'>8 ~ ^> ] ~ <g g'>8 [ <c, e c'>8
_> ] <c e c'>2 _> b'4 \rest | % 17
\time 4/4 | % 17
<a d a'>4\( \f \arpeggio <f f'>8 <f f'>8 ~ <f f'>8 <d d'>8
<f f'>8 [ <e e'>8 ~ ] ~ | % 18
<e e'>8 [ <f f'>8 ] <g g'>2\) <d d'>8 _> \( [ <d d'>8 _> ] | % 19
<e e'>4 <c c'>8 <g' g'>4 <a a'>8 <g g'>8 [ <g g'>8 ] | %20
<f a f'>2\) <d d'>4\( <a' a'>4 | % 21
<bes d bes'>4 \arpeggio <f bes f'>8 <f bes f'>8 ~ <f bes f'>4
<d d'>8 [ <f f'>8 ] | % 22
<e e'>4 <f f'>8 <g g'>4 <c, c'>8 <e e'>8 [ <f f'>8 ~ ] ~ | % 23
<f f'>4. <f f'>8 ^. <g g'>8 _. [ <e e'>8 _. <c c'>8 _. <d d'>8 ~ ] ~
| % 24
<d d'>4.\) <d d'>8\( _. <a' a'>8 ^. [ <f f'>8 ^. <g g'>8 ^. <f f'>8 ~ ]
~ | % 25
<f f'>4 <d f d'>4 <bes' d f bes>8 \arpeggio
<a d a'>4 <g c g'>8 ~ ~ ~ | % 26
<g c g'>8 [ <f f'>8 <g g'>8 <g g'>8 ] <e g e'>4. <c e c'>8 | % 27
<c e c'>4 <bes' bes'>4 <a a'>8 <e e'>8 <g g'>8 [ <g g'>8 ] | % 28
<f a f'>2\) r8 <a a'>8\( [ <g g'>8 <f f'>8 ~ ] ~ | % 29
<f f'>8 [ <d d'>8 ] <d d'>4.\) <d d'>8\( <a' a'>8 [ <g g'>8 ~ ] ~ | %30
<g g'>8 [ <a a'>8 ] <e e'>2\) <c c'>8\( [ <c c'>8 ] | % 31
<a' a'>4 <a a'>8 <g g'>4 <c, c'>8 <c c'>8 [ <d d'>8 ~ ] ~ | % 32
<d d'>4.\) <d d'>8\( _. <a' a'>8 ^. [ <f f'>8 ^. <g g'>8 ^. <f f'>8 ~ ]
~ | % 33
<f f'>4 <d f d'>4 <bes' d f bes>8 <a d a'>4 <g c g'>8 ~ ~ ~ | % 34
<g c g'>8 [ <f f'>8 <g g'>8 <g g'>8 ] <e g e'>4. <c e c'>8 | % 35
<c e c'>4 <bes' bes'>8 <a a'>8 ~ <a a'>8 <e e'>8 <g g'>8 [ <g g'>8 ] | % 36
<f a f'>2\) r8 <d d'>8\<\( [ <e e'>8 <f f'>8
~ ] ~ | % 37
<f f'>4 <g g'>8 <f f'>4\) <e e'>8\( <f f'>8 [ <g g'>8 ~ ] ~ | % 38
<g g'>4 <a a'>8 <g g'>8 ~ <g g'>4\) <bes bes'>8\( [ <a a'>8 ~ ] ~ | % 39
<a a'>8 [ <g g'>8 ] <a a'>8 <bes d bes'>8 ~ <bes d bes'>4. <bes d bes'>8 ~ ^> ~ ~ |% 40
<bes d bes'>8 <c c'>4 <a a'>4 <g g'>8 <a a'>4 ~ ~ | % 41
\key a \minor
<a a'>4\) <a a'>8\( [ <a a'>8 ] <gis gis'>8 [ <a a'>8 ] <b
b'>4 | % 42
<c e c'>8\! \ff [ <b b'>8 ] <g g'>8 <g g'>4 <e e'>8 <b' b'>8 [ <b b'>8
] | % 43
<a c f a>2\) r8 <e e'>8\( [ <g g'>8 <f f'>8 ] | % 44
<a d>4 <a d a'>8 <g b g'>4 <d d'>4 <d d'>8 ~ ~ | % 45
<d d'>8 [ <e g e'>8 ] <e g e'>2\) r8 <e e'>8\( | % 46
<c' c'>8 [ <b b'>8 ] <d d'>8 <c c'>4 <g g'>8 <b b'>8 [ <b b'>8 ]
| % 47
<a c f a>2\) r8 <a a'>8\( [ <g g'>8 <a a'>8 ] | % 48
<d f>4 <a d a'>8 <b d b'>4 <g g'>4 <a c e a>8 ~ ~ ~ ~ | % 49
<a c e a>4\) <a c a'>8\( [ <a c a'>8 ] <gis gis'>8 [ <a a'>8 ] <b b'>4 | %50
<c e c'>8 [ <b b'>8 ] <g g'>8 <g g'>4 <e e'>8 <b' b'>8 [ <b b'>8 ]
| % 51
<a c f a>2\) r8 <e e'>8\( [ <g g'>8 <f f'>8 ] | % 52
<a d>4 <a a'>8 <b b'>4 <g g'>4 <b b'>8 ~ ~ | % 53
<b b'>8 [ <c c'>8 ] <b b'>2\) r8 <e, e'>8\( | % 54
<c' e c'>8 [ <b e b'>8 ] <d d'>8 <c c'>4 <e, e'>8 <b' b'>8 [ <c c'>8
~ ] ~ | % 55
<c c'>2\) r8 <c c'>8\( [ <b b'>8 <a a'>8 ] | % 56
<d f>4 <a d a'>8 <d d'>4 <g, g'>4 <g g'>8 ~ ~ | % 57
<g g'>8 [ <b b'>8 ] <a a'>2.\) | % 58
<c, c'>8 [ e8 ] <c c'>8 <d d'>4 _. <d d'>4 _. <e a c e>8 ~ ~ ~ ~ | % 59
<e a c e>1 ^\fermata \bar "|."
}
PartPOneVoiceThree = \relative d, {
\clef "bass"
\key d \minor
\time 4/4 <d d'>1 | % 2
<cis cis'>1 | % 3
<c c'>1 | % 4
<b b'>1 | % 5
<bes bes'>8( [ bes'8 f'8 d8 ]) bes8( [ f8 bes,8 f'8 ]) | % 6
a,8 _>( [ f'8 a8 f8 ]) c'8( [ f8 a8 c,8 ]) | % 7
g,8 _>( [ g'8 bes8 d8 ]) g8( [ d8 bes8 g8 ]) | % 8
<a, a'>8 _> \( [ a'8 e'8 cis8 ]\) <a, a'>8\( [ e'8 cis8 a8 ]\) | % 9
g8( [ g'8 bes8 d8 ] g8 [ bes8 ]) r4 | %10
c,,8( [ g'8 c8 e8 ] g8 [ c8 ]) r4 | % 11
a,,8( [ e'8 a8 c8 ] e8 [ a8 ]) r4 | % 12
d,,8( [ a'8 d8 f8 ]) a8( [ f8 d8 a8 ]) | % 13
g,8 ([ g'8 bes8 d8 ] g8 [ bes8 ]) r4 | % 14
a,,8 ([ e'8 a8 c8 ] e4) r4 | % 15
<d, d'>8 [ <c c'>8 _> <cis cis'>8 _> <d d'>8 _> ] r8 <d, d'>8 _> _.
[ <e e'>8 _> _. <f f'>8 ~ _> ] ~ \break| % 16
\time 6/4 <f f'>4. <c'' c'>8 g'8 [ e8 ] c8 [ g8 ] e8
[ c8 ] g8 [ c,8 ] | % 17
\time 4/4 g'8( [ g'8 bes8 d8 ] g8 [ bes8 ]) r4 | % 18
c,,8( [ g'8 c8 e8 ] g8 [ c8 ]) r4 | % 19
a,,8( [ e'8 a8 c8 ] e8 [ a8 ]) r4 | %20
d,,8( [ a'8 d8 f8 ]) a8( [ f8 d8 a8 ]) | % 21
g,8 ([ g'8 bes8 d8 ] g8 [ bes8 ] ) r4 | % 22
c,,8( [ g'8 c8 e8 ] g4 ) r4 | % 23
<d, d'>8 [ a'8 d,8 d'8 ] <a, a'>8 [ e'8 <a, e'>8 <d, d'>8 ~ ] ~ | % 24
<d d'>8 [ <d d'>8 ] <d d'>4 <d' d'>8 _. [ r8 <c c'>8 _. <bes bes'>8
] | % 25
bes'8 [ d8 f8 d8 ] f,8 [ bes,8 ] f'4 | % 26
c8( [ g'8 c8 e8 ] g8 [ c8 g8 e8 ]) | % 27
a,,8( [ e'8 a8 c8 ] e8 [ a8 ] ) r4 | % 28
d,,8( [ a'8 d8 f8 ]) a8( [ f8 d8 a8 ] ) | % 29
g,8 [ g'8 bes8 d8 ] g8 [ bes8 ] r4 | %30
a,,8 [ e'8 a8 c8 ] e8 [ a8 ] r4 | % 31
<bes,, bes'>8 [ bes'8 ] f'8 <c, c'>4. <c' c'>8 [ <d, d'>8 ~ ] ~ | % 32
<d d'>8 [ <d, d'>8 ] <d d'>4 <d' d'>8 _. [ r8 <c c'>8 _. <bes bes'>8
] | % 33
bes'8 [ d8 f8 d8 ] f,8 [ bes,8 ] f'4 | % 34
c8 [ g'8 c8 e8 ] g8 [ c8 g8 e8 ] | % 35
a,,8 [ e'8 a8 c8 ] e8 [ a8 ] e4 | % 36
d,8 [ a'8 d8 f8 ] a8 [ f8 d8 a8 ] | % 37
<g, g'>8 [ g'8 <bes bes'>8 g8 ] <bes bes'>8 [ g8 <bes bes'>8 g8 ] | % 38
<a, a'>8 [ a'8 <e' c'>8 a,8 ] <e' c'>8 [ a,8 <e' c'>8 <bes, bes'>8 ~
] ~ | % 39
<bes bes'>4 bes'8 <a, a'>4 a'8 <cis e a>8 [ <bes, bes'>8 ~ ] ~ | %40
<bes bes'>8 bes'4 <c, c'>8 ~ <c c'>4 <c' g' c>4 | % 41
\key a \minor
<a, a'>4 <g' g'>8 [ <f f'>8 ] <e e'>8 [ <d d'>8 <c c'>8
<b b'>8 ] | % 42
<a a'>8 [ a'8 ] <e' c'>8 <g,, g'>8 ~ <g g'>8 g'8 <e' b'>4 | % 43
<f,, f'>8 [ f'8 f'8 f8 ] <a c>8 [ f8 <f, f'>8 c'8 ] | % 44
<d,, d'>8 [ d''8 ] <a' d>8 <g,, g'>4 <g' d' g>4 <c, c'>8 ~ ~ | % 45
<c c'>4 <c' g'>4 <e, e'>4 <e, e'>4 | % 46
<a a'>8 [ a'8 ] <e' c'>8 <g,, g'>4 g'8 <e' b'>4 | % 47
<f,, f'>8 [ f'8 f'8 f8 ] <a c>8 [ f8 <f, f'>8 c'8 ] | % 48
<d,, d'>8 [ d''8 ] <a' d>8 <g,, g'>4 <g' d' g>4 <a, a'>8 ~ ~ | % 49
<a a'>8 [ <a' a'>8 <g g'>8 <f f'>8 ] <e e'>8 [ <d d'>8 <c c'>8 <b
b'>8 ] | %50
<a a'>8 [ a'8 ] <e' c'>8 <g,, g'>4 g'8 <e' b'>4 | % 51
<f,, f'>8 [ f'8 f'8 f8 ] <a c>8 [ f8 <f, f'>8 c'8 ] | % 52
<d,, d'>8 [ d''8 ] <a' d>8 <g,, g'>4 <g' d' g>4 <c, c'>8 ~ ~ | % 53
<c c'>4 <c' c'>8 [ g'8 ] <e, e'>8 [ <gis b>8 <e, e'>8 <gis b>8 ] | % 54
<a a'>8 [ a'8 ] <e' c'>8 <g,, g'>4 g'8 <e' b'>4 | % 55
<f,, f'>8 [ f'8 f'8 f8 ] <a c>8 [ f8 <f, f'>8 c'8 ] | % 56
<d,, d'>8 [ d''8 ] <a' d>8 <g,, g'>4 <g' d' g>4 <a, a'>8 ~ ~ | % 57
<a a'>8 [ a'8 <e' a>8 a,8 ] <e' b'>8 [ a,8 <e' c'>8 a,8 ] | % 58
<a, a'>8 [ e'8 ] <a, a'>8 <g g'>4 _. <g g'>4 _. <f f'>8 ~ ~ | % 59
<f f'>1 ^\fermata \bar "|."
}
PartPOneVoiceTwo = \relative d' {
\clef "treble"
\key d \minor
\time 4/4 | % 1
\tempo "Allegro risoluto" 4=144 s1*4 | % 5
<d d'>4. ^> s8 <e e'>4. ^> s8 | % 6
<f f'>4. ^> s8 <g g'>4. ^> s8 | % 7
<a a'>4. ^> s8 <bes bes'>4. ^> s8 | % 8
<cis cis'>4. ^> s8 <e e'>4. ^> s8 | % 9
s1*4 s1*3 | % 16
\time 6/4 s1. | % 17
\time 4/4 | % 17
s1*2 s1*4 s1*4 s1*4 s1*4 s8*13
s4. | % 37
s1*4\key a \minor| % 42
}
two = {
\zeilenLänge #'(50 . 32) % 2 Zeilen, die jeweils 32 16-tel lang sind
}
\score {
<<
\new PianoStaff \with { \override NonMusicalPaperColumn #'line-break-permission = ##f } <<
\set PianoStaff.instrumentName = "Piano"
\context Staff = "1" <<
\context Voice = "PartPOneVoiceOne" { \voiceOne \PartPOneVoiceOne }
\context Voice = "PartPOneVoiceTwo" { \voiceTwo \PartPOneVoiceTwo }
\context Voice = "two" { \two }
>> \context Staff = "2" <<
\context Voice = "PartPOneVoiceThree" { \PartPOneVoiceThree }
\context Voice = "two" { \two }
>>
>>
>>
\layout {}
}
Auffällig ist, dass das falsche Verhalten nach den Taktwechseln angenommen wird.
Hat jemand eine Lösung meines Problems parat?
Viele Grüße,
Mario
-
geht das auch kürzer? >:(
-
Bei mir funktioniert der von harm6 vorgestellte Code nur anfangs und anschließend nimmt Lilypond wieder das Standardverhalten bei den Systemlängen an.
An Beispiel meines Problems erkennt man an folgendem Code:
[...]
Auffällig ist, dass das falsche Verhalten nach den Taktwechseln angenommen wird.
Hat jemand eine Lösung meines Problems parat?
Hallo Mario,
so wie Du meinen Code benutzt hast kann es auch nicht funktionieren. Es hagelt ja auch Warnungen:
Wie willst Du einen 6/4-Takt (plus einen 4/4-Takt) in eine Zeile packen und dann nach 32 16-teln an einem Taktende umbrechen?
Das gibt die Mathematik nicht her.
Da müßtest Du eine einzelne Zeile mit \zeilenLänge #'(1 . 40) einfügen.
Allerdings gibt es mittlerweile eine bessere Methode:
bars-per-line-systems-per-page-engraver
Dank an David Nalesnik
Siehe meinen Beitrag hier (Punkt 3.) (https://liarchiv.joonet.de/index.php?topic=1316.msg7224#msg7224)
HTH,
Harm