PTCell-class {ProTrackR} | R Documentation |
The PTCell class
Description
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.
Details
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.
Slots
data
A
vector
of classraw
of length 4. Theraw
data is stored identical to the way it is stored in a ProTracker module file. Thecharacter
representation is easier to understand, and with the ProTrackR package it shouldn't be necessary to manipulate theraw
data directly.The structure is illustrated with an example. Let's start with a
character
representation of aPTCell
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 thatPTSample
number0x1B = 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 theeffect()
code and"ppp"
represents the period value. The correct note and octave can be derived by looking up the period value in theperiod_table
(which is also implemented in the following methods:note()
,octave()
andperiodToChar()
). The period value0x0d6 = 214
corresponds with note "C" in octave 3.
Author(s)
Pepijn de Vries
See Also
Other cell.operations:
PTCell-method
,
effect()
,
note()
,
sampleNumber()
Examples
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)