From 759d88f49a2b99ca283aabb623a1692c9c17bc7e Mon Sep 17 00:00:00 2001 From: akok Date: Thu, 18 Mar 2021 03:10:13 -0700 Subject: [PATCH] Fixed audioread bug for large sample numbers Audioread was misreading numbers in scientific notation as decimal numbers. Since it requires integers, this would case it to crash. I fixed it by converting the numbers to int and back again to double. --- Remoras/Explosion-Detector/ex_xcorr_explosion_p2_v4.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Remoras/Explosion-Detector/ex_xcorr_explosion_p2_v4.m b/Remoras/Explosion-Detector/ex_xcorr_explosion_p2_v4.m index b17d7c2e..5f7f0922 100644 --- a/Remoras/Explosion-Detector/ex_xcorr_explosion_p2_v4.m +++ b/Remoras/Explosion-Detector/ex_xcorr_explosion_p2_v4.m @@ -106,7 +106,12 @@ function ex_xcorr_explosion_p2_v4(varargin) continue end - y = audioread(filepath,[rStart rStop]); + %Making sure audioread doesn't crash because of scientific notation + rStart2 = uint64(rStart); + rStop2 = uint64(rStop); + rStart3 = double(rStart2); + rStop3 = double(rStop2); + y = audioread(filepath,[rStart3 rStop3]); % Filter between 200 and 2000 Hz. yFilt = filtfilt(B,A,y); % Filter click. fprintf('max = %0.3f\n',max(yFilt))