Title: | Open ModPlug Tracker port |
---|---|
Description: | Reads, renders and plays music tracker files using the libopenmpt library. |
Authors: | Pepijn de Vries [aut, cre] , Jeroen Ooms [ctb] , Jester [cph, dtc] (Copyright holder of cyberrid.mod), OpenMPT Project Developers and Contributors [cph] |
Maintainer: | Pepijn de Vries <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.1.0004 |
Built: | 2024-11-05 20:33:18 UTC |
Source: | https://github.com/pepijn-devries/openmpt |
Functions to control the global volume of a module, or that of specific channels in the module.
channel_mute_status(mod, channel, ...) channel_mute_status(mod, channel, ...) <- value channel_volume(mod, channel, ...) channel_volume(mod, channel, ...) <- value global_volume(mod, ...) global_volume(mod, ...) <- value
channel_mute_status(mod, channel, ...) channel_mute_status(mod, channel, ...) <- value channel_volume(mod, channel, ...) channel_volume(mod, channel, ...) <- value global_volume(mod, ...) global_volume(mod, ...) <- value
mod |
A tracker module object of class |
channel |
Channel index ( |
... |
Ignored |
value |
Replacement value. In case of ' |
Returns the volume (status), or the updated object in case
of an assign operation (<-
).
mod <- demo_mod() channel_mute_status(mod, 0L) ## Mute the first channel in the module channel_mute_status(mod, 0L) <- TRUE ## Second channel volume at 50% channel_volume(mod, 1L) <- 0.5 ## global volume at 90% global_volume(mod, 1L) <- 0.9
mod <- demo_mod() channel_mute_status(mod, 0L) ## Mute the first channel in the module channel_mute_status(mod, 0L) <- TRUE ## Second channel volume at 50% channel_volume(mod, 1L) <- 0.5 ## global volume at 90% global_volume(mod, 1L) <- 0.9
Renders ModPlug Tracker music to an audio file and encodes it to a desired
output format (e.g. .mp3, .ogg, etc) using av::av_audio_convert()
.
convert_mod( mod, file, start_order = 0L, start_row = 0L, sample_rate = 44100L, verbose = FALSE, ... )
convert_mod( mod, file, start_order = 0L, start_row = 0L, sample_rate = 44100L, verbose = FALSE, ... )
mod |
A tracker module object of class |
file |
Output audio file where the rendered audio is stored. The file name extension is used to determine the type of encoding to be applied. |
start_order |
Starting position ( |
start_row |
Starting row ( |
sample_rate |
Output sample rate in Hz (samples per seconds). |
verbose |
Passed on to |
... |
Ignored |
Returns NULL
invisibly
mod <- demo_mod() destination <- tempfile(fileext = ".mp3") convert_mod(mod, destination)
mod <- demo_mod() destination <- tempfile(fileext = ".mp3") convert_mod(mod, destination)
Reads the file cyberrid.mod
. It is a ProTracker
file create by Jester.
It is redistributed under the
Attribution Non-commercial Share Alike license.
The music was part of an Amiga computer demo named 'Extension' and was originally released in 1993.
demo_mod()
demo_mod()
Returns the demo module tracker object of class openmpt
mod <- demo_mod()
mod <- demo_mod()
Get the duration of the song from a openmpt
class module object in seconds.
get_duration_seconds(mod, ...)
get_duration_seconds(mod, ...)
mod |
A tracker module object of class |
... |
Ignored |
Returns a numeric
value indicating the song duration in seconds.
mod <- demo_mod() get_duration_seconds(mod)
mod <- demo_mod() get_duration_seconds(mod)
Get meta data of a tracker module such as its "type"
, "title"
and "tracker"
.
Use get_metadata_keys()
to get the available keys for a module object.
get_metadata(mod, key = "title", ...) get_metadata_keys(mod, ...)
get_metadata(mod, key = "title", ...) get_metadata_keys(mod, ...)
mod |
A tracker module object of class |
key |
A key as listed by |
... |
Ignored |
A list of available keys in case of get_metadata_keys()
, the requested
information in case of get_metadata()
.
mod <- demo_mod() get_metadata_keys(mod) get_metadata(mod, "tracker")
mod <- demo_mod() get_metadata_keys(mod) get_metadata(mod, "tracker")
A wrapper for the get
function in libopenmpt (see
API documentation)
openmpt_info(key = "library_version", ...)
openmpt_info(key = "library_version", ...)
key |
A key |
... |
Ignored |
Returns a character
string with the requested information.
openmpt_info("library_version") openmpt_info("library_features") openmpt_info("url")
openmpt_info("library_version") openmpt_info("library_features") openmpt_info("url")
Collects a specific pattern table from a tracker module and presents it as
a matrix of formatted character
strings.
pattern(mod, pattern = 0L, width = 0L, pad = TRUE, ...)
pattern(mod, pattern = 0L, width = 0L, pad = TRUE, ...)
mod |
A tracker module object of class |
pattern |
The pattern index (starting at |
width |
The maximum number of characters the string should contain. |
pad |
If |
... |
Ignored |
A matrix
of pattern cells formatted as character
strings. Each column represents
an audio channel.
mod <- demo_mod() pattern(mod)
mod <- demo_mod() pattern(mod)
Functions to control the pitch and tempo of a module.
pitch_factor(mod, ...) pitch_factor(mod, ...) <- value tempo_factor(mod, ...) tempo_factor(mod, ...) <- value
pitch_factor(mod, ...) pitch_factor(mod, ...) <- value tempo_factor(mod, ...) tempo_factor(mod, ...) <- value
mod |
A tracker module object of class |
... |
Ignored |
value |
Replacement value. A |
Returns current factor, or the updated object in case
of an assign operation (<-
).
mod <- demo_mod() ## Increase the module pitch with a factor 2 pitch_factor(mod) <- 2 ## Increase the module tempo with a factor 2 tempo_factor(mod) <- 2
mod <- demo_mod() ## Increase the module pitch with a factor 2 pitch_factor(mod) <- 2 ## Increase the module tempo with a factor 2 tempo_factor(mod) <- 2
Renders a module tracker object of class openmpt
and plays it instantaneously.
play(mod, sample_rate = 44100L, progress = "vu", ...)
play(mod, sample_rate = 44100L, progress = "vu", ...)
mod |
A tracker module object of class |
sample_rate |
Output sample rate when playing the module. |
progress |
Progress printed to console while playing. Should be one of
|
... |
Ignored |
Returns NULL
invisibly.
## Not run: mod <- demo_mod() play(mod) ## End(Not run)
## Not run: mod <- demo_mod() play(mod) ## End(Not run)
Get or set the position of the music player. rewind()
moves the position
to the start of the song.
position_seconds(mod, ...) position_seconds(mod, ...) <- value rewind(mod, ...) set_position_order_row(mod, order, row, ...)
position_seconds(mod, ...) position_seconds(mod, ...) <- value rewind(mod, ...) set_position_order_row(mod, order, row, ...)
mod |
A tracker module object of class |
... |
Ignored |
value |
Position in seconds to move the player to. The value is rounded
to its nearest |
order |
Index of the position in the pattern sequence table (starts at |
row |
Index of the row in the current pattern table (starts at |
Returns NULL
invisibly, or the updated object in case of the assign operator (<-
).
mod <- demo_mod() position_seconds(mod) position_seconds(mod) <- 10.2 set_position_order_row(mod, 1, 4) rewind(mod)
mod <- demo_mod() position_seconds(mod) position_seconds(mod) <- 10.2 set_position_order_row(mod, 1, 4) rewind(mod)
Implementation of basic S3 generics such as print()
.
## S3 method for class 'openmpt' print(x, ...) ## S3 method for class 'openmpt' format(x, ...)
## S3 method for class 'openmpt' print(x, ...) ## S3 method for class 'openmpt' format(x, ...)
x |
Object to apply the method to. |
... |
Ignored. |
In case of print
and format
a formatted string
with basic information about the module is returned.
Read any of the music tracker module file formats supported by libopenmpt: https://wiki.openmpt.org/Manual:_Module_formats.
read_mod(file, ...)
read_mod(file, ...)
file |
File path or URL to read the file from. Binary connections are also supported. |
... |
Ignored |
A modplug
class object. It is an external pointer, pointing to the module object
in memory. It can be used for rendering audio.
## You can read from files mod1 <- read_mod(system.file("cyberrid", "cyberrid.mod", package = "openmpt")) ## but also URLs mod2 <- read_mod("https://api.modarchive.org/downloads.php?moduleid=41529#elektric_funk.mod")
## You can read from files mod1 <- read_mod(system.file("cyberrid", "cyberrid.mod", package = "openmpt")) ## but also URLs mod2 <- read_mod("https://api.modarchive.org/downloads.php?moduleid=41529#elektric_funk.mod")