Print "pizz." only once until "ord."
Hello All, "pizz." is usually marked above a score only once. Performers presume all subsequent music is pizzicato until "ord." appears. I'm looking to write scheme functions \pizz and \ord with this behavior. \pizz should only print the first time it is called and then do nothing until after \ord is called. \ord should behave the same way, only printing once in a row. I attempted to hack up a solution but couldn't get the markup to print! \version "2.20.0" pizz-list = #'() add-pizz-list = #(define-scheme-function (cont bool) (ly:context? boolean?) (set! pizz-list (cons (cons (ly:context-id cont) bool) pizz-list))) flip-pizz-list = #(define-scheme-function (cont) (ly:context?) (if (not (apply (lambda (a b) (or a b)) (map (lambda (x) (let ((condition (equal? (car x) (ly:context-id cont (if condition (set-cdr! x (not (cdr x condition)) pizz-list) (list #f))) (add-pizz-list cont #f)) ) #(define* (pizz? cont #:optional (list pizz-list)) (let ((name (ly:context-id cont))) (cond ((or (not (list? list)) (null? list)) #f) ((and (equal? name (car (car list))) (cdr (car list))) #t) (else (pizz? cont (cdr list)) pizz-scheme = #(define-music-function (cont) (ly:context?) (if (not (pizz? cont)) (begin (flip-pizz-list cont) #{ ^\markup \italic "pizz." #}) #{ #})) pizz = \applyContext #(lambda (x) (pizz-scheme x)) ord-scheme = #(define-music-function (cont) (ly:context?) (if (pizz? cont) (begin (flip-pizz-list cont) #{ ^\markup \italic "ord." #}) #{ #})) ord = \applyContext #(lambda (x) (ord-scheme x)) \score { << \new Staff = "cl" { \applyContext #(lambda (x) (add-pizz-list x #t)) c1 \pizz c1 \pizz c1 \ord c1 \ord } >> } Any easy fixes to my attempt here? I'm also open to taking a different approach if there's a more idiomatic lilypond angle. Best, Zach
\repeat unfold 0 times?
Hello All, I have a little scheme function which gives me the number of times to repeat a particular bit of music in my composition. Sometimes I want that number to be zero and thus print no music at all. I'm using the "\repeat unfold repeatcount" syntax. However, when repeatcount is zero, the music is still engraved one time. I have found a way to use a scheme conditional to check if repeatcount is greater than zero before evaluating repeat. Here's the snippet: \version "2.20.0" m = #0 n = #1 o = #2 \new Staff { \repeat unfold #m dis'1 #(let ((x #{ \repeat unfold #m dis1 #})) (if (> m 0) x)) #(let ((x #{ \repeat unfold #n d1 #})) (if (> n 0) x)) #(let ((x #{ \repeat unfold #o des1 #})) (if (> o 0) x)) } I'm looking for a more elegant solution that doesn't have me going in and out of scheme and lilypond. Please offer me some suggestions. Best, Zachary Pine
Autochange with Staves named other than "up" and "down"
Hello Community, I'm writing a piano piece across three staves. Sometimes I would like to use autochange to engrave material on the top two staves, other times across the bottom two. I know autochange works by default on staves named "up" and "down". Is there any way to override the names of the staves autochange looks for? Perhaps there is another solution I'm not seeing other than manually inputting \change Staff everytime. Best, Zachary Pine