Skip to contents

This function outputs duration information in as traditional note value. symbols, as in Western notation.

If notehead() is applied to a humdrumR data class you may use the data's fields as arguments. If no field names are specified, the first selectedField is used as x.

Usage

# S3 method for default
notehead(x, ..., parseArgs = list(), scale = 1, unit = 1, inPlace = FALSE)

humData |> select(Token) |> notehead() 
humData |> notehead(Token)
humData |> notehead(simple = TRUE)

notehead(x, ..., parseArgs = list(), scale = 1, unit = 1, inPlace = FALSE)

Arguments

x

An input vector.

The x argument can be any (atomic) vector, or a rational (rhythmInterval), or NULL.

Must be parsable as rhythm infromation.

...

Arguments passed to the rhythm parser.

There are also two hidden (advanced) arguments you can specify: memoize and deparse (see the details below).

scale

A numeric or rational value which is used as the output unit of measurement.

Defaults to rational(1, 1).

Must be numeric or rational.

inPlace

Should non-rhythm information be retained in the output string?

Defaults to FALSE.

Must be a singleton logical value: an on/off switch.

Defaults to FALSE.

A singleton logical value, or NA.

See "Grace notes" section below.

Details

Note-value symbols are simply encoded in character vectors, since the unicode character table includes these musical symbols. Of course, this depends on your system having a unicode font installed and working: the symbols might not show up properly on your machine! In fact, the symbols always print a bit strangely (out of alignment) and can be hard to manipulate like "normal" character strings.

The note-value symbols are most useful for making the labels of plots. For example, if you tabulate note values and use barplot(), you get nice bar labels:

chorales <- readHumdrum(humdrumRroot, 'HumdrumData/Chorales/.*krn')
with(chorales, barplot(table(notehead(Token)), cex.names = 2))

See also

To better understand how this function works, read about the family of rhythm functions, or how rhythms are parsed and deparsed.

Other rhythm functions: duration(), grid(), recip()

Examples


tokens <- c('4.GG', '8G', '16E', '16F#', '16G', '16D', 'q8D#', '4E')
notehead(tokens)
#> **notehead (character)
#> [1] 𝅘𝅥 𝅭  𝅘𝅥𝅮    𝅘𝅥𝅯    𝅘𝅥𝅯    𝅘𝅥𝅯    𝅘𝅥𝅯    .    𝅘𝅥   

if (FALSE) {
B075 <- readHumdrum(humdrumRroot, "HumdrumData/BeethovenVariations/B075_00_05_a.krn")

with(B075[[,3:4]], notehead(Token)) |> table()
}