Render sheet music/tablature from a music score with LilyPond.
tab(
  score,
  file,
  key = "c",
  time = "4/4",
  tempo = "2 = 60",
  header = NULL,
  paper = NULL,
  string_names = NULL,
  endbar = TRUE,
  midi = TRUE,
  colors = NULL,
  crop_png = TRUE,
  transparent = FALSE,
  res = 150,
  keep_ly = FALSE,
  simplify = TRUE,
  details = FALSE
)render_tab(
  score,
  file,
  key = "c",
  time = "4/4",
  tempo = "2 = 60",
  header = NULL,
  paper = NULL,
  string_names = NULL,
  endbar = TRUE,
  midi = TRUE,
  colors = NULL,
  crop_png = TRUE,
  transparent = FALSE,
  res = 150,
  keep_ly = FALSE,
  simplify = TRUE,
  details = FALSE
)
render_score(
  score,
  file,
  key = "c",
  time = "4/4",
  tempo = "2 = 60",
  header = NULL,
  paper = NULL,
  endbar = TRUE,
  colors = NULL,
  crop_png = TRUE,
  transparent = FALSE,
  res = 150,
  keep_ly = FALSE,
  simplify = TRUE,
  details = FALSE
)
render_midi(score, file, key = "c", time = "4/4", tempo = "2 = 60")
a score object.
character, output file ending in .pdf or .png for sheet music or
tablature for score. May include an absolute or relative path.
For render_midi, a file ending in .mid.
character, key signature, e.g., c, b_, f#m,
etc.
character, defaults to "4/4".
character, defaults to "2 = 60". Set to NULL to
suppress display of the time signature in the output.
a named list of arguments passed to the header of the
LilyPond file. See lilypond for details.
a named list of arguments for the LilyPond file page layout.
See lilypond for details.
label strings at beginning of tab staff. NULL
(default) for non-standard tunings only, TRUE or FALSE for
force on or off completely.
character, the end bar.
logical, output midi file in addition to sheet music.
a named list of LilyPond element color overrides. See
lilypond for details.
logical, see lilypond for details.
logical, transparent background, png only.
numeric, resolution, png only. transparent = TRUE may fail
when res exceeds ~150.
logical, keep the intermediary LilyPond file.
logical, uses simplify_phrase to convert to simpler,
more efficient LilyPond syntax for the LilyPond file before rendering it.
logical, set to TRUE to print LilyPond log output to
console. Windows only.
nothing returned; a file is written.
Generate a pdf or png of a music score using the LilyPond music engraving
program.
Output format is inferred from file extension. This function is a
wrapper around lilypond, the function that creates the
LilyPond (.ly) file.
render_score renders score to pdf or png. render_midi
renders a MIDI file based on score. This is still done via LilyPond.
The sheet music is created automatically in the process behind the scenes
but is deleted and only the MIDI output is retained.
The original tab or render_tab (equivalent) produces both the
sheet music and the MIDI file output by default and includes other arguments
such as the tablature-relevant argument string_names.
This is the all-purpose function. Also use this when you intend to create
both a sheet music document and a MIDI file.
Remember that whether a track contains a tablature staff, standard music
staff, or both, is defined in each individual track object contained in
score. It is the contents you have assembled in
score that dictate what render function you should use.
render_tab is general and always works, but render_score would
not be the best choice when a tablature staff is present unless you accept
the default string naming convention.
render_midi is different from midily and miditab, whose
purpose is to create sheet music from an existing MIDI file using a LilyPond
command line utility.
For Windows users, add the path to the LilyPond executable to the system
path variable. For example, if the file is at
C:/Program Files (x86)/LilyPond/usr/bin/lilypond.exe,
then add C:/Program Files (x86)/LilyPond/usr/bin to the system path.
# NOT RUN {
if(tabr_options()$lilypond != ""){
  x <- phrase("c ec'g' ec'g'", "4 4 2", "5 432 432")
  x <- track(x)
  x <- score(x)
  outfile <- file.path(tempdir(), "out.pdf")
  tab(x, outfile) # requires LilyPond installation
}
# }
Run the code above in your browser using DataLab