Import Audio dialog

The Import Audio dialog allows audio files to be added to the project from disk. It is accessed by selecting Import Sounds or Import Music from the right-click menu of the Sounds or Music folders in the Project Bar. Be sure to add the Audio object to your project to play back sounds and music.

Import Audio dialog
Before the dialog appears, you will be prompted to select some audio files from disk. You can select more than one file. The files are listed in the Import Audio dialog before importing, with tips about whether the format is supported or not. You can also click Add more files... on this screen to add some more files to the list.

Click Import to begin importing the listed files to the project. This may take a while with long audio recordings (e.g. music tracks); a progress bar may appear during the processing. Only files which are in a supported format are imported. Once importing has finished, the list will show the results of which files were successfully imported. Click Done to close the dialog. Note that importing audio with the same name as audio files in the project will cause those files to be replaced.

It is highly recommended to import PCM .wav files, since they are commonly supported and Construct 2 can encode them to both Ogg Vorbis and MPEG-4 AAC (only on Windows 7+).

Two audio formats are required

Browser makers have not been able to agree on a common audio format for the web. Internet Explorer and Safari use the proprietary MPEG-4 AAC (.m4a) format, and all other browsers (Firefox, Chrome and Opera) support the free Ogg Vorbis format.

For audio playback in all browsers, your audio must therefore be in both formats. Construct 2 helps you by encoding any uncompressed audio you import to both .m4a and .ogg for you automatically. However due to licensing restrictions around the proprietary MPEG-4 AAC format, Construct 2 will only encode .m4a files on Windows 7 and newer. Users on Windows XP and Vista must encode .m4a files on their own. The file extension must be .m4a. Free encoders are available; try searching the web for an AAC encoder.

The Ogg Vorbis format can be encoded on any system.

Construct 2 favours the Ogg Vorbis format. When choosing a sound in the event system, only .ogg files are listed. A .m4a file is considered a back-up to the .ogg file for browsers which do not support Ogg Vorbis. This also means if you import a .m4a file with no corresponding .ogg file, it will not be listed in the event system. This is by design.

Construct 2 will not trans-code .m4a files to .ogg nor .ogg files to .m4a; it is recommended to import PCM .wav files which Construct 2 can encode itself. Trans-coding also degrades the quality to worse than if uncompressed audio was encoded once.

Categorise audio files correctly

It is important to organise audio files appropriately, because audio files in the Sounds project folder are downloaded completely before playing, but files in the Music folder are streamed. This means if a Music track is accidentally put in the Sounds folder, it would have to download completely (which could take a couple of minutes) before it started playing. However, audio in the Music folder can start playing immediately since it is streamed from the server.

Supported audio formats

There are many audio formats and many of them have different levels of support. Also, many formats have sub-formats, and not all sub-formats are always supported. This makes describing the audio support complicated. A best effort is made below to summarise the supported audio formats but this is not guaranteed to give you results. Instead, it is highly recommended you only import PCM .wav files, which are widely supported and can be encoded to both .m4a and .ogg by Construct 2. Note there are different types of .wav file other than PCM: Construct 2 will try to display the type of .wav file in the Import Audio dialog (in the picture above, PCM files were used), but types other than PCM may not import. Any good audio codec software will be able to convert to PCM .wav. Try to avoid using "lossy" formats before importing to Construct 2, else the quality will be further degraded when Construct 2 encodes the lossy .ogg and .m4a files.

The following formats are listed by their file extension, and whether Construct 2 can encode them to Ogg Vorbis (.ogg) and MPEG-4 AAC (.m4a).

.wav (PCM or PCM float format): Both
.flac (FLAC): Both
.ogg (Ogg Vorbis): Imported but not converted to .m4a
.m4a (MPEG-4 AAC): Imported but not converted to .ogg
.aif, .aiff, .aifc (AIFF): .ogg only
.aac (MPEG-4 AAC): .m4a only
.mp3 (MPEG-1 layer 3): .m4a only
.wma (Windows Media Audio): .m4a only

MIME types

When publishing a HTML5 game to your own server, you must set up the correct MIME types. If the server sends the wrong MIME types, audio may not play in some browsers.

Tags: