Skip to content

Commit fbc18d3

Browse files
committed
Fix doc build
1 parent dd5872a commit fbc18d3

File tree

3 files changed

+11
-141
lines changed

3 files changed

+11
-141
lines changed

README.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,8 @@ This is easily achieved by downloading
3636
or individual libraries can be installed using
3737
`circup <https://github.com/adafruit/circup>`_.
3838

39-
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
40-
image from the assets folder in the PCB's GitHub repo.
41-
42-
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
4339
Installing from PyPI
4440
=====================
45-
.. note:: This library is not available on PyPI yet. Install documentation is included
46-
as a standard element. Stay tuned for PyPI availability!
47-
48-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
4941

5042
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
5143
PyPI <https://pypi.org/project/adafruit-circuitpython-wave/>`_.
@@ -96,8 +88,15 @@ Or the following command to update an existing version:
9688
Usage Example
9789
=============
9890

99-
.. todo:: Add a quick, simple example. It and other examples should live in the
100-
examples folder and be included in docs/examples.rst.
91+
.. code-block:: python
92+
93+
import adafruit_wave
94+
95+
with adafruit_wave.open("sample.wav") as w:
96+
print(w.getsampwidth())
97+
print(w.getnchannels())
98+
print(w.getcomptype())
99+
print(list(memoryview(w.readframes(100)).cast("h")))
101100
102101
Documentation
103102
=============

adafruit_wave.py

Lines changed: 2 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -18,76 +18,6 @@
1818
* Adafruit CircuitPython firmware for the supported boards:
1919
https://circuitpython.org/downloads
2020
21-
Usage.
22-
23-
Reading WAVE files:
24-
f = wave.open(file, 'r')
25-
where file is either the name of a file or an open file pointer.
26-
The open file pointer must have methods read(), seek(), and close().
27-
When the setpos() and rewind() methods are not used, the seek()
28-
method is not necessary.
29-
30-
This returns an instance of a class with the following public methods:
31-
getnchannels() -- returns number of audio channels (1 for
32-
mono, 2 for stereo)
33-
getsampwidth() -- returns sample width in bytes
34-
getframerate() -- returns sampling frequency
35-
getnframes() -- returns number of audio frames
36-
getcomptype() -- returns compression type ('NONE' for linear samples)
37-
getcompname() -- returns human-readable version of
38-
compression type ('not compressed' linear samples)
39-
getparams() -- returns a namedtuple consisting of all of the
40-
above in the above order
41-
getmarkers() -- returns None (for compatibility with the
42-
aifc module)
43-
getmark(id) -- raises an error since the mark does not
44-
exist (for compatibility with the aifc module)
45-
readframes(n) -- returns at most n frames of audio
46-
rewind() -- rewind to the beginning of the audio stream
47-
setpos(pos) -- seek to the specified position
48-
tell() -- return the current position
49-
close() -- close the instance (make it unusable)
50-
The position returned by tell() and the position given to setpos()
51-
are compatible and have nothing to do with the actual position in the
52-
file.
53-
The close() method is called automatically when the class instance
54-
is destroyed.
55-
56-
Writing WAVE files:
57-
f = wave.open(file, 'w')
58-
where file is either the name of a file or an open file pointer.
59-
The open file pointer must have methods write(), tell(), seek(), and
60-
close().
61-
62-
This returns an instance of a class with the following public methods:
63-
setnchannels(n) -- set the number of channels
64-
setsampwidth(n) -- set the sample width
65-
setframerate(n) -- set the frame rate
66-
setnframes(n) -- set the number of frames
67-
setcomptype(type, name)
68-
-- set the compression type and the
69-
human-readable compression type
70-
setparams(tuple)
71-
-- set all parameters at once
72-
tell() -- return current position in output file
73-
writeframesraw(data)
74-
-- write audio frames without patching up the
75-
file header
76-
writeframes(data)
77-
-- write audio frames and patch up the file header
78-
close() -- patch up the file header and close the
79-
output file
80-
You should set the parameters before the first writeframesraw or
81-
writeframes. The total number of frames does not need to be set,
82-
but when it is set to the correct value, the header does not have to
83-
be patched up.
84-
It is best to first set all parameters, perhaps possibly the
85-
compression type, and then write audio frames using writeframesraw.
86-
When all frames have been written, either call writeframes(b'') or
87-
close() to patch up the sizes in the header.
88-
The close() method is called automatically when the class instance
89-
is destroyed.
90-
9121
"""
9222

9323
# pylint: disable=missing-class-docstring,redefined-outer-name,missing-function-docstring,invalid-name,import-outside-toplevel,too-many-instance-attributes,consider-using-with,no-self-use,redefined-builtin,not-callable,unused-variable,attribute-defined-outside-init,too-many-public-methods,no-else-return
@@ -176,6 +106,7 @@ def tell(self):
176106

177107
def read(self, size=-1):
178108
"""Read at most size bytes from the chunk.
109+
179110
If size is omitted or negative, read until the end
180111
of the chunk.
181112
"""
@@ -197,6 +128,7 @@ def read(self, size=-1):
197128

198129
def skip(self):
199130
"""Skip the rest of the chunk.
131+
200132
If you are not interested in the contents of the chunk,
201133
this method should be called so that the file points to
202134
the start of the next chunk.
@@ -236,36 +168,6 @@ class Error(Exception):
236168

237169

238170
class Wave_read:
239-
"""Variables used in this class:
240-
241-
These variables are available to the user though appropriate
242-
methods of this class:
243-
_file -- the open file with methods read(), close(), and seek()
244-
set through the __init__() method
245-
_nchannels -- the number of audio channels
246-
available through the getnchannels() method
247-
_nframes -- the number of audio frames
248-
available through the getnframes() method
249-
_sampwidth -- the number of bytes per audio sample
250-
available through the getsampwidth() method
251-
_framerate -- the sampling frequency
252-
available through the getframerate() method
253-
_comptype -- the AIFF-C compression type ('NONE' if AIFF)
254-
available through the getcomptype() method
255-
_compname -- the human-readable AIFF-C compression type
256-
available through the getcomptype() method
257-
_soundpos -- the position in the audio stream
258-
available through the tell() method, set through the
259-
setpos() method
260-
261-
These variables are used internally only:
262-
_fmt_chunk_read -- 1 iff the FMT chunk has been read
263-
_data_seek_needed -- 1 iff positioned correctly in audio
264-
file for readframes()
265-
_data_chunk -- instantiation of a chunk class for the DATA chunk
266-
_framesize -- size of one frame in the file
267-
"""
268-
269171
def initfp(self, file):
270172
self._convert = None
271173
self._soundpos = 0
@@ -429,31 +331,6 @@ def _read_fmt_chunk(self, chunk):
429331

430332

431333
class Wave_write:
432-
"""Variables used in this class:
433-
434-
These variables are user settable through appropriate methods
435-
of this class:
436-
_file -- the open file with methods write(), close(), tell(), seek()
437-
set through the __init__() method
438-
_comptype -- the AIFF-C compression type ('NONE' in AIFF)
439-
set through the setcomptype() or setparams() method
440-
_compname -- the human-readable AIFF-C compression type
441-
set through the setcomptype() or setparams() method
442-
_nchannels -- the number of audio channels
443-
set through the setnchannels() or setparams() method
444-
_sampwidth -- the number of bytes per audio sample
445-
set through the setsampwidth() or setparams() method
446-
_framerate -- the sampling frequency
447-
set through the setframerate() or setparams() method
448-
_nframes -- the number of audio frames written to the header
449-
set through the setnframes() or setparams() method
450-
451-
These variables are used internally only:
452-
_datalength -- the size of the audio samples written to the header
453-
_nframeswritten -- the number of frames actually written
454-
_datawritten -- the size of the audio samples actually written
455-
"""
456-
457334
def __init__(self, f):
458335
self._i_opened_the_file = None
459336
if isinstance(f, str):

docs/index.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@ Table of Contents
2424
.. toctree::
2525
:caption: Tutorials
2626

27-
.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
28-
the toctree above for use later.
29-
3027
.. toctree::
3128
:caption: Related Products
3229

33-
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
34-
the toctree above for use later.
35-
3630
.. toctree::
3731
:caption: Other Links
3832

0 commit comments

Comments
 (0)