Debeat - Helping you sound good

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!

19 Likes

Nice! Thank you for sharing Adam!

1 Like

Some feedback:

  • I think you should have an example folder in the project where you show how it’s integrated and how it works.
  • Perhaps also an HTML5 build?
  • I’d like to have some documentation on the public functions
  • What do the different config values in the readme actually mean?
  • And what are their types (I’m guessing numbers?) and valid range?
4 Likes

Thanks for the feedback, I will definitely add LDoc and flesh out the readme.
Regarding example I first have to find some nice sounds without licensing issues…

1 Like

Generate some sounds using one of the tools here: Tools and resources for Game Jammers

There’s also several sites with free music (often for non-commercial use). I’ve used some chip-tune music by Ozzed for Mini Mega Party.

Update:

  • Added new examples folder containing a mixer setup. Try the HTML5 Demo
  • Added LDoc and improved Documentation in readme.md
  • Patch version with bugfixes to initial gain and finished sounds.
5 Likes

Fantastic! Great stuff Adam!

1 Like

Version 2.0.0 has been released, introducing the concept of Events and script based queues.

5 Likes

Version 2.2.0 has been released adding support for gain variation and a reset of queues.

Also events can now be sent using the shorthand function event(hash|string)

7 Likes