Export a Music object to a file format such as PNG or MP3.

export(x, ...)

# S3 method for Music
export(x, path, musescore = NULL, ...)

Arguments

x

A Music object.

...

Optional arguments to export() methods. Should be ignored by the user.

path

A single character, which specifies the output file path. For example, "my/music/x.mp3". See the Details section for supported file extensions.

musescore

Optional. A character vector, which represents the command line options passed to MuseScore. See MuseScore command line usage for details.

Value

An invisible NULL. A file is generated in the specified path.

Details

Supported file extensions:

  1. flac

  2. metajson

  3. mid

  4. midi

  5. mlog

  6. mp3

  7. mpos

  8. mscx

  9. mscz

  10. musicxml

  11. mxl

  12. ogg

  13. pdf

  14. png

  15. spos

  16. svg

  17. wav

  18. xml

Examples

if (interactive()) {
  music <- Music() + Meter(4, 4) + Line("C4")
  export(music, tempfile(fileext = ".mp3"), "-r 200 -b 520")
}