From 748f8559e40430dd65b33bb62f3bee672e310ef2 Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Thu, 12 Dec 2019 15:56:59 -0500
Subject: [PATCH] Remove the 11khz option because it doesnt work on safari

---
 src/lib/audio/audio-util.js       |  7 ++-----
 test/unit/util/audio-util.test.js | 10 +---------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/lib/audio/audio-util.js b/src/lib/audio/audio-util.js
index 2a4c3bb19..e4470b2b3 100644
--- a/src/lib/audio/audio-util.js
+++ b/src/lib/audio/audio-util.js
@@ -70,11 +70,8 @@ const downsampleIfNeeded = (samples, sampleRate, resampler) => {
     if (duration * 22050 * 2 < SOUND_BYTE_LIMIT) {
         return resampler({samples, sampleRate}, 22050);
     }
-    // If encodeable at 11khz, resample and call submitNewSamples again
-    if (duration * 11025 * 2 < SOUND_BYTE_LIMIT) {
-        return resampler({samples, sampleRate}, 11025);
-    }
-    // Cannot save this sound even at 11khz, refuse to edit
+    // Cannot save this sound at 22khz, refuse to edit
+    // In the future we could introduce further compression here
     return Promise.reject('Sound too large to save, refusing to edit');
 };
 
diff --git a/test/unit/util/audio-util.test.js b/test/unit/util/audio-util.test.js
index 876cf71e4..f8a32e5c9 100644
--- a/test/unit/util/audio-util.test.js
+++ b/test/unit/util/audio-util.test.js
@@ -66,16 +66,8 @@ describe('downsampleIfNeeded', () => {
         expect(resampler).toHaveBeenCalledWith({samples, sampleRate}, 22050);
         expect(res).toEqual('TEST');
     });
-    test('downsamples to 11025 if that puts it under the limit', async () => {
-        samples.length = 44100 * 7 * 60;
-        const resampler = jest.fn(() => 'TEST');
-        const res = await downsampleIfNeeded(samples, sampleRate, resampler);
-        expect(resampler).toHaveBeenCalledWith({samples, sampleRate}, 11025);
-        expect(res).toEqual('TEST');
-    });
-
     test('fails if resampling would not put it under the limit', async () => {
-        samples.length = 44100 * 8 * 60;
+        samples.length = 44100 * 4 * 60;
         try {
             await downsampleIfNeeded(samples, sampleRate, null);
         } catch (e) {
-- 
GitLab