Skip to main content

Extended WAVE I/O

Project description

ProjectStatus Version BuildStatus License PythonVersions

Pure python support for reading and writing extended WAVE formats.

The wave module in Python’s standard library doesn’t support a number of useful formats and encodings, notably IEEE floats. Ewave is a small, simple solution written in pure Python that provides a number of enhanced features:

  • Floating point formats

  • Extensible formats (> 2 channels, larger bit depths)

  • Read and write using memory mapping for simple, speedy access to large files

  • Read directly to numpy arrays

  • Data appended to existing files in read/write modes can be immediately accessed

  • Rescaling of data for different encodings and bit depths

  • Supports Python context managers for cleaner resource semantics

Requirements and installation

The current version of ewave requires Python 3.7+ and numpy 1.19+.

To install, run pip install . in the source directory, or pip install ewave.

Usage

There are some notable differences between the ewave interface and the standard library wave module. There’s only a single class that manages both reading and writing, and a number of the properties have changed names and behaviors. Importantly, the read method by default returns a numpy memmap to the data in the file. This provides faster access to large files and allows writing data in place.

For example, to write a second of stereo white noise in floating point format and then rescale it in place:

import ewave
from numpy import random
data = random.randn(48000,2)
with ewave.open("myfile.wav","w+",sampling_rate=48000,dtype='f',nchannels=2) as fp:
    fp.write(data)
    # rescale the data by 50%
    fp.read(memmap='r+') *= 0.5

Testing

Ewave has been tested on a large number of different WAVE formats and comes with a fairly extensive unit test suite. To run unit tests on files, place them in the ‘test’ subdirectory and run pytest. You can also place unsupported or invalid files in the ‘unsupported’ directory to test whether ewave rejects them correctly. Bug reports are always appreciated.

Licence and acknowledgements

Ewave is based heavily on the original wave module in the Python standard library and is released under the same Python Software Foundation Licence (http://opensource.org/licenses/python-2.0)

Information about the WAVE formats supported by this module was extensively gleaned from http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ewave-1.0.12.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ewave-1.0.12-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file ewave-1.0.12.tar.gz.

File metadata

  • Download URL: ewave-1.0.12.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ewave-1.0.12.tar.gz
Algorithm Hash digest
SHA256 3928d28cd336756a993df983a098232da65a371effe9c6c72343b2b6e8519882
MD5 82474f848d727404e60ac57c9b8f3f8d
BLAKE2b-256 e334a1e4c6ddb8efe85f7f84f1c043e837a442930fbddb626fd53a25d642e348

See more details on using hashes here.

Provenance

The following attestation bundles were made for ewave-1.0.12.tar.gz:

Publisher: publish-to-pypi.yml on melizalab/py-ewave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ewave-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: ewave-1.0.12-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ewave-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 29569137dca7c99f279b8f3c78597396605b902497a88f64560f05a0d8a3d795
MD5 5474a3e9d93be18b3faa21845aefd709
BLAKE2b-256 62c191f51205100088416c5d388cae7697b9a692b2c6198647ca3fd032861db7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ewave-1.0.12-py3-none-any.whl:

Publisher: publish-to-pypi.yml on melizalab/py-ewave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page