From a4d2bc30d1e2f0dcc868615b3328d23630ffb5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Thu, 14 May 2026 21:04:50 +0100 Subject: [PATCH 1/3] Add Windows x64 on ARM64 variant to CI --- .github/workflows/sounddevice-data.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sounddevice-data.yml b/.github/workflows/sounddevice-data.yml index 5bdfaad..a566835 100644 --- a/.github/workflows/sounddevice-data.yml +++ b/.github/workflows/sounddevice-data.yml @@ -16,6 +16,8 @@ jobs: arch: 'x86' - os: windows-11-arm arch: 'arm64' + - os: windows-11-arm + arch: 'x64' runs-on: ${{ matrix.os }} steps: - name: Set up Python @@ -25,7 +27,7 @@ jobs: architecture: ${{ matrix.arch }} - name: Double-check Python version run: | - python --version + python --version --version - name: Clone Git repository (with submodules) uses: actions/checkout@v6 with: From 75b9efc6e63b4d8268f624188bb1f91c92d40bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Tue, 19 May 2026 21:58:30 +0100 Subject: [PATCH 2/3] Prevent CI/CI checks falsely passing if the last check passes --- .github/workflows/sounddevice-data.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sounddevice-data.yml b/.github/workflows/sounddevice-data.yml index a566835..4a019e7 100644 --- a/.github/workflows/sounddevice-data.yml +++ b/.github/workflows/sounddevice-data.yml @@ -38,6 +38,7 @@ jobs: run: | python -m pip install . - name: Import module + shell: bash run: | python -m sounddevice python -c "import sounddevice as sd; print(sd._libname)" @@ -47,6 +48,7 @@ jobs: python -c "import sounddevice as sd; assert not any(a['name'] == 'ASIO' for a in sd.query_hostapis())" - name: Import module (using the ASIO DLL) if: startsWith(matrix.os, 'windows') + shell: bash env: SD_ENABLE_ASIO: 1 run: | From 1418197a5b9b5dd158e30e24fda522e02e853d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Thu, 23 Jul 2026 17:25:11 +0100 Subject: [PATCH 3/3] Fix architecture detection on Windows ARM64 When running an AMD64 Python on a Windows ARM64 host, platform.machine() returns the host architecture instead of the process architecture, causing sounddevice to try and load the wrong DLL. >>> import sounddevice Traceback (most recent call last): File "C:\Users\bagpuss\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\sounddevice.py", line 72, in raise OSError('PortAudio library not found') OSError: PortAudio library not found During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in import sounddevice File "C:\Users\bagpuss\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\sounddevice.py", line 91, in _lib: ... = _ffi.dlopen(_libname) ~~~~~~~~~~~^^^^^^^^^^ OSError: cannot load library 'C:\Users\bagpuss\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\_sounddevice_data\portaudio-binaries\libportaudioarm64.dll': error 0x7e Switch to sysconfig.get_platform() which does the right thing under emulation. --- setup.py | 4 +++- src/sounddevice.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 46a82fa..5438b11 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import os import platform +import sysconfig from setuptools import setup MACOSX_VERSIONS = '.'.join([ @@ -11,7 +12,8 @@ system = os.environ.get('PYTHON_SOUNDDEVICE_PLATFORM', platform.system()) machine = platform.machine().lower() architecture0 = os.environ.get('PYTHON_SOUNDDEVICE_ARCHITECTURE', - 'arm64' if machine in ['arm64', 'aarch64'] else platform.architecture()[0]) + 'arm64' if 'arm64' in sysconfig.get_platform() or 'aarch64' in sysconfig.get_platform() + else platform.architecture()[0]) if system == 'Darwin': libname = 'libportaudio.dylib' diff --git a/src/sounddevice.py b/src/sounddevice.py index 00fc6f8..a3f213e 100644 --- a/src/sounddevice.py +++ b/src/sounddevice.py @@ -55,6 +55,7 @@ import os as _os import platform as _platform import sys as _sys +import sysconfig as _sysconfig from ctypes.util import find_library as _find_library from _sounddevice import ffi as _ffi @@ -75,7 +76,7 @@ if _platform.system() == 'Darwin': _libname = 'libportaudio.dylib' elif _platform.system() == 'Windows': - if _platform.machine().lower() in ('arm64', 'aarch64'): + if 'arm64' in _sysconfig.get_platform() or 'aarch64' in _sysconfig.get_platform(): _platform_suffix = 'arm64' else: _platform_suffix = _platform.architecture()[0]