phrase | R Documentation |
Create a musical phrase from character strings that define notes, note metadata, and optionally explicit strings fretted. The latter can be used to ensure proper tablature layout.
phrase(notes, info = NULL, string = NULL, bar = NULL)
p(notes, info = NULL, string = NULL, bar = NULL)
notes , info |
noteworthy and note info strings. When |
string |
space-delimited character string or vector (or integer vector
if simple string numbers). This is an optional argument that specifies which
instrument strings to play for each specific timestep. Otherwise |
bar |
character or |
A phrase object combines a valid string of notes with a corresponding valid
string of note info. The only required note info is time, but other
information can be included as well. You do not need to input an existing
noteworthy
class object and noteinfo
class object, but both
inputs must be valid and thus coercible to these classes. This is similar to
how the music
class works. The difference with phrase objects is that
they are used to create LilyPond syntax analogous to what a music object
contains.
Note that if you convert a music object to a phrase object, you are changing
contexts. The phrase object is the simplest LilyPond-format music structure.
Coercion with phrase()
strips all attributes of a music object and
retains only notes, note info and string numbers.
See the help documentation on noteworthy
, noteinfo
, and
music
classes for an understanding of the input data structures.
The function p()
is a convenient shorthand wrapper for phrase()
.
If a string is provided to bar
, it is interpreted as LilyPond bar
notation. E.g., bar = "|"
adds the LilyPond syntax \bar "|"
to the end of a phrase. If only a bar check is desired, use
bar = TRUE
. FALSE
is treated as NULL
for completeness.
a phrase.
valid-notes()
, valid-noteinfo()
, music()
phrase("c ec'g' ec'g'", "4- 4 2") # no string arg (not recommended for tabs)
phrase("c ec4g4 ec4g4", "4 4 2") # same as above
phrase("c b, c", "4. 8( 8)", "5 5 5") # direction implies hammer on
phrase("b2 c d", "4( 4)- 2", "5 5 5") # hammer and slide
phrase("c ec'g' ec'g'", "1 1 1", "5 432 432")
p("c ec'g' ec'g'", 1, "5 4 4") # same as above
n <- "a, b, c d e f g e f g a~ a"
i <- "8- 8 8 8-. t8( t8)( t8) t16( t16)( t16) 8 1"
m <- as_music(n, i)
x <- p(n, i)
x
identical(x, p(m))
x <- "a,4;5*5 b,4- c4 cgc'e'~4 cgc'e'1 e'4;2 c';3 g;4 c;5 ce'1;51"
p(x)
identical(p(x), p(as_music(x)))
x <- p("a b", 2, bar = "|.")
x2 <- pc(p("a b", 2), '\\bar "|."')
identical(x, x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.