Compare commits
10 Commits
b4622b991f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 70ad9536bf | |||
| ddb8395d18 | |||
| 79e5b3d165 | |||
| 4797000ca3 | |||
| 717b32cece | |||
| 3ccd2aa9f7 | |||
| 30e3032d4e | |||
| b80900f367 | |||
| 7ef35839a5 | |||
| 53e40f7122 |
133
functions.ly
133
functions.ly
@@ -1,10 +1,65 @@
|
|||||||
|
\version "2.25.3"
|
||||||
|
\language "english"
|
||||||
|
|
||||||
|
stripArticulations = #(define-scheme-function
|
||||||
|
(music)
|
||||||
|
(ly:music?)
|
||||||
|
|
||||||
|
(define (strip-articulations-i o)
|
||||||
|
(define (f l)
|
||||||
|
(if (null? l)
|
||||||
|
'()
|
||||||
|
(let ((o (car l)))
|
||||||
|
(if (music-is-of-type? o 'articulation-event)
|
||||||
|
(f (cdr l))
|
||||||
|
(cons o (f (cdr l)))))
|
||||||
|
))
|
||||||
|
|
||||||
|
(let ((els (ly:music-property o 'elements)))
|
||||||
|
(map strip-articulations-i els))
|
||||||
|
|
||||||
|
(let ((arts (ly:music-property o 'articulations)))
|
||||||
|
(cond ((not (null? arts))
|
||||||
|
(let ((n-arts (f arts)))
|
||||||
|
(ly:music-set-property! o 'articulations n-arts)))))
|
||||||
|
|
||||||
|
o)
|
||||||
|
|
||||||
|
(strip-articulations-i (ly:music-deep-copy music))
|
||||||
|
)
|
||||||
|
|
||||||
|
forceAccidental = #(define-scheme-function
|
||||||
|
(on_off music)
|
||||||
|
(index? ly:music?)
|
||||||
|
|
||||||
|
(let ((yn (if (= on_off 0) #f #t)))
|
||||||
|
(define (force-accidental-i o)
|
||||||
|
(define (f o)
|
||||||
|
(cond ((music-is-of-type? o 'note-event)
|
||||||
|
(ly:music-set-property! o 'force-accidental yn)))
|
||||||
|
(force-accidental-i o)
|
||||||
|
o
|
||||||
|
)
|
||||||
|
|
||||||
|
(let ((els (ly:music-property o 'elements)))
|
||||||
|
(map f els))
|
||||||
|
|
||||||
|
(let ((arts (ly:music-property o 'articulations)))
|
||||||
|
(map f arts))
|
||||||
|
|
||||||
|
o
|
||||||
|
)
|
||||||
|
|
||||||
|
(force-accidental-i (ly:music-deep-copy music))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
rmtext = #(define-scheme-function
|
rmtext = #(define-scheme-function
|
||||||
(o)
|
(o)
|
||||||
(ly:music?)
|
(ly:music?)
|
||||||
(define (f o)
|
(define (f o)
|
||||||
(ly:music-set-property! o 'text "")
|
(ly:music-set-property! o 'text "")
|
||||||
|
(ly:music-set-property! o 'span-text "")
|
||||||
(let ((t (ly:music-property o 'name)))
|
(let ((t (ly:music-property o 'name)))
|
||||||
(let ((els (ly:music-property o 'elements)))
|
(let ((els (ly:music-property o 'elements)))
|
||||||
(if (null? els)
|
(if (null? els)
|
||||||
@@ -102,3 +157,81 @@ frr = #(define-scheme-function
|
|||||||
(rep 8 n)
|
(rep 8 n)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
none = #(define-scheme-function
|
||||||
|
(n1 n2 n3 n4 n5 n6 n7 n8 n9)
|
||||||
|
(ly:music? ly:music? ly:music?
|
||||||
|
ly:music? ly:music? ly:music?
|
||||||
|
ly:music? ly:music? ly:music?)
|
||||||
|
#{ \times 2/3 { $n1 $n2 $n3 }
|
||||||
|
\times 2/3 { $n4 $n5 $n6 }
|
||||||
|
\times 2/3 { $n7 $n8 $n9 }
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
tri = #(define-scheme-function
|
||||||
|
(n1 n2 n3)
|
||||||
|
(ly:music? ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\times 2/3 { $n1 $n2 $n3 }
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
triN = #(define-scheme-function
|
||||||
|
(n1 n2 n3)
|
||||||
|
(ly:music? ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\tuplet 3/2 { \once \omit TupletNumber \once \omit TupletBracket $n1 $n2 $n3 }
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
triG = #(define-scheme-function
|
||||||
|
(n1 n2 n3)
|
||||||
|
(ly:music? ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\times 2/3 { $n1[ $n2 $n3] }
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
triGn = #(define-scheme-function
|
||||||
|
(n1 n2 n3)
|
||||||
|
(ly:music? ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\tuplet 3/2 { \once \omit TupletNumber $n1[ $n2 $n3] }
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
markupBetween = #(define-scheme-function
|
||||||
|
(a b c)
|
||||||
|
(ly:music? ly:music? markup?)
|
||||||
|
#{
|
||||||
|
\once \override Stem.X-extent = #'(1 . 5) $a ^$c $b
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
turnBetween = #(define-scheme-function
|
||||||
|
(a b)
|
||||||
|
(ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\markupBetween $a $b \markup { \halign #-3 { \musicglyph #"scripts.turn" } }
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
turnNaturalBetween = #(define-scheme-function
|
||||||
|
(a b)
|
||||||
|
(ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\markupBetween $a $b \markup { \halign #-3 \column {
|
||||||
|
{ \musicglyph #"scripts.turn" }
|
||||||
|
\super { \musicglyph #"accidentals.natural" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
turnNatural = ^\markup { \column {
|
||||||
|
{ \musicglyph #"scripts.turn" }
|
||||||
|
\super { \musicglyph #"accidentals.natural" }
|
||||||
|
}}
|
||||||
|
|||||||
110
string-quartet.ly
Normal file
110
string-quartet.ly
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
\version "2.24.3"
|
||||||
|
\language "english"
|
||||||
|
|
||||||
|
|
||||||
|
makePiece = #(define-scheme-function
|
||||||
|
(p)
|
||||||
|
(string?)
|
||||||
|
#{ \markup { \bold \fontsize #+1 $p } #}
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScriptum = #(define-scheme-function
|
||||||
|
(s)
|
||||||
|
(string?)
|
||||||
|
#{ \markup { \fontsize #-1 \normal-text $s } #}
|
||||||
|
)
|
||||||
|
|
||||||
|
makeHdr = #(define-scheme-function
|
||||||
|
(thePiece theScriptum)
|
||||||
|
(markup? markup?)
|
||||||
|
#{
|
||||||
|
\header {
|
||||||
|
subsubtitle = $theScriptum
|
||||||
|
piece = $thePiece
|
||||||
|
}
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScore = #(define-scheme-function
|
||||||
|
(instrument midi music)
|
||||||
|
(string? string? ly:music?)
|
||||||
|
(let ((moment (if (defined? 'sqCustomMoment) sqCustomMoment #(ly:make-moment 1/3))))
|
||||||
|
(display "MOMENT=")(display moment)(newline)
|
||||||
|
#{
|
||||||
|
\score {
|
||||||
|
\new Staff \with {
|
||||||
|
instrumentName = $instrument
|
||||||
|
midiInstrument = $midi
|
||||||
|
}
|
||||||
|
$music
|
||||||
|
\layout {
|
||||||
|
\context {
|
||||||
|
\Score
|
||||||
|
\override SpacingSpanner.common-shortest-duration = #moment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\midi {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScoreVI = #(define-scheme-function
|
||||||
|
(music)
|
||||||
|
(ly:music?)
|
||||||
|
(makeScore "Violin I" "violin" music)
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScoreVII = #(define-scheme-function
|
||||||
|
(music)
|
||||||
|
(ly:music?)
|
||||||
|
(makeScore "Violin II" "violin" music)
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScoreVa = #(define-scheme-function
|
||||||
|
(music)
|
||||||
|
(ly:music?)
|
||||||
|
(makeScore "Viola" "viola" #{ { \clef alto $music } #})
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScoreCl = #(define-scheme-function
|
||||||
|
(music)
|
||||||
|
(ly:music?)
|
||||||
|
(makeScore "Cello" "cello" #{ { \clef bass $music } #})
|
||||||
|
)
|
||||||
|
|
||||||
|
makeScoreFull = #(define-scheme-function
|
||||||
|
(vI vII va cl)
|
||||||
|
(ly:music? ly:music? ly:music? ly:music?)
|
||||||
|
#{
|
||||||
|
\score {
|
||||||
|
<<
|
||||||
|
\new Staff \with {
|
||||||
|
instrumentName = "Violin I"
|
||||||
|
midiInstrument = "violin"
|
||||||
|
} $vI
|
||||||
|
\new Staff \with {
|
||||||
|
instrumentName = "Violin II"
|
||||||
|
midiInstrument = "violin"
|
||||||
|
} $vII
|
||||||
|
\new Staff \with {
|
||||||
|
instrumentName = "Viola"
|
||||||
|
midiInstrument = "viola"
|
||||||
|
} { \clef alto $va }
|
||||||
|
\new Staff \with {
|
||||||
|
instrumentName = "Cello"
|
||||||
|
midiInstrument = "cello"
|
||||||
|
} { \clef bass $cl }
|
||||||
|
>>
|
||||||
|
\layout {
|
||||||
|
\context {
|
||||||
|
\Score
|
||||||
|
\override SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\midi {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#}
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user