From f0648be5fa85c9d2bfdfdc0cadcd2593dcc21b81 Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Sat, 6 Jun 2026 10:28:54 +0200 Subject: [PATCH 1/2] platform selection fixed for Windows previously, we used platform.architecture and platform.machine to determine whether we're running on Python 32, 64, or arm64. However, this has proven unreliable, as Python always reports arm64 if it is running on an arm64 machine, regardless of the python build. Instead, we needed a different mechanism that determines the python build instead, which is found in sysconfig.get_platform. --- soundfile.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/soundfile.py b/soundfile.py index c8169845..9ef734cf 100644 --- a/soundfile.py +++ b/soundfile.py @@ -164,18 +164,17 @@ from platform import machine as _machine _packaged_libname = 'libsndfile_' + _machine() + '.dylib' elif _sys.platform == 'win32': - from platform import architecture as _architecture - from platform import machine as _machine + import sysconfig as _sysconfig - _win_machine = _machine().lower() - if _win_machine in ('arm64', 'aarch64'): + _win_machine = _sysconfig.get_platform() + if _win_machine == 'win-arm64': _packaged_libname = 'libsndfile_arm64.dll' - elif _architecture()[0] == '64bit': + elif _win_machine == 'win-amd64': _packaged_libname = 'libsndfile_x64.dll' - elif _architecture()[0] == '32bit': + elif _win_machine == 'win32': _packaged_libname = 'libsndfile_x86.dll' else: - raise OSError(f'no packaged library for Windows {_architecture()} {_machine()}') + raise OSError(f'no packaged library for Windows {_win_machine}') elif _sys.platform == 'linux': from platform import machine as _machine if _machine() in ["aarch64", "aarch64_be", "armv8b", "armv8l"]: From a2a5acb1cd5c5c73d192df629410703a071abd8a Mon Sep 17 00:00:00 2001 From: Bastian Bechtold Date: Sat, 6 Jun 2026 10:29:15 +0200 Subject: [PATCH 2/2] increment version number and adds changelog --- README.rst | 26 ++++++++++++++++++-------- soundfile.py | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index e28c3a8a..fc4a94a5 100644 --- a/README.rst +++ b/README.rst @@ -242,22 +242,22 @@ In the following example OGG is converted to WAV entirely in memory (without wri Controlling bitrate mode and compression level ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For some audio formats, you can control the bitrate and compression level. +For some audio formats, you can control the bitrate and compression level. -`compression_level` is a float between 0 and 1, with 1 being the highest compression, +`compression_level` is a float between 0 and 1, with 1 being the highest compression, and `bitrate_mode` is 'VARIABLE', 'CONSTANT', or 'AVERAGE'. .. code:: python import soundfile as sf - + # for example, this uncompressed 5 minute wav file with 32 kHz sample rate is 18 Mb - data, samplerate = sf.read('5min_32kHz.wav') - + data, samplerate = sf.read('5min_32kHz.wav') + # maximum mp3 compression results in 1.1 Mb file, with either CONSTANT or VARIABLE bit rate - sf.write('max_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=.99) + sf.write('max_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=.99) sf.write('max_compression_cbr.mp3', data, samplerate, bitrate_mode='CONSTANT', compression_level=.99) - + # minimum mp3 compression results in 3.5 Mb file sf.write('min_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=0) @@ -407,4 +407,14 @@ News 2025-01-25 V0.13.1 Bastian Bechtold Thank you, Brian McFee and Guy Illes - - Fixed regression in blocks \ No newline at end of file + - Fixed regression in blocks + +2026-06-06 V0.14.0 Bastian Bechtold + Thank you GesonAnko, Trevor Gamblin, Andreas Karatzas, Harish RS, Hunter Hogan + + - Added type annotations + - Added Licensing note to wheel + - Fixed race condition when opening files concurrently + - Fixed regressions in test suite + - Removed support for Python <= 3.9 + - Added ARM64 support for Windows diff --git a/soundfile.py b/soundfile.py index 9ef734cf..6db0b4b6 100644 --- a/soundfile.py +++ b/soundfile.py @@ -8,7 +8,7 @@ For further information, see https://python-soundfile.readthedocs.io/. """ -__version__ = "0.13.1" +__version__ = "0.14.0" import os as _os import sys as _sys