Learn R Programming

tabr (version 0.3.0)

sf_phrase: Create a musical phrase from string/fret combinations

Description

Create a musical phrase from character strings that define string numbers, fret numbers and note metadata. This function is a wrapper around phrase. It allows for specifying string/fret combinations instead of unambiguous pitch as is used by phrase. In order to remove ambiguity, it is critical to specify the instrument string tuning and key signature. It essentially uses string and fret in combination with a known tuning and key signature in order to generate notes for phrase. info is passed straight through to phrase, as is string once it is done being used to help inform notes.

Usage

sf_phrase(string, fret, info, key = "c", tuning = "standard",
  to_notes = FALSE, bar = FALSE)

sfp(string, fret, info, key = "c", tuning = "standard", to_notes = FALSE, bar = FALSE)

sf_note(...)

sfn(...)

Arguments

string

character, string numbers associated with notes.

fret

character, fret numbers associated with notes.

info

character, metadata associated with notes.

key

character, key signature or just specify "sharp" or "flat".

tuning

character, instrument tuning.

to_notes

logical, return only the mapped notes character string rather than the entire phrase object.

bar

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

...

arguments passed to sf_phrase.

Value

a phrase.

Details

See the main function phrase for more details. If you landed here first and are not familiar with phrase, be aware that sf_phrase is a tangential extra feature wrapper function in tabr and for a variety of reasons (see below) the approach it uses is discouraged in general. If this is your only option, take note of the details and limitations below.

This function is a crutch for users not working with musical notes (what to play), but rather just position on the guitar neck (where to play). This method has its conveniences, but it is inherently limiting. In order to remove ambiguity, it is necessary to specify the instrument tuning and the key signature (or at least whether accidentals in the output should be sharps or flats).

In the standard approach where you specify what to play, specifying exactly where to play is optional, but highly recommended (by providing string). Here string is of course required along with fret. But any time the tuning changes, this "where to play" method breaks down and must be redone. It is much more robust to provide the string and pitch rather than the string and fret. The key is always important because it is the only way to indicate if accidentals are sharps or flats.

This crutch method also increases redundancy and typing. In order to specify rests r, silent rests s, and tied notes ~, these must now be providing in parallel in both the string and fret arguments, whereas in the standard method using phrase, they need only be provided once to notes. A mismatch will throw an error. Despite the redundancy, this is helpful for ensuring proper match up between string and fret, which is essentially a dual entry method that aims to reduce itself inside sf_phrase to a single notes string that is passed internally to phrase.

The important thing to keep in mind is that by its nature, this method of writing out music does not lend itself well to high detail. Tabs that are informed by nothing but string and fret number remove a lot of important information, and those that attempt to compensate with additional symbols in say, an ascii tab, are difficult to read. This wrapper function providing this alternative input method does its job of allowing users to create phrase objects that are equivalent to standard phrase-generated objects, including rests and ties, but practice and comfort with working with phrase and not this wrapper is highly recommended, not just for eventual ease of use but for not preventing yourself from learning your way around the guitar neck and where all the different pitches are located.

The function sfp is a convenient shorthand wrapper for sf_phrase. sf_note and the alias sfn are wrappers around sf_phrase that force to_notes = TRUE.

See Also

phrase

Examples

Run this code
# NOT RUN {
sf_phrase("5 4 3 2 1", "1 3 3 3 1", "8*4 1", key = "b_")
sf_phrase("654321 6s 12 1 21", "133211 355333 11 (13) (13)(13)", "4 4 8 8 4", key = "f")
sfp("6s*2 1*4", "000232*2 2*4", "4 4 8*4", tuning = "dropD", key = "d")
# }

Run the code above in your browser using DataLab