Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -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);
});
});