Drop-in replacement for Pythons wave.py
Project description
newwave - drop-in replacement for wave.py
"Enjoy the silence"
newwave is a drop-in replacement for Python's standard library wave module,
which is used for reading and writing WAVE audio files.
It backports features from newer Python versions to older ones, so you can use
the latest wave improvements on Python 3.10 and later.
Features
Features backported from newer Python versions:
- Support for
bytesand path-like objects inwave.open()(from Python 3.15) - Fix for
Wave_writeemitting unraisable exception whenopen()raises (from Python 3.15) - Removal of deprecated
setmark,getmark,getmarkersinterfaces (from Python 3.15) - Support for reading WAVE_FORMAT_EXTENSIBLE files (from Python 3.12)
Installation
pip install newwave
or with uv:
uv add newwave
Requires Python 3.10 or later.
Usage
Simply replace your wave import with newwave:
# Before
import wave
# After
import newwave as wave
All existing code using wave will continue to work:
import newwave as wave
with wave.open('audio.wav', 'rb') as f:
print(f.getnchannels(), f.getsampwidth(), f.getframerate())
Relationship to CPython
newwave is not a fork in spirit, but a compatibility and incubation layer for
Python’s standard-library wave module.
The goals of this project are to:
- Backport features from newer Python releases to older supported versions.
- Provide fixes for correctness issues in
wave.py, such as malformed headers or incorrect frame padding. - Experiment with and stabilize enhancements (e.g. higher bit depths, extended formats) before proposing them upstream to CPython.
Where practical, fixes and features developed in newwave are intended to be
upstreamed to CPython. Some enhancements may remain in newwave if they are
not suitable for inclusion in the standard library due to
backward-compatibility, policy, or maintenance constraints.
newwave aims to remain a drop-in replacement for wave, preserving the
public API and behavior of the standard library wherever possible.
Development
This project uses uv for dependency management and running tests.
Prerequisites
- uv must be installed
Running tests
A Makefile is provided for common development tasks:
make test # Run tests with the default Python version
make typecheck # Run type checker (ty)
make fulltest # Run type checker + tests on Python 3.10–3.15
make clean # Remove cache directories
Or run tests directly:
uv run pytest
Make WAVEs!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file newwave-0.2.0.tar.gz.
File metadata
- Download URL: newwave-0.2.0.tar.gz
- Upload date:
- Size: 118.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dccc9d174864a35454c5815e3f6355aa5ad49ec06ac17216aff2c1b1b38a7d1
|
|
| MD5 |
b2d95e5f96788a665d63d6538ff03297
|
|
| BLAKE2b-256 |
a6ac17cd09f2f4f1c5cef464cab61845a83f3f593d4a7d3d26243167dcdaab40
|
File details
Details for the file newwave-0.2.0-py3-none-any.whl.
File metadata
- Download URL: newwave-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ead954ed6fa4dcc53850654b8a207ef0ef202fa1cb0215fc1fe0c4927290b87d
|
|
| MD5 |
db820bc032c8e421856d15e10e44ed1b
|
|
| BLAKE2b-256 |
944b5bf1455a38e0cd91e79002020a7503ab18ca413786acb8d3e88933118a20
|