normalize {sound}R Documentation

Rescale the Range of a Sample to [-1,1]

Description

Multiply the waveform of a Sample object or a wav file with a positive constant so that the maximum absolut value becomes 1, or any other specified constant.

Use this command before saving or playing a Sample object to avoid cracks in the sound caused by parts in the waveform that exceed the range [-1,1].

Usage

normalize(s, level=1)

Arguments

s

a Sample object, or a string giving the name of a wav file.

level

a number between 0 and 1 specifying the desired maximum absolute value of the waveform.

Value

a Sample object with the specified maximum absolut value of the waveform.

Author(s)

Author: Matthias Heymann [aut], Stefan Langenberg [cre] (<https://orcid.org/0000-0001-5817-5469>)

Maintainer: Stefan Langenberg <langenberg@uni-bonn.de>

See Also

Ops.Sample, center

Examples

## Not run: 
s <- .6*Sine(440,1)
plot(s)
plot(normalize(s)) # now it uses the full range
play(s)
play(normalize(s)) # this one is louder

## End(Not run)

[Package sound version 1.4.6 Index]