importing_audio_samples.rst 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. .. _doc_importing_audio_samples:
  2. Importing audio samples
  3. =======================
  4. Supported files
  5. ---------------
  6. Godot provides three options to import your audio data: WAV, Ogg Vorbis
  7. and MP3.
  8. Each has different advantages.
  9. * WAV files use raw data or light compression (IMA-ADPCM). They are lightweight
  10. on the CPU to play back (hundreds of simultaneous voices in this format are
  11. fine). The downside is that they take up a lot of disk space.
  12. * Ogg Vorbis files use a stronger compression that results in much
  13. smaller file size, but require significantly more processing power to
  14. play back.
  15. * MP3 files use better compression than WAV with IMA-ADPCM, but worse than
  16. Ogg Vorbis. This means that a MP3 file with roughly equal quality to
  17. Ogg Vorbis will be significantly larger. On the bright side, MP3 requires
  18. less CPU usage to play back compared to Ogg Vorbis. This makes MP3 useful
  19. for mobile and HTML5 projects where CPU resources are limited, especially
  20. when playing multiple compressed sounds at the same time (such as long
  21. ambient sounds).
  22. Here is a comparative chart.
  23. +-----------------------------+-------------------+
  24. | Format | 1 second of audio |
  25. +=============================+===================+
  26. | WAV 24-bit, 96 kHz, stereo | 576 KB |
  27. +-----------------------------+-------------------+
  28. | WAV 16-bit, 44 kHz, mono | 88 KB |
  29. +-----------------------------+-------------------+
  30. | WAV 16-bit, IMA-ADPCM, mono | 22 KB |
  31. +-----------------------------+-------------------+
  32. | MP3 192 Kb/s, stereo | 24 KB |
  33. +-----------------------------+-------------------+
  34. | Ogg Vorbis 128 Kb/s, stereo | 16 KB |
  35. +-----------------------------+-------------------+
  36. | Ogg Vorbis 96 Kb/s, stereo | 12 KB |
  37. +-----------------------------+-------------------+
  38. Consider using WAV for short and repetitive sound effects, and Ogg Vorbis
  39. for music, speech, and long sound effects.
  40. Best practices
  41. --------------
  42. Godot has an :ref:`extensive bus system <doc_audio_buses>` with built-in effects.
  43. This saves SFX artists the need to add reverb to the sound effects,
  44. reducing their size greatly and ensuring correct trimming. Say no to SFX
  45. with baked reverb!
  46. .. image:: img/reverb.png
  47. As you can see above, sound effects become huge with reverb added.
  48. Trimming
  49. ~~~~~~~~
  50. One issue that happens often is that the waveform is exported with long
  51. silences at the beginning and at the end. These are inserted by
  52. DAWs when saving to a waveform, increase their size unnecessarily and
  53. add latency to the moment they are played back.
  54. Importing as WAV with the **Trimming** option enabled solves
  55. this.
  56. Looping
  57. ~~~~~~~
  58. Godot supports looping in the samples (tools such as Sound Forge or
  59. Audition can add loop points to WAV files). This is useful for sound
  60. effects, such as engines, machine guns etc. Ping-pong looping is also
  61. supported.
  62. As an alternative, the Import dock has a **Loop** option that enables
  63. looping for the entire sample when importing.