From 3bbb30d97e97d63c67cf9bb1973ca802fb59c778 Mon Sep 17 00:00:00 2001 From: nyanpasu64 Date: Sat, 17 Nov 2018 21:44:50 -0800 Subject: [PATCH] Add test for loud stereo overflowing --- tests/stereo in-phase.wav | Bin 0 -> 6444 bytes tests/test_wave.py | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/stereo in-phase.wav diff --git a/tests/stereo in-phase.wav b/tests/stereo in-phase.wav new file mode 100644 index 0000000000000000000000000000000000000000..f2a044c9ed468fb83e4c93a891152ff1c294e818 GIT binary patch literal 6444 zcmeHMp$>vj6umkdg^gswU?cDaxUs35vl*a*b0$n!3{GY++00HNBOBe^;0H9&@dF%* zVv;j{znAaDJe%k7sj=huXh*HV#~fn70E-;tf&*OO1UKJ< z--G`Z*9Z42?z=occ%HK^VSU9qk##%!4?AKX#lDvPIdul=CDgB|!% 0.99 + assert np.amin(data) < -0.99 + + # In the absence of overflow, sine waves have no large jumps. + # In the presence of overflow, stereo sum will jump between INT_MAX and INT_MIN. + # np.mean and rescaling converts to 0.499... and -0.5, which is nearly 1. + assert np.amax(np.abs(np.diff(data))) < 0.5