audioSample methods behave in the same way as the underlying methods of numeric vectors and matrices except that they preserve the attributes and class of the objects.

# S3 method for audioSample
$(x, name)
  # S3 method for audioSample
$(x, name) <- value
  # S3 method for audioSample
[(x, ..., drop = FALSE)
  # S3 method for audioSample
as.Sample(x, ...) 
  # S3 method for audioSample
print(x, ...)

Arguments

x

sample object

name

name of the attribute to get/set

value

value to set

drop

see `[` operator documentation

...

parameters passed to the object-specific method

Examples

x <- audioSample(sin(1:8000/10), 8000)
x$rate
#> [1] 8000
x[1:10]
#> sample rate: 8000Hz, mono, 16-bits
#>  [1] 0.09983342 0.19866933 0.29552021 0.38941834 0.47942554 0.56464247
#>  [7] 0.64421769 0.71735609 0.78332691 0.84147098