sinetone {gsignal} | R Documentation |
Sine tone
Description
Generate discrete sine tone.
Usage
sinetone(freq, rate = 8000, sec = 1, ampl = 64)
Arguments
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 |
Value
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.
Author(s)
Friedrich Leisch.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
Examples
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 = "")