The Import Audio dialog allows audio files to be added to the project from disk. It is accessed by selecting or 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.
There are two ways to import audio files:
- Click the Import audio button, which opens a file picker to choose some local files to import
- 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 or FLAC 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.
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 WebM Opus decoder for Safari & iOS, which are the last platforms left that do not have built-in support for WebM Opus.
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 in Safari. 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.
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.
The following formats can be imported to Construct. PCM WAV or FLAC 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)
- MP3 (.mp3): copied to project (provides alternative for Safari)
- Ogg Vorbis (.ogg): converted to WebM Opus (note this is lossy)
- Ogg Opus (.opus): converted to WebM Opus (note this is lossy)
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.
- WebM Opus
- Ogg Vorbis (used by Construct 2)
- MPEG-4 AAC
- Software decode WebM Opus