lilypond-user
[Top][All Lists]
Advanced

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

Suggestions for macro tools to generate .ly files


From: Jack O'Quin
Subject: Suggestions for macro tools to generate .ly files
Date: 11 Oct 2004 19:26:56 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

I'm helping a friend write an electric bass method book.  In an effort
to reach as many players as possible, we decided to print each
exercise in both bass clef and tablature.  Lilypond and lilypond-book
work great for this.

After experimenting, we came up with dozens of snippets like the
example below.  It looks good and has lots of information about
fingerings and where to shift hand positions.

Since I've already created dozens of these little files and will be
creating hundreds or even thousands more, I want some tools to ease
the chore.  There is a lot of redundent information in each example.
All I really need to type are the note sequence, fingerings, and the
fingerboard position of each shift.  Conceptually, something like this
should suffice...

   %% B-flat major arpeggio, second inversion
   \exercise{f-1  bf-1 \pos{3} d-3 f-1  bf-1 \pos{7} d-1 |
             f-4 d-1 bf-2 f-2 \pos{5} d-1 bf-2 |}

I could write a stand-alone script to expand that into the full .ly
file.  But, should I do it all within lilypond using SCHEME?  (I know
SCHEME, but not the internals of lilypond.)  Or, should I use
something like the LaTeX \newcommand{}?  M4?  Emacs lisp?

I don't understand the whole infrastructure of lilypond and LaTeX well
enough to know what approach to use.  What do you folks suggest?

  %% B-flat major arpeggio, second inversion
  \version "2.0.0"
  \include "english.ly"
  fingerings = \notes \relative c, {
      \clef bass \key bf \major
      \repeat volta 2 {f-1  bf-1  d-3\startGroup f-1  bf-1\stopGroup
                     d-1\startGroup | f-4 d-1 bf-2 f-2\stopGroup
                     d-1\startGroup bf-2\stopGroup}
  }
  tablature = \notes \relative c, {
      f bf
      \property TabStaff.minimumFret = #3
      d f bf 
      \property TabStaff.minimumFret = #7
      d | f d bf f
      \property TabStaff.minimumFret = #5
      d bf |
  }
  \score { 
      \include "fingerings.ly"
  }
  
  %% fingerings.ly contains..
  \notes <<
      \time 3/4
      \context Staff \fingerings
      \context TabStaff \relative c, {
        \applyoutput #(outputproperty-compatibility 
                       (make-type-checker 'staff-symbol-interface)
                       'line-count 4)
        \property TabStaff.stringTunings =  #'(-5 -10 -15 -20)
        \tablature
      }
  >> 
  \paper{ papersize = "letter"
        \translator {
            \StaffContext \consists "Horizontal_bracket_engraver"
        } }

This example uses lilypond 2.0.0, which I currently have installed.  I
experimented with 2.2.6 briefly, discovered that my code would need
conversion, then backed it out because I needed to get some work
finished.  I should probably go ahead and make the conversion soon,
before it becomes even more of a barrier.  A macro expansion tool
might make that job a little easier.

Once again, thanks for creating such a great program.
-- 
  joq




reply via email to

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