Create a Wave
object of special waveform such as
silcence, power law (white, red, pink, ...) noise, sawtooth, sine, square, and pulse.
noise(kind = c("white", "pink", "power", "red"), duration = samp.rate,
samp.rate = 44100, bit = 1, stereo = FALSE,
xunit = c("samples", "time"), alpha = 1, ...)pulse(freq, duration = samp.rate, from = 0, samp.rate = 44100,
bit = 1, stereo = FALSE, xunit = c("samples", "time"),
width = 0.1, plateau = 0.2, interval = 0.5, ...)
sawtooth(freq, duration = samp.rate, from = 0, samp.rate = 44100,
bit = 1, stereo = FALSE, xunit = c("samples", "time"),
reverse = FALSE, ...)
silence(duration = samp.rate, from = 0, samp.rate = 44100,
bit = 1, stereo = FALSE, xunit = c("samples", "time"), ...)
sine(freq, duration = samp.rate, from = 0, samp.rate = 44100,
bit = 1, stereo = FALSE, xunit = c("samples", "time"), ...)
square(freq, duration = samp.rate, from = 0, samp.rate = 44100,
bit = 1, stereo = FALSE, xunit = c("samples", "time"),
up = 0.5, ...)
A Wave
object.
The kind of noise, “white”, “pink”, “power”, or “red” (these are not dB adjusted (!) but all except for “white” are linear decreasing on a log-log scale). Algorithm for generating power law noise is taken from Timmer and König (1995).
The frequency (in Hertz) to be generated.
Duration of the Wave
in xunit
.
Starting value of the Wave
in xunit
.
Sampling rate of the Wave
.
Resolution of the Wave
and rescaling unit. This may be
1
(default) for rescaling to numeric values in [-1,1],
8
(i.e. 8-bit) for rescaling to integers in [0, 254],
16
(i.e. 16-bit) for rescaling to integers in [-32767, 32767],
24
(i.e. 24-bit) for rescaling to integers in [-8388607, 8388607],
32
(i.e. 32-bit) for rescaling either to integers in [-2147483647, 2147483647]
(PCM Wave format if pcm = TRUE
) or to numeric values in [-1, 1]
(FLOAT_IEEE Wave format if pcm = FALSE
),
64
(i.e. 64-bit) for rescaling to numeric values in [-1, 1] (FLOAT_IEEE Wave format), and
0
for not rescaling at all. These numbers are internally passed to normalize
.
The Wave
slot bit
will be set to 32 if bit = 0
, bit = 1
or bit = 32
.
Logical, if TRUE
, a stereo sample will be generated.
The right channel is identical to the left one for sawtooth
, silence
,
sine
, and square
. For noise
, both channel are independent.
Character indicating which units are used
(both in arguments duration
and from
).
If xunit = "time"
, the unit is time in seconds, otherwise the number of samples.
The power for the power law noise (defaults are 1 for pink and 1.5 for red noise) \(1/f^{\alpha}\).
Logical, if TRUE
, the waveform will be mirrored vertically.
A number between 0 and 1 giving the percentage of the waveform at max value (= 1 - percentage of min value).
Relative pulses width: the proportion of time the amplitude is non-zero.
Relative plateau width: the proportion of the pulse width where amplitude is ±1.
Relative interval between the up-going and down-going pulses with respect to the center of the wave period (0: immediatly after up-going, 1: center of the wave period).
Further arguments to be passed to Wave
through the internal function postWaveform
.
Uwe Ligges ligges@statistik.tu-dortmund.de, partly based on code from Matthias Heymann's former package ‘sound’, Anita Thieler, Guillaume Guénard
J. Timmer and M. König (1995): On generating power law noise. Astron. Astrophys. 300, 707-710.
Wave-class, Wave
, normalize
, noSilence
Wobj <- sine(440, duration = 1000)
Wobj2 <- noise(duration = 1000)
Wobj3 <- pulse(220, duration = 1000)
plot(Wobj)
plot(Wobj2)
plot(Wobj3)
Run the code above in your browser using DataLab