From 3232d7f6f80d058088fe0d6b64976dd6284ce94e Mon Sep 17 00:00:00 2001 From: norvell Date: Tue, 7 May 2024 13:24:59 +0000 Subject: [PATCH] Use float in scipy.signal.resample. int16 renders a zero output vector. --- scripts/pyaudio3dtools/audioarray.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pyaudio3dtools/audioarray.py b/scripts/pyaudio3dtools/audioarray.py index 8fabd5ca1c..4095a74333 100644 --- a/scripts/pyaudio3dtools/audioarray.py +++ b/scripts/pyaudio3dtools/audioarray.py @@ -334,8 +334,8 @@ def compare( for i in range(nchannels): tmpfile_ref = Path(tmpdir).joinpath(f"ref_ch{i+1}.wav") tmpfile_test = Path(tmpdir).joinpath(f"test_ch{i+1}.wav") - r48 = resample(ref[:, i], fs, 48000) - t48 = resample(test[:, i], fs, 48000) + r48 = resample(ref[:, i].astype(float), fs, 48000).astype(np.dtype('int16')) # Convert to float for resample, then to int16 for wavfile.write + t48 = resample(test[:, i].astype(float), fs, 48000).astype(np.dtype('int16')) wavfile.write(str(tmpfile_ref), 48000, r48) wavfile.write(str(tmpfile_test), 48000, t48) out = subprocess.check_output([mld, tmpfile_ref, tmpfile_test]) -- GitLab