Lab

useSoundReport

Reads the sound of a track as edited, to tell what it is: its loudness, key and tempo, and whether it meets ACX's audiobook requirements, held as a report until it is cleared.

pnpm dlx shadcn@latest add @audio-ui/use-sound-report
import { useSoundReport } from "@/hooks/use-sound-report";
Fileshooks/use-sound-report.ts
Depends onarrangement, clip-player, use-bake
npm@audio-ui/engine
Used byblock-audio-editor
ExportKindWhat it is
useSoundReportfunctionReads the sound as edited, to tell what it is: its loudness, key and tempo, and whether it meets ACX's audiobook requirements.

Usage

useSoundReport renders what a track's clips play, as useBake does, and reads it with reportSound of @audio-ui/engine/analysis: the loudness and true peak, the likeliest key, the tempo when the sound has a beat, and checkAcx's verdict on each of ACX's audiobook requirements (RMS between -23 and -18 dBFS, peak at most -3 dBFS, noise floor at most -60 dBFS on the quietest pause).

import { useSoundReport } from "@/hooks/use-sound-report";
import { SoundReport } from "@/components/audio-ui/sound-report";

const { analyze, clear, report } = useSoundReport({
  doc, // the arrangement's document
  recordings,
  sampleRate: 48_000,
  setStatus, // what the editor says while it works
  track: "track-1",
});

<MenuItem onClick={analyze}>Analyze sound</MenuItem>;
<SoundReport onOpenChange={(open) => !open && clear()} report={report} />;

report is null until analyze has read the sound, and again after clear. SoundReport draws it in a dialog.

Built by Ouest Labs, the source code is available on GitHub.
RSS