lilypond-user
[Top][All Lists]
Advanced

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

Re: Apply a music-function script to all elements of a list


From: zaord
Subject: Re: Apply a music-function script to all elements of a list
Date: Thu, 4 May 2017 09:59:37 -0700 (MST)

Hi,

I still have a little question :

In my code, I use a define-music-function to exctract the nots of chords
from a chordmode , and i compare each pitch of the notes events with a list
to find x/y position of a colored dot making a custom diagram.

My problem is that I can't get the name of the pitch, and when I compare the
pitch and my list, the values didn't match.

#(define-markup-command (complete layout props the-chord)
  (ly:music?)
  (ly:stencil-scale
   (
     
     (make-dot-list 
      (map
        (lambda (m) (ly:music-property m 'pitch))
        (extract-named-music the-chord 'NoteEvent)))) 
    1 1))


diag=
#(define-music-function (parser location music)
  (ly:music?)
  (music-map
    (lambda (m)
     (if (music-is-of-type? m 'event-chord)
      #{ <>^\markup \complete #m $m #}
      m))
    music))


Here is the code which compare the list and the pitch from music event
function :

#(define (make-dot-list l1)
   (if (null? l1) 
       empty-stencil
       (ly:stencil-add 
          (make-dot (ly:pitch-notename(car l1)))
          (make-dot-list (cdr l1)))))

I get this error in lilypond.

keyboard diagram error - unkown note '0' 

If I drop the ly:pitch-notename, I get this error instead : fatal error:
keyboard diagram error - unkown note '#<Pitch c' >'

I would like to extact from the varioable only c' in this case.
Why the function ly:pitch-notename fails ?

I join the ly file.

Thanks By advance.

Ewen







--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Apply-a-music-function-script-to-all-elements-of-a-list-tp200313p202900.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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