• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

wavio.egg-info/H03-May-2022-7055

PKG-INFOH A D14-Jul-20182.8 KiB7055

README.rstH A D14-Jul-20181.6 KiB4834

setup.cfgH A D14-Jul-201838 53

setup.pyH A D14-Jul-20181.6 KiB5545

wavio.pyH A D14-Jul-201814.2 KiB392300

README.rst

1wavio
2=====
3
4``wavio`` is a Python module that defines two functions:
5
6* ``wavio.read`` reads a WAV file and returns an object that holds the sampling
7  rate, sample width (in bytes), and a numpy array containing the data.
8* ``wavio.write`` writes a numpy array to a WAV file, optionally using a
9  specified sample width.
10
11The module uses the ``wave`` module in Python's standard library, so it has the
12same limitations as that module.  In particular, it does not support compressed
13WAV files, and it does not handle floating point WAV files.  (When floating
14point data is passed to ``wavio.write`` it is converted to integers before
15being written to the WAV file.)  The functions can read and write 8-, 16-, 24-
16and 32-bit integer WAV files.
17
18``wavio`` has been tested with Python versions 2.7, 3.4, 3.5, 3.6 and 3.7.
19
20``wavio`` depends on numpy (http://www.numpy.org).
21
22The package has a suite of unit tests, but it should still be considered
23prototype-quality software.  There may be backwards-incompatible API changes
24between releases.
25
26Example
27~~~~~~~
28
29The following code (also found in the docstring of ``wavio.write``) writes
30a three second 440 Hz sine wave to a 24-bit WAV file::
31
32    import numpy as np
33    import wavio
34
35    rate = 22050  # samples per second
36    T = 3         # sample duration (seconds)
37    f = 440.0     # sound frequency (Hz)
38    t = np.linspace(0, T, T*rate, endpoint=False)
39    x = np.sin(2*np.pi * f * t)
40    wavio.write("sine24.wav", x, rate, sampwidth=3)
41
42
43-----
44
45:Author:     Warren Weckesser
46:Repository: https://github.com/WarrenWeckesser/wavio
47:License:    BSD 2-clause (http://opensource.org/licenses/BSD-2-Clause)
48