[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modifying Chordnames bug or feature?
From: |
Carl Sorensen |
Subject: |
Re: Modifying Chordnames bug or feature? |
Date: |
Sat, 16 Jul 2011 19:51:28 -0600 |
On 7/16/11 4:20 PM, "harm6" <address@hidden> wrote:
>
>
> 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??
The syntax of the chord root namer has changed between 2.12 and 2.14. The
chord root namer now needs both a pitch and a boolean value that says
whether minor chord names should be lowercase. So LilyPond will always pass
a pitch and a boolean to the chord root namer.
The LSR snippet uses the old syntax -- chord root namer only takes a pitch.
To make the snippet work (and ignore the possibility of making minor chords
lowercase), just add an extra argument to the definition of myChordNames
(just like you did with bla-blub). It will then work -- your myChordNames
procedure ignores the boolean value passed it by LilyPond, which is just
fine.
HTH,
Carl