Learn R Programming

ProTrackR

ProTracker is music sequencer software from the 1990s on the Commodore Amiga (see screenshot of version 2.3a on the right). This R package is designed to read, process and play ProTracker module audio files.

Installation

Get CRAN version

install.packages("ProTrackR")

Get development version from R-Universe

install.packages("ProTrackR", repos = c('https://pepijn-devries.r-universe.dev', 'https://cloud.r-project.org'))

Usage

The package comes bundled with a tiny chiptune, which can easily be played like so:

library(ProTrackR) |>
  suppressMessages()
data("mod.intro")

playMod(mod.intro, verbose = FALSE)

There are plethora of module files available on-line as well. Below you can see how you can download such a file. It also show how you can select an audio sample (number 25) from the module and calculate its power spectrum:

elekfunk <- read.module("https://api.modarchive.org/downloads.php?moduleid=41529#elektric_funk.mod")

spec <- elekfunk |>
  PTSample(25) |>
  waveform() |>
  tuneR::powspec(wintime = 0.1, steptime = 0.001)

image(log10(spec), col = hcl.colors(100, palette = "Inferno"))

While we are at it, why not play it:

playMod(elekfunk, verbose = FALSE)

Package status and alternatives

This package is no longer actively developed. It will receive minimal attention and only required updates for the latest CRAN policies. It is surpassed by the alternatives listed below.

  • ProTrackR2: A complete rewrite in C and C++ of the current package using the ProTracker clone by Olav Sørensen. It has similar features as the current package but has a better implementation of the tracker interpretation and is a lot faster.
  • openmpt: An R port of libopenmpt. It plays and renders a wide range of tracker music files, but they cannot be edited.

Further reading

For some further reading and inspiration please have a look at the following blog articles:

Copy Link

Version

Install

install.packages('ProTrackR')

Monthly Downloads

241

Version

0.4.4

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Pepijn de Vries

Last Published

January 13th, 2025

Functions in ProTrackR (0.4.4)

PTCell-class

The PTCell class
PTModule-class

The PTModule class
PTSample-method

Coerce to or replace PTSample
clearSamples

Clear all samples from module
PTTrack-class

The PTTrack class
as.character

Character representation of ProTrackR objects
clearSong

Clear all pattern info from module
as.raw

Extract and replace raw data
appendPattern

Append a PTPattern to a PTModule
ProTrackR-package

Manipulate and play ProTracker Modules. A description of the package, ProTracker effect commands and test cases.
deletePattern

Remove a PTPattern table from a PTModule object
effect

Extract or replace effect/trigger codes
PTTrack-method

Coerce to or replace PTTrack
loopSample

Looped waveform of a sample
modToWave

Convert a PTModule object into an audio Wave object
loopStart

The loop start position of a PTSample
funk_table

ProTracker Funk Table
moduleSize

Get module file size
mod.intro

Example of a PTModule object
loopState

Get PTSample loop state
fineTune

Fine tune a PTSample
noteUp

Raise or lower notes and octaves
noteToPeriod

Extract period value for a specific note
name

Obtain or replace the name of a PTModule or PTSample
octave

Extract or replace an octave
modArchive.info

Deprecated function migrated to openmpt
periodToChar

Get the note and octave from period table
fix.PTModule

Attempt to fix PTModule to ProTracker specs
paula_clock

Paula clock table
pasteBlock

Paste a block of PTCell data into a PTPattern
playWave

Play Wave objects
patternLength

Get the number of PTPattern tables in a PTModule
playSample

Play audio samples
loopLength

The loop length of a PTSample
nybble

Get the high or low nybble of a raw value
nybbleToSignedInt

Get signed integer values from nybbles
period_table

ProTracker Period Table
read.module

Read a ProTracker module file
note

Extract or replace a note
playingtable

Generate a table for playing a PTModule object
patternOrder

Get the pattern order table
rawToCharNull

Convert raw vectors into a character string
read.sample

Read an audio file and coerce to a PTSample object
sampleLength

Get the length of a PTSample
resample

Resample data
rawToSignedInt

Convert a raw vector into signed integers (short)
playMod

Play PTModule objects
rawToPTModule

Convert a vector of raw data into a PTModule object
trackerFlag

Tracker flag indicating version compatibility
print

Print ProTrackR objects
plot

Plot a PTModule object
proTrackerVibrato

Get the vibrato table used by ProTracker
volume

Default playback volume of PTSample
patternOrderLength

Get the length of the pattern order table
write.sample

Write a PTSample object to an audio file
write.module

Export an PTModule object as a ProTracker module file
rawToUnsignedInt

Convert raw vector into a single unsigned integer value
signedIntToNybble

Convert a signed integer to a nybble in raw data.
unsignedIntToRaw

Convert unsigned integer into a raw vector
sampleRate

Calculate the sample rate for a note or period value
sampleNumber

Extract or replace a sample number
signedIntToRaw

Convert signed integers (short) into a raw vector
waveform

Extract or replace a PTSample waveform
PTPattern-method

Coerce to or replace PTPattern
PTPatternToMODPlug

Convert PTPattern data into a MODPlug pattern
PTCell-method

Coerce to or replace PTCell
PTSample-class

The PTSample class
PTBlock

Select and copy a range of PTCells into a PTBlock
MODPlugToPTPattern

Convert MODPlug pattern into a PTPattern object
PTPattern-class

The PTPattern class