Skip to content

Commit 3162358

Browse files
authored
Merge pull request #489 from bastibe/windows-platform
Fixes platform selection on Windows
2 parents d026abe + a2a5acb commit 3162358

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

‎README.rst‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,22 @@ In the following example OGG is converted to WAV entirely in memory (without wri
242242
243243
Controlling bitrate mode and compression level
244244
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
245-
For some audio formats, you can control the bitrate and compression level.
245+
For some audio formats, you can control the bitrate and compression level.
246246

247-
`compression_level` is a float between 0 and 1, with 1 being the highest compression,
247+
`compression_level` is a float between 0 and 1, with 1 being the highest compression,
248248
and `bitrate_mode` is 'VARIABLE', 'CONSTANT', or 'AVERAGE'.
249249

250250
.. code:: python
251251
252252
import soundfile as sf
253-
253+
254254
# for example, this uncompressed 5 minute wav file with 32 kHz sample rate is 18 Mb
255-
data, samplerate = sf.read('5min_32kHz.wav')
256-
255+
data, samplerate = sf.read('5min_32kHz.wav')
256+
257257
# maximum mp3 compression results in 1.1 Mb file, with either CONSTANT or VARIABLE bit rate
258-
sf.write('max_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=.99)
258+
sf.write('max_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=.99)
259259
sf.write('max_compression_cbr.mp3', data, samplerate, bitrate_mode='CONSTANT', compression_level=.99)
260-
260+
261261
# minimum mp3 compression results in 3.5 Mb file
262262
sf.write('min_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=0)
263263
@@ -426,4 +426,14 @@ News
426426
2025-01-25 V0.13.1 Bastian Bechtold
427427
Thank you, Brian McFee and Guy Illes
428428

429-
- Fixed regression in blocks
429+
- Fixed regression in blocks
430+
431+
2026-06-06 V0.14.0 Bastian Bechtold
432+
Thank you GesonAnko, Trevor Gamblin, Andreas Karatzas, Harish RS, Hunter Hogan
433+
434+
- Added type annotations
435+
- Added Licensing note to wheel
436+
- Fixed race condition when opening files concurrently
437+
- Fixed regressions in test suite
438+
- Removed support for Python <= 3.9
439+
- Added ARM64 support for Windows

‎soundfile.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
For further information, see https://python-soundfile.readthedocs.io/.
99
1010
"""
11-
__version__ = "0.13.1"
11+
__version__ = "0.14.0"
1212

1313
import os as _os
1414
import sys as _sys
@@ -164,18 +164,17 @@
164164
from platform import machine as _machine
165165
_packaged_libname = 'libsndfile_' + _machine() + '.dylib'
166166
elif _sys.platform == 'win32':
167-
from platform import architecture as _architecture
168-
from platform import machine as _machine
167+
import sysconfig as _sysconfig
169168

170-
_win_machine = _machine().lower()
171-
if _win_machine in ('arm64', 'aarch64'):
169+
_win_machine = _sysconfig.get_platform()
170+
if _win_machine == 'win-arm64':
172171
_packaged_libname = 'libsndfile_arm64.dll'
173-
elif _architecture()[0] == '64bit':
172+
elif _win_machine == 'win-amd64':
174173
_packaged_libname = 'libsndfile_x64.dll'
175-
elif _architecture()[0] == '32bit':
174+
elif _win_machine == 'win32':
176175
_packaged_libname = 'libsndfile_x86.dll'
177176
else:
178-
raise OSError(f'no packaged library for Windows {_architecture()} {_machine()}')
177+
raise OSError(f'no packaged library for Windows {_win_machine}')
179178
elif _sys.platform == 'linux':
180179
from platform import machine as _machine
181180
if _machine() in ["aarch64", "aarch64_be", "armv8b", "armv8l"]:

0 commit comments

Comments
 (0)