On Windows-on-ARM with an x86_64 Python (the default python.org installer), sounddevice.py picks libportaudioarm64.dll because it reads platform.machine(), which describes the OS, not the process. An x86_64 process cannot load an ARM64 DLL, so import fails with OSError: ... error 0xc1 (ERROR_BAD_EXE_FORMAT).
Repro: python -c "import sounddevice" on Windows 11 ARM64 with Python 3.14.3 x86_64, sounddevice 0.5.5.
Root cause: the elif _platform.system() == 'Windows': branch (~line 78) uses platform.machine() alone.
Fix: gate the arm64 branch on the process being ARM64 too — parse the compiler tag in sys.version (AMD64 vs ARM64), or try libportaudio64bit.dll first and only fall back to the arm64 name for an ARM64-native process.
On Windows-on-ARM with an x86_64 Python (the default python.org installer), sounddevice.py picks libportaudioarm64.dll because it reads platform.machine(), which describes the OS, not the process. An x86_64 process cannot load an ARM64 DLL, so import fails with OSError: ... error 0xc1 (ERROR_BAD_EXE_FORMAT).
Repro: python -c "import sounddevice" on Windows 11 ARM64 with Python 3.14.3 x86_64, sounddevice 0.5.5.
Root cause: the elif _platform.system() == 'Windows': branch (~line 78) uses platform.machine() alone.
Fix: gate the arm64 branch on the process being ARM64 too — parse the compiler tag in sys.version (AMD64 vs ARM64), or try libportaudio64bit.dll first and only fall back to the arm64 name for an ARM64-native process.