Under development. Please contribute.
knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
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.
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()
get_composer("bach") %>% head()
Let's get one of these paths and read:
bach_music <- get_composer("bach")[61] %>% read_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.
bach_music[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.