tabr (version 0.3.5)

trackbind: Bind track tables

Description

Bind together track tables by row.

Usage

trackbind(..., tabstaff)

Arguments

...

track tables.

tabstaff

integer, ID vector indicating the tablature staff for each track. See details.

Value

a track table.

Details

This function appends multiple track tables into a single track table for preparation of generating a multi-track score. tabstaff is used to separate music 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, the tabstaff ID automatically propagates 1:n for n tracks passed to ... when binding these tracks together. This expresses the default assumption of one tab staff per track. This is the typical use case where each single track object being bound into a multi-track object is a fully separated track on its own staff.

However, some tracks represent different voices that share the same staff. These should be assigned the same staff ID value, in which case you must provide the tabstaff argument. An error will be thrown if any two tracks have both the same voice and the same tabstaff. The pair must be unique. E.g., provide tabstaff = 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.

Examples

Run this code
# NOT RUN {
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, tabstaff = c(1, 1))
# }

Run the code above in your browser using DataLab