Normalize - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

AudioTools

  

Normalize

  

normalize audio sample values to a specified maximum amplitude

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Normalize(audArray, opts)

Parameters

audArray

-

Array, Vector, or Matrix containing the audio data to normalize

opts

-

(optional) one or more equations of the form option = value, where option is amplitude or offset

Options

• 

amplitude=value - the peak amplitude of the result

• 

offset=mode - specifies how a DC offset should be handled

Description

• 

The Normalize command adjusts the amplitude of samples in a recording so the maximum amplitude of any one sample is as specified.

• 

The audArray parameter specifies the audio data to normalize, and must be a dense, rectangular, one or two dimensional Array, Vector, or Matrix with datatype=float[8].

• 

The amplitude=value option specifies the maximum amplitude that any sample may have. If omitted, this defaults to 1.0.

• 

The offset=mode option specifies what is to be done if the audio has a DC offset. Three modes are available:

• 

offset='scale', which is the default, treats the audio data as if the offset were zero. The resulting audio will contain at least one sample with a value of amplitude or -amplitude, and the offset will have been scaled.

• 

offset='remove' specifies that any DC offset is to be removed before normalizing. The resulting audio will contain at least one sample with a value of amplitude or -amplitude.

• 

offset='ignore' completely ignores the offset. The audio data will be scaled so that at least one sample will have the value amplitude, and one will have the value -amplitude. The offset will have been shifted and scaled.

  

Both the remove and ignore modes have the potential to introduce a DC offset if the arithmetic mean of all the samples is not zero. Thus it is best to use scale mode if the DC offset is known to be zero.

• 

The Normalize command is often useful after performing other audio processing operations that may have produced out-of-bound values or very low amplitudes.

Examples

audiofilecatkerneloptsdatadir,/audio/stereo.wav:

withAudioTools:

audReadaudiofile

audSample Rate22050File FormatPCM File Bit Depth8Channels2Samples/Channel19962Duration0.90531s

(1)

printf%6.3f\n,aud1000..1015

 0.378 -0.547
 0.465  0.921
 0.535  0.898
 0.598  0.992
 0.638  0.898
 0.669 -0.625
 0.685 -0.734
 0.685 -0.945
 0.669  0.669
 0.646 -0.281
 0.606 -0.828
 0.559 -0.891
 0.504 -0.586
 0.449  0.976
 0.378 -0.477
 0.315 -0.602

normedNormalizeaud1000..1015:

printf%6.3f\n,normed

 0.381 -0.551
 0.468  0.929
 0.540  0.905
 0.603  1.000
 0.643  0.905
 0.675 -0.630
 0.690 -0.740
 0.690 -0.953
 0.675  0.675
 0.651 -0.283
 0.611 -0.835
 0.563 -0.898
 0.508 -0.591
 0.452  0.984
 0.381 -0.480
 0.317 -0.606

Compatibility

• 

The offset option is new in Maple 2020.

See Also

Array

AudioTools

Matrix

Vector

 


Download Help Document