lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme function help


From: Stjepan Horvat
Subject: Re: scheme function help
Date: Mon, 6 May 2013 12:44:14 +0200

And this concept with including lilypond code block in function is 100% easyer..:)

On Mon, May 6, 2013 at 12:40 PM, Stjepan Horvat <address@hidden> wrote:
When i do this
insMark =
#(define-music-function (parser location mark mus)
  (markup? ly:music?)
  (set! (ly:music-property mus 'elements)
   (cons (make-music 'MarkEvent 'label mark)
   (ly:music-property mus 'elements)))
 mus)

\displayMusic { \insMark "A" c'4 }

(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'NoteEvent
          'elements
          (list (make-music (quote MarkEvent) (quote label) "A"))
          'duration
          (ly:make-duration 2 0 1)
          'pitch
          (ly:make-pitch 0 0 0))))

The mark goes inside note-event element and it is not shown.

and it should be like that

(make-music
  'SequentialMusic
  'elements
  (list (make-music (quote MarkEvent) (quote label) "A")
        (make-music
          'NoteEvent
          'duration
          (ly:make-duration 2 0 1)
          'pitch
          (ly:make-pitch 0 0 0))))

and David yours makes

(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'SequentialMusic
          'elements
          (list (make-music (quote MarkEvent) (quote label) "A")
                (make-music
                  'NoteEvent
                  'duration
                  (ly:make-duration 2 0 1)
                  'pitch
                  (ly:make-pitch 0 0 0))))))


On Mon, May 6, 2013 at 12:32 PM, Stjepan Horvat <address@hidden> wrote:
I'm using GNU LilyPond 2.16.2 and Guile 1.8.8
I found out the error

insMark = 
#(define-music-function (parser location mark mus)
    (markup? ly:music?)
    (set! (ly:music-property mus 'elements)
      (cons (make-music 'MarkEvent 'label mark)
      (ly:music-property mus 'elements)))
    mus)

\displayMusic { \insMark "A" c'4 }
%\displayMusic \insMark { "A" c'4 } %tryed that too
%\relative c' { \insMark "A" c'4 } %that too

after insMark =* was a strange invisible character with code 160, Hex 00a0, Octal 240 and becouse of that it wouldn't want to pass..

"no-break space" from unicode.
> (to make it worse, this character code is displayed as space by most
> text editors....).

On Mon, May 6, 2013 at 11:40 AM, David Kastrup <address@hidden> wrote:
Madoka Machitani <address@hidden> writes:

> Now, is it correct to assume you are trying to achieve something like
> this?  \insMark "a" musical-sequence
>
> If so, the function would be:
>
> insMark =
> #(define-music-function (parser location mark mus)
>    (markup? ly:music?)
>    (set! (ly:music-property mus 'elements)
>          (cons (make-music 'MarkEvent 'label mark)
>                (ly:music-property mus 'elements)))
>    mus)
>
> This is a crude example and won't work with single note events like c'4

Why wouldn't you do

insMark =
#(define-music-function (parser location mark mus)
   (markup? ly:music?)
   #{ \mark #mark #mus #})

instead?  Note that depending on the version, #mark and/or #mus might
need to be $mark or $mus instead.

--
David Kastrup


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



--
Nesmotren govori kao da mačem probada, a jezik je mudrih iscjeljenje. Izreke 12:18



--
Nesmotren govori kao da mačem probada, a jezik je mudrih iscjeljenje. Izreke 12:18



--
Nesmotren govori kao da mačem probada, a jezik je mudrih iscjeljenje. Izreke 12:18

reply via email to

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