{"name":"prefab-audio","title":"Audio","kind":"prefab","status":"available","summary":"Game/app audio over raw Web Audio: load samples from your bundle, play with volume/rate/loop, zero-asset beeps. Replaces maintenance-mode audio shims.","spec":"prefab-audio@0.1.1","version":"0.1.1","versions":["0.1.1","0.1.0"],"license":"MIT","source":"prototir","sizeKB":2,"requires":[],"permissions":[],"flags":{"wasm":false,"streamed":false},"compatibility":"Desktop and mobile browsers.","install":{"manifest":"{\n  \"modules\": [\n    \"prefab-audio@0.1.1\"\n  ]\n}","importFrom":"prefab-audio"},"example":"import { createAudio } from 'prefab-audio';\n\nconst audio = createAudio();\nawait audio.load('coin', 'assets/coin.ogg'); // a file in your bundle\naudio.play('coin', { volume: 0.8 });\naudio.beep(880, 0.08); // no file needed","api":[{"heading":"createAudio({ volume = 1 })","entries":[{"signature":"await audio.load(name, url)","description":"Fetches and decodes a sample from your bundle and keeps it under `name`. Throws if the file is missing."},{"signature":"audio.play(name, { volume = 1, rate = 1, loop = false })","description":"Plays a loaded sample. Returns a voice { stop(), source, gain }, or null when the name is unknown."},{"signature":"audio.beep(freq = 880, duration = 0.08, { volume = 0.5, type = 'sine' })","description":"A synthesized blip for UI feedback, with no audio file. Returns the same voice shape."},{"signature":"audio.volume","description":"Master volume, readable and settable."},{"signature":"audio.stopAll()","description":"Stops every playing voice."},{"signature":"audio.destroy()","description":"Stops everything, removes its listeners and closes the AudioContext."},{"signature":"audio.ctx, audio.master","description":"The AudioContext and master GainNode, for your own routing."}]}],"notes":["Browsers start audio suspended; the context resumes on the first pointer or key press, so the first sound should follow a player action."],"upstreamDocs":null,"labs":[]}