Adding sound - a beginner's guide

5

Stats

33,530 visits, 59,066 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 13 Dec, 2011. Last updated 19 Feb, 2019

It takes three simple steps. Here they are, followed by detailed instructions, and a walkthrough showing how you can add sounds to the Beginner's Guide tutorial:

1) Import sound files into your project.

2) Insert an Audio object to your project.

3) Add sound events in the event sheet.

1) Import sound files into your project

In the Project Bar (on the right of the workspace - if it's not visible, click the Project tab at bottom right), right-click the Sounds or Music folders and select 'Import sounds' or 'Import music'.

How do you decide which folder to import your files into? Audio files in the Sounds folder are downloaded completely before they're played, while files in the Music folder are streamed (played as they're downloading). So, if you put a music track in the Sounds folder, it would need to take time to download completely before playing, but if it's in the Music folder, it can start playing immediately while it's streamed.

Select the sound files you need:

Preferably, import WAV files (in PCM encoding). Construct 2 will automatically encode these to both Ogg Vorbis and MPEG-4 (MP4) files. (Why are both formats needed? You can find the reason here in the Manual, and more details of HTML5 audio formats here and even more, including the politics - yes! - of audio formats here. And why can't you use MP3 files? Because of licensing issues - read more about them here.)

2) Insert an Audio object to your project

Right-click in the layout sheet. In the dialog that opens, select 'Insert new object'.

Under 'Media', select 'Audio' and click 'Insert'.

In the Project Bar, an Audio object will appear under 'Object types', and its properties will appear in the Properties Bar (on the left of the layout sheet).

3) Add sound events in the event sheet

Now, by way of example, here's how we add sounds to the Beginner's Guide tutorial game:

First, we import the sound files we want - bullet fire, an explosion for when a bullet monster is destroyed, a different explosion for when your player is destroyed, and a victory sound for when your player wins. We're taking our sound files from the free bundle download of music, sounds and sprites - for the bullets firing we'll use Lazer Fire 1.wav, for the monster destruction we'll import Explosion 3.wav, for the player destruction RetroLaser1.wav (it's got a suitably dismal quality), and SquareMotif1.wav for the celebration of victory. Import these and you'll see their .ogg and .m4a versions showing up in the Sounds folder in the Project Bar.

Now we insert an Audio object.

Lastly, we add the sound events:

There's still the victory celebration sound to add. Over to you - along with other sounds you may want to add. (What about a sound when a monster runs out of health and it's destroyed?)

You should now find that the game is noisier - and more fun.

  • 0 Comments

Want to leave a comment? Login or Register an account!