Normalizing audio

### 28.2.15 Normalizing audio

The normalize command scales the amplitude of an audio clip.

- normalize takes two mandatory arguments:
  - A, an audio clip.
  - level, a negative real number specifying the maximum audio level in decibels (setting a positive value would result in clipping, i.e. audio distortion).
- normalize returns the copy of A normalized to the desired level.

#### Example

To normalize a sinusoidal sound to −6 dB:

t:=soundsec(3):; L,R:=sin(2*pi*440*t),sin(2*pi*445*t):; s:=normalize(createwav([L,R]),-6):;

Indeed, since about computes the level of audio:

about(s)

Bit depth: 16
Channels: 2 (stereo)
Sample rate: 44100
Length: 132300 samples
Duration: 3 seconds
Level: -6.00048 dB