On 2024-04-05 10:20 am, Pierre-Luc Gauthier wrote:
Hi there,

Is there a way to quote multiple quotables ?

I use it often for piano reductions and what not.
e.g.:

\version "2.25.15"

\addQuote "piccolo" {c''''4}
\addQuote "fluteI"  {g'''4}
\addQuote "fluteII" {e'''4}
\addQuote "oboeI"   {c'''4}

\new Voice <<
  \ottava 1
  \quoteDuring "piccolo" {s4}
  \quoteDuring "fluteI" {s4}
  \quoteDuring "fluteII" {s4}
  \quoteDuring "oboeI" {s4}


Wouldn't elegance suggests something like :

pianoReduction = \quoteDuring #'("piccolo" "fluteI" "fluteII" "oboeI") {s4}

I thought maybe the \quoteDuring command could accept lists but I have
not managed to get it to work... :-(


%%%%
\version "2.25.13"

#(define (string-list? arg) (and (list? arg) (every string? arg)))
#(define (string-or-string-list? arg) (or (string? arg) (string-list? arg)))

quoteDuring =
#(define-music-function (what main-music) (string-or-string-list? ly:music?)
  (fold (lambda (elem prev)
          (make-music 'QuoteMusic
                      'element prev
                      'quoted-music-name elem))
    main-music (if (list? what) what (list what))))

%% - - - - %%

\addQuote "piccolo" {c''''4}
\addQuote "fluteI"  {g'''4}
\addQuote "fluteII" {e'''4}
\addQuote "oboeI"   {c'''4}

\new Voice {
  \ottava 1
  \quoteDuring #'("piccolo" "fluteI" "fluteII" "oboeI") { s4 }
}
%%%%

NOTE: The modified \quoteDurring above produces a nested music expression, as if you had written:

%%%%
\quoteDuring "oboeI" \quoteDuring "fluteII" \quoteDuring "fluteI" \quoteDuring "piccolo" { s4 }
%%%%


-- Aaron Hill

Reply via email to