Travis-CI Build Status

Under development. Please contribute.

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

music21

The goal of music21 is to have an pipe-able API of music21 python library. It uses RStudio's excellent reticulate package in the backend.

In practice, music21 is more limited than the python library. However, it is really easy to run any functions from music21 inside R.

Installation

music21 package is based on the music21 python library. On Ubuntu:

```{bash pip, eval=FALSE} sudo apt-get install python-pip sudo pip install pip --upgrade sudo pip install music21

You can install `music21` from github with:

```r
# install.packages("devtools")
devtools::install_github("jtrecenti/music21")

To use the plot and view methods, you'll also have to install lilypond:

```{bash, eval=FALSE} sudo apt-get install lilypond

## `music21` object

```r
library(music21)
music21

music21 object stores the python module. It is possible to run any function from it just by using $, treating it as a Reference Class object.

note <- music21$note$Note("C#")
note
note %>% 
  plot()

Example

Show bach chorales

get_composer("bach") %>% 
  head()

Let's get one of these paths and read:

bach_music <- get_composer("bach")[61] %>% 
  read_music()

Plot bwv165.6 music

Now let's plot the music!

bach_music %>% 
  plot()

In RStudio, you can use the view function to see the music inside viewer pane.

Print bwv165.6 music (soprano part)

bach_music[[1]]


jtrecenti/music21 documentation built on May 29, 2019, 3 a.m.