PyALSoft
PyALSoft provides a functional, managed playback API and typed bindings for
OpenAL Soft, including core OpenAL, ALC, EFX, and supported extensions. The
managed API lives at the package root; the complete low-level interface remains
available through pyalsoft.bindings.
PyALSoft is an independent project and is not affiliated with or endorsed by the OpenAL Soft project.
Installation
PyALSoft requires Python 3.12 or later.
python3 -m pip install pyalsoft
Quick start
This example generates a 440 Hz sine wave, plays it, and releases every native
resource when the with block exits:
import math
import time
from array import array
from pyalsoft import (
PCM,
VoiceState,
get_voice_status,
open_playback,
play,
release,
upload,
)
sample_rate = 44_100
duration = 0.5
pcm = array(
"h",
(
round(((1 << 14) - 1) * math.sin(math.tau * 440 * frame / sample_rate))
for frame in range(round(sample_rate * duration))
),
).tobytes()
audio = PCM(samples=pcm, channels=1, sample_rate=sample_rate)
with open_playback() as playback:
clip = upload(playback, audio)
voice = play(playback, clip)
while get_voice_status(playback, voice).state is VoiceState.PLAYING:
time.sleep(0.01)
release(playback, voice)
release(playback, clip)
The same example is available as examples/play_sine.py
and can be run from a source checkout with:
uv run python examples/play_sine.py
examples/move_sine.py shows a playing voice moving
from left to right by creating updated VoiceConfig values with
dataclasses.replace and passing them to set_voice_config.
Platforms
PyALSoft supports Windows x86-64, macOS x86-64 and ARM64, and Linux x86-64
and ARM64. Platform wheels bundle OpenAL Soft. pyalsoft.bindings.load() uses
the bundled library when available, then falls back to a system installation.
Pass an explicit library path to pyalsoft.bindings.load(path) to override
discovery.
API layers
The package root is a functional interface for static buffered playback.
PCM, VoiceConfig, and Listener are immutable data. Clip and Voice are
opaque identities owned by a Playback session. Functions including upload,
play, set_voice_config, set_listener, pause, resume, stop, and
release make state changes explicit. A stopped or completed voice retains its
identity until it is passed to release; release_finished collects all such
voices in a long-lived session. Closing the session releases any resources that
remain. resume accepts paused voices only.
pyalsoft.bindings is the supported low-level escape hatch for streaming,
capture, EFX, extensions, or direct control. Its recommended library.al and
library.alc namespaces use snake-case names, accept Python strings and
sequences, infer array lengths, allocate output parameters, and return normal
Python values. Generated object handles such as library.al.source(identifier)
expose typed properties including gain, position, buffer, and state.
Exact C entry points remain available when direct control is needed. For
example, library.alGenSources is the generated ctypes binding for
alGenSources, while library.al.gen_sources() is its Python-value wrapper.
Constants, enums, and C types are available through bindings.constants,
bindings.enums, and bindings.types.
Extensions are discoverable by registry name or generated attribute. Check an extension against its device or current context before using its commands:
efx = library.extensions.alc_ext_efx
if efx.is_present(device):
print(efx.commands)
At the bindings layer, unavailable libraries, missing contexts, and unsupported
extensions raise LibraryNotFoundError, ContextRequiredError, and
ExtensionUnavailableError, respectively. open_playback translates library
discovery failures into PlaybackOpenError. See the
bindings API reference for the complete command,
property, and extension surface.
Contributing
Create the locked development environment with uv:
uv sync --locked --python 3.12
Before submitting a change, run the same core checks as CI:
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run python tools/generate_bindings.py --check
uv run python tools/sync_openal_soft.py --check
Bindings and docs/reference.md are generated from the
vendored OpenAL registry plus reviewed corrections in
tools/semantic_overrides.toml. After changing
the generator, registry, or overrides, regenerate them with:
uv run python tools/generate_bindings.py
See the repository tool guide for the purpose and structure of each development and release command.
License
PyALSoft's original Python code is available under the MIT License. Bundled OpenAL Soft and other third-party components remain under their respective licenses. The distribution includes the complete license texts and a third-party notice.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 pyalsoft-0.2.0.tar.gz.
File metadata
- Download URL: pyalsoft-0.2.0.tar.gz
- Upload date:
- Size: 2.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3734243fdc707bb1cb1ccb4ce72a3b5163aa44d1440488a87af5f6446e4d13ac
|
|
| MD5 |
cebaf32d7fa76b183ca45b05b6a37651
|
|
| BLAKE2b-256 |
40d78e7cbe531f7474d72482578d75a2b0f3b74ac09c8230c764babb4ecc04ac
|
File details
Details for the file pyalsoft-0.2.0-py3-none-win_amd64.whl.
File metadata
- Download URL: pyalsoft-0.2.0-py3-none-win_amd64.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b51cd0051d6025561aa2e6e4ad0ff2982939baa1da646653dd6cd2ff5cc7412a
|
|
| MD5 |
58450e49e2a751b7a6297fc2b33dfbb6
|
|
| BLAKE2b-256 |
cf39168e89c6c2b6e9447f4d6ed6c5b4153b0f3a3d36811e5bd14514b72a20ee
|
File details
Details for the file pyalsoft-0.2.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyalsoft-0.2.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3098cbf12ac9d11fe5e890dc961d5009f30b3f133676b5538c7922e05211ef26
|
|
| MD5 |
7c79c48892ea54bb66f50e5ecd4a6165
|
|
| BLAKE2b-256 |
22555682ce38bd6ab826d91473c9578da5f784f3070c23dca8e27648d7561349
|
File details
Details for the file pyalsoft-0.2.0-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pyalsoft-0.2.0-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9daf5ad017521db36f7f1888eaa0a6f780c5de747d1acdb76f3706261f38e3f
|
|
| MD5 |
3056fe71ff5d948e318a8898b5bc8df8
|
|
| BLAKE2b-256 |
7dcd3703e4d01c19df1290f6722d576af9cf80774edaac4552370a138245ad59
|
File details
Details for the file pyalsoft-0.2.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyalsoft-0.2.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 833.0 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34536579169615d7d76258809458b6e1803ee3f10dab53075e5f3d303d1ef0ae
|
|
| MD5 |
60ab7c2d9ac13fa19e67be76820051c2
|
|
| BLAKE2b-256 |
faded4c12302706b7068d71faf90f99e951057db1187546790157b5c0bbd770f
|
File details
Details for the file pyalsoft-0.2.0-py3-none-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pyalsoft-0.2.0-py3-none-macosx_10_13_x86_64.whl
- Upload date:
- Size: 917.4 kB
- Tags: Python 3, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ea365da52b0897b230deb2cd517badcc984a43c6f7b39c598abf39141c775b
|
|
| MD5 |
92dd1a20f9b14c55102f442c0815e35e
|
|
| BLAKE2b-256 |
6c6f5b18cbbf4a2d053214ee3e4cd1c98141e5e5174f82223eb97835c7be12c5
|