Blip - The retro sound effect extension

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)

Get it or try the HTML5 demo from the asset portal.

15 Likes

Nice! and funny. Remembering the 80s :smiley:

Its a little bit inspiring me to do a very simple old-style-game with these sounds :slight_smile:

Are there more sounds available?

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

1 Like

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.

Nope, you’re doing everything right. You could try and clone/download the entire project: https://github.com/britzl/blip/ and run the example to see if that works (I doubt it).

This is likely the culprit.

Would you mind testing the OpenAL extension as well and see if that works? (there’s a sample project on GitHub IIRC)

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.

OK, that’s good. I made something wrong then. I’ll do some testing on a windows machine on Monday then. Sorry about this!

4 Likes

Huh! I get the same with that seed. However, if I change the seed to 16574 it works!

3 Likes

Got around to testing this tonight and yeah, works fine if not using that seed.
Like, what are the odds of picking a non-working seed?

Maybe that can be the name of my game.
Bad Seed™ - A Space Adventure

4 Likes

Hey @britzl!

First of all, thanks for making a ton of awesome extensions.

Secondly, I can’t see to get Blip working on my machine :sweat_smile:

I’ve tried a bunch of sounds, but all of them return nil. The error I get is:

ERROR:BLIP: OpenAL Error: New source (Invalid Enum)

I’m testing on MacOS Mojave 10.14.5. HTML5 demo version on the website works fine.

Full list of sounds I’ve tried below:

pprint(blip.jump(4000))
pprint(blip.hurt(4000))
pprint(blip.explosion(4000))
pprint(blip.laser(4000))
pprint(blip.jump(11111))
pprint(blip.hurt(11111))
pprint(blip.explosion(11111))
pprint(blip.laser(11111))
pprint(blip.jump(23456))
pprint(blip.hurt(23456))
pprint(blip.explosion(23456))
pprint(blip.laser(23456))
pprint(blip.jump(40000))
pprint(blip.hurt(40000))
pprint(blip.explosion(40000))
pprint(blip.laser(40000))
pprint(blip.jump(55000))
pprint(blip.hurt(55000))
pprint(blip.explosion(55000))
pprint(blip.laser(55000))
pprint(blip.jump(85000))
pprint(blip.hurt(85000))
pprint(blip.explosion(85000))
pprint(blip.laser(85000))

Cheers,
Deividas

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.

1 Like

I haven’t tried Blip in quite some time. Something must have changed. I can look into it when I’m back from my vacation.

1 Like

Same for me - getting errors… thanks if you’ve had a chance to look at this again…

Hi Ben! Welcome back to the forum (and Defold?)!

I’ve fixed the issue. Please try Blip 1.1.1:

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!

2 Likes

HTML5 example (the URL in the first post is broken): Blip 1.0

3 Likes

Getting some errors on that link:

Turn on the random seed and click one of the other buttons listening to sounds until it picks a number that causes a crash to replicate.

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:

7 Likes