chord <- function(notes, root_first = TRUE, duration = 4) {
notes <- stringr::str_trim(notes)
d <- music21$duration$Duration(duration)
ch <- music21$chord$Chord(notes, duration = d)
if (root_first) ch$root(stringr::str_extract(notes, "^[^ ]+"))
ch
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.