"sndhdr" --- 判定聲音檔案的型別
*******************************

**原始碼：**Lib/sndhdr.py

自從版本 3.11 後不推薦使用，將會自版本 3.13 中移除。: "sndhdr" 模組
(module) 即將被棄用（詳情與替代方案請見 **PEP 594**）。

======================================================================

"sndhdr" 提供了企圖猜測檔案中聲音資料型別的工具函式。當這些函式可以推
測出儲存在檔案中聲音資料的型別，它們分別回傳一個
"collections.namedtuple()"，包含了五種屬性：（"filetype"、"framerate"
、"nchannels"、"nframes"、"sampwidth"）。這些 *type* 的值表示資料的型
別，會是以下字串之一："'aifc'"、"'aiff'"、"'au'"、"'hcom'"、"'sndr'"、
"'sndt'"、"'voc'"、"'wav'"、"'8svx'"、"'sb'"、"'ub'" 或 "'ul'"。
*sampling_rate*（取樣頻率）可能是實際值、或者當未知或者難以解碼時為
"0"。同樣的，*channels*（影像通道數）也會回傳實際值或者在無法推測或難
以解碼時回傳 "0"。*frames*（幀數）則是實際值或 "-1"。tuple 的最後一項
，*bits_per_sample* 為位元表示的取樣大小，或者在 A-LAW 時為 "'A'"，
u-LAW 時為 "'U'"。

sndhdr.what(filename)

   使用 "whathdr()" 推測儲存在 *filename* 檔案中聲音資料的型別。如果成
   功，回傳上述的 namedtuple（附名元組），否則回傳 "None"。

   在 3.5 版的變更: 結果從 tuple 改為 namedtuple。

sndhdr.whathdr(filename)

   根據檔案標頭 (header) 推測儲存在檔案中的聲音資料型別。檔名由
   *filename* 給定。這個函式在成功時回傳上述 namedtuple，或在失敗時回
   傳 "None"。

   在 3.5 版的變更: 結果從 tuple 改為 namedtuple。

The following sound header types are recognized, as listed below with
the return value from "whathdr()": and "what()":

+--------------+--------------------------------------+
| Value        | Sound header format                  |
|==============|======================================|
| "'aifc'"     | Compressed Audio Interchange Files   |
+--------------+--------------------------------------+
| "'aiff'"     | Audio Interchange Files              |
+--------------+--------------------------------------+
| "'au'"       | Au 檔案                              |
+--------------+--------------------------------------+
| "'hcom'"     | HCOM 檔案                            |
+--------------+--------------------------------------+
| "'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 檔案                              |
+--------------+--------------------------------------+
| "'ul'"       | uLAW 音檔                            |
+--------------+--------------------------------------+

sndhdr.tests

   A list of functions performing the individual tests.  Each function
   takes two arguments: the byte-stream and an open file-like object.
   When "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.

範例：

   >>> import sndhdr
   >>> imghdr.what('bass.wav')
   'wav'
   >>> imghdr.whathdr('bass.wav')
   'wav'
