Expand Up @@ -32,42 +32,48 @@ msgid "" "\"WAVE\" (or \"WAV\") file format. Only uncompressed PCM encoded wave files " "are supported." msgstr "" ":mod:`wave` 模組為波形音訊檔案格式「WAVE」(或稱「WAV」)提供了便捷的介面。" "僅支援未壓縮的 PCM 編碼波形檔。" #: ../../library/wave.rst:20 msgid "" "Support for ``WAVE_FORMAT_EXTENSIBLE`` headers was added, provided that the " "extended format is ``KSDATAFORMAT_SUBTYPE_PCM``." msgstr "" "增加了標頭 ``WAVE_FORMAT_EXTENSIBLE`` 的支援,要求的擴展格式" "為 ``KSDATAFORMAT_SUBTYPE_PCM``。" #: ../../library/wave.rst:23 msgid "The :mod:`wave` module defines the following function and exception:" msgstr "" msgstr ":mod:`wave` 模組定義了以下的函式和例外: " #: ../../library/wave.rst:28 msgid "" "If *file* is a string, open the file by that name, otherwise treat it as a " "file-like object. *mode* can be:" msgstr "" "如果 *file* 是一個字串,會打開對應名稱的檔案,否則會以類檔案物件處理。" "*mode* 可以是:" #: ../../library/wave.rst:32 msgid "``'rb'``" msgstr "``'rb'``" #: ../../library/wave.rst:32 msgid "Read only mode." msgstr "" msgstr "唯讀模式。 " #: ../../library/wave.rst:35 msgid "``'wb'``" msgstr "``'wb'``" #: ../../library/wave.rst:35 msgid "Write only mode." msgstr "" msgstr "唯寫模式。 " #: ../../library/wave.rst:37 msgid "Note that it does not allow read/write WAV files." msgstr "" msgstr "請注意,不支援同時讀寫 WAV 檔案。 " #: ../../library/wave.rst:39 msgid "" Expand All @@ -76,131 +82,145 @@ msgid "" "file-like object is passed as *file*, ``file.mode`` is used as the default " "value for *mode*." msgstr "" "*mode* 設定為 ``'rb'`` 時,會回傳一個 :class:`Wave_read` 物件,*mode* 設定為 " "``'wb'`` 時,則回傳一個 :class:`Wave_write` 物件。如果省略 *mode*,並且將類檔案" " (file-like) 物件作為 *file* 參數傳遞,則 ``file.mode`` 會是 *mode* 的預設值。" #: ../../library/wave.rst:44 msgid "" "If you pass in a file-like object, the wave object will not close it when " "its ``close()`` method is called; it is the caller's responsibility to close " "the file object." msgstr "" "如果您傳遞一個類檔案物件,當呼叫其 ``close()`` 方法時,wave 物件不會自動關閉" "該物件;關閉檔案物件的責任會在呼叫者上。" #: ../../library/wave.rst:48 msgid "" "The :func:`.open` function may be used in a :keyword:`with` statement. When " "the :keyword:`!with` block completes, the :meth:`Wave_read.close()` or :meth:" "`Wave_write.close()` method is called." msgstr "" ":func:`.open` 函式可以在 :keyword:`with` 陳述式中使用。當 :keyword:`!with` 區" "塊完成時,會呼叫 :meth:`Wave_read.close()` 或是 :meth:`Wave_write.close()` 方" "法。" #: ../../library/wave.rst:52 ../../library/wave.rst:176 msgid "Added support for unseekable files." msgstr "" msgstr "增加對不可搜尋 (unseekable) 檔案的支援。 " #: ../../library/wave.rst:57 msgid "" "An error raised when something is impossible because it violates the WAV " "specification or hits an implementation deficiency." msgstr "" msgstr "當不符合 WAV 格式或無法操作時會引發錯誤。 " #: ../../library/wave.rst:64 msgid "Wave_read Objects" msgstr "Wave_read 物件" #: ../../library/wave.rst:68 msgid "Read a WAV file." msgstr "" msgstr "讀取一個 WAV 檔案。 " #: ../../library/wave.rst:70 msgid "" "Wave_read objects, as returned by :func:`.open`, have the following methods:" msgstr "" msgstr "由 :func:`.open` 回傳的 Wave_read 物件具有以下方法: " #: ../../library/wave.rst:75 msgid "" "Close the stream if it was opened by :mod:`wave`, and make the instance " "unusable. This is called automatically on object collection." msgstr "" msgstr "關閉 :mod:`wave` 開啟的串流並使該實例無法使用。當物件回收時自動呼叫。 " #: ../../library/wave.rst:81 msgid "Returns number of audio channels (``1`` for mono, ``2`` for stereo)." msgstr "" msgstr "回傳音訊聲道的數量(單聲道為 ``1``,立體聲為 ``2``)。 " #: ../../library/wave.rst:86 msgid "Returns sample width in bytes." msgstr "" msgstr "回傳以位元組表示的取樣寬度 (sample width)。 " #: ../../library/wave.rst:91 msgid "Returns sampling frequency." msgstr "" msgstr "回傳取樣率。 " #: ../../library/wave.rst:96 msgid "Returns number of audio frames." msgstr "" msgstr "回傳音訊幀數。 " #: ../../library/wave.rst:101 msgid "Returns compression type (``'NONE'`` is the only supported type)." msgstr "" msgstr "回傳壓縮類型(僅支援 ``'NONE'`` 類型)。 " #: ../../library/wave.rst:106 msgid "" "Human-readable version of :meth:`getcomptype`. Usually ``'not compressed'`` " "parallels ``'NONE'``." msgstr "" ":meth:`getcomptype` 的人類可讀的版本。通常使用 ``'not compressed'`` 代替 " "``'NONE'``。" #: ../../library/wave.rst:112 msgid "" "Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " "framerate, nframes, comptype, compname)``, equivalent to output of the " "``get*()`` methods." msgstr "" "回傳一個 :func:`~collections.namedtuple` ``(nchannels, sampwidth, framerate, " "nframes, comptype, compname)``,等同於 ``get*()`` 方法的輸出。" #: ../../library/wave.rst:119 msgid "" "Reads and returns at most *n* frames of audio, as a :class:`bytes` object." msgstr "" msgstr "讀取並回傳以 :class:`bytes` 物件表示的最多 *n* 個音訊幀。 " #: ../../library/wave.rst:124 msgid "Rewind the file pointer to the beginning of the audio stream." msgstr "" msgstr "重置檔案指標至音訊流的開頭。 " #: ../../library/wave.rst:126 msgid "" "The following two methods are defined for compatibility with the :mod:`aifc` " "module, and don't do anything interesting." msgstr "" msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。 " #: ../../library/wave.rst:132 msgid "Returns ``None``." msgstr "" msgstr "回傳 ``None``。 " #: ../../library/wave.rst:137 msgid "Raise an error." msgstr "" msgstr "引發錯誤。 " #: ../../library/wave.rst:139 msgid "" "The following two methods define a term \"position\" which is compatible " "between them, and is otherwise implementation dependent." msgstr "" "以下兩個方法所定義的「位置」,在它們之間是相容的,但其他情況下則取決於具體實作" "方式。" #: ../../library/wave.rst:145 msgid "Set the file pointer to the specified position." msgstr "" msgstr "將檔案指標設定為指定的位置。 " #: ../../library/wave.rst:150 msgid "Return current file pointer position." msgstr "" msgstr "回傳目前的檔案指標位置。 " #: ../../library/wave.rst:156 msgid "Wave_write Objects" msgstr "Wave_write 物件" #: ../../library/wave.rst:160 msgid "Write a WAV file." msgstr "" msgstr "寫入一個 WAV 檔案。 " #: ../../library/wave.rst:162 msgid "Wave_write objects, as returned by :func:`.open`." msgstr "" msgstr "Wave_write 物件,由 :func:`.open` 回傳。 " #: ../../library/wave.rst:164 msgid "" Expand All @@ -215,10 +235,17 @@ msgid "" "`writeframes` will calculate the number of frames in the data and set " "*nframes* accordingly before writing the frame data." msgstr "" "對於可搜尋 (seekable) 的輸出串流,``wave`` 標頭將自動更新,以反映實際寫入的幀" "數。對於不可搜尋的串流,當寫入第一個幀資料時,*nframes* 的值必" "須是準確的。要取得準確的 *nframes* 值,可以通過呼叫 :meth:`setnframes` 或 :" "meth:`setparams` 方法,並在呼叫 :meth:`close` 之前設定將寫入的幀數量,然後使" "用 :meth:`writeframesraw` 方法寫入幀資料;或者通過呼叫 :meth:`writeframes` 方" "法一次性寫入所有的幀資料。在後一種情況下,:meth:`writeframes` 方法將計算資料" "中的幀數量,並在寫入幀資料之前相應地設定 *nframes* 的值。" #: ../../library/wave.rst:179 msgid "Wave_write objects have the following methods:" msgstr "" msgstr "Wave_write 物件具有以下方法: " #: ../../library/wave.rst:183 msgid "" Expand All @@ -227,56 +254,65 @@ msgid "" "exception if the output stream is not seekable and *nframes* does not match " "the number of frames actually written." msgstr "" "確保 *nframes* 正確,如果該檔案是由 :mod:`wave` 開啟的,則關閉該檔案。此方法" "在物件回收時被呼叫。如果輸出串流不可搜尋且 *nframes* 不符合實際" "寫入的幀數,則會引發例外。" #: ../../library/wave.rst:191 msgid "Set the number of channels." msgstr "" msgstr "設定音訊的通道數量。 " #: ../../library/wave.rst:196 msgid "Set the sample width to *n* bytes." msgstr "" msgstr "設定取樣寬度為 *n* 個位元組。 " #: ../../library/wave.rst:201 msgid "Set the frame rate to *n*." msgstr "" msgstr "設定取樣頻率為 *n*。 " #: ../../library/wave.rst:203 msgid "A non-integral input to this method is rounded to the nearest integer." msgstr "" msgstr "此方法的非整數輸入會被將四捨五入到最接近的整數。 " #: ../../library/wave.rst:210 msgid "" "Set the number of frames to *n*. This will be changed later if the number " "of frames actually written is different (this update attempt will raise an " "error if the output stream is not seekable)." msgstr "" "設定幀數為 *n*。如果實際寫入的幀數不同,則稍後將進行更改(如果輸出串流不可搜" "尋,則此嘗試將引發錯誤)。" #: ../../library/wave.rst:217 msgid "" "Set the compression type and description. At the moment, only compression " "type ``NONE`` is supported, meaning no compression." msgstr "" msgstr "設定壓縮類型和描述。目前只支援壓縮類型為 ``NONE``,表示無壓縮。 " #: ../../library/wave.rst:223 msgid "" "The *tuple* should be ``(nchannels, sampwidth, framerate, nframes, comptype, " "compname)``, with values valid for the ``set*()`` methods. Sets all " "parameters." msgstr "" "這個 *tuple* 應該是 ``(nchannels, sampwidth, framerate, nframes, comptype, " "compname)``,值需要是符合 ``set*()`` 方法的參數。設定所有參數。" #: ../../library/wave.rst:230 msgid "" "Return current position in the file, with the same disclaimer for the :meth:" "`Wave_read.tell` and :meth:`Wave_read.setpos` methods." msgstr "" "回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` 和 :meth:" "`Wave_read.setpos` 是一致的。" #: ../../library/wave.rst:236 msgid "Write audio frames, without correcting *nframes*." msgstr "" msgstr "寫入音訊幀,不修正 *nframes*。 " #: ../../library/wave.rst:238 ../../library/wave.rst:249 msgid "Any :term:`bytes-like object` is now accepted." msgstr "" msgstr "現在可接受任何 :term:`bytes-like object`。 " #: ../../library/wave.rst:244 msgid "" Expand All @@ -285,10 +321,14 @@ msgid "" "that have been written after *data* has been written does not match the " "previously set value for *nframes*." msgstr "" "寫入音訊幀並確保 *nframes* 正確。如果輸出串流不可搜尋,並且在寫" "入 *data* 後已寫入的總幀數與先前設定的 *nframes* 值不符,則會引發錯誤。" #: ../../library/wave.rst:252 msgid "" "Note that it is invalid to set any parameters after calling :meth:" "`writeframes` or :meth:`writeframesraw`, and any attempt to do so will " "raise :exc:`wave.Error`." msgstr "" "注意在呼叫 :meth:`writeframes` 或 :meth:`writeframesraw` 之後設置任何參數都是" "無效的,任何嘗試這樣做的操作都會引發 :exc:`wave.Error`。"