Skip to content

Commit cb3499b

Browse files
skyace65Calinou
andauthored
Update audio stream and audio import pages, document MP3 support (#4606)
Co-authored-by: Hugo Locurcio <[email protected]>
1 parent b979211 commit cb3499b

File tree

3 files changed

+22
-29
lines changed

3 files changed

+22
-29
lines changed

tutorials/assets_pipeline/importing_audio_samples.rst

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
33
Importing audio samples
44
=======================
55

6-
Why import?
7-
-----------
6+
Supported files
7+
---------------
88

9-
Raw audio data in general is large and undesired. Godot provides two main
10-
options to import your audio data: WAV and Ogg Vorbis.
9+
Godot provides three options to import your audio data: WAV, Ogg Vorbis
10+
and MP3.
1111

1212
Each has different advantages.
1313

14-
* WAV files use raw data or light compression, make few demands on the CPU to play back (hundreds of simultaneous voices in this format are fine), but take up significant space.
15-
* Ogg Vorbis files use a stronger compression that results in much smaller file size, but require significantly more processing power to play back.
16-
17-
18-
.. image:: img/audio_stream_import.png
14+
* WAV files use raw data or light compression (IMA-ADPCM). They are lightweight
15+
on the CPU to play back (hundreds of simultaneous voices in this format are
16+
fine). The downside is that they take up a lot of disk space.
17+
* Ogg Vorbis files use a stronger compression that results in much
18+
smaller file size, but require significantly more processing power to
19+
play back.
20+
* MP3 files use better compression than WAV with IMA-ADPCM, but worse than
21+
Ogg Vorbis. This means that a MP3 file with roughly equal quality to
22+
Ogg Vorbis will be significantly larger. On the bright side, MP3 requires
23+
less CPU usage to play back compared to Ogg Vorbis. This makes MP3 useful
24+
for mobile and HTML5 projects where CPU resources are limited, especially
25+
when playing multiple compressed sounds at the same time (such as long
26+
ambient sounds).
1927

2028
Here is a comparative chart.
2129

@@ -28,6 +36,8 @@ Here is a comparative chart.
2836
+-----------------------------+-------------------+
2937
| WAV 16-bit, IMA-ADPCM, mono | 22 KB |
3038
+-----------------------------+-------------------+
39+
| MP3 192 Kb/s, stereo | 24 KB |
40+
+-----------------------------+-------------------+
3141
| Ogg Vorbis 128 Kb/s, stereo | 16 KB |
3242
+-----------------------------+-------------------+
3343
| Ogg Vorbis 96 Kb/s, stereo | 12 KB |

tutorials/audio/audio_streams.rst

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,9 @@ AudioStream
1414
-----------
1515

1616
An audio stream is an abstract object that emits sound. The sound can come from
17-
many places, but is most commonly loaded from the filesystem. Audio files such
18-
as WAV (``.wav``) or Ogg Vorbis (``.ogg``) can be loaded as AudioStreams and
19-
placed inside an AudioStreamPlayer.
20-
21-
Here is a comparison of the two file types to help you choose the one that fits
22-
your use case best:
23-
24-
- WAV files are quite large, but use little CPU power to play back.
25-
Hundreds of them can be played simultaneously with little impact
26-
on performance. This format is usually best for short sound effects.
27-
- Ogg Vorbis files are much smaller, but use considerably more CPU power
28-
to play back, so only a few can be played back at once (especially on mobile).
29-
This format works well for music, long sound effect sequences, and voice
30-
at relatively low bitrates.
31-
32-
Keep in mind that while WAV files may contain looping information in their metadata,
33-
Ogg Vorbis files do not. If looping an Ogg Vorbis file is desired,
34-
it must be set up using the import options:
35-
36-
.. image:: img/audio_stream_import.png
17+
many places, but is most commonly loaded from the filesystem. Audio files can be
18+
loaded as AudioStreams and placed inside an AudioStreamPlayer. You can find a
19+
information on supported formats and differences in :ref:`doc_importing_audio_samples`.
3720

3821
There are other types of AudioStreams, such as AudioStreamRandomPitch.
3922
This one makes a random adjustment to the sound's pitch every time it's
-10.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)