lilypond-user
[Top][All Lists]
Advanced

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

Re: Help with creating incipit-like custom ambitus


From: Spyros Lyberis
Subject: Re: Help with creating incipit-like custom ambitus
Date: Sun, 15 Mar 2009 08:25:36 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Spyros Lyberis <lyberis <at> csd.uoc.gr> writes:

> 
> Hi,
> 
> I'm currently using lilypond to help my music teacher publish a book of his
> lifelong collection of ~100 choir arrangements (both a cappella and
> piano-accompanied) and up to now I'm using the normal ambitus grob for the
> voice staffs which does the job fine.
> 
> However, having worked a lot with older renaissance scores, I'd like to
> create a custom ambitus for this book, which resembles the incipits
> described in some snippets in the documentation. Specifically:
> 
> - For each staff, a new short staff would be created in the instrument
>   name, as in the incipits example
> 
> - Instead of the starting notes of the music, this short staff must
>   contain two notes connected by a glissando: the minimum pitch of
>   the actual music of the normal staff, and the maximum pitch.
> 
> I think I understand how to do this manually (i.e. finding the min/max
> pitches of each staff, and then put these pitches explicitly in the
> "incipit"), although I haven't tried it yet. Since we're talking about 100
> scores, averaging 400 staffs, the question is: can I write some Scheme
> function that AUTOMATICALLY finds the min and max pitches from a ly:music
> object?
> 
> I've written some simple substitution functions, but I'm still not very
> familiar with Scheme. I searched the functions index, but nothing seemed
> appropriate. I also looked at ambitus.cc, but that was even more cryptic :)
> 
> Can anybody point me to the right direction?
> 
> Thanks in advance,
> Spyros
> 


To be more specific, I did the manual work and the result looks like this:

http://thalitas.gr/tmp/incipit.jpg

The code so far is listed below.

Can anyone help w.r.t. how can I create a function that given a voice's music 
(a ly:music object) will automatically determine the two notes for the custom
ambitus?


#(define-music-function (parser location incipit-music) (ly:music?)
  #{
    \once \override Staff.InstrumentName #'self-alignment-X = #RIGHT
    \once \override Staff.InstrumentName #'self-alignment-Y = #UP
    \once \override Staff.InstrumentName #'Y-offset = #4
    \once \override Staff.InstrumentName #'padding = #0.3
    \once \override Staff.InstrumentName #'stencil =
    #(lambda (grob)
       (let* ((instrument-name (ly:grob-property grob 'long-text))
              (layout (ly:output-def-clone (ly:grob-layout grob)))
              (music (make-music 'SequentialMusic
                      'elements (list (make-music 'ContextSpeccedMusic
                                        'context-type 'Staff
                                        'element (make-music 'PropertySet
                                                   'symbol 'instrumentName
                                                   'value instrument-name))
                                      $incipit-music)))
              (score (ly:make-score music))
              (mm (ly:output-def-lookup layout 'mm))
              (indent (ly:output-def-lookup layout 'indent))
              (width (ly:output-def-lookup layout 'incipit-width))
              (incipit-width (if (number? width)
                                 (* width mm)
                                 (* indent 0.5))))
         (ly:output-def-set-variable! layout 'indent (- indent incipit-width))
         (ly:output-def-set-variable! layout 'line-width indent)
         (ly:output-def-set-variable! layout 'ragged-right #f)
         (ly:output-def-set-variable! layout 'ragged-last #f)
         (ly:output-def-set-variable! layout 'system-count 1)
         (ly:score-add-output-def! score layout)
         (ly:grob-set-property! grob 'long-text
               (markup #:score score))
         (ly:system-start-text::print grob)))
  #})


sopraniIncipit = <<
  \new Voice = "sopraniIncipit" <<
    {
      \clef "treble"
      \once \override Score.TimeSignature #'stencil = ##f

      s64 c'4 \glissando c''4

      \stopStaff
      \once \override Rest #'transparent = ##t
      r4
    }
  >>
>>

altiIncipit = <<
  \new Voice = "altiIncipit" <<
    {
      \clef "treble"
      \once \override Score.TimeSignature #'stencil = ##f

      s64 a4 \glissando bes'4

      \stopStaff
      \once \override Rest #'transparent = ##t
      r4
    }
  >>
>>







reply via email to

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