The name of both a PTModule
and
PTSample
are stored as raw
data.
This method returns the name as a character
string, or it can
be used to assign a new name to a PTModule
or
PTSample
.
Usage
# S4 method for PTSample
name(x)
# S4 method for PTSample,character
name(x) <- value
# S4 method for PTModule
name(x)
# S4 method for PTModule,character
name(x) <- value
Value
For name
, the name of the PTModule
or
PTSample
object as a character
string is returned.
For name<-
, object x
with an updated name is returned.
Details
The name of a PTModule
and
PTSample
is stored as a vector
of
raw
data with a length of 20 or 22 respectively. This method
provides the means for getting the name as a character
string
or to safely redefine the name of a PTModule
or
PTSample
object. To do so,
the provided name (value
) is converted to a raw
vector
of length 20 or 22 respectively. Long names may therefore get clipped.
See also
Other character.operations:
as.character()
,
periodToChar()
,
rawToCharNull()
,
sampleRate
Other sample.operations:
PTSample-class
,
PTSample-method
,
fineTune()
,
loopLength()
,
loopSample()
,
loopStart()
,
loopState()
,
playSample()
,
read.sample()
,
sampleLength()
,
volume()
,
waveform()
,
write.sample()
Examples
data("mod.intro")
## get the name of mod.intro:
name(mod.intro)
#> [1] "intro"
## I don't like the name, let's change it:
name(mod.intro) <- "I like this name better"
#> Warning: Name is too long and will be truncated.
## Note that the provided name was too long and is truncated:
name(mod.intro)
#> [1] "I like this name bet"
## print all sample names in the module:
unlist(lapply(as.list(1:31), function(x)
name(PTSample(mod.intro, x))))
#> [1] "by pepijn de vries" "a.k.a. freeze ii" "created in the late"
#> [4] "nineties on a" "commodore amiga 500" ""
#> [7] "it was meant to be" "used in a bootblock" "intro, but never was."
#> [10] "now it serves as an" "example in the" "protrackr package"
#> [13] "i wrote for the r" "language for" "statistical computing"
#> [16] "" "" ""
#> [19] "" "" ""
#> [22] "" "" ""
#> [25] "" "" ""
#> [28] "" "" ""
#> [31] ""