read.module {ProTrackR}R Documentation

Read a ProTracker module file

Description

Reads a ProTracker module file and coerces it to a PTModule object.

Usage

## S4 method for signature 'character,logical'
read.module(file, ignore.validity = F)

## S4 method for signature 'ANY,missing'
read.module(file, ignore.validity = F)

## S4 method for signature 'ANY,missing'
read.module(file, ignore.validity = F)

## S4 method for signature 'ANY,logical'
read.module(file, ignore.validity = F)

Arguments

file

either a filename or a file connection, that allows reading binary data (see e.g., base::file or base::url).

ignore.validity

A logical value indicating whether the validity of the PTModule should be ignored. When set to FALSE (default), the validity of the read object is checked; an error is thrown when the object is not valid. When this argument is set to TRUE, the validity of the object will not be checked and a potentially invalid object is returned. As the validity check of PTModule objects is very strict, it can be useful to ignore this check. This way you can try to read a broken module file, try to fix it such that it becomes valid and save (with write.module) it again.

Details

The routine to read ProTracker modules is based on the referenced version of ProTracker 2.3A. This means that the routine may not be able to read files produced with later ProTracker versions, or earlier versions with back-compatibility issues. So far I've successfully tested this method on all modules I've composed with ProTracker version 2.3A (which I believe was one of the more popular versions of ProTracker back in the days).

It should also be able to read most of the .mod files in The Mod Archive.

Value

Returns a PTModule object read from the provided ProTracker file

Author(s)

Pepijn de Vries

References

https://wiki.multimedia.cx/index.php?title=Protracker_Module

See Also

Other io.operations: read.sample(), write.module(), write.sample()

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

Examples

## Not run: 

## first create an module file from example data:
data("mod.intro")
write.module(mod.intro, "intro.mod")

## read the module:
mod  <-  read.module("intro.mod")

## or create a connection yourself:
con  <- file("intro.mod", "rb")

## note that you can also read from URL connections!
mod2 <- read.module(con)

## don't forget to close the file:
close(con)

## End(Not run)

[Package ProTrackR version 0.4.3 Index]