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, ...)
  # S3 method for default
as.audioSample(x, rate, bits, clip, ...)
  # S3 method for Sample
as.audioSample(x, ...)audioSample and as.audioSample return an audio sample
  object.
object to convert or initilize with
sample rate
resolution of the source. It doesn't affect the data itself and is only used for playback and export.
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
x <- audioSample(sin(1:8000/10), 8000)
# \donttest{
play(x)
# }
Run the code above in your browser using DataLab