Article Tutorials/Intro to sounds

From GiderosMobile
Revision as of 19:10, 13 November 2023 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Now that we can display images and text on the screen, you’ll be wanting to make noise!

First, we’ll start with just sound effects.

Download all audio for this tutorial from: Gideros Mobile Tutorial Audio file (2.4Mb)

The easiest and cheapest way to get cool sound effects for your application is to use the funky BFXR which you can download from here: (Note: This site is offline but you can get its software for Windows and for Mac here.)

This is a free-to-use and download application which lets you create sound effects and export the wav files of your effects for using in your application.

If you download the standalone version, you will need to install Adobe Air, but it’s worth it.


Click on the buttons until you find an effect you like and use Export Wav to save it into your Gideros Studio Project folder.

Create a new Project and add a new main.lua file to it. Use Add Existing Files to add your wav sound (eg laser.wav).

Type this into the main.lua file:

local laserfx ="laser.wav")

This creates an object called “laserfx” and loads the laser.wav file into it. The next line plays your sound effect. Pretty simple, huh?

Every game needs a funky tune in the background, so lets add in a tune. There’s plenty of free mp3s on the internet, so go grab your own and add it to the Project.

I grabbed a free tune from No Soap Radio ( They have a lot of game tunes, all totally free – even for commercial use!

local gametune ="DST-AngryMod.mp3")

Now, if you launch your application you will hear the sound playing. Awesome!
The ‘play’ parameter has two options:

• StartPosition
• Loops

You can start your tune partway through the song by specifying the StartPosition option. You can tell the tune how many times to loop (play over again) by specifying the Loops option.


local gametune ="DST-AngryMod.mp3")

If you want to play the song repeating forever, use this:

gametune:play(0, true)

Set the volume of your tune or sound effect:


“0.5” is at half volume. You can set your volume anywhere from 0 to 1.

Stop your tune from playing:


To unload and free up memory when you’re finished with your tune, use:

gametune = nil

Note: This tutorial was written by Jason Oakley and was originally available here:

Written Tutorials