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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibcpy 3.10–3.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.fixAdd `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.fixEvaluate 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.fixOpen 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.fixAvoid 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.
fixInstall 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`.
fixChange 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.
fixInteract 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.