Initial Commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
import { LoudnessMeter } from "../src/index.js";
|
||||
import { buildDoc, sine } from "./helpers/build-doc.js";
|
||||
|
||||
describe("LoudnessMeter integration", () => {
|
||||
it("full round-trip on a 48 kHz stereo 5 s fixture", {
|
||||
timeout: 60000,
|
||||
}, async () => {
|
||||
const sr = 48000;
|
||||
const left = sine(0.5, 1000, sr, 5);
|
||||
const right = sine(0.5, 1000, sr, 5);
|
||||
const doc = buildDoc([left, right], sr);
|
||||
const result = await new LoudnessMeter().analyze(doc);
|
||||
expect(result.op).toBe("loudness-meter");
|
||||
expect(result.sampleRate).toBe(sr);
|
||||
expect(result.dcOffset.length).toBe(2);
|
||||
expect(result.truePeak).toBeGreaterThanOrEqual(result.peak - 1e-3);
|
||||
});
|
||||
|
||||
it("44.1 kHz mono is handled with rate-adapted K-weighting", {
|
||||
timeout: 30000,
|
||||
}, async () => {
|
||||
const sr = 44100;
|
||||
const doc = buildDoc([sine(0.25, 1000, sr, 4)], sr);
|
||||
const r = await new LoudnessMeter().analyze(doc);
|
||||
expect(Number.isFinite(r.lufs)).toBe(true);
|
||||
expect(Number.isFinite(r.truePeak)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user