pt2_instrument | R Documentation |
As explained in vignette("s3class")
, the ProTracker pattern table
consists of cells containing information about the note and instrument
to be played. This function extracts the sample index (instrument)
from such a cell.
pt2_instrument(x, ...)
pt2_instrument(x, silent = TRUE, ...) <- value
x |
An object of class |
... |
Ignored. |
silent |
Don't warn about replacement values not being used or recycled. |
value |
Replacement value for the instrument (sample id). An |
Returns the integer
sample index in x
. The index
has a base of 1
. An index of 0
means 'no sample'.
In case of the assignment operator (<-
) an updated version of
x
is returned
mod <- pt2_read_mod(pt2_demo())
## select a specific cell from the first pattern
cell <- pt2_cell(mod$patterns[[1]], 0L, 0L)
## get the sample number used in this cell
pt2_instrument(cell)
## Replace the instrument in all cells of
## pattern 1 with sample number 3:
pt2_instrument(mod$patterns[[1]][]) <- 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.