lilypond-user
[Top][All Lists]
Advanced

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

Re: Extract pitch and duration from ly:music


From: Joshua Stutter
Subject: Re: Extract pitch and duration from ly:music
Date: Wed, 21 Feb 2018 14:40:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

I feel I should enter into the discussion here. I had a conversation with Paolo on lilypond IRC where he was wishing to accomplish something along the lines of:

fun = #(define-music-function (parser location note dur) (ly:pitch? ly:duration?)
#{ $note$dur #})

and create notes from pitches and durations within #{ #}. I explained that, to the best of my knowledge, this is not possible and new notes must be constructed within Scheme and cannot be concatenated like this.

Joshua.


On 21/02/18 14:29, David Kastrup wrote:
Paolo Prete <address@hidden> writes:

Hello,
is it possible to extract pitch and duration, inside a function, from
a ly:music (a simple note) parameter?
I would like to obtain something like:
func = #(define-music-function (parser location note dur)
(ly:music) #{ ....  $mypitch $myduration .....  #}  )
... But I don't understand if is there a way to obtain $mipitch and $myduration
I know that I can extract them with scheme:
((mypitch (ly:music-property note 'pitch '()))    (myduration
(ly:music-property note 'duration '())))

But I see that it is not possible to use $mypitch and $myduration in
the #{ ... #}  scope.
Can you tell us what makes you see that?





reply via email to

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