lilypond-user
[Top][All Lists]
Advanced

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

Re: adding 'HarmonicEvent?


From: Éditions IN NOMINE
Subject: Re: adding 'HarmonicEvent?
Date: Mon, 20 Sep 2010 13:46:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2

Naerly the same, that works perfectly (welle I'm quite enthousiastic beacause it's my first scheme function !) :

makeHarmonic =
  #(define-music-function (parser location note)(ly:music?)
  "force noteHead to harmonic"
  (let ((result-note (ly:music-deep-copy note)))
    (set! (ly:music-property (first (ly:music-property result-note 'elements)) 'articulations)
          (list (make-music (quote HarmonicEvent)))
    )
    result-note)
    )

{c''4 \makeHarmonic c''4}


Best regards.

JMarc
On 20/09/2010 11:36, David Kastrup wrote:
Marc Hohl <address@hidden> writes:

Hello all,

I try to write a function that changes its argument to harmonics,
so
\makeHarmonic c4

should have the same effect as
<c\harmonic>4

I read Notation Reference 6.3.4, but the 'HarmonicEvent is
deep inside the 'elements list, so I think the only way to get this done
is to read the full structure and rebuild it, including the 'HarmonicEvent.

I remembered to have seen something similar in ly/chord-repetition-init.ly
and tried to modify the code here, but after struggling with the code
for about an hour or so, it still doesn't work at all. Can somebody please
explain to me how I can rebuild the argument to \makeHarmonic so that
in includes
the desired 'HarmonicEvent entry?
Well, I would have suggested something like

makeHarmonic =
#(define-music-function (parser location music) (ly:music?)
  (let ((event (car (ly:music-property music 'elements))))
   #{
  < #(ly:export (ly:event-property $event 'pitch)) \harmonic>
    #(ly:export (ly:event-property $event 'duration)) #}))

{ <c\harmonic>4 \makeHarmonic c4 }


Except that it segfaults.


reply via email to

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