From 455c281a79ff04c9776c65ce659184b6c7213881 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Wed, 21 Dec 2022 22:57:20 +0100 Subject: [PATCH] bump to release version --- doc/changes/0.4.rst | 3 +-- pyproject.toml | 2 +- stimuli/audio/sound.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/changes/0.4.rst b/doc/changes/0.4.rst index 0acdeb4a..421952af 100644 --- a/doc/changes/0.4.rst +++ b/doc/changes/0.4.rst @@ -16,10 +16,9 @@ Bugs ~~~~ - Fix indentation of docstrings with a summary line (by `Mathieu Scheltienne`_) - - Fix casting of ``true_divide`` with different ``dtypes`` when loading a sound (by `Mathieu Scheltienne`_) - - Cast loaded sounds to ``np.float64`` to prevent floating point error in the volume assessment (by `Mathieu Scheltienne`_) +- Cast all sounds to ``np.float32`` since ``sounddevice`` cast them anyway (by `Mathieu Scheltienne`_) Authors ~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index c3a9a010..8aa3d03b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'stimuli' -version = '0.4.2' +version = '0.4.3' description = 'Simple auditory and visual stimuli avoiding PsychoPy.' readme = 'README.md' license = {file = 'LICENSE'} diff --git a/stimuli/audio/sound.py b/stimuli/audio/sound.py index 670ba3da..214f6d11 100644 --- a/stimuli/audio/sound.py +++ b/stimuli/audio/sound.py @@ -119,7 +119,7 @@ def _check_signal( the _set_signal method. """ assert signal.ndim in (1, 2) - signal = signal.astype(np.float32) + signal = signal.astype(np.float64) if signal.ndim == 2: assert signal.shape[1] in (1, 2) if signal.shape[1] == 1: @@ -139,6 +139,7 @@ def _check_signal( if all(elt != 0 for elt in volume): signal /= np.max(np.abs(signal), axis=0) np.nan_to_num(signal, copy=False, nan=0.0) # sanity-check + signal = signal.astype(np.float32) return signal, volume @staticmethod