moduleSize {ProTrackR}R Documentation

Get module file size

Description

Get the file size in bytes of a PTModule object, when it is to be saved as an original module file with write.module.

Usage

## S4 method for signature 'PTModule'
moduleSize(x)

Arguments

x

A PTModule object for which the file size is to be calculated.

Details

The ProTracker module has a 1084 byte sized header containing all (meta) information on the patterns, their order and the audio samples. Each pattern holds exactly 1 Kb of information and the length of the audio samples corresponds with the size in bytes, as they are of 8 bit quality in mono. This function calculates the file size of the PTModule object when it is to be saved with write.module.

Value

Returns potential uncompressed module file size in bytes represented by a number of class object_size.

Author(s)

Pepijn de Vries

See Also

Other module.operations: PTModule-class, appendPattern(), clearSamples(), clearSong(), deletePattern(), fix.PTModule(), modToWave(), patternLength(), patternOrderLength(), patternOrder(), playMod(), playingtable(), rawToPTModule(), read.module(), trackerFlag(), write.module()

Examples

## Calculate the file size for the example module 'mod.intro':

data("mod.intro")
moduleSize(mod.intro)

## Note that this is not the same as the size the object
## requires in R working memory:

object.size(mod.intro)

## In working memory it takes more memory to store the module, than in a
## file. This is because the S4 structure of the object consumes some
## memory. In addition, samples are of 8 bit quality, corresponding with
## a byte per sample. In the PTSample object it is stored as a
## vector of integer values. In R, integer values are 32 bit, which
## costs 4 times as much memory as the original 8 bit.


[Package ProTrackR version 0.4.3 Index]