lilypond-devel
[Top][All Lists]
Advanced

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

Re: Passing music objects into scheme functions


From: Charles Winston
Subject: Re: Passing music objects into scheme functions
Date: Mon, 14 Aug 2017 13:45:19 -0400

> On Aug 14, 2017, at 1:34 PM, David Kastrup <address@hidden> wrote:
> 
> David Kastrup <address@hidden> writes:
> 
>> Charles Winston <address@hidden> writes:
>> 
>>>> On Aug 14, 2017, at 1:20 PM, David Kastrup <address@hidden> wrote:
>>>> 
>>>> Charles Winston <address@hidden> writes:
>>>> 
>>>>> Here is the function inside chord-name.scm
>>>>> 
>>>>> 
>>>>> ;; chordmode-to-exceptions
>>>>> (define-safe-public (chordmode-to-exceptions chord markup)
>>>>> "Transform event-chord entered in chord mode to alist
>>>>> entry in chordSemanticsNameExceptions list
>>>>> "
>>>>> (define (is-semantics-event? x)
>>>>>   (ly:in-event-class? x 'chord-semantics-event))
>>>> 
>>>> Event classes are for stream events, not for music expressions.
>>>> 
>>>>> (define (get-semantics chord)
>>>>>   (let* ((elts (ly:music-property chord 'elements))
>>>>>          (semantics-event (filter is-semantics-event? elts))
>>>>>          (semantics-list (ly:event-property semantics-event 
>>>>> 'chord-semantics)))
>>>> 
>>>> ly:event-property is for stream events, not for music expressions.
>>>> 
>>>>>     semantics-list))
>>>>> (list (cons (get-semantics chord) markup)))
>>>> 
>>>> Stream events are generated from music expressions during iteration of
>>>> music expressions (the interpretation phase making use of engravers
>>>> etc).
>>> 
>>> I believe these actually are stream events.
>> 
>> It doesn't matter what you believe.  After
>> 
>>> chordVar = \chordmode { c1:m7 }
>>> 
>>> markupVar = \markup { “min7” }
>>> 
>>> #(chordmode-to-exceptions chordVar markupVar)
>> 
>> chordVar most certainly is a music expression rather than a stream
>> event.  And chordmode-to-exceptions is a confused mess that sometimes
>> calls ly:music-property and sometimes ly:event-property on its
>> constituents.  There is no input (apart from empty chords) that it will
>> process sensibly unless your branch messes up \chordmode completely and
>> generates a mishmash of stream events and music expressions.
> 
> Ok, that was quite uncalled for.  I apologize for the pigheaded way I
> expressed myself here.

I know that chordVar isn’t a stream event. I was saying chord-semantics-event 
is. Anyway this is what I’m trying to do:

Extract the elements property from the chord parameter, thats when I call 
ly:music-property. Then from the elements, I want to find the element which is 
a chord-semantics-event. I do this with the function is-semantics-event?. This 
stream event is something I’ve defined as a part of my summer of code project 
and has worked for naming chords using semantics. Then from this 
semantics-event, I want to get the list of semantics, which is a property of 
the chord-semantics-event. This is when I use ly:event-property.  This is the 
list that I would like to be a key for the alist pair. I return the pair as a 
list so I can append it to the complete list of chord exceptions, just like the 
current chord exceptions does it.

Let me know where I’m going wrong here.

Charles


reply via email to

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