lilypond-user
[Top][All Lists]
Advanced

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

Re: Fwd: Slash chords


From: Luca Fascione
Subject: Re: Fwd: Slash chords
Date: Sat, 21 Nov 2015 11:31:48 +1300

Wow looks brilliant! I'm away from my computer at the moment but I'll test later in the day and report, I think it's great!  Thanks a lot Simon!
Luca

On 21 Nov 2015 10:36, "Simon Albrecht" <address@hidden> wrote:
Hello Luca,

with the help of the french blog post jmechmech linked in his reply, I cooked up the following from your code:

%%%%%%%%%%%%
\version "2.18.2"

#(define (lower-extension pitch chbass)
   "Return lowered markup for pitch note name."
   #{
     \markup \raise #-1.9 \halign #0.2
     #(note-name->markup pitch chbass)
   #})

chExceptionMusic = {
  <c e g bes>1-\markup { "7" }
  %<c e g b>1-\markup { "<7/" \raise #-2.5 "B" } % for illustration purposes only
  <c ees g>1-\markup { ">" }
}

chExceptions = #(append
                 (sequential-music-to-chord-exceptions chExceptionMusic #t)
                 ignatzekExceptions)

\layout {
  \context {
    \ChordNames
    \override ChordName.font-name = #"New Real Book Chords"
    chordNameExceptions = \chExceptions
    slashChordSeparator = \markup {
      % the \hspace commands simulate kerning
      \hspace #-.7
      \fontsize #1 \lower #1.2 \rotate #-10 "/"
      \hspace #-.1
    }
    chordNoteNamer = #lower-extension
  }
}

\score {
  \new StaffGroup <<
    \chords {
      f2.:m c4:7/e c2:maj7
    }
    \new Staff { \key aes \major \time 3/4 c'4 aes'2 c'4 bes'2 }
  >>
  \layout { }
}
%%%%%%%%%%%%%%

Does that do what you want? I couldn’t test it with the actual font, of course, only with LilyPond’s default Sans font. So you’ll likely have to adjust the numerical values in lines 6 and 27–29 to taste. See <http://lilypond.org/doc/v2.18/Documentation/notation/text-markup-commands> for documentation on the markup commands (you can also look them up in the index, section D of the Notation Reference).
You can fitfully use the \layout {} block in a stylesheet (i.e., a separate .ily file to \include everywhere you want this kind of chord names display).

HTH, Simon

On 20.11.2015 22:04, Luca Fascione wrote:
Actually, sorry for not thinking about this before, but writing it in LaTeX gave me an idea to illustrate what I'd like to achieve (roughly).

%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
% test for setting slash chords with realbookchords font

chExceptionMusic = {
  <c e g bes>1-\markup { "7" }
  <c e g b>1-\markup { "<7/" \raise #-2.5 "B" } % for illustration purposes only
  <c ees g>1-\markup { ">" }
}

chExceptions = #( append
  ( sequential-music-to-chord-exceptions chExceptionMusic #t)
  ignatzekExceptions)

\score {
  \new StaffGroup <<
    \chords {
        \override Score.ChordName #'font-name = #"New Real Book Chords"
        \set chordNameExceptions = #chExceptions
        \set slashChordSeparator = "/"
        f2.:m c4:7/e c2:maj7
    }
    \new Staff { \key aes \major \time 3/4 c'4 aes'2 c'4 bes'2 }
  >>
  \layout {}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%

You can see I have hardcoded the form of Cmaj7 to render as Cmaj7/B, but the spacing feels like a step in the right direction (admittedly the kerning could use work, but it feels like a reasonable compromise)

I have attached the corresponding pdf I get, so you can see what I mean

Thanks,
Luca

On Sat, Nov 21, 2015 at 9:27 AM, Luca Fascione <address@hidden <mailto:address@hidden>> wrote:

    Thanks Simon!
    I'm also attaching the small GIF from the other website for reference,
    and the result I presently get from 2.18.2.

    It seems this question has come up a long time ago but I couldn't
    find a definitive resolution to it.

    As I was saying, I am happy to contribute time to the coding if it
    helps, but I could certainly use a bit of guidance as to where to
    start.

    Things are never this simple, but in LaTeX-speak it seems to me
    all it's needed is to wrap the bass note in something more or less
    like \raisebox{-1ex}{E} (and maybe mess a bit with the kerning of
    the slash, hard to say without trying it out).

    I've tried to look in the source (for 2.18.2) and I found that in
    chord-ignatzek-names.scm, around line 210, it calls a routine
    names make-line-markup, which might be near where the modification
    needs to happen. But I have no idea how to override the behaviour
    of that piece of code from my source file.

    Thanks for your help
    Luca

    On Fri, Nov 20, 2015 at 11:36 PM, Simon Albrecht
    <address@hidden <mailto:address@hidden>> wrote:

        On 20.11.2015 10:56, Urs Liska wrote:

            Dear Luca,

            this is a question you should ask on the lilypond-user
            mailing list.
            I have forwarded it there but I strongly suggest you
            subscribe at
            https://lists.gnu.org/mailman/listinfo/lilypond-user to
            automatically receive any replies.

            Best
            Urs

            Am 20.11.2015 um 10:46 schrieb LilyPond blog contact form:


                /From:/ Luca Fascione

                /Message:/

                Hello,
                I've been using lilypond for a little while now and I
                rather like it.

                I've been able to achieve most of what I want for my
                engraving needs, but I think I need some help to set
                up slash chords like in this example

                http://www.apianotuner.com/img/RealBookSample.gif

                I'm using the font &quot;New Real Book Chords&quot;
                distributed here https://musescore.org/node/7785, and
                I have setup exceptions to the Ignatzek rules to drive
                the font correctly, but I can't find a way to tell
                lilypond that the bass note should be set lowered
                (like in the gif above).

                I have put a small repro case at the bottom of this
                message

                Any help or indication you could spare would be
                greatly appreciated (I am a fairly accomplished
                software engineer and I'm not afraid of writing code
                to achieve this, although I have to confess I am a C++
                guy, not a Guile/Scheme guy).

                Thanks very much
                Luca Fascione

                ------------------------
                example.ly <http://example.ly>


        Too bad the code got messed up. Here is a (hopefully) clean
        version:
        %%%%%%%%%%
        \version "2.18.2"
        % test for setting slash chords with realbookchords font

        chExceptionMusic = {
          <c e g bes>1-\markup { "7" }
          <c ees g>1-\markup { ">" }
        }

        chExceptions = #(append
        (sequential-music-to-chord-exceptions chExceptionMusic #t)
                          ignatzekExceptions)

        \score {
          \new StaffGroup <<
            \chords {
              \override Score.ChordName.font-name = #"New Real Book
        Chords"
              \set chordNameExceptions = #chExceptions
              \set slashChordSeparator = "/"
              f2.:m c:7/e
            }
            \new Staff { \key aes \major \time 3/4 c'4 aes'2 c'4 bes'2 }
          >>
          \layout {}
        }
        %%%%%%%%%%%%%
        and once attached, just in case.

        Yours, Simon





reply via email to

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