sinetone | R Documentation |
Generate discrete sine tone.
sinetone(freq, rate = 8000, sec = 1, ampl = 64)
freq |
frequency of the tone, specified as a vector of positive numeric
values. The length of |
rate |
sampling frequency, specified as a positive scalar. Default: 8000. |
sec |
length of the generated tone in seconds. Default: 1 |
ampl |
amplitude of the tone, specified as a vector of positive numeric
values. The length of |
Sine tone, returned as a vector of length rate * sec
, or as a
matrix with rate * sec
columns and max(length(freq),
length(ampl))
columns.
Friedrich Leisch.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
fs <- 1000
sec <- 2
y <- sinetone(10, fs, sec, 1)
plot(seq(0, sec, length.out = sec * fs), y, type = "l", xlab = "", ylab = "")
y <- sinetone(c(10, 15), fs, sec, c(1, 2))
matplot(seq(0, sec, length.out = sec * fs), y, type = "l",
xlab = "", ylab = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.