tabr (version 0.3.5)

miditab: Convert MIDI to tablature

Description

Convert a MIDI file to sheet music/guitar tablature.

Usage

miditab(midi_file, file, keep_ly = FALSE, path = NULL,
  details = TRUE, ...)

Arguments

midi_file

character, MIDI file (.mid). May include an absolute or relative path.

file

character, output file ending in .pdf or .png.

keep_ly

logical, keep LilyPond file.

path

character, optional output directory prefixed to file, may be an absolute or relative path. If NULL (default), only file is used.

details

logical, set to FALSE to disable printing of log output to console.

...

additional arguments passed to midily.

Value

nothing returned; a file is written.

Details

Under development/testing. See warning and details below.

Convert a MIDI file to a pdf or png music score using the LilyPond music engraving program. Output format is inferred from file extension. This function is a wrapper around midily, the function that converts the MIDI file to a LilyPond (.ly) file using a LilyPond command line utility.

WARNING: Even though the purpose of the command line utility is to convert an existing MIDI file to a LilyPond file, it nevertheless generates a LilyPond file that specifies inclusion of MIDI output. This means when you subsequently process the LilyPond file with LilyPond or if you use miditab to go straight from your MIDI file to pdf output, the command line tool will also produce a MIDI file output. It will overwrite your original MIDI file if it has the same file name and location! The next version of this function will add an default argument midi_out = FALSE to remove this from the generated LilyPond file. If TRUE and the basename of midi_file matches the basename of file, then file will be renamed, the basename appended with a -1.

On Windows systems, it may be necessary to specify a path in tabr_options to both midi2ly and python if they are not already successfully set as follows. On package load, tabr will attempt to check for midi2ly.exe at C:/Program Files (x86)/LilyPond/usr/bin/midi2ly.py and similarly for the python.exe that ships with LilyPond at C:/Program Files (x86)/LilyPond/usr/bin/python.exe. If this is not where LilyPond is installed, then LilyPond and Python need to be provided to tabr_options or added to the system PATH variable.

See Also

midily, tab, lilypond

Examples

Run this code
# NOT RUN {
if(tabr_options()$midi2ly != ""){
  midi <- system.file("example.mid", package = "tabr")
  outfile <- file.path(tempdir(), "out.pdf")
  miditab(midi, outfile, details = FALSE) # requires LilyPond installation
}
# }

Run the code above in your browser using DataLab