Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
5d6240e8
Kaydet (Commit)
5d6240e8
authored
Mar 08, 2014
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
whatsnew: Wave_write handles unseekable files. (#5202)
Also clarify the documentation of this feature.
üst
19f1df64
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
wave.rst
Doc/library/wave.rst
+25
-6
3.4.rst
Doc/whatsnew/3.4.rst
+4
-0
No files found.
Doc/library/wave.rst
Dosyayı görüntüle @
5d6240e8
...
@@ -150,14 +150,30 @@ them, and is otherwise implementation dependent.
...
@@ -150,14 +150,30 @@ them, and is otherwise implementation dependent.
Wave_write Objects
Wave_write Objects
------------------
------------------
For seekable output streams, the ``wave`` header will automatically be updated
to reflect the number of frames actually written. For unseekable streams, the
*nframes* value must be accurate when the first frame data is written. An
accurate *nframes* value can be achieved either by calling
:meth:`~Wave_write.setnframes` or :meth:`~Wave_write.setparams` with the number
of frames that will be written before :meth:`~Wave_write.close` is called and
then using :meth:`~Wave_write.writeframesraw` to write the frame data, or by
calling :meth:`~Wave_write.writeframes` with all of the frame data to be
written. In the latter case :meth:`~Wave_write.writeframes` will calculate
the number of frames in the data and set *nframes* accordingly before writing
the frame data.
Wave_write objects, as returned by :func:`.open`, have the following methods:
Wave_write objects, as returned by :func:`.open`, have the following methods:
.. versionchanged:: 3.4
Added support for unseekable files.
.. method:: Wave_write.close()
.. method:: Wave_write.close()
Make sure *nframes* is correct, and close the file if it was opened by
Make sure *nframes* is correct, and close the file if it was opened by
:mod:`wave`. This method is called upon object collection. Can raise an
:mod:`wave`. This method is called upon object collection. It will raise
exception if *nframes* is not correct and a file is not seekable.
an exception if the output stream is not seekable and *nframes* does not
match the number of frames actually written.
.. method:: Wave_write.setnchannels(n)
.. method:: Wave_write.setnchannels(n)
...
@@ -181,8 +197,9 @@ Wave_write objects, as returned by :func:`.open`, have the following methods:
...
@@ -181,8 +197,9 @@ Wave_write objects, as returned by :func:`.open`, have the following methods:
.. method:: Wave_write.setnframes(n)
.. method:: Wave_write.setnframes(n)
Set the number of frames to *n*. This will be changed later if more frames are
Set the number of frames to *n*. This will be changed later if the number
written.
of frames actually written is different (this update attempt will
raise an error if the output stream is not seekable).
.. method:: Wave_write.setcomptype(type, name)
.. method:: Wave_write.setcomptype(type, name)
...
@@ -214,8 +231,10 @@ Wave_write objects, as returned by :func:`.open`, have the following methods:
...
@@ -214,8 +231,10 @@ Wave_write objects, as returned by :func:`.open`, have the following methods:
.. method:: Wave_write.writeframes(data)
.. method:: Wave_write.writeframes(data)
Write audio frames and make sure *nframes* is correct. Can raise an
Write audio frames and make sure *nframes* is correct. It will raise an
exception if a file is not seekable.
error if the output stream is not seekable and the total number of frames
that have been written after *data* has been written does not match the
previously set value for *nframes*.
.. versionchanged:: 3.4
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
Any :term:`bytes-like object`\ s are now accepted.
...
...
Doc/whatsnew/3.4.rst
Dosyayı görüntüle @
5d6240e8
...
@@ -1439,6 +1439,10 @@ plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)
...
@@ -1439,6 +1439,10 @@ plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)
:meth:`wave.open` now supports the context manager protocol. (Contributed
:meth:`wave.open` now supports the context manager protocol. (Contributed
by Claudiu Popa in :issue:`17616`.)
by Claudiu Popa in :issue:`17616`.)
:mod:`wave` can now :ref:`write output to unssekable files
<wave-write-objects>`. (Contributed by David Jones, Guilherme Polo, and Serhiy
Storchaka in :issue:`5202`.)
weakref
weakref
-------
-------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment