audioSample | R Documentation |
audioSample
is a class encapsulating digitalized (sampled)
audio data. Essentiually it tags numeric vectors and matrices with
additional audio information (most importantly sample rate).
audioSample
is the designated constructor of such objects.
Instances of the audioSample
are numeric vectors or matrices
with the following additional attributes:
ratesample rate (in Hz), mandatory
bitsresolution of the source (in bits), optional
If the object itself is a vector, it contains only one channel. Otherwise it is a matrix with as many rows as there are channels (hence 2 for stereo).
as.audioSample
generic converts an object into an audio
sample object. The default method is very similar to the constructor
except that it attempts to infer the parameters from the object's
attributes if they are not specified. Thus they are optional although
they don't have visible defaults.
audioSample(x, rate=44100, bits=16, clip = TRUE)
as.audioSample(x, ...)
## Default S3 method:
as.audioSample(x, rate, bits, clip, ...)
## S3 method for class 'Sample'
as.audioSample(x, ...)
x |
object to convert or initilize with |
rate |
sample rate |
bits |
resolution of the source. It doesn't affect the data itself and is only used for playback and export. |
clip |
boolean value determining whether the source should be clipped to a range between -1 and 1. Values outside this range result in undefined behavior. |
... |
parameters passed to the object-specific method |
audioSample
and as.audioSample
return an audio sample
object.
x <- audioSample(sin(1:8000/10), 8000)
play(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.