duration | R Documentation |
Get or set the duration (in seconds) of a Sample object or a wav file.
duration(s)
duration(s) <- value
setDuration(s,value)
s |
a Sample object, or a string giving the name of a wav file. |
value |
a double giving the duration in seconds. |
The replacement form can be used to reset the duration of the Sample object (here, filenames are not accepted).
If a Sample object is shortened, extra values are discarded. When a Sample object is lengthened, it is padded out to its new length with zeros (silence).
For duration
, the duration of the sample in seconds.
For setDuration
, a Sample object with the new duration.
Author: Matthias Heymann [aut], Stefan Langenberg [cre] (<https://orcid.org/0000-0001-5817-5469>)
Maintainer: Stefan Langenberg <langenberg@uni-bonn.de>
sampleLength
## Not run:
s <- Sine(440,3)
duration(s) # 3
duration(s) <-.5 # sample is now .5 sec long
play(setDuration(s,1)) # plays a .5 sec sine wave and then .5 sec silence
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.