summaryrefslogtreecommitdiffstats
path: root/Doc/library/sndhdr.rst
diff options
context:
space:
mode:
authorJoannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>2022-10-15 13:30:05 (GMT)
committerGitHub <noreply@github.com>2022-10-15 13:30:05 (GMT)
commit05c042e70786bd2e3fcb274d185e1e0a54dab5a7 (patch)
treee5e79482539955752470af9e56c2af834f63ac6b /Doc/library/sndhdr.rst
parent3c4cbd177f36777a04e78eb07ce20367560a66d3 (diff)
downloadcpython-05c042e70786bd2e3fcb274d185e1e0a54dab5a7.zip
cpython-05c042e70786bd2e3fcb274d185e1e0a54dab5a7.tar.gz
cpython-05c042e70786bd2e3fcb274d185e1e0a54dab5a7.tar.bz2
gh-85525: Indicate supported sound header formats (#21575)
* Indicate supported sound header formats * modify file names Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Doc/library/sndhdr.rst')
-rw-r--r--Doc/library/sndhdr.rst49
1 files changed, 49 insertions, 0 deletions
diff --git a/Doc/library/sndhdr.rst b/Doc/library/sndhdr.rst
index e1dbe4a..8c5c0bf 100644
--- a/Doc/library/sndhdr.rst
+++ b/Doc/library/sndhdr.rst
@@ -54,3 +54,52 @@ be the sample size in bits or ``'A'`` for A-LAW or ``'U'`` for u-LAW.
.. versionchanged:: 3.5
Result changed from a tuple to a namedtuple.
+The following sound header types are recognized, as listed below with the return value
+from :func:`whathdr`: and :func:`what`:
+
++------------+------------------------------------+
+| Value | Sound header format |
++============+====================================+
+| ``'aifc'`` | Compressed Audio Interchange Files |
++------------+------------------------------------+
+| ``'aiff'`` | Audio Interchange Files |
++------------+------------------------------------+
+| ``'au'`` | Au Files |
++------------+------------------------------------+
+| ``'hcom'`` | HCOM Files |
++------------+------------------------------------+
++------------+------------------------------------+
+| ``'sndt'`` | Sndtool Sound Files |
++------------+------------------------------------+
+| ``'voc'`` | Creative Labs Audio Files |
++------------+------------------------------------+
+| ``'wav'`` | Waveform Audio File Format Files |
++------------+------------------------------------+
+| ``'8svx'`` | 8-Bit Sampled Voice Files |
++------------+------------------------------------+
+| ``'sb'`` | Signed Byte Audio Data Files |
++------------+------------------------------------+
+| ``'ub'`` | UB Files |
++------------+------------------------------------+
+| ``'ul'`` | uLAW Audio Files |
++------------+------------------------------------+
+
+.. data:: tests
+
+ A list of functions performing the individual tests. Each function takes two
+ arguments: the byte-stream and an open file-like object. When :func:`what` is
+ called with a byte-stream, the file-like object will be ``None``.
+
+ The test function should return a string describing the image type if the test
+ succeeded, or ``None`` if it failed.
+
+Example:
+
+.. code-block:: pycon
+
+ >>> import sndhdr
+ >>> imghdr.what('bass.wav')
+ 'wav'
+ >>> imghdr.whathdr('bass.wav')
+ 'wav'
+