diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/audioop.rst | 12 | ||||
-rw-r--r-- | Doc/library/random.rst | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/Doc/library/audioop.rst b/Doc/library/audioop.rst index 8ee2795..9eb315f 100644 --- a/Doc/library/audioop.rst +++ b/Doc/library/audioop.rst @@ -136,6 +136,18 @@ The module defines the following variables and functions: Convert samples between 1-, 2- and 4-byte formats. + .. note:: + + In some audio formats, such as .WAV files, 16 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 or 32 + bit width samples. + .. function:: lin2ulaw(fragment, width) diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 0b82bf4..86a9a95 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -155,13 +155,13 @@ be found in any statistics text. .. function:: triangular(low, high, mode) - Return a random floating point number *N* such that ``low <= N < high`` - and with the specified *mode* between those bounds. + Return a random floating point number *N* such that ``low <= N < high`` and + with the specified *mode* between those bounds. The *low* and *high* bounds + default to zero and one. The *mode* argument defaults to the midpoint + between the bounds, giving a symmetric distribution. - If *mode* is not specified or is ``None``, it defaults to the midpoint - between the upper and lower bounds, producing a symmetric distribution. + .. versionadded:: 2.6 - The default values for *low* and *high* are zero and one. .. function:: betavariate(alpha, beta) |