Skip to contents

The PTModule class provides a container to store and modify and use ProTracker module files.

Details

MOD is a computer file format used primarily to represent music. A MOD file contains a set of instruments in the form of samples, a number of patterns indicating how and when the samples are to be played, and a list of what patterns to play in what order. The simplified structure of a module class is visualised in the scheme below. Details are given in the slot descriptions below.

ProTracker conceptual scheme

This class is designed to hold all relevant information of a ProTracker module (MOD) for which ProTracker 2.3a documentation was used. The ProTrackR package may be compatible with earlier or later versions, but this was not tested. Use read.module and write.module to import and export objects of class PTModule.

Slots

name

A vector of length 20 of class raw, representing the name of the PTModule. The name of a module can be extracted or replaced with the name method.

pattern.order

A vector of length 128 of class raw. The raw values represent the indices of PTPattern tables and indicate in which order these patterns need to be played. Note that the raw values are conform the indices used in ProTracker, starting at zero. In R, indices of objects start at one. Users need to compensate for this discrepancy theirselves.

The pattern order table can be extracted or replaced with the patternOrder method.

pattern.order.length

A single value of class raw. Indicates the length of the visible (and playable) part of the pattern order table.

Use the patternOrderLength method to extract or replace the length of a pattern order table of a module.

tracker.byte

A single raw value. Gives an indication of which Tracker was used to produce a module file. In ProTracker modules, this byte is set to 0x7f, which is also used in PTModule objects. This value should not be changed.

tracker.flag

A vector of length 4 of class raw, indicates the version of a module, which basically reflects how many patterns the module can hold. For details, and extracting and replacing this flag see the trackerFlag method.

samples

List of length 31 of class "PTSample".

patterns

List of class "PTPattern" (the pattern tables). The list should have at least 1 element, and can have a maximum of 64 or 100 elements (depending on the state of the trackerFlag).

Author

Pepijn de Vries

Examples

## create an empty PTModule class object:
mod.empty <- new("PTModule")

## get an example PTModule class object
## provided with the ProTrackR package:
data("mod.intro")