Compose weighted style prompts; blended live in your browser.
The whole engine is one ES module β no build step, no install, runs on WebGPU. Import it like transformers.js:
// downloads the weights from HF + builds the WebGPU engines
import { MagentaRT } from "https://magenta-community-magenta-rt-stack.static.hf.space/magenta-rt.mjs";
const mrt = await MagentaRT.load({ precision: "q4" }); // "q4" (fast) | "fp32" (reference)
// free-text styles, blended with weights
await mrt.setStyle([
{ text: "lo-fi hip hop", weight: 0.7 },
{ text: "jazz piano trio", weight: 0.4 },
]);
await mrt.play(); // straight to the speakers (Web Audio + low-latency)
await mrt.setStyle("ambient techno"); // change live β lands in ~0.5s
mrt.stop();
Prefer to drive the audio yourself?
for await (const { audio, sampleRate } of mrt.stream()) {
// audio: Float32Array, interleaved stereo @ 48 kHz, ~0.4s per chunk
}
100% client-side β no server, nothing uploaded. Module: magenta-rt.mjs Β· minimal demo: example.html