Skip to main content

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 bytes and path-like objects in wave.open() (from Python 3.15)
  • Fix for Wave_write emitting unraisable exception when open() raises (from Python 3.15)
  • Removal of deprecated setmark, getmark, getmarkers interfaces (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

newwave-0.2.0.tar.gz (118.3 kB view details)

Uploaded Source

Built Distribution

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

newwave-0.2.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

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

Hashes for newwave-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6dccc9d174864a35454c5815e3f6355aa5ad49ec06ac17216aff2c1b1b38a7d1
MD5 b2d95e5f96788a665d63d6538ff03297
BLAKE2b-256 a6ac17cd09f2f4f1c5cef464cab61845a83f3f593d4a7d3d26243167dcdaab40

See more details on using hashes here.

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

Hashes for newwave-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ead954ed6fa4dcc53850654b8a207ef0ef202fa1cb0215fc1fe0c4927290b87d
MD5 db820bc032c8e421856d15e10e44ed1b
BLAKE2b-256 944b5bf1455a38e0cd91e79002020a7503ab18ca413786acb8d3e88933118a20

See more details on using hashes here.

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