/** * Port of xa.beat.beat_track() * Much faster and more accurate than our basic BPM detector */ export function beatTrack(audioData: any, sampleRate: any, { hopLength, startBpm, tightness, _trim, units, }?: { hopLength?: number; startBpm?: number; tightness?: number; _trim?: boolean; units?: string; }): { tempo: number; beats: number[]; beatFrames: number[]; onsetStrength: Float32Array; confidence: number; }; /** * Fast tempo estimation using autocorrelation * Much more efficient than testing every possible BPM */ export function estimateTempo(onsetStrength: any, sampleRate: any, hopLength?: number, startBpm?: number): { bpm: number; confidence: number; allCandidates?: undefined; } | { bpm: number; confidence: number; allCandidates: { bpm: number; strength: number; lag: number; }[]; }; /** * Dynamic programming beat tracker * Simplified version of xa's beat tracking */ export function trackBeats(onsetStrength: any, bpm: any, sampleRate: any, hopLength?: number, tightness?: number): number[]; /** * Extract tempo from beat times * Useful for validation and multiple tempo detection */ export function extractTempo(beatTimes: any): { bpm: number; confidence: number; intervals: number[]; medianInterval: number; }; /** * Optimized BPM detection - replacement for the slow one * Uses onset detection + tempo estimation * * Failure paths THROW with diagnostics naming the failed stage — there is no * silent fallback estimator here. (The old catch-all fell back to an * RMS-interval heuristic that clamped into [60, 200] BPM and reported a * fabricated confidence of 0.5; that path was deleted, 2026-07-04.) * * @throws {Error} when the beat-tracking stage fails; the original error is * attached as `cause`. */ export function fastBPMDetect(audioData: any, sampleRate: any): { bpm: number; confidence: number; beats: number[]; onsetStrength: Float32Array; };