to_tabr | R Documentation |
Convert alternative representations of music notation to tabr
syntax.
to_tabr(id, ...)
from_chorrrds(x, key = "c", guitar = FALSE, gc_args = list())
from_music21(x, accidentals = c("flat", "sharp"), output = c("music", "list"))
id |
character, suffix of |
... |
arguments passed to the function matched by |
x |
character, general syntax input. See details and examples for how inputs are structured for each converter. |
key |
key signature, used to enforce consistent use of flats or sharps. |
guitar |
logical, attempt to match input chords to known guitar chords
in |
gc_args |
named list of additional arguments passed to |
accidentals |
character, represent accidentals, |
output |
character, type of output when multiple options are available. |
These functions convert music notation from other data sources into the style
used by tabr
for music analysis and sheet music transcription.
noteworthy string for chorrrds; music string or list for music21.
The input x
is a character vector of chords output from the chorrrds
package, as shown in the examples. Output is a noteworthy string object.
Some sources do not offer as complete or explicit information in order to
make sheet music. However, what is available in those formats is converted
to the extent possible and available function arguments can allow the user
to add some additional specification. Different input syntax makes use of a
different syntax converter. Depending on the format, different arguments
may be available and/or required. The general wrapper function for all of
the available syntax converters is to_tabr()
. This function takes an
id
argument for the appropriate converter function. See examples.
For example, output from the chorrrds
package that scrapes chord
information from the Cifraclub website only provides chords, not note for
note transcription data for any particular instrument. This means the result
of syntax conversion still yields only chords, which is fine for data
analysis but doesn't add anything useful for sheet music transcription.
The input in this case also does not specify distinct pitches by assigning octaves numbers to a chord's notes, not even the root note. It remains up to the user if they want to apply the information. By default, every chord starts in octave three. It is also ambiguous how the chord is played since all that is provided is a generic chord symbol. By default a standard chord is constructed if it can be determined.
Setting guitar = TRUE
switches to using the guitarChords()
dataset to
find matching guitar chords using gc_info()
, which can be provided
additional arguments in a named list to gc_args
. For guitar, this allows
some additional control over the actual structure of the chord, its shape and
position on the guitar neck. The options will never work perfectly for all
chords in chords
, but at a minimum, typical default component pitches
will be determined and returned in tabr
notation style.
The input x
is a character vector of in music21 tiny notation syntax,
as shown in the examples. Default output is a music object. Setting
output = "list"
returns a list of three elements: a noteworthy string,
a note info string, and the time signature.
The recommendation for music21 syntax is to keep it simple. Do not use the
letter n
for explicit natural notes. Do not add text annotations such
as lyrics. Double flats and sharps are not supported. The examples
demonstrate what is currently supported.
# chorrrds package output
chords <- c("Bb", "Bbm", "Bbm7", "Bbm7(b5)", "Bb7(#5)/G", "Bb7(#5)/Ab")
from_chorrrds(chords)
to_tabr(id = "chorrrds", x = chords)
from_chorrrds(chords, guitar = TRUE)
to_tabr(id = "chorrrds", x = chords, guitar = TRUE)
# music21 tiny notation
x <- "4/4 CC#FF4.. trip{c#8eg# d'- e-' f g a'} D4~# D E F r B16"
from_music21(x)
from_music21(x, accidentals = "sharp")
from_music21(x, output = "list")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.