beatlyze
v0.1.1
Published
JavaScript/TypeScript SDK for the Beatlyze audio analysis API.
Downloads
24
Maintainers
Readme
beatlyze
JavaScript/TypeScript SDK for the Beatlyze audio analysis API.
Install
npm install beatlyzeQuick start
const { Beatlyze } = require("beatlyze");
(async () => {
const bz = new Beatlyze("bz_your_api_key");
// Analyze from URL (waits for result by default)
const result = await bz.analyzeUrl("https://example.com/track.mp3");
console.log(result.bpm); // 128.4
console.log(result.key); // "A"
console.log(result.energy);
// Submit without waiting
const job = await bz.analyzeUrl("https://example.com/track.mp3", { wait: false });
console.log(job.job_id);
// Check result later
const analysis = await bz.getAnalysis(job.job_id);
console.log(analysis.status);
// Batch (up to 10 URLs)
const jobs = await bz.analyzeBatch([
"https://example.com/a.mp3",
"https://example.com/b.mp3",
]);
console.log(jobs.length);
// Check usage
const usage = await bz.getUsage();
console.log(`${usage.count}/${usage.limit} analyses used`);
})().catch(console.error);TypeScript
Full type definitions included. Import types directly:
import { Beatlyze, AnalysisResult, BeatlyzeError } from "beatlyze";The SDK targets the live production API at https://api.beatlyze.dev by default.
License
MIT
