@@ -54,3 +54,52 @@ be the sample size in bits or ``'A'`` for A-LAW or ``'U'`` for u-LAW.
54
54
.. versionchanged :: 3.5
55
55
Result changed from a tuple to a namedtuple.
56
56
57
+ The following sound header types are recognized, as listed below with the return value
58
+ from :func: `whathdr `: and :func: `what `:
59
+
60
+ +------------+------------------------------------+
61
+ | Value | Sound header format |
62
+ +============+====================================+
63
+ | ``'aifc' `` | Compressed Audio Interchange Files |
64
+ +------------+------------------------------------+
65
+ | ``'aiff' `` | Audio Interchange Files |
66
+ +------------+------------------------------------+
67
+ | ``'au' `` | Au Files |
68
+ +------------+------------------------------------+
69
+ | ``'hcom' `` | HCOM Files |
70
+ +------------+------------------------------------+
71
+ +------------+------------------------------------+
72
+ | ``'sndt' `` | Sndtool Sound Files |
73
+ +------------+------------------------------------+
74
+ | ``'voc' `` | Creative Labs Audio Files |
75
+ +------------+------------------------------------+
76
+ | ``'wav' `` | Waveform Audio File Format Files |
77
+ +------------+------------------------------------+
78
+ | ``'8svx' `` | 8-Bit Sampled Voice Files |
79
+ +------------+------------------------------------+
80
+ | ``'sb' `` | Signed Byte Audio Data Files |
81
+ +------------+------------------------------------+
82
+ | ``'ub' `` | UB Files |
83
+ +------------+------------------------------------+
84
+ | ``'ul' `` | uLAW Audio Files |
85
+ +------------+------------------------------------+
86
+
87
+ .. data :: tests
88
+
89
+ A list of functions performing the individual tests. Each function takes two
90
+ arguments: the byte-stream and an open file-like object. When :func: `what ` is
91
+ called with a byte-stream, the file-like object will be ``None ``.
92
+
93
+ The test function should return a string describing the image type if the test
94
+ succeeded, or ``None `` if it failed.
95
+
96
+ Example:
97
+
98
+ .. code-block :: pycon
99
+
100
+ >>> import sndhdr
101
+ >>> imghdr.what('bass.wav')
102
+ 'wav'
103
+ >>> imghdr.whathdr('bass.wav')
104
+ 'wav'
105
+
0 commit comments