Export an object to various file formats.

export(x, dir_path, file_name, formats, musescore)

# S3 method for Music
export(x, dir_path, file_name, formats, musescore = NULL)

Arguments

x

An object.

dir_path

A single character which specifies the directory to which to export the object.

file_name

A single character which specifies the name of the exported file(s).

formats

A character vector which specifies the file formats. Supported file formats are "mscz", "mscx", "pdf", "png", "svg", "wav", "mp3", "flac", "ogg", "midi", "mid", "musicxml", "mxl", "xml", "metajson", "mlog", "mpos" and "spos".

musescore

Optional. A character vector which represents the command line options passed to MuseScore. See MuseScore command line options for details. Also see "Examples" section.

Value

Invisible NULL. Files with name file_name and with extensions formats are generated in dir_path.

Methods (by class)

  • Music: export a Music object.

Examples

if (interactive()) {
  m <- Music() + Meter(4, 4) + Line(list("C4"), list(4))
  export(m, tempdir(), "x", c("mp3", "png"), "-r 200 -b 520")
}