Formats/Audio

From Unvanquished
Jump to: navigation, search

The terms lossy and lossless are used multiple times in this page. Lossy means that sound files compressed using that format will lose some of their audio fidelity to save space. Lossless means that the compression will not sacrifice audio fidelity, no matter how much you compress the sound file with that format.

Tools

See Tools/Audio.

Licensing

The following licenses are suitable for music and sounds:

Information 48x48.png

Note

The following licenses are suitable for media files (images, models, sound files…):

The default contribution license is CC BY-SA 4.0, unless you specify another license, by contributing to Unvanquished you are placing your work under CC BY-SA 4.0 license. You must have right to.

Older licenses like CC BY-SA 3.0, CC BY-SA 2.5, and CC BY-SA 3.0, CC BY-SA 2.5 are fairly acceptable for importing existing media. Many of our older media use such licenses, but please not use those older licenses for brand new content when you have full power to use latest version of those licenses. If you can get permission from original author to get a newer or more permissive license, please get it. For Creative Commons licenses older than 3.0, please ask us before merging.

See the page Licenses/Media for details.

Supported formats

  • Opus — a lossy compressed format, ✅️ recommended;
  • Vorbis — a lossy compressed format, ➡️ prefer Opus instead;
  • Wav — a lossless uncompressed format, ⚠️ discouraged, ➡️ prefer Opus instead.

The Dæmon engine expects the Vorbis files to use the .ogg file extension and the Opus files to use the .opus file extension.

Recommended audio formats

Those are recommended audio formats to be used in source repositories and in game to be delivered to players, and related tools.

Purpose Kind Format Tool
Source All sound files flac Audacity, flac
Purpose Kind Format Tool
Release All sound files opus opusenc

Recommended formats in repositories

It's recommended to store data files in well-known compressed lossless formats in data repositories.

There is no lossless compressed audio format supported by the engine.

Convert Wav files and other lossless audio files to FLAC to store them in repositories. The choice of FLAC in repositories is a convention, and the Urcheon package builder knows how to convert from FLAC to Opus.

It's better to compress to specific formats (Opus) while you distribute your work for use in game, but please keep them lossless and in widely-used formats in repositories!

If your original file is already in OGG Vorbis or Opus lossy format, store it in repository as is without recompressing it to another format to avoid losing more data.

Configuration files

Buildables

There are 14 animations per buildable type: construct1, construct2, idle1, idle2, idle3, attack1, attack2, spawn1, spawn2, pain1, pain2, destroy1, destroy2, and destroyed. Each buildable type has a sound configuration file, located at sound/buildables/<buildable_type>/sound.cfg, that describes 2 properties for each buildable animation:

  • whether the buildable animation has an associated sound, and
  • whether the sound is to be played in a loop.

Such a file should contain a 1 for a yes answer and a 0 for a no answer, for the above 2 questions, in the given order, and for each buildable animation, in the above given order. Technically, this means that the file should contain 28 integers (2 per animation). However, by convention, 1 line is used for each animation, and comments are added for guidance about which animation a pair of numbers refers to.

So each line in a buildable sound configuration file is formatted as follows:

<has_sound> <loop> //<filename>

This is an sound configuration file example for a buildable:

1 0 //construct1.wav
0 0 //construct2.wav
1 1 //idle1.wav
0 0 //idle2.wav
0 0 //idle3.wav
0 0 //attack1.wav
0 0 //attack2.wav
0 0 //spawn1.wav
0 0 //spawn2.wav
0 0 //pain1.wav
0 0 //pain2.wav
1 0 //destroy1.wav
1 0 //destroy2.wav
0 0 //destroyed.wav

Do not reorder the lines because it's how the game knows what is what. The comments are for humans only!

Sound filenames

The structure cg_customSoundNames in src/gamelogic/gpp/src/cgame/cg_players.c contains a list of some sounds.