Extend JamesDSP with convolution and spatial audio
This commit is contained in:
23
frontend/jamesdsp-ir.test.js
Normal file
23
frontend/jamesdsp-ir.test.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const { test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
test('generated room responses support four true-stereo paths and respect the low-memory cap', async () => {
|
||||
const { generateIR, BUILTIN_IRS } = await import('./vendor/jamesdsp/ir-builtins.mjs');
|
||||
const { resampleIR } = await import('./vendor/jamesdsp/ir-utils.mjs');
|
||||
const ir = generateIR('Hall', 48000, 4, { maxFrames: 24000 });
|
||||
assert.equal(ir.numberOfChannels, 4);
|
||||
assert.equal(ir.length, 24000);
|
||||
assert.equal(ir.truncated, true);
|
||||
assert.ok(ir.getChannelData(0).some((sample, i) => sample !== ir.getChannelData(1)[i]), 'each matrix path has distinct taps');
|
||||
const converted = resampleIR(ir, 32000);
|
||||
assert.equal(converted.sampleRate, 32000);
|
||||
assert.equal(converted.numberOfChannels, 4);
|
||||
assert.equal(converted.length, 16000);
|
||||
assert.deepEqual(Object.keys(BUILTIN_IRS), ['Small room', 'Hall', 'Plate', 'Cathedral']);
|
||||
});
|
||||
|
||||
test('the IndexedDB store rejects impulse responses beyond its measured internal-frame cap', async () => {
|
||||
const { saveIR } = await import('./vendor/jamesdsp/ir-store.mjs');
|
||||
const oversized = { sampleRate: 48000, numberOfChannels: 4, length: 65537, getChannelData: () => new Float32Array(65537) };
|
||||
await assert.rejects(saveIR('oversized', oversized), /65,536-frame internal limit/);
|
||||
});
|
||||
Reference in New Issue
Block a user