Render a standalone chord chart of chord fretboard diagrams with LilyPond for a set of chords.
Usage
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
)Arguments
- chords
named character vector of valid formatting for LilyPond chord names and values. See examples.
- file
output file.
- size
numeric, size of fretboard diagrams (relative to paper font size). Use this to scale diagrams up or down.
- header
a named list of arguments passed to the header of the LilyPond file. See details.
- paper
a named list of arguments for the LilyPond file page layout. See details.
- colors
reserved; not yet implemented for this function.
- crop_png
logical, see
lilypond()for details.- transparent
logical, transparent background, png only.
- res
numeric, resolution, png only.
transparent = TRUEmay fail whenresexceeds ~150.- keep_ly
logical, keep intermediate LilyPond file.
- details
logical, set to
TRUEto print LilyPond log output to console. Windows only.
Details
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 = 220linewidth = 150indent = 0fontsize = 10page_numbers = FALSEprint_first_page_number = TRUEfirst_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.
Examples
if (FALSE) { # \dontrun{
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)
# 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))
}
} # }
