[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setting fretboard diagrams at the top of the page
From: |
Carl Sorensen |
Subject: |
Re: setting fretboard diagrams at the top of the page |
Date: |
Thu, 17 Jan 2019 19:34:17 +0000 |
User-agent: |
Microsoft-MacOutlook/10.10.5.181209 |
Hi Evan,
Welcome to LilyPond!
On 1/15/19, 11:10 AM, "Evan Levine" <address@hidden> wrote:
Good afternoon! I've got a few things I'm brewing right now, but the
most pressing is that I'm looking to set all of the chord diagrams for a
lead sheet at the top of the page under the title, and modify the
spacing of the diagrams to be centered on the page and have padding
between each diagram.
The key here, in my opinion, is to set the fret diagrams as markups, rather
than as music.
Thanks so much! Here's my code:
Great job on providing a small example! That was helpful to see what you
intended.
The only problem with the example is that it wouldn't completely compile,
because the music and lyrics were missing. It's much easier if you provide
those.
Please forgive me for any oversight of the protocol here, as this is my
first interaction with the mailing list.
The only oversight I see is that you put your mail at the top of another
unrelated post. Please don't post your reply to the top of a full post, and
when you start a new thread, don't do it by replying to a previous post.
With that said, here's how I'd attack your problem. I've created some markup
functions to allow you to have control over size, spacing, etc.
%%%% Beginning of sample code
\version "2.19.82"
\header {
title = "Steven Universe Theme"
composer = "Rebecca Sugar, Aivi & Surasshu"
tagline = ##t
}
#(define chord-name-fontsize 6)
#(define name-fretboard-separation .75)
#(define different-separation 8)
#(define same-separation 2)
#(define or-vspace 1.75)
#(define fret-formatting "s:2.2;w:4;h:3;d:0.37;f:1;")
#(define c-fret "4-x;3-4-2;2-3-2;1-x;")
#(define e-one-fret "c:4-2-4;4-4-3;3-4-3;2-4-3;1-x;")
#(define e-two-fret "4-x;3-4-2;2-4-3;1-2-1;")
#(define f-fret "4-x;3-5-2;2-5-3;1-3-1;")
#(define fm-fret "4-x;3-5-2;2-4-3;1-3-1;")
#(define-markup-command (chord-name-markup layout props chord-name)
(markup?)
"Display a chord name in the desired formatting"
(interpret-markup layout props
#{ \markup \sans \fontsize #chord-name-fontsize $chord-name #} ))
#(define-markup-command (name-and-fret-markup layout props chord-name
fret-diagram)
(markup? markup?)
"Display a chord name and fretboard as stacked markups separated by
name-fretboard-separation"
(interpret-markup layout props
#{ \markup \center-column {
\chord-name-markup $chord-name
\vspace #name-fretboard-separation
$fret-diagram
}
#}))
#(define-markup-command (or-markup layout props or-text)
(markup?)
"Display a separator between alternative fretboards"
(interpret-markup layout props
#{ \markup \center-column {
\vspace #or-vspace
\chord-name-markup $or-text
}
#}))
\markup \line {
\name-and-fret-markup "C" \fret-diagram #(string-append fret-formatting
c-fret)
\hspace #different-separation
\center-column {
\name-and-fret-markup "E" \line {
\fret-diagram #(string-append fret-formatting e-one-fret)
\hspace #same-separation
\or-markup "or"
\hspace #same-separation
\fret-diagram#(string-append fret-formatting e-two-fret)
\hspace #same-separation
\or-markup "or"
\hspace #same-separation
\fret-diagram#(string-append fret-formatting e-two-fret)
}
}
\hspace #different-separation
\name-and-fret-markup "F" \fret-diagram #(string-append fret-formatting
f-fret)
\hspace #different-separation
\center-column {
\name-and-fret-markup "Fm" \fret-diagram #(string-append fret-formatting
fm-fret)
}
}
\score {
<<
\new ChordNames {
c1 e f c f
}
\new Staff {
\new Voice = "melody" {
\repeat unfold 5 {c'4 d' e' f'}
}
}
\new Lyrics {
\lyricsto "melody" {
\repeat unfold 5 {tra la la la }
}
}
>>
}
%%%% end of sample code
HTH,
Carl