Skip to content
Snippets Groups Projects
Commit 76f5cfe1 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Correctly return the sampleRate from the sample dropper

parent fcbf1b05
Branches
Tags
No related merge requests found
......@@ -102,7 +102,7 @@ const dropEveryOtherSample = buffer => {
}
return {
samples: newSamples,
sampleRate: buffer.rate / 2
sampleRate: buffer.sampleRate / 2
};
};
......
......@@ -87,11 +87,15 @@ describe('dropEveryOtherSample', () => {
sampleRate: 2
};
test('result is half the length', () => {
const {samples} = dropEveryOtherSample(buffer, 1);
const {samples} = dropEveryOtherSample(buffer);
expect(samples.length).toEqual(Math.floor(buffer.samples.length / 2));
});
test('result contains only even-index items', () => {
const {samples} = dropEveryOtherSample(buffer, 1);
const {samples} = dropEveryOtherSample(buffer);
expect(samples).toEqual(new Float32Array([1, 2, 3]));
});
test('result sampleRate is given sampleRate / 2', () => {
const {sampleRate} = dropEveryOtherSample(buffer);
expect(sampleRate).toEqual(buffer.sampleRate / 2);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment