Registry / serialization / standard-sunau

standard-sunau

JSON →
library3.13.0pypypi✓ verified 22d ago

The `standard-sunau` library is a redistribution of the `sunau` module, which was formerly part of the Python standard library. It provides an interface for reading and writing Sun AU audio files (`.au` format). The original `sunau` module was deprecated in Python 3.11 and completely removed in Python 3.13 as part of PEP 594. This package allows legacy projects or those needing Sun AU file support to continue using the module by installing it as a PyPI dependency. It is currently at version 3.13.0 and is part of the 'dead battery' project, focused on redistributing removed standard library modules with minimal maintenance.

pip install standard-sunau
INSTALL
IMPORT
SIG · STANDARD-SUNAU
S
standard-sunau
serializationpythonv3.13.0
Install
1.5s avg
Import
10ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.008s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sunau
import sunau
import sunau (without prior installation on Python >= 3.13)
The `sunau` module was removed from the standard library in Python 3.13. On Python 3.13 and newer, it must be installed via pip.

This quickstart demonstrates how to create an in-memory Sun AU audio file and then read its properties using the `sunau` module. The `sunau.open()` function is used for both writing and reading, similar to standard file I/O operations.

import sunau import io # Create a dummy in-memory AU file for demonstration output_buffer = io.BytesIO() with sunau.open(output_buffer, 'wb') as w: w.setnchannels(1) w.setsampwidth(2) # 2 bytes = 16-bit w.setframerate(8000) # Write 100 frames of silence (two zero bytes per frame) w.writeframes(b'\x00\x00' * 100) # Rewind the buffer to read from the beginning output_buffer.seek(0) # Now read the dummy AU file with sunau.open(output_buffer, 'rb') as r: print(f"Number of channels: {r.getnchannels()}") print(f"Sample width (bytes): {r.getsampwidth()}") print(f"Frame rate (Hz): {r.getframerate()}") print(f"Number of frames: {r.getnframes()}") print(f"Compression type: {r.getcomptype()}") print(f"Compression name: {r.getcompname()}") # Read some frames (e.g., 50 frames) frames = r.readframes(50) print(f"Read {len(frames) // r.getsampwidth()} frames of audio data.")
Debug
Known issues
breakingThe `sunau` module was officially removed from the Python standard library in Python 3.13 (after being deprecated in 3.11) as per PEP 594. Applications relying on `sunau` in Python 3.13 or newer must explicitly install `standard-sunau` via pip.
fix
Add `standard-sunau` to your project's dependencies (`pip install standard-sunau`).
affects: Python 3.11+, especially 3.13+
gotchaThis `standard-sunau` package is a redistribution of a module removed from the standard library, primarily intended for compatibility. It is not actively developed for new features or significant improvements. For advanced or modern audio processing needs, consider more actively maintained Python audio libraries.
fix
Evaluate if an alternative, actively developed audio library better suits your project's long-term needs.
affects: All versions
gotchaThe `sunau.open()` function does not support simultaneous read/write ('r+' or 'w+') modes. You must open the file explicitly in either read ('r' or 'rb') or write ('w' or 'wb') mode.
fix
Open the file once for reading and separately for writing, or manage file pointer manually if using a file-like object.
affects: All versions
gotchaThe `sunau` module's `getmarkers()` method always returns `None`, and `getmark()` raises an error. These methods are present for compatibility with the `aifc` module but are not implemented for Sun AU files.
fix
Avoid using `getmarkers()` or `getmark()` as they do not provide functionality for Sun AU files.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sunau'
The `sunau` module was removed from the Python standard library in Python 3.13 (and deprecated in 3.11), causing existing code that imports it to fail.
fix
Install the `standard-sunau` package using `pip install standard-sunau`. Your existing `import sunau` statements will then work without modification.
ModuleNotFoundError: No module named 'standard_sunau'
The `standard-sunau` package provides the `sunau` module directly as a drop-in replacement; it does not expose a separate top-level module named `standard_sunau`.
fix
Change your import statement from `import standard_sunau` to `import sunau`.
ModuleNotFoundError: No module named '_sunau'
The `_sunau` module was an internal C implementation detail of the original standard library `sunau` module and is not present in the pure Python `standard-sunau` replacement.
fix
Interact with the public `sunau` module directly (e.g., `import sunau`); avoid attempting to import `_sunau`.
Upgrade
Version history
3.13.0latest on PyPI · released Oct 30, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
standard-sunau — pip install standard-sunau · libregistry