Waveforms {tuneR} | R Documentation |
Create a Wave
object of special waveform such as
silcence, (white/pink) noise, sawtooth, sine, and square.
noise(kind = c("white", "pink"), duration = samp.rate, samp.rate = 44100, bit = 1, stereo = FALSE, xunit = c("samples", "time"), ...) 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, ...)
kind |
The kind of noise, either “white” or “pink” (the latter is not dB adjusted (!) but linear decreasing on a log-log scale). |
freq |
The frequency (in Hertz) to be generated. |
duration |
Duration of the Wave in xunit . |
from |
Starting value of the Wave in xunit . |
samp.rate |
Sampling rate of the Wave . |
bit |
Resolution of the Wave and rescaling unit. This may be1 (default) for rescaling to real 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 to integers in [-2147483647, 2147483647], and0 for not rescaling at all. These numbers are internally passed to normalize .
The Wave slot bit will be set to 8, if bit=8 , and to 16 otherwise. |
stereo |
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. |
xunit |
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. |
reverse |
Logical, if TRUE , the waveform will be mirrored vertically. |
up |
A number between 0 and 1 giving the percentage of the waveform at max value (= 1 - percentage of min value). |
... |
Further arguments to be passed to Wave through the internal function postWaveform . |
A Wave
object.
Uwe Ligges, ligges@statistik.tu-dortmund.de, partly based on code from Matthias Heymann's former package ‘sound’, code for pink noise adapted and simplified from C code of Steve Moshier.
Wave-class, Wave
, normalize
, noSilence
Wobj <- sine(440, bit = 16, duration = 1000) Wobj2 <- noise(bit = 16, duration = 1000) plot(Wobj) plot(Wobj2)