Learn R Programming

⚠️There's a newer version (0.4.4) of this package.Take me there.

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)

Developmental status

It has been a decade since the initial release of this package. Since it’s release a lot has changed in R and in my skill set. I still have plans for this package, but this requires drastic changes. Therefore, I will only apply minimal maintenance to this package. Meanwhile I will work on a complete overhaul which will be released in due time as a new package. This new package will:

  • have the same or similar features as the current package.
  • will implement modern R features and try to adhere to tidyverse principles.
  • implement rendering procedures in C++ giving the package a speed boost.

But until then, please enjoy the current package as is.

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

207

Version

0.4.3

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Pepijn de Vries

Last Published

February 15th, 2024

Functions in ProTrackR (0.4.3)

deletePattern

Remove a PTPattern table from a PTModule object
PTTrack-class

The PTTrack class
as.character

Character representation of ProTrackR objects
as.raw

Extract and replace raw data
clearSong

Clear all pattern info from module
appendPattern

Append a PTPattern to a PTModule
clearSamples

Clear all samples from module
effect

Extract or replace effect/trigger codes
ProTrackR-package

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

Coerce to or replace PTTrack
loopLength

The loop length of a PTSample
funk_table

ProTracker Funk Table
fineTune

Fine tune a PTSample
fix.PTModule

Attempt to fix PTModule to ProTracker specs
mod.intro

Example of a PTModule object
modLand

ModLand helper functions
loopStart

The loop start position of a PTSample
loopState

Get PTSample loop state
loopSample

Looped waveform of a sample
modArchive

ModArchive helper functions
name

Obtain or replace the name of a PTModule or PTSample
nybble

Get the high or low nybble of a raw value
noteToPeriod

Extract period value for a specific note
noteUp

Raise or lower notes and octaves
octave

Extract or replace an octave
pasteBlock

Paste a block of PTCell data into a PTPattern
moduleSize

Get module file size
playSample

Play audio samples
playMod

Play PTModule objects
modToWave

Convert a PTModule object into an audio Wave object
paula_clock

Paula clock table
patternOrderLength

Get the length of the pattern order table
patternLength

Get the number of PTPattern tables in a PTModule
period_table

ProTracker Period Table
periodToChar

Get the note and octave from period table
patternOrder

Get the pattern order table
plot

Plot a PTModule object
rawToUnsignedInt

Convert raw vector into a single unsigned integer value
print

Print ProTrackR objects
rawToPTModule

Convert a vector of raw data into a PTModule object
note

Extract or replace a note
rawToSignedInt

Convert a raw vector into signed integers (short)
read.module

Read a ProTracker module file
unsignedIntToRaw

Convert unsigned integer into a raw vector
waveform

Extract or replace a PTSample waveform
write.module

Export an PTModule object as a ProTracker module file
proTrackerVibrato

Get the vibrato table used by ProTracker
rawToCharNull

Convert raw vectors into a character string
signedIntToRaw

Convert signed integers (short) into a raw vector
volume

Default playback volume of PTSample
nybbleToSignedInt

Get signed integer values from nybbles
playWave

Play Wave objects
playingtable

Generate a table for playing a PTModule object
read.sample

Read an audio file and coerce to a PTSample object
write.sample

Write a PTSample object to an audio file
sampleNumber

Extract or replace a sample number
sampleLength

Get the length of a PTSample
signedIntToNybble

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

Calculate the sample rate for a note or period value
resample

Resample data
trackerFlag

Tracker flag indicating version compatibility
PTSample-method

Coerce to or replace PTSample
MODPlugToPTPattern

Convert MODPlug pattern into a PTPattern object
PTCell-class

The PTCell class
PTModule-class

The PTModule class
PTPattern-method

Coerce to or replace PTPattern
PTBlock

Select and copy a range of PTCells into a PTBlock
PTCell-method

Coerce to or replace PTCell
PTSample-class

The PTSample class
PTPatternToMODPlug

Convert PTPattern data into a MODPlug pattern
PTPattern-class

The PTPattern class