mixaudio
v0.1.3
Published
Adaptive game music DSL compiler, browser player, and studio.
Readme
mixaudio
mixaudio is a browser-first adaptive music library for games. It ships:
compileDsl(...)to compile the music DSL into a normalized runtime graphcreateMixPlayer(...)to decode audio and drive playback withplay,pause,resume,stop, andgotonpx mixaudio studioto launch the packaged web studio for authoring and testing mixes
Install
npm install mixaudioLibrary Usage
import { compileDsl, createMixPlayer } from "mixaudio";
const compileResult = compileDsl(dsl, {
bpm: 120,
beatsPerSection: 16,
trimMs: 0,
sectionCount: 8,
sourceId: "battle-theme.mp3",
});
if (!compileResult.compiled) {
console.error(compileResult.diagnostics);
throw new Error("Invalid mix DSL");
}
const player = await createMixPlayer(file, {}, compileResult.compiled);
await player.play({ stateName: "calm" });
player.goto("combat");Studio
npx mixaudio studioOptions:
--port <port>--host <host>--no-open
Development
npm run dev
npm run build
npm test