Skip to main content

PyALSoft

CI status PyPI version Supported Python versions

OpenAL Soft 1.25.2

PyALSoft provides a function-oriented, 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

play starts a WAV file immediately and returns an optional control handle:

import time

from pyalsoft import play

sound = play("sound.wav")
while sound.playing:
    time.sleep(0.1)

Playback is asynchronous. If no control is needed, the return value can be ignored without stopping the sound:

play("notification.wav")

The returned PlayingSound has pause(), resume(), stop(), and set_config() methods, plus playing, state, and status properties. The convenience API supports uncompressed mono or stereo WAV files containing 8-bit unsigned or 16-bit signed PCM. It opens its default audio session lazily, reuses clips loaded from the same resolved path, and releases it automatically at process exit. Applications can call shutdown() to close it earlier.

The complete example is available as examples/play_file.py and can be run from a source checkout with:

uv run python examples/play_file.py

Explicit playback sessions

Applications that generate audio, stream it, select a device, or require fully explicit resource lifetimes can use the underlying managed API directly:

from pyalsoft import PCM, open_playback, play, release, upload

pcm = PCM(
    # Half a second of mono silence; replace with your application's PCM bytes.
    samples=b"\0\0" * 22_050,
    channels=1,
    sample_rate=44_100,
)

with open_playback() as playback:
    clip = upload(playback, pcm)
    voice = play(playback, clip)
    # Query or control the voice here.
    release(playback, voice)
    release(playback, clip)

Device selection and HRTF

Playback devices can be enumerated and passed to open_playback. Context preferences such as HRTF are requested with PlaybackConfig; query PlaybackInfo to see what the audio backend actually enabled:

from pyalsoft import (
    PlaybackConfig,
    get_playback_info,
    list_playback_devices,
    open_playback,
)

devices = list_playback_devices()
selected = next((device for device in devices if device.is_default), None)

with open_playback(selected, config=PlaybackConfig(hrtf=True)) as playback:
    info = get_playback_info(playback)
    print(info.device_name, info.hrtf_status.value, info.hrtf_name)

See examples/play_sine.py, examples/move_sine.py, and examples/stream_sine.py for complete explicit API examples. Device selection and HRTF are demonstrated in examples/select_device_hrtf.py.

API layers

Automatically generated ctypes bindings for OpenAL live at pyalsoft.bindings. The same namespace also provides owned playback, capture, loopback, and context handles for deterministic native resource lifetimes. See the owned backend handle guide and the generated bindings reference.

pyalsoft holds the hand authored Python API, intended to make working with the library more Pythonic and manageable.

Contributing

Direct development occurs on development, the base branch of the repository. Pull requests from there to master represent official releases, signified by a version increase in pyproject.toml. Version increases should only be done from development. If implementing your own feature, it is requested that you fork this repository and make your own feature branch, and then merge into development.

Create the locked development environment with uv:

uv sync --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

pyalsoft-0.6.0.tar.gz (3.0 MB view details)

Uploaded Source

Built Distributions

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

pyalsoft-0.6.0-py3-none-win_amd64.whl (1.7 MB view details)

Uploaded Python 3Windows x86-64

pyalsoft-0.6.0-py3-none-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

pyalsoft-0.6.0-py3-none-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

pyalsoft-0.6.0-py3-none-macosx_11_0_arm64.whl (851.4 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

pyalsoft-0.6.0-py3-none-macosx_10_13_x86_64.whl (935.8 kB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file pyalsoft-0.6.0.tar.gz.

File metadata

  • Download URL: pyalsoft-0.6.0.tar.gz
  • Upload date:
  • Size: 3.0 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

Hashes for pyalsoft-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d29fec8b025724033ae01a7da810d7b22aee629a988b61f7c60feab1292fb0da
MD5 bf967ec1b8bc37fcd04fcbd894d94239
BLAKE2b-256 1b3943b5eead901f1e74a4f58e1374317d5cb752c1815ab93dd88e7d66284151

See more details on using hashes here.

File details

Details for the file pyalsoft-0.6.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyalsoft-0.6.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

Hashes for pyalsoft-0.6.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 59d1902f27102d31132bd4cc548319cf8d27c0d1a43688c5d17c6162b32656b2
MD5 878100a95dc9ec8f23421a9c43fafff3
BLAKE2b-256 1f8776c280f995f2ae9c4c7723353a531083dfd245e82372b0720568a46ca694

See more details on using hashes here.

File details

Details for the file pyalsoft-0.6.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: pyalsoft-0.6.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

Hashes for pyalsoft-0.6.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9d821f8cc41fe04c15105df67f6d8faff8d3dad9086afe2f1faea35cf5c7072
MD5 a22c7f421c1c778bc5e52be28e6dc49c
BLAKE2b-256 9d07be59bd9301afe97ad92d696d1aed45893c42ea8029cc4c470dd9b58bf73b

See more details on using hashes here.

File details

Details for the file pyalsoft-0.6.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: pyalsoft-0.6.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

Hashes for pyalsoft-0.6.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b879ca97fd3c18fafc648102298be3bc898766a6ee2fc13d42855eda9984fd87
MD5 d1d512f10ab772df58b748aa46bd39b8
BLAKE2b-256 8f088a1bf6667c2ba7c036eb8b9fe8ca13e717bc52d13a13033105b7523affa1

See more details on using hashes here.

File details

Details for the file pyalsoft-0.6.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pyalsoft-0.6.0-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 851.4 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

Hashes for pyalsoft-0.6.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 946c032010f766a8be3ee4992ce2fa6fc5d14eddc1a6d1d2e6690ee7a3d1c151
MD5 990dd8d6cd431d6dc00f0702230a2591
BLAKE2b-256 69e780e5a9c7040ddac4f3e45b7f4526ebb5173949877d413a9357978b44fed4

See more details on using hashes here.

File details

Details for the file pyalsoft-0.6.0-py3-none-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: pyalsoft-0.6.0-py3-none-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 935.8 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

Hashes for pyalsoft-0.6.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0de1b0b1f7ac1ca653781abde36cf98cff84d6166146d69be4a560aa0f8c0e70
MD5 16cfbbed1d0ed010ffab3356de3e44c1
BLAKE2b-256 b7d5d3be2f69263c6dcb65ff2f7ad5422202c04ac890206957d93d6653e29463

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 Sentry Error logging StatusPage Status page