PTCell-class | R Documentation |
The PTCell
class is the smallest possible element of a PTPattern
table. It holds all information on which note to play, at which frequency,
with which effect and what kind of triggers or jumps should be applied.
The PTCell
class consists of a vector
of four raw
values,
as specified in the 'Slots' section. A cell will tell which PTSample
is to be played at which frequency (corresponding to a note and octave). If
no octave or note is specified, nothing will be played, or if a sample was
started to play on the same PTTrack
, this sample will continue
playing. The PTCell
can also hold effect()
codes which
can be used to add audio effects to the sample being played, change the
speed/tempo at which patterns are played, or trigger jumps to other positions
within a PTPattern
or to other positions in the
patternOrder
table.
data
A vector
of class raw
of length 4. The raw
data is stored identical to the way it is stored in a ProTracker module
file. The character
representation is easier to understand, and
with the ProTrackR package it shouldn't be necessary to manipulate
the raw
data directly.
The structure is illustrated with an example. Let's start with a
character
representation of a PTCell
as an example: "C-3 1B A08"
.
The left-hand part of this string shows that this cell will play note "C" in
octave 3. The middle part shows that PTSample
number 0x1B = 27
will be played. The right-hand part of the string shows that effect "A08"
will be applied (which is a volume slide down).
The raw
representation of this example would be "10 d6 ba 08"
,
or when I replace the actual values with symbols: "sp pp se ee"
. Where
"ss"
represents the sample number, "eee"
represents the effect()
code and "ppp"
represents the period value. The correct note and octave
can be derived by looking up the period value in the period_table
(which is also implemented in the following methods: note()
,
octave()
and periodToChar()
).
The period value 0x0d6 = 214
corresponds with note "C"
in octave 3.
Pepijn de Vries
Other cell.operations:
PTCell-method
,
effect()
,
note()
,
sampleNumber()
data("mod.intro")
## get the PTCell from mod.intro at
## PTPattern #1, PTTrack #1 and row #1:
cell <- PTCell(mod.intro, 1, 1, 1)
## get the note of this cell:
note(cell)
## get the octave of this cell:
octave(cell)
## get the sampleNumber of this cell:
sampleNumber(cell)
## get the effect code of this cell:
effect(cell)
## get the raw data of this cell:
as.raw(cell)
## get the character representation of this cell:
as.character(cell)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.