Skip to contents

Create a character representation of PTCell, PTTrack or PTPattern objects.

Usage

# S4 method for PTCell
as.character(x)

# S4 method for PTTrack
as.character(x)

# S4 method for PTPattern
as.character(x)

Arguments

x

An object of any of the following classes: PTCell, PTTrack or PTPattern.

Value

Returns a single character string when x is of class PTCell.

Returns a vector of length 64 of the type character when x is of class PTTrack.

Returns a 64 by 4 matrix of the type character when x is of class PTPattern.

Details

A PTCell is an element of a PTTrack which in turn is an element of a PTPattern. A PTPattern tells a tracker which sample to play at which frequency on which of the four audio channels and with which effects. A PTCell in essence holds all this information as described at the documentation of the PTCell.

Data in these objects are stored in these objects in a raw form, to save working memory and to comply to the ProTracker file specifications. As the raw data is not easy to interpret, this method is provided to make your life (and the interpretation of the objects) easier.

This method generates a character representation of each of the three objects. These character representations can be coerced back to their original classes with the following methods: PTCell-method, PTTrack-method and PTPattern-method.

See also

Other character.operations: name, periodToChar(), rawToCharNull(), sampleRate

Other track.operations: PTTrack-method

Author

Pepijn de Vries

Examples

data("mod.intro")

as.character(   PTCell(mod.intro, 1, 1, 1))
#> [1] "C-3 01 A08"

as.character(PTTrack(mod.intro, 1, 1))
#>  [1] "C-3 01 A08" "--- 01 A08" "--- 01 A08" "--- 00 000" "--- 01 A08"
#>  [6] "--- 00 000" "--- 01 A08" "--- 00 000" "--- 01 A08" "--- 00 000"
#> [11] "--- 01 A08" "--- 00 000" "G-3 01 000" "--- 00 A08" "F-3 01 000"
#> [16] "--- 00 A08" "C-3 01 A08" "--- 01 A08" "--- 01 A08" "--- 00 000"
#> [21] "--- 01 A08" "--- 00 000" "--- 01 A08" "--- 00 000" "--- 01 A08"
#> [26] "--- 00 000" "--- 01 A08" "--- 00 000" "G-2 01 000" "--- 00 A08"
#> [31] "A-2 01 000" "--- 00 A08" "E-3 01 A08" "--- 01 A08" "--- 01 A08"
#> [36] "--- 00 000" "--- 01 A08" "--- 00 000" "--- 01 A08" "--- 00 000"
#> [41] "--- 01 A08" "--- 00 000" "--- 01 A08" "--- 00 000" "B-3 01 000"
#> [46] "--- 00 A08" "A-3 01 000" "--- 00 A08" "D-3 01 A08" "--- 01 A08"
#> [51] "--- 01 A08" "--- 00 000" "--- 01 A08" "--- 00 000" "--- 01 A08"
#> [56] "--- 00 000" "--- 01 A08" "--- 00 000" "--- 01 A08" "--- 00 000"
#> [61] "A-3 01 000" "--- 00 A08" "G-3 01 000" "--- 00 A08"

as.character(PTPattern(mod.intro, 1))
#>       [,1]         [,2]         [,3]         [,4]        
#>  [1,] "C-3 01 A08" "C-3 02 C40" "A#1 03 F06" "A#2 04 000"
#>  [2,] "--- 01 A08" "C-3 02 C30" "--- 00 A01" "--- 00 A02"
#>  [3,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "C-3 04 000"
#>  [4,] "--- 00 000" "C-3 02 000" "--- 00 A02" "--- 00 A02"
#>  [5,] "--- 01 A08" "C-3 02 000" "--- 00 120" "D-3 04 000"
#>  [6,] "--- 00 000" "A#2 04 C08" "--- 00 A02" "--- 00 A02"
#>  [7,] "--- 01 A08" "C-3 02 000" "--- 00 220" "D#3 04 000"
#>  [8,] "--- 00 000" "A#2 04 C08" "--- 00 A01" "--- 00 A02"
#>  [9,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "F-3 04 000"
#> [10,] "--- 00 000" "A#3 04 C08" "--- 00 A01" "--- 00 A02"
#> [11,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "D#3 04 000"
#> [12,] "--- 00 000" "G-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [13,] "G-3 01 000" "C-3 02 000" "--- 00 A01" "D-3 04 000"
#> [14,] "--- 00 A08" "F-3 04 C08" "--- 00 000" "--- 00 A02"
#> [15,] "F-3 01 000" "C-3 02 000" "--- 00 000" "C-3 04 000"
#> [16,] "--- 00 A08" "A#2 04 C08" "--- 00 000" "--- 00 A02"
#> [17,] "C-3 01 A08" "C-3 02 C40" "A#1 03 F06" "A#2 04 000"
#> [18,] "--- 01 A08" "C-3 02 C30" "--- 00 A01" "--- 00 A02"
#> [19,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "D-3 04 000"
#> [20,] "--- 00 000" "C-3 02 000" "--- 00 A02" "--- 00 A02"
#> [21,] "--- 01 A08" "C-3 02 000" "--- 00 120" "F-2 04 000"
#> [22,] "--- 00 000" "A#2 04 C08" "--- 00 A02" "--- 00 A02"
#> [23,] "--- 01 A08" "C-3 02 000" "--- 00 220" "G-2 04 000"
#> [24,] "--- 00 000" "A#2 04 C08" "--- 00 A01" "--- 00 A02"
#> [25,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "A#2 04 000"
#> [26,] "--- 00 000" "A#3 04 C08" "--- 00 A01" "--- 00 A01"
#> [27,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "--- 00 000"
#> [28,] "--- 00 000" "G-3 04 C08" "--- 00 A01" "--- 00 A01"
#> [29,] "G-2 01 000" "C-3 02 000" "--- 00 A01" "--- 00 000"
#> [30,] "--- 00 A08" "F-2 04 C08" "--- 00 000" "--- 00 A01"
#> [31,] "A-2 01 000" "C-3 02 000" "--- 00 000" "--- 00 000"
#> [32,] "--- 00 A08" "G-2 04 C08" "--- 00 000" "--- 00 A01"
#> [33,] "E-3 01 A08" "C-3 02 C40" "D-2 03 000" "D-3 04 000"
#> [34,] "--- 01 A08" "C-3 02 C30" "--- 00 A01" "--- 00 A02"
#> [35,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "E-3 04 000"
#> [36,] "--- 00 000" "C-3 02 000" "--- 00 A02" "--- 00 A02"
#> [37,] "--- 01 A08" "C-3 02 000" "--- 00 126" "F#3 04 000"
#> [38,] "--- 00 000" "D-3 04 C08" "--- 00 A02" "--- 00 A02"
#> [39,] "--- 01 A08" "C-3 02 000" "--- 00 226" "G-3 04 000"
#> [40,] "--- 00 000" "E-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [41,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "A-3 04 000"
#> [42,] "--- 00 000" "D-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [43,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "G-3 04 000"
#> [44,] "--- 00 000" "D-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [45,] "B-3 01 000" "C-3 02 000" "--- 00 A01" "F#3 04 000"
#> [46,] "--- 00 A08" "D-3 04 C08" "--- 00 000" "--- 00 A02"
#> [47,] "A-3 01 000" "C-3 02 000" "--- 00 000" "E-3 04 000"
#> [48,] "--- 00 A08" "E-2 04 C08" "--- 00 000" "--- 00 A02"
#> [49,] "D-3 01 A08" "C-3 02 C40" "C-2 03 000" "C-3 04 000"
#> [50,] "--- 01 A08" "C-3 02 C30" "--- 00 A01" "--- 00 A02"
#> [51,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "D-3 04 000"
#> [52,] "--- 00 000" "C-3 02 000" "--- 00 A02" "--- 00 A02"
#> [53,] "--- 01 A08" "C-3 02 000" "--- 00 12B" "E-3 04 000"
#> [54,] "--- 00 000" "G-3 04 C08" "--- 00 A02" "--- 00 A02"
#> [55,] "--- 01 A08" "C-3 02 000" "--- 00 22B" "F-3 04 000"
#> [56,] "--- 00 000" "G-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [57,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "G-3 04 000"
#> [58,] "--- 00 000" "E-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [59,] "--- 01 A08" "C-3 02 000" "--- 00 A01" "F-3 04 000"
#> [60,] "--- 00 000" "C-3 04 C08" "--- 00 A01" "--- 00 A02"
#> [61,] "A-3 01 000" "C-3 02 000" "--- 00 A01" "E-3 04 000"
#> [62,] "--- 00 A08" "G-3 04 C08" "--- 00 000" "--- 00 A02"
#> [63,] "G-3 01 000" "F-3 04 C08" "--- 00 000" "D-3 04 000"
#> [64,] "--- 00 A08" "C-3 04 C08" "--- 00 000" "--- 00 A02"