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. Only experienced users should need them.

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.5.0.tar.gz (2.9 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.5.0-py3-none-win_amd64.whl (1.7 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

pyalsoft-0.5.0-py3-none-macosx_11_0_arm64.whl (839.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

pyalsoft-0.5.0-py3-none-macosx_10_13_x86_64.whl (923.9 kB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

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

Hashes for pyalsoft-0.5.0.tar.gz
Algorithm Hash digest
SHA256 8129fc13b828ee80b434719eac64321c0f07271e4ee4903ec6d6aa3457d611d3
MD5 68ffd1772827a7fa6e986f98a0129ac6
BLAKE2b-256 b32996b37b12d9c9d16f344834bdc16a4f7351abc29436a3f5ec47f767b87cae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyalsoft-0.5.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.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a1567af132357b0296a50f666fae0edc72ac63b894cfe8b6a0de26bf10242eb2
MD5 b29e083dccd68828f2c582fd94bcf35c
BLAKE2b-256 1f12df36dccd16270cb4b3961f423569b08d24e767f55c0fbd59d32c2d4ebc10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyalsoft-0.5.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.5.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 38d81f26d253642e73fb95d9bd2bf83c8bfdda370c8774b0e1b9f9aee023e22f
MD5 49c407843c140bf41289298da150742e
BLAKE2b-256 97b45c45e232a6682d240513ad8bb10540a04ea35d5e63341c64c192cbc10b58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyalsoft-0.5.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.5.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4df3792ddba9aaf3f58c5ad57b538a346585a90b014cecd2ca793180e79ecaf6
MD5 98e84c7b205f527a7aa61a5dd2ebd0ea
BLAKE2b-256 07c717fa7e952cd405020053fc009e63f3519a106c96bd2e6607de93ccc3c190

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyalsoft-0.5.0-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 839.5 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.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b9d64a8322ba081d9e1c72f98a059d0703738872eef68c7f4c09efaeff2b1e7e
MD5 6382cfc884d2b2ed8a1123fd3a015f66
BLAKE2b-256 06ceacfa1ab80784eb74961999b86ea80628e23d74e51293afc2e8584cb91766

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyalsoft-0.5.0-py3-none-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 923.9 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.5.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b0c46ec0aaeee624253609745485901304a47af9ab32cbd877ae79d0354c442e
MD5 75011a27589f515cbde22d34ad1a72a7
BLAKE2b-256 5b7e6be3585a79aa6180fe6e9e9458f8ceb29e1f107ab883fd403fc4057dbec9

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