Stimme = 0
KI_N = #(if (= Stimme 0) "Klarinette 1") KI_SN = #(if (= Stimme 0) "Kl.1")
KII_N = #(if (= Stimme 0) "Klarinette 2") KII_SN = #(if (= Stimme 0) "Kl.2")
KIII_N = #(if (= Stimme 0) "Klarinette 3") KIII_SN = #(if (= Stimme 0) "Kl.3")
KB_N = #(if (= Stimme 0) "Bass-Klarinette") KB_SN = #(if (= Stimme 0) "Bass")
STAFF_I = \new Staff = "K1" \with {midiInstrument = "clarinet" instrumentName = \KI_N shortInstrumentName = \KI_SN } \relative c'' { \EnsGlobalStaffSettings \PieceSettings \Noten-I }
STAFF_II = \new Staff = "K2" \with {midiInstrument = "clarinet" instrumentName = \KII_N shortInstrumentName = \KII_SN} \relative c'' { \EnsGlobalStaffSettings \PieceSettings \Noten-II }
STAFF_III = \new Staff = "K3" \with {midiInstrument = "clarinet" instrumentName = \KIII_N shortInstrumentName = \KIII_SN } \relative c'' { \EnsGlobalStaffSettings \PieceSettings \Noten-III }
STAFF_IV = \new Staff = "BK" \with {midiInstrument = "clarinet" instrumentName = \KB_N shortInstrumentName = \KB_SN } \relative c'' { \EnsGlobalStaffSettings \PieceSettings \Noten-BKL }
STAFF_I = #(if (or (= Stimme 0) (= Stimme 1)) STAFF_I "")
STAFF_II = #(if (or (= Stimme 0) (= Stimme 2)) STAFF_II "")
STAFF_III = #(if (or (= Stimme 0) (= Stimme 3)) STAFF_III "")
STAFF_IV = #(if (or (= Stimme 0) (= Stimme 4)) STAFF_IV "")
\bookpart {
% \header {piece = "Allemande."}
#(set-global-staff-size 20)
\score {
<< % More: [\new StaffGroup/GrandStaff/ChoirStaff = "Ensemble"] <<
\new ChoirStaff = "Ensemble" <<
\STAFF_I
\STAFF_II
\STAFF_III
\STAFF_IV
>>
>>
\layout { } \midi { }
}
}
Zitat von: Tapio am Freitag, 7. März 2025, 11:49Zeilen dynamisch auskommentieren geht schon mal nicht, wie ich mir das vorstelle.
Zitat von: Manuela am Freitag, 7. März 2025, 11:19Genauso würde ich es sehen (Harm, bitte korrigiere, wenn ich mich irre).
#(if (= 0 0) "%")
\version "2.25.22"
\language "deutsch"
%\include "C:/Manuela/_lily/_inc.ly"
#(set-global-staff-size 30)
#(define ((chord-name->german-markup-text-alteration B-instead-of-Bb) pitch lowercase?)
(define (pitch-alteration-semitones pitch)
(inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
(define (conditional-string-downcase str condition)
(if condition
(string-downcase str)
str))
(let* ((name (ly:pitch-notename pitch))
(alt-semitones (pitch-alteration-semitones pitch))
(n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -1)))
(cons 7 (+ (if B-instead-of-Bb 1 1) alt-semitones))
(cons name alt-semitones))))
(make-line-markup
(list
(make-simple-markup
(conditional-string-downcase
(vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
lowercase?))
(let ((alteration (/ (cdr n-a) 2)))
(cond
((and (equal? lowercase? #f) (= alteration FLAT) (= (car n-a) 7)) (make-simple-markup ""))
((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2) )) (make-simple-markup "s"))
((= alteration FLAT) (make-simple-markup "es"))
((and (= alteration DOUBLE-FLAT) (or (= (car n-a) 5)(= (car n-a) 2) )) (make-simple-markup "ses"))
((= alteration DOUBLE-FLAT) (make-simple-markup "eses"))
((= alteration SHARP) (make-simple-markup "is"))
((= alteration DOUBLE-SHARP) (make-simple-markup "isis"))
(else empty-markup)))))))
\paper {
top-margin = 40\mm
ragged-right = ##t
ragged-bottom = ##t
line-width = 100\mm
oddFooterMarkup = ##f
scoreTitleMarkup = ##f
}
\layout {
\context {
\ChordNames
chordRootNamer = #(chord-name->german-markup-text-alteration #f)
}
}
\markup "default"
mykord = \chordmode { b4:1 es:1 c:1 cis:1 }
<<
\new ChordNames
\mykord
\new RhythmicStaff
{
\mykord
}
>>
\markup "zentriert"
<<
\new ChordNames
\mykord
\new RhythmicStaff
\with
{
\override NoteColumn.before-line-breaking =
#(lambda (grob)
(let* ((pap-col (ly:grob-parent grob X))
(pap-col-elts (ly:grob-object pap-col 'elements))
(chord-names
(if (ly:grob-array? pap-col-elts)
(filter
(lambda (elt)
(grob::has-interface elt 'chord-name-interface))
(ly:grob-array->list pap-col-elts))
'())))
(for-each
(lambda (chrd)
(ly:grob-set-parent! chrd X grob))
chord-names)))
}
{
\mykord
}
>>
\markup "Es ist kein Unterschied zu sehen"
Zitat von: Tapio am Freitag, 7. März 2025, 11:11Sehe ich das richtig? Scheme schickt quasi einen String zurück, der dann im Lilypond-Quellcode an der Stelle, wo er eingesetzt wird, syntaktisch passen muss? Könnte ich also theoretisch versuchen, Scheme dies hier an der passenden Stelle zurückgeben zu lassen?
Stimme = 1
InstrumentName = #(cond
((= Stimme 4) "Bass-Klarinette")
((= Stimme 0) "")
(else (string-append "Klarinette " (number->string Stimme)))
)
"\new Staff \with {...}
InstrumentName = #(if (< 2 1)
"Test"
"Klappt"
)
Ziel ist dies: Ich will in meiner Partiturvorlage ein Flag oben einsetzen, wie "Stimme = 3", und im Staff-Part sollen dann nur die Staffs entsprechend der Stimme genommen werden. Bei "0" dann alle, also Partitur drucken. Von der Logik alles sehr simpel, auch (short)instrumentName müssen gesetzt werden, aber praktisch vermutlich schwierig.
Zitat von: Tapio am Freitag, 7. März 2025, 10:08Scheme geht mir jetzt schon auf den Geist. Ich würde gerne ein paar Flags setzen und so bspw. steuern, ob Dinge angezeigt werden oder nicht. Doch schon hier falle ich auf die Nase.#(if (> 2 1)
(define InstrumentName "Test")
(define InstrumentName "")
)
wird durchgeführt, somit wird eine Variable namens InstrumentName mit dem Inhalt "Test" definiert.
Meiner Theorie nach sollte danach in Lilypond eine Variable \InstrumentName mit "Test" gesetzt sein. Stattdessen wird herumgemault. "source expression failed to match any pattern in form (define (InstrumentName "Test"))"
(if (> 2 1)
das bedeutet, wenn der erste Ausdruck größer ist als der zweite, also in deinem Fall wenn 2 > 1 wahr ist, dann wird der erste Klammerausdruck als Ergebnis zurückgegeben, also(define InstrumentName "Test")
wird ausgeführt, es wird eine Variable namens InstrumentName mit dem Inhalt "Test" erstellt.#(if (> 2 1)
(define InstrumentName "Test")
(define InstrumentName "")
)
ZitatMir wäre schon geholfen, wenn man einem Bookpart, vom ersten abgesehen, beibringen könnte, pauschal immer auf der linken (geraden) Seite zu beginnen.
ZitatDeshalb die Frage, ob man in einem Markup überhaupt einen Seitenwechsel auslösen kann!
\paper {
counter = 1
#(define (page-post-process layout pages)
(let* ((page-count (length pages)))
(format #t "\n\tbookpart ~a has ~a page(s)~a"
counter
page-count
(if (odd? page-count) ", i.e. an uneven amount of pages" ""))
(set! counter (1+ counter))))
}
\bookpart {
\header { title = "MYBOOK" }
\markup \null
}
\bookpart {
\header { instrument = "bookpart 3 pages" }
\repeat unfold 3 { R1 \pageBreak }
}
\bookpart {
\header { instrument = "bookpart 2 pages" }
\repeat unfold 2 { R1 \pageBreak }
}
Zitat von: terminalProcessing `file.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
bookpart 1 has 1 page(s), i.e. an uneven amount of pages
Finding the ideal number of pages...
Fitting music on 2 or 3 pages...
Drawing systems...
bookpart 2 has 3 page(s), i.e. an uneven amount of pages
Finding the ideal number of pages...
Fitting music on 1 or 2 pages...
Drawing systems...
bookpart 3 has 2 page(s)
Converting to `file.pdf'...
Success: compilation successfully completed