trackbind: Bind track tables

View source: R/tracks.R

trackbindR Documentation

Bind track tables

Description

Bind together track tables by row.

Usage

trackbind(..., id)

Arguments

...

single-entry track data frames.

id

integer, ID vector indicating distinct tracks corresponding to distinct sheet music staves. See details.

Details

This function appends multiple track tables into a single track table for preparation of generating a multi-track score. id is used to separate staves in the sheet music/tablature output. A track's voice is used to separate distinct voices within a common music staff.

If not provided, id automatically propagates 1:n for n tracks passed to ... when binding these tracks together. This expresses the default assumption of one staff or music/tab staff pair per track. This is the typical use case.

Some tracks represent different voices that share the same staff. These should be assigned the same id, in which case you must provide the id argument. Up to two voices per track are supported. An error will be thrown if any two tracks have both the same voice and the same id. The pair must be unique. E.g., provide id = c(1, 1) when you have two tracks with voice equal to 1 and 2. See examples.

Note that the actual ID values assigned to each track do not matter; only the order in which tracks are bound, first to last.

Value

a tibble data frame

See Also

phrase(), track(), score()

Examples

x <- phrase("c ec'g' ec'g'", "4 4 2", "5 432 432")
x1 <- track(x)
x2 <- track(x, voice = 2)
trackbind(x1, x1)
trackbind(x1, x2, id = c(1, 1))

tabr documentation built on Sept. 12, 2024, 6:18 a.m.