Learn R Programming

tabr (version 0.1.2)

phrase: Create a musical phrase

Description

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. Notes separated in time are separated in the notes string by spaces. Sharps and flats are indicated by appending # and _, respectively, e.g. f# or g_.

Usage

phrase(notes, info, string = NULL, bar = FALSE)

p(...)

Arguments

notes

character, notes a through g. See details.

info

character, metadata pertaining to the notes . See details.

string

character, optional string that specifies which guitar strings to play for each specific note.

bar

logical, insert a bar check at the end of the phrase.

...

arguments passed to phrase.

Value

a phrase.

Details

Specifying notes that are one or multiple octaves below or above the middle can be done by appending one or multiple commas or single quote tick marks, respectively, e.g. c, or c''. But this is not necessary. Instead, you can use octave numbering. This may easier to read, generally more familiar, potentially requires less typing, can still be omitted completely for the middle octave (no need to type c3, d3, ...), and is automatically converted for you by phrase to the tick mark format interpreted by LilyPond. That said, using the raised and lowered tick mark approach can be surprisingly easier to read for chords, which have no spaces between notes, especially six-string chords, given that the tick marks help break up the notes in the chord visually much more so than integers do. See examples.

The function p is a convenient shorthand wrapper for phrase.

Tied notes indicated by ~ are part of the note notation and not part of the info notation, e.g. c''~.

Notes can comprise chords. These are bound tightly rather than space-delimited, as they are not separated in time. For example, a C chord could be given as ceg and in the case of tied notes would be c~e~g~.

Other information about a note is indicated with the info string. The most pertinent information, minimally required, is the note duration. A string of space-delimited notes will always be accompanied by a space-delimited string of an equal number of integer durations. Durations are powers of 2: 1, 2, 4, 8, 16, 32, 64. They represent the fraction of a measure, e.g., 2 means 1/2 of a measure and 8 refers to an eighth note. Dotted notes are indicated by adding . immediately after the integer, e.g., 2. or 2... Any other note metadata is appended to these durations. See examples.

Opening and closing slurs (or hammer ons and pull offs) are indicated with opening and closing parentheses, slides with -, and simple bends with ^. Text annotations aligned vertically with a note in time on the staff is done by appending the text to the note info entry itself. See notate. For more details and example, see the package vignettes.

Examples

Run this code
# NOT RUN {
phrase("c ec'g' ec'g'", "4 4 2") # no explicit string specification (not recommended)
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 1 1", "5 432 432") # same as above
# }

Run the code above in your browser using DataLab