lilypond-devel
[Top][All Lists]
Advanced

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

Re: Working on scheme engravers


From: Trevor Daniels
Subject: Re: Working on scheme engravers
Date: Sat, 23 Jan 2010 09:21:55 -0000

Hi Eric

I'm a relative newcomer to Lily development too,
so it's best to keep these questions and answers
on the -devel list.  That way others can chip in
to correct anything I say that is wrong and suggest
alternative and probably better ways of achieving
what you want to do.

I've tried to answer some of your questions below,
and left your mail unaltered so others can see the
full content.

Trevor

Eric Knapp wrote Friday, January 22, 2010 5:43 PM
Subject: Re: Working on scheme engravers


Thanks, Trevor.

I have gotten this to work with the following code:

      (cons 'note-event (lambda (engraver event)
        (display (list "\n\nEngraver: \n" engraver "\n\n"))
        (let*
          (
            (arts (ly:event-property event 'articulations)
          )
          (finger-found #f)
          (string-found #f))

          (map (lambda (arts)
             (let*
               ((digit-num (ly:event-property arts 'digit))
(string-num (ly:event-property arts 'string-number))) (if (and (eq? 'string-number-event (ly:event-property arts 'class))
                   (number? string-num))
                 (set! string-found string-num)
               )
(if (and (eq? 'fingering-event (ly:event-property arts 'class))
                   (number? digit-num))
                 (set! finger-found digit-num)
               )
             )
          )
          arts)
          (display (list "\n\nFinger: " finger-found "\nString: "
string-found "\n\n"))
      )))

Now I'm on to the next step. Now that I have the finger and string
numbers, I have to do the following:

1. Prevent drawing of the notehead.

You may find it best to set up a custom context
or contexts eventually, but for now just remove
any engravers you don't need.  Look at the
definitions of TabStaff and TabVoice in
ly/engraver-init.ly for inspiration.  This might
suggest other things you might want to adjust too.

2. Prevent drawing of the fingering number.

See (1)

3. Draw custom notehead or glyph depending on finger number. Maybe I
could use a custom font here? A font for this already exists for
Finale. There are Postscript Type 1 and TrueType versions.

If you intend eventually adding this to the LilyPond
distribution be sure any fonts you use have a GPL
license or be public domain.  Or if you design them
yourself be prepared to release them under GPL 3.

The code which generates these in tabulation is in
scm/translation-functions.scm.  I, Carl and possibly
others are modifying this file at present, so I can't
give an exact line number, but if you search for
TabNoteHead you'll find it.

4. Prevent drawing of string number.

See (1)

5. Draw a small rectangle on the staff line that corresponds to the
string number.

The routines mentioned in (3) should give you some
hints.  The markup command for rounded-box is probably
the one you need.

6. Calculate the fret based on the note and string and display a fret
number above or below the staff.

See (3)

I'm looking through the code in the scm directory looking for examples of doing things like this. Where should I be looking for examples? I have some music functions that do this but they can't do everything.

Hope the clues above will help.  I'm sure others will
chip in if there are better suggestions.

Thanks again for the help.

You're welcome

-Eric
Trevor





reply via email to

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