The audiotools.replaygain module contains the ReplayGain class for calculating the ReplayGain gain and peak values for a set of PCM data, and the ReplayGainReader class for applying those gains to a audiotools.PCMReader stream.
This class performs ReplayGain calculation for a stream of the given sample_rate. Raises ValueError if the sample rate is not supported.
The sample rate given when the object was initialized.
Given a pcm.FrameList object, updates the current gain values with its data.
Returns the gain value of the current title as a positive or negative floating point value. May raise ValueError if not enough samples have been submitted for processing.
Returns the peak value of the title as a floating point value between 0.0 and 1.0.
Returns the gain value of the entire album as a positive or negative floating point value. May raise ValueError if not enough samples have been submitted for processing.
Returns the peak value of the entire album as a floating point value between 0.0 and 1.0.
Indicates the current track is finished and resets the stream to process the next track. This method should be called after ReplayGain.title_gain() and ReplayGain.title_peak() have been used to extract the title’s gain values, but before data has been submitted for the next title or ReplayGain.album_gain() ReplayGain.album_peak() have been called to get the entire album’s gain values.
This class wraps around an existing PCMReader object. It takes floating point gain and peak values and modifies the pcmreader’s output as necessary to match those values. This has the effect of raising or lowering a stream’s sound volume to ReplayGain’s reference value.