Skip to content

Commit 748f855

Browse files
committed
Remove the 11khz option because it doesnt work on safari
1 parent 8fae109 commit 748f855

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/lib/audio/audio-util.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@ const downsampleIfNeeded = (samples, sampleRate, resampler) => {
7070
if (duration * 22050 * 2 < SOUND_BYTE_LIMIT) {
7171
return resampler({samples, sampleRate}, 22050);
7272
}
73-
// If encodeable at 11khz, resample and call submitNewSamples again
74-
if (duration * 11025 * 2 < SOUND_BYTE_LIMIT) {
75-
return resampler({samples, sampleRate}, 11025);
76-
}
77-
// Cannot save this sound even at 11khz, refuse to edit
73+
// Cannot save this sound at 22khz, refuse to edit
74+
// In the future we could introduce further compression here
7875
return Promise.reject('Sound too large to save, refusing to edit');
7976
};
8077

test/unit/util/audio-util.test.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,8 @@ describe('downsampleIfNeeded', () => {
6666
expect(resampler).toHaveBeenCalledWith({samples, sampleRate}, 22050);
6767
expect(res).toEqual('TEST');
6868
});
69-
test('downsamples to 11025 if that puts it under the limit', async () => {
70-
samples.length = 44100 * 7 * 60;
71-
const resampler = jest.fn(() => 'TEST');
72-
const res = await downsampleIfNeeded(samples, sampleRate, resampler);
73-
expect(resampler).toHaveBeenCalledWith({samples, sampleRate}, 11025);
74-
expect(res).toEqual('TEST');
75-
});
76-
7769
test('fails if resampling would not put it under the limit', async () => {
78-
samples.length = 44100 * 8 * 60;
70+
samples.length = 44100 * 4 * 60;
7971
try {
8072
await downsampleIfNeeded(samples, sampleRate, null);
8173
} catch (e) {

0 commit comments

Comments
 (0)