lilypond-user
[Top][All Lists]
Advanced

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

Re: Figured Bass Questions part II


From: Nicolas Sceaux
Subject: Re: Figured Bass Questions part II
Date: Wed, 20 Oct 2004 09:43:51 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Trent J" <address@hidden> writes:

> 4.    How can I ensure that the verse lines are close together and
> not separated by a lot of white space?

For that particular problem, I use a function that transform a figured
bass expression, ie:
  \figuremode { <_>4 <5> <4-> }
to a regular voice with skips and markups, ie (approximatively):
  { s4 s-\markup \number 5 s-\markup { \number 4 \flat } }

I still have problems with it, but here is a function which might
be a starting point:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Custom figured bass

#(define (fig-seq->markup-seq seq-music)
  ;;
  (define (alteration->markup alteration)
   (make-raise-markup
    (if (= alteration FLAT)
        0.3
        0.6)
    (make-musicglyph-markup
     (string-append "accidentals-" (number->string alteration)))))
  ;; BassFigureEvent --> TextScriptEvent and SkipEvent
  (define (fig->markup fig-music)
   (let* ((fig  (ly:music-property fig-music 'figure))
          (acc  (ly:music-property fig-music 'alteration))
          (acc-markup #f)
          (fig-markup (if (markup? fig)
                       fig
                       (if (not (eq? acc '()))
                        (make-simple-markup "")
                        (make-strut-markup)))))
    (list 
     (make-music 'TextScriptEvent
      'direction -1
      'text (markup #:teeny (if (number? acc)
                                         (markup fig-markup
                                          (alteration->markup acc))
                                         fig-markup)))
     (make-music 'SkipEvent
      'duration (ly:music-property fig-music 'duration)))))
  ;;
  (if (not (null? seq-music))
   (begin
    (if (ly:music-property seq-music 'element)
     (set! (ly:music-property seq-music 'element)
      (fig-seq->markup-seq (ly:music-property seq-music 'element))))
    (set! (ly:music-property seq-music 'elements)
     (let ((elements (list)))
      (for-each (lambda (mus)
                 (if (eqv? (ly:music-property mus 'name) 'BassFigureEvent)
                  (set! elements (append (fig->markup mus) elements))
                  (set! elements (cons (fig-seq->markup-seq mus) elements))))
       (ly:music-property seq-music 'elements))
      (if (eqv? (ly:music-property seq-music 'name) 'EventChord)
       elements
       (reverse! elements))))))
  seq-music)

markupfigures=#(def-music-function (location music) (ly:music?)
            (fig-seq->markup-seq music))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

It can be used like this:

  \new Staff <<
    \clef bass
    \notemode { c2 d4 }
    \markupfigures \figuremode { <_>4 <5> <4-> }
  >>

nicolas





reply via email to

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