Render a standalone chord chart of chord fretboard diagrams with LilyPond for a set of chords.
render_chordchart(
chords,
file,
size = 1.2,
header = NULL,
paper = NULL,
colors = NULL,
crop_png = TRUE,
transparent = FALSE,
res = 150,
keep_ly = FALSE,
details = FALSE
)
named character vector of valid formatting for LilyPond chord names and values. See examples.
output file.
numeric, size of fretboard diagrams (relative to paper font size). Use this to scale diagrams up or down.
a named list of arguments passed to the header of the LilyPond file. See details.
a named list of arguments for the LilyPond file page layout. See details.
reserved; not yet implemented for this function.
logical, see lilypond()
for details.
logical, transparent background, png only.
numeric, resolution, png only. transparent = TRUE
may fail when
res
exceeds ~150.
logical, keep intermediate LilyPond file.
logical, set to TRUE
to print LilyPond log output to
console. Windows only.
writes files to disk
This function uses a generates a LilyPond template for displaying only a
fretboard diagram chart. It then passes the file to LilyPond for rendering.
To plot specific fretboard diagrams in R using ggplot and with greater
control, use plot_fretboard()
.
The options for paper
include the following and have the following
default values if not provided.
textheight = 220
linewidth = 150
indent = 0
fontsize = 10
page_numbers = FALSE
print_first_page_number = TRUE
first_page_number = 1
fontsize
only controls the global font size. If you want to scale the
size of the fretboard diagrams up or down use the the size
argument
rather than this paper
value.
Note that chord chart output must fit on a single page. If the full set of
chord diagrams does not fit on one page then diagrams will be clipped in the
rendered output. Use size
to keep the output to one page or make
multiple sheets separately.
suppressPackageStartupMessages(library(dplyr))
chords <- filter(
guitarChords, root %in% c("c", "f") & id %in% c("7", "M7", "m7") &
!grepl("#", notes) & root_fret <= 12) |>
arrange(root, id)
chords <- setNames(chords$fretboard, chords$lp_name)
head(chords)
#> c:7 c:7 c:7 c:7
#> "x;3;2;3;1;x;" "x;3;5;3;5;3;" "x;3;2;3;1;3;" "8;10;8;9;8;8;"
#> c:7 c':7
#> "8;x;8;9;8;x;" "x;x;10;9;11;8;"
# requires LilyPond installation
if(tabr_options()$lilypond != ""){
outfile <- file.path(tempdir(), "out.pdf")
hdr <- list(
title = "Dominant 7th, major 7th and minor 7th chords",
subtitle = "C and F root"
)
render_chordchart(chords, outfile, 2, hdr, list(textheight = 175))
}