Learn R Programming

gm (version 1.0.2)

show: Show Object

Description

Show an object as musical score or audio file.

Usage

show(x, to)

# S3 method for Music show(x, to = NULL)

Value

Invisible NULL.

The generated musical score or audio file is

  1. showed in Viewer panel if show is called in RStudio,

  2. included in generated HTML file if called in R Markdown document,

  3. showed in output cell if called in R Jupyter Notebook, and

  4. showed in user's browser if called in a normal R console.

Arguments

x

An object.

to

Optional. A character vector which contains "score", "audio" or both, which indicates whether to show the object as musical score or audio file. The default value is "score".

Methods (by class)

  • Music: show a Music object.

Examples

Run this code
if (interactive()) {
  m <- Music() + Meter(4, 4) + Line(list("C4"), list(4))
  show(m, c("score", "audio"))
}

Run the code above in your browser using DataLab