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

loopSample

Looped waveform of a sample


Description

Generate a looped waveform of a PTSample object.

Usage

## S4 method for signature 'PTSample'
loopSample(sample, times, n_samples)

Arguments

sample

A PTSample object that needs to be looped.

times

A positive integer value indicating the number of times a sample loop should be repeated. This argument is ignored if n_samples is specified.

n_samples

A positive integer value indicating the desired length of the looped waveform in number of samples. This argument overrules the times argument.

Details

For playing routines, it can be useful to generate repeats of a sample loop. This method returns the waveform of a PTSample where the loop is repeated 'times' times or has a length of 'n_samples'.

Value

Returns a waveform represented by a numeric vector of values ranging from 0 up to 255. Has a length of n_samples when that argument is specified.

Author(s)

Pepijn de Vries

See Also

Other loop.methods: loopLength(), loopStart(), loopState()

Examples

data("mod.intro")

## Loop sample number 4 10 times:
wform <- loopSample(PTSample(mod.intro, 4), times = 10)
plot(wform, type = "l")

## Loop sample number 4, such that its
## final length is 5000 samples:
wform <- loopSample(PTSample(mod.intro, 4), n_samples = 5000)
plot(wform, type = "l")

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.