Rescale the range of values


Centering and rescaling the waveform of a Wave or WaveMC object to a canonical interval corresponding to the Wave format (e.g. [-1, 1], [0, 254], [-32767, 32767], [-8388607, 8388607], or [-2147483647, 2147483647]).


normalize(object, unit = c("1", "8", "16", "24", "32", "64", "0"), 
    center = TRUE, level = 1, rescale = TRUE, pcm = object@pcm)



Object of class Wave or WaveMC.


Unit to rescale to.
"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 real values in [-1, 1] (FLOAT_IEEE Wave format), and
"0" for not rescaling (hence only centering if center = TRUE).


If TRUE (default), values are centered around 0 (or 127 if unit = "8").


Maximal percentage of the amplitude used for normalizing (default is 1).


Logical, whether to rescale to the maximal possible dynamic range.


Logical. By default, the pcm information from the object is kept. Otherwise, if TRUE, the object is coerced to the PCM Wave format. If FALSE, the object is coerced to the FLOAT_IEEE format, i.e. numeric values in [-1, 1].


An object containing the normalized data of the same class as the input object, i.e. either Wave or WaveMC.


Uwe Ligges, Sarah Schnackenberg, based on code from Matthias Heymann's former package ‘sound’.

See Also

writeWave, Wave-class, Wave, WaveMC-class, WaveMC

Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus