Thomas Morley <thomasmorle...@gmail.com> writes:

> 2014-06-13 17:42 GMT+02:00 Hlolli <hlo...@gmail.com>:
>> 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
>> lilypond-user@gnu.org
>> 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

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to