audioop.max()

audioop.max(fragment, width) Return the maximum of the absolute value of all samples in a fragment.

audioop.lin2ulaw()

audioop.lin2ulaw(fragment, width) Convert samples in the audio fragment to u-LAW encoding and return this as a bytes object. u-LAW is an audio encoding format whereby you get a dynamic range of about 14 bits using only 8 bit samples. It is used by the Sun audio hardware, among others.

audioop.lin2lin()

audioop.lin2lin(fragment, width, newwidth) Convert samples between 1-, 2-, 3- and 4-byte formats. Note In some audio formats, such as .WAV files, 16, 24 and 32 bit samples are signed, but 8 bit samples are unsigned. So when converting to 8 bit wide samples for these formats, you need to also add 128 to the result: new_frames = audioop.lin2lin(frames, old_width, 1) new_frames = audioop.bias(new_frames, 1, 128) The same, in reverse, has to be applied when converting from 8 to 16, 24 or 32 bi

audioop.lin2alaw()

audioop.lin2alaw(fragment, width) Convert samples in the audio fragment to a-LAW encoding and return this as a bytes object. a-LAW is an audio encoding format whereby you get a dynamic range of about 13 bits using only 8 bit samples. It is used by the Sun audio hardware, among others.

audioop.lin2adpcm()

audioop.lin2adpcm(fragment, width, state) Convert samples to 4 bit Intel/DVI ADPCM encoding. ADPCM coding is an adaptive coding scheme, whereby each 4 bit number is the difference between one sample and the next, divided by a (varying) step. The Intel/DVI ADPCM algorithm has been selected for use by the IMA, so it may well become a standard. state is a tuple containing the state of the coder. The coder returns a tuple (adpcmfrag, newstate), and the newstate should be passed to the next call

audioop.getsample()

audioop.getsample(fragment, width, index) Return the value of sample index from the fragment.

audioop.findmax()

audioop.findmax(fragment, length) Search fragment for a slice of length length samples (not bytes!) with maximum energy, i.e., return i for which rms(fragment[i*2:(i+length)*2]) is maximal. The fragments should both contain 2-byte samples. The routine takes time proportional to len(fragment).

audioop.findfit()

audioop.findfit(fragment, reference) Try to match reference as well as possible to a portion of fragment (which should be the longer fragment). This is (conceptually) done by taking slices out of fragment, using findfactor() to compute the best match, and minimizing the result. The fragments should both contain 2-byte samples. Return a tuple (offset, factor) where offset is the (integer) offset into fragment where the optimal match started and factor is the (floating-point) factor as per fin

audioop.findfactor()

audioop.findfactor(fragment, reference) Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal, i.e., return the factor with which you should multiply reference to make it match as well as possible to fragment. The fragments should both contain 2-byte samples. The time taken by this routine is proportional to len(fragment).

audioop.error

exception audioop.error This exception is raised on all errors, such as unknown number of bytes per sample, etc.