Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

moduleSize

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

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.

ProTrackR

Manipulate and Play 'ProTracker' Modules

v0.3.7
GPL-3
Authors
Pepijn de Vries [aut, cre, dtc]
Initial release
2020-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.