Construct 3 icon

Construct 3


The Import Audio dialog

Published 18 Aug, 2017
695 words
~3-5 mins

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.

The Import Audio dialog

There are two ways to import audio files:

  1. Click the Import audio button, which opens a file picker to choose some local files to import
  2. Drag-and-drop some local files in to the area that says Drag and drop audio files here

As soon as you choose some files or drop them in, Construct will encode them to WebM Opus for best compatibility across platforms. It is recommended to import 16-bit PCM WAV files to ensure Construct can encode them without any quality loss. If you import files which are already WebM Opus, they will simply be copied to the project.

Construct will use all available CPU cores to encode imported audio, which is useful if you need to import a lot of audio files. The progress of encoding is displayed in the table of files. Once all encoding is done, you can click Import to add them to the project.

Categorise audio files correctly

It is important to organise audio files appropriately. Audio files in the Sounds project folder are loaded 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 load completely before it can start playing. However, audio in the Music folder can start playing much more quickly since it is streamed, and also uses less memory for long tracks.

Platform compatibility

There is not one audio format that can play across all browsers and platforms with built-in support. To avoid having to use multiple audio formats, Construct uses its own decoder for platforms that do not have built-in support for WebM Opus. This software decoder is used for Safari, all browsers on iOS, and Microsoft Edge.

In some cases the software decoder can slow down the startup time of the game, or add latency before a track can start playing. If this is a problem, you can import MPEG-4 AAC (.m4a) or MP3 alternatives for your audio files, which have built-in support on all browsers that use the software decoder. If there is an AAC or MP3 version of an audio file available, and the current platform has built-in support for it, Construct will use that file instead.

Internet Explorer is too old to support a software decoder. Importing AAC or MP3 equivalents of your audio files is required for audio playback to work in Internet Explorer.

Construct does not encode AAC or MP3 audio for you. You will need to use other software to encode your audio in to one of these formats, and then import the .m4a or .mp3 files in to your project. Construct will simply copy these files in to your project without converting them to WebM Opus.

Import formats

The following formats can be imported to Construct. PCM WAV files are recommended. Not all files are converted, as noted below.

  • PCM WAV (.wav): converted to WebM Opus
  • FLAC (.flac): converted to WebM Opus
  • WebM (.webm): copied to project if Opus, else converted to Opus
  • MPEG-4 AAC (.m4a): copied to project (provides alternative for Safari & Edge)
  • MP3 (.mp3): copied to project (provides alternative for Safari & Edge)
  • Ogg Vorbis (.ogg): converted to WebM Opus (note this is lossy)
  • Ogg Opus (.opus): converted to WebM Opus (note this is lossy)

Playback preference

If an audio file is available in multiple formats in the project, Construct uses the following order of preference to pick which to play at runtime. The first format in the list that has built-in support is used. If none of the available formats has built-in support, and there is a WebM Opus file available, then Construct falls back to the software decoder last of all.

  1. WebM Opus
  2. Ogg Vorbis (used by Construct 2)
  3. MPEG-4 AAC
  4. MP3
  5. Software decode WebM Opus