lilypond-user
[Top][All Lists]
Advanced

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

Modifying Chordnames – bug or feature?


From: harm6
Subject: Modifying Chordnames – bug or feature?
Date: Sat, 16 Jul 2011 15:20:02 -0700 (PDT)

Hi,

trying to modify chordnames (version 2.14.1) I'm running in a strange
behaviour. 

1. Compiling http://lsr.dsi.unimi.it/LSR/Item?id=750 gives:

ERROR: Wrong number of arguments to #<procedure my-chord-name->pop-markup
(pitch)>


2. So I tried my own definition.
Copying, modifying and simplifying code from chord-name.scm, I came up with

%begin
---------------------------------------------------------------------------

#(define (myChordNames  pitch lowercase?)

   (define (pitch-alteration-semitones pitch)
     (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
     
   (define (conditional-kern-before markup bool amount)
     (if bool
         (make-line-markup
          (list (make-hspace-markup amount)
          markup))
         markup))
      
   (define (accidental->markup alteration)
     (if (= alteration 0)
         (make-line-markup (list empty-markup))
         (conditional-kern-before
          (alteration->text-accidental-markup alteration)
          (= alteration FLAT) 0.2)))
     
   (let* ((name (ly:pitch-notename pitch))
          (alt-semitones  (pitch-alteration-semitones pitch))
          (n-a (cons name alt-semitones)))
     (make-line-markup
      (list
       (make-simple-markup
         (vector-ref #("C" "D" "E" "F" "G" "A" "B") (car n-a)))
       (make-fontsize-markup -3 
        (make-raise-markup 1.5
         (accidental->markup (/ (cdr n-a) 2))))))))   
         
myChords = {
  \set chordRootNamer = #myChordNames
}

%--------------------------- Test ----------------------------------

\chords { \myChords cis ces }

%end
----------------------------------------------------------------------------------

        It works as expected.

3. But trying to delete "lowercase?" in the first line of
myChordNames-Definition gives the some ERROR as above!?

And it is possible to replace "lowercase?" with any other expression and it
will work!! 
                
                #(define (myChordNames  pitch bla-blub) ...  works!

4.So I tried the LSR-Snippet again, adding bla-blub:

                #(define (my-chord-name->pop-markup pitch bla-blub) ...

                and ... it works !!!


Is this a feature for something or a bug or what's going on here??


Regards,
  Harm
-- 
View this message in context: 
http://old.nabble.com/Modifying-Chordnames-%E2%80%93-bug-or-feature--tp32075610p32075610.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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