lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro/multiply notes


From: David Kastrup
Subject: Re: Macro/multiply notes
Date: Fri, 13 Jun 2014 21:40:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2014-06-13 17:42 GMT+02:00 Hlolli <address@hidden>:
>> Is is possible to do smoething like this:
>>
>> {c'8 d' e' d'}*4 -> c'8 d' e' d' | c'8 d' e' d' | c'8 d' e' d' | c'8 d' e'
>> d' ?
>>
>> Just to save space I was hoping that repetitive musical patterns could be
>> repeted with multiplication/asterix sign?
>>
>>
>>
>> --
>> View this message in context:
>> http://lilypond.1069038.n5.nabble.com/Macro-multiply-notes-tp163291.html
>> Sent from the User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> lilypond-user mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> Afaik, closest you can do is:
>
> \version "2.18.0"
>
> "*" =
> #(define-scheme-function (parser location number)(number?)
>   (define-music-function (parser location music)(ly:music?)
>     #{ \repeat unfold $number $music #}))
>
> "*4" = \"*" 4
> "*3" = \"*" 3
> "*2" = \"*" 2
>
> { \"*3" { \"*4" { c'8 d' e' d' \"*2" g'4 \bar "||" } \bar "S" } }

Ugh.  How about

"\\*" =
#(define-music-function (parser location n m) (number? ly:music?)
  #{ \repeat unfold $n $m #})

{ \*3 { \*4 { c'8 d' e' d' \*2 g'4 \bar "||" } \bar "S" } }

Saves defining separate commands and all that juggling with quotes.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]