Blip is a retro sound effect extension for Defold. It is based on the Sfxr library and can be used to generate and play simple sound effects from a running Defold game. It’s super easy to use:
-- The seed is a number that is used to generate a specific version of the sound effect.
-- Each seed will always result in the same sound.
local seed = 1234
-- Generate the sound effect (use one of blip, jump, hurt, powerup, explosion, laser or pickup)
local sound = blip.blip(seed)
local sound = blip.jump(seed)
local sound = blip.hurt(seed)
local sound = blip.powerup(seed)
local sound = blip.explosion(seed)
local sound = blip.laser(seed)
local sound = blip.pickup(seed)
-- Play it!
blip.play(sound)
You can get a lot of variation by providing different seeds to the functions. And the various parameters to Sfxr could be exposed to give very fine grained control over the sounds that are generated. But it all boils down to simple wave types such as sawtooth, since, noise etc
I’m trying to use this extension, but I keep running into OpenAL errors.
In a game object I do:
local seed = 16575
local hurt = blip.hurt(seed)
print(hurt)
This gives me the following error (followed by printing nil):
ERROR:DEFAULT: OpenAL Error: Copying to buffer (Invalid Value)
DEBUG:SCRIPT: nil
I’ve included the lib in game.project and hit fetch libraries, can see the lib show up in the editor and all.
Am I missing something basic here maybe?
Testing this on Windows 10.
Correct, the example project produced same results, same error and the return value is nil.
The sample project for OpenAL extension worked however, I hear the car going back and forth and moving to different objects plays their respective sounds.
P.S. Sorry for reviving an old thread, but I couldn’t find any other threads on Google and I thought that this may be useful to anyone else who may run into this. Happy to repost this somewhere more appropriate if you could point me in the right direction.
Hah! I’ll check soon. Yes… I’m back – I never quite left, been working on other projects and now back on my own stuff. Shipped four games the last 18 months. One is stuck in dev limbo waiting for final client approval. I’m back building a framework for something new in Defold – self funded so it gets set down when new paid work comes in. Happy to see how much progress has been made!
I recently fixed the sporadic crash in Blip. It was caused by an error in the WAV length calculation for the generated wav file and occasionally writing outside the allocated buffer.
If anyone needs an 8-bit sound effect fix for their next game then give Blip a try: