@@ -6,7 +6,7 @@ Importing audio samples
66Supported audio formats
77-----------------------
88
9- Godot provides 3 options to import your audio data: WAV, Ogg Vorbis and MP3 .
9+ Godot provides 4 options to import your audio data: WAV, Ogg Vorbis, MP3 and Opus .
1010
1111Each format has different advantages:
1212
@@ -20,6 +20,9 @@ Each format has different advantages:
2020 worse than Ogg Vorbis. This means that an MP3 file with roughly equal quality
2121 to Ogg Vorbis will be significantly larger. On the bright side, MP3 requires
2222 less CPU usage to play back compared to Ogg Vorbis.
23+ - Opus files use a more modern compression than Ogg Vorbis and MP3 that results in
24+ much smaller file size for a given quality, but require slightly more processing
25+ power to play back than Ogg Vorbis.
2326
2427.. note ::
2528
@@ -46,17 +49,19 @@ each format:
4649+------------------------------+-------------------+
4750| Ogg Vorbis 96 Kb/s, stereo | 12 KB |
4851+------------------------------+-------------------+
52+ | Opus 128 Kb/s, stereo | 16 KB |
53+ +------------------------------+-------------------+
4954
50- Note that the MP3 and Ogg Vorbis figures can vary depending on the encoding
51- type. The above figures use :abbr: `CBR ( Constant Bit Rate ) ` encoding for
52- simplicity, but most Ogg Vorbis and MP3 files you can find online are encoded
53- with :abbr: `VBR ( Variable Bit Rate ) ` encoding which is more efficient.
55+ Note that the MP3, Ogg Vorbis and Opus figures can vary depending on the
56+ encoding type. The above figures use :abbr: `CBR ( Constant Bit Rate ) ` encoding
57+ for simplicity, but most MP3, Ogg Vorbis and Opus files you can find online are
58+ encoded with :abbr: `VBR ( Variable Bit Rate ) ` encoding which is more efficient.
5459VBR encoding makes the effective audio file size depend on how "complex" the
5560source audio is.
5661
5762.. tip ::
5863
59- Consider using WAV for short and repetitive sound effects, and Ogg Vorbis for
64+ Consider using WAV for short and repetitive sound effects, and Opus for
6065 music, speech, and long sound effects. MP3 is useful for mobile and web projects
6166 where CPU resources are limited, especially when playing multiple compressed
6267 sounds at the same time (such as long ambient sounds).
@@ -73,14 +78,14 @@ the FileSystem dock:
7378
7479 Import options in the Import dock after selecting a WAV file in the FileSystem dock
7580
76- The set of options available after selecting an Ogg Vorbis or MP3 file is different:
81+ The set of options available after selecting an Ogg Vorbis, MP3 or Opus file is different:
7782
7883.. figure :: img/importing_audio_samples_import_options_mp3.webp
7984 :align: center
8085 :alt: Import options in the Import dock after selecting an MP3 file in the FileSystem dock
8186
8287 Import options in the Import dock after selecting an MP3 file in the
83- FileSystem dock. Options are identical for Ogg Vorbis files.
88+ FileSystem dock. Options are identical for Ogg Vorbis and Opus files.
8489
8590After importing a sound, you can play it back using the AudioStreamPlayer,
8691AudioStreamPlayer2D or AudioStreamPlayer3D nodes. See :ref: `doc_audio_streams `
@@ -96,8 +101,8 @@ If enabled, forces the imported audio to use 8-bit quantization if the source
96101file is 16-bit or higher.
97102
98103Enabling this is generally not recommended, as 8-bit quantization decreases
99- audio quality significantly. If you need smaller file sizes, consider using Ogg
100- Vorbis or MP3 audio instead.
104+ audio quality significantly. If you need smaller file sizes, consider using Opus,
105+ Ogg Vorbis or MP3 audio instead.
101106
102107Force > Mono
103108------------
@@ -138,7 +143,7 @@ its original peak volume.
138143Edit > Loop Mode
139144----------------
140145
141- Unlike Ogg Vorbis and MP3 , WAV files can contain metadata to indicate whether
146+ Unlike Ogg Vorbis, MP3 and Opus , WAV files can contain metadata to indicate whether
142147they're looping (in addition to loop points). By default, Godot will follow this
143148metadata, but you can choose to apply a specific loop mode:
144149
@@ -174,13 +179,13 @@ and memory usage a little, at the cost of decreasing quality in an audible manne
174179decrease is much less noticeable, at the cost of slightly higher CPU usage (still
175180much lower than MP3).
176181
177- Ogg Vorbis and MP3 don't decrease quality as much and can provide greater file
182+ Ogg Vorbis, MP3 and Opus don't decrease quality as much and can provide greater file
178183size reductions, at the cost of higher CPU usage during playback. This higher
179184CPU usage is usually not a problem (especially with MP3), unless playing dozens
180185of compressed sounds at the same time on mobile/web platforms.
181186
182- Import options (Ogg Vorbis and MP3 )
183- -----------------------------------
187+ Import options (Ogg Vorbis, MP3 and Opus )
188+ -----------------------------------------
184189
185190Loop
186191~~~~
@@ -245,17 +250,17 @@ dialog, as it lets you preview your changes without having to reimport the audio
245250
246251.. _doc_importing_audio_samples_advanced_import_settings :
247252
248- Advanced import settings (Ogg Vorbis and MP3 )
249- ---------------------------------------------
253+ Advanced import settings (Ogg Vorbis, MP3 and Opus )
254+ ---------------------------------------------------
250255
251- If you double-click an Ogg Vorbis or MP3 file in the FileSystem dock (or choose
256+ If you double-click an Ogg Vorbis, MP3 or Opus file in the FileSystem dock (or choose
252257**Advanced… ** in the Import dock), you will see a dialog appear:
253258
254259.. figure :: img/importing_audio_samples_advanced_import_settings.webp
255260 :align: center
256- :alt: Advanced dialog when double-clicking an Ogg Vorbis or MP3 file in the FileSystem dock
261+ :alt: Advanced dialog when double-clicking an Ogg Vorbis, MP3 or Opus file in the FileSystem dock
257262
258- Advanced dialog when double-clicking an Ogg Vorbis or MP3 file in the FileSystem dock
263+ Advanced dialog when double-clicking an Ogg Vorbis, MP3 or Opus file in the FileSystem dock
259264
260265This dialog allows you to edit the audio's loop point with a real-time preview,
261266in addition to the :abbr: `BPM ( Beats Per Minute ) `, beat count and bar beats.
@@ -265,7 +270,7 @@ music tracks).
265270
266271.. note ::
267272
268- Unlike WAV files, Ogg Vorbis and MP3 only support a "loop begin" loop point,
273+ Unlike WAV files, Ogg Vorbis, MP3 and Opus only support a "loop begin" loop point,
269274 not a "loop end" point. Looping can also be only be standard forward looping,
270275 not ping-pong or backward.
271276
@@ -300,6 +305,38 @@ sample rate and number of channels for your audio:
300305 reduced to 22 kHz without a noticeable loss in quality (unless the voice is
301306 very high-pitched). This is because most human voices never go past 11 kHz.
302307
308+ Use the right bitrate for the chosen file format
309+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310+
311+ While audio files are commonly compressed as MP3 for historical reasons, formats like Ogg Vorbis
312+ and Opus can provide lower sizes with higher quality.
313+
314+ Here is a comparative chart with estimates for "transparent" bitrates for each audio format:
315+
316+ +--------------------+--------------------------------+
317+ | Format | Estimated Transparency Bitrate |
318+ +====================+================================+
319+ | WAV (uncompressed) | 1411 kbps |
320+ +--------------------+--------------------------------+
321+ | MP3 | 192 kbps |
322+ +--------------------+--------------------------------+
323+ | Ogg Vorbis | 160 kbps |
324+ +--------------------+--------------------------------+
325+ | Opus | 128 kbps |
326+ +--------------------+--------------------------------+
327+
328+ Since audio at "transparent" bitrates has no noticeable compression artifacts (even with studio
329+ headphones) you can save space without impacting quality by reducing the bitrate to the level
330+ of transparency. Note that audio can sound "good enough" at much lower bitrates, depending on
331+ the purpose of the audio.
332+
333+ When changing the format or reducing the bitrate of an audio file, avoid converting from one lossy
334+ format to another (e.g. MP3 to Ogg Vorbis) to avoid generational loss. Always convert from
335+ the source WAV file if possible.
336+
337+ Unless processing power is limited, always prefer Opus encoding as it provides the best quality
338+ for a given bitrate. MP3 and Ogg Vorbis are older and use outdated compression techniques.
339+
303340Use real-time audio effects to reduce file size
304341~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305342
0 commit comments