Are you struggling with your sounds and want them to have that nice fade in and out that makes all the difference??
Then you are looking for Debeat: a simple but effective library for Audio support
Try the HTML5 Demo
Integration
Add the mixer.go
Create a script controller
local mixer = require("debeat.mixer")
local queue = require("debeat.queue")
function init(self)
msg.post(".", "acquire_input_focus")
self.sfx_btn = queue.create("btn", {gating=0.3, behaviour=queue.TYPE_RANDOM, min_offset=2})
self.sfx_btn.add(msg.url("/sounds#sfx_btn1"))
self.sfx_btn.add(msg.url("/sounds#sfx_btn2"))
self.sfx_btn.add(msg.url("/sounds#sfx_btn3"))
end
function on_input(self, action_id, action)
if action_id == hash("sfx") and action.released then
self.sfx_btn.play()
elseif action_id == hash("play") and action.released then
mixer.play(msg.url("/sounds#track_ingame"))
elseif action_id == hash("stop") and action.released then
mixer.stop(msg.url("/sounds#track_ingame"))
elseif action_id == hash("drop") and action.released then
mixer.set_gain(msg.url("/sounds#track_ingame"), 0.5)
elseif action_id == hash("mute") and action.released then
mixer.set_group_gain(hash("master"), 0)
elseif action_id == hash("unmute") and action.released then
mixer.set_group_gain(hash("master"), 1)
end
end
And Enjoy!