class_resourceimporterwav.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ResourceImporterWAV.xml.
  6. .. _class_ResourceImporterWAV:
  7. ResourceImporterWAV
  8. ===================
  9. **Inherits:** :ref:`ResourceImporter<class_ResourceImporter>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Imports a WAV audio file for playback.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. WAV is an uncompressed format, which can provide higher quality compared to Ogg Vorbis and MP3. It also has the lowest CPU cost to decode. This means high numbers of WAV sounds can be played at the same time, even on low-end devices.
  15. By default, Godot imports WAV files using the lossy Quite OK Audio compression. You may change this by setting the :ref:`compress/mode<class_ResourceImporterWAV_property_compress/mode>` property.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Importing audio samples <../tutorials/assets_pipeline/importing_audio_samples>`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +---------------------------+--------------------------------------------------------------------------------+-----------+
  26. | :ref:`int<class_int>` | :ref:`compress/mode<class_ResourceImporterWAV_property_compress/mode>` | ``2`` |
  27. +---------------------------+--------------------------------------------------------------------------------+-----------+
  28. | :ref:`int<class_int>` | :ref:`edit/loop_begin<class_ResourceImporterWAV_property_edit/loop_begin>` | ``0`` |
  29. +---------------------------+--------------------------------------------------------------------------------+-----------+
  30. | :ref:`int<class_int>` | :ref:`edit/loop_end<class_ResourceImporterWAV_property_edit/loop_end>` | ``-1`` |
  31. +---------------------------+--------------------------------------------------------------------------------+-----------+
  32. | :ref:`int<class_int>` | :ref:`edit/loop_mode<class_ResourceImporterWAV_property_edit/loop_mode>` | ``0`` |
  33. +---------------------------+--------------------------------------------------------------------------------+-----------+
  34. | :ref:`bool<class_bool>` | :ref:`edit/normalize<class_ResourceImporterWAV_property_edit/normalize>` | ``false`` |
  35. +---------------------------+--------------------------------------------------------------------------------+-----------+
  36. | :ref:`bool<class_bool>` | :ref:`edit/trim<class_ResourceImporterWAV_property_edit/trim>` | ``false`` |
  37. +---------------------------+--------------------------------------------------------------------------------+-----------+
  38. | :ref:`bool<class_bool>` | :ref:`force/8_bit<class_ResourceImporterWAV_property_force/8_bit>` | ``false`` |
  39. +---------------------------+--------------------------------------------------------------------------------+-----------+
  40. | :ref:`bool<class_bool>` | :ref:`force/max_rate<class_ResourceImporterWAV_property_force/max_rate>` | ``false`` |
  41. +---------------------------+--------------------------------------------------------------------------------+-----------+
  42. | :ref:`float<class_float>` | :ref:`force/max_rate_hz<class_ResourceImporterWAV_property_force/max_rate_hz>` | ``44100`` |
  43. +---------------------------+--------------------------------------------------------------------------------+-----------+
  44. | :ref:`bool<class_bool>` | :ref:`force/mono<class_ResourceImporterWAV_property_force/mono>` | ``false`` |
  45. +---------------------------+--------------------------------------------------------------------------------+-----------+
  46. .. rst-class:: classref-section-separator
  47. ----
  48. .. rst-class:: classref-descriptions-group
  49. Property Descriptions
  50. ---------------------
  51. .. _class_ResourceImporterWAV_property_compress/mode:
  52. .. rst-class:: classref-property
  53. :ref:`int<class_int>` **compress/mode** = ``2`` :ref:`🔗<class_ResourceImporterWAV_property_compress/mode>`
  54. The compression mode to use on import.
  55. - **PCM (Uncompressed):** Imports audio data without any form of compression, preserving the highest possible quality. It has the lowest CPU cost, but the highest memory usage.
  56. - **IMA ADPCM:** Applies fast, lossy compression during import, noticeably decreasing the quality, but with low CPU cost and memory usage. Does not support seeking and only Forward loop mode is supported.
  57. - **\ `Quite OK Audio <https://qoaformat.org/>`__:** Also applies lossy compression on import, having a slightly higher CPU cost compared to IMA ADPCM, but much higher quality and the lowest memory usage.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_ResourceImporterWAV_property_edit/loop_begin:
  61. .. rst-class:: classref-property
  62. :ref:`int<class_int>` **edit/loop_begin** = ``0`` :ref:`🔗<class_ResourceImporterWAV_property_edit/loop_begin>`
  63. The begin loop point to use when :ref:`edit/loop_mode<class_ResourceImporterWAV_property_edit/loop_mode>` is **Forward**, **Ping-Pong**, or **Backward**. This is set in samples after the beginning of the audio file.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_ResourceImporterWAV_property_edit/loop_end:
  67. .. rst-class:: classref-property
  68. :ref:`int<class_int>` **edit/loop_end** = ``-1`` :ref:`🔗<class_ResourceImporterWAV_property_edit/loop_end>`
  69. The end loop point to use when :ref:`edit/loop_mode<class_ResourceImporterWAV_property_edit/loop_mode>` is **Forward**, **Ping-Pong**, or **Backward**. This is set in samples after the beginning of the audio file. A value of ``-1`` uses the end of the audio file as the end loop point.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_ResourceImporterWAV_property_edit/loop_mode:
  73. .. rst-class:: classref-property
  74. :ref:`int<class_int>` **edit/loop_mode** = ``0`` :ref:`🔗<class_ResourceImporterWAV_property_edit/loop_mode>`
  75. Controls how audio should loop.
  76. - **Detect From WAV:** Uses loop information from the WAV metadata.
  77. - **Disabled:** Don't loop audio, even if the metadata indicates the file playback should loop.
  78. - **Forward:** Standard audio looping. Plays the audio forward from the beginning to :ref:`edit/loop_end<class_ResourceImporterWAV_property_edit/loop_end>`, then returns to :ref:`edit/loop_begin<class_ResourceImporterWAV_property_edit/loop_begin>` and repeats.
  79. - **Ping-Pong:** Plays the audio forward until :ref:`edit/loop_end<class_ResourceImporterWAV_property_edit/loop_end>`, then backwards to :ref:`edit/loop_begin<class_ResourceImporterWAV_property_edit/loop_begin>`, repeating this cycle.
  80. - **Backward:** Plays the audio backwards from :ref:`edit/loop_end<class_ResourceImporterWAV_property_edit/loop_end>` to :ref:`edit/loop_begin<class_ResourceImporterWAV_property_edit/loop_begin>`, then repeats.
  81. \ **Note:** In :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`, the :ref:`AudioStreamPlayer.finished<class_AudioStreamPlayer_signal_finished>` signal won't be emitted for looping audio when it reaches the end of the audio file, as the audio will keep playing indefinitely.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_ResourceImporterWAV_property_edit/normalize:
  85. .. rst-class:: classref-property
  86. :ref:`bool<class_bool>` **edit/normalize** = ``false`` :ref:`🔗<class_ResourceImporterWAV_property_edit/normalize>`
  87. If ``true``, normalize the audio volume so that its peak volume is equal to 0 dB. When enabled, normalization will make audio sound louder depending on its original peak volume.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_ResourceImporterWAV_property_edit/trim:
  91. .. rst-class:: classref-property
  92. :ref:`bool<class_bool>` **edit/trim** = ``false`` :ref:`🔗<class_ResourceImporterWAV_property_edit/trim>`
  93. If ``true``, automatically trim the beginning and end of the audio if it's lower than -50 dB after normalization (see :ref:`edit/normalize<class_ResourceImporterWAV_property_edit/normalize>`). This prevents having files with silence at the beginning or end, which increases their size unnecessarily and adds latency to the moment they are played back. A fade-in/fade-out period of 500 samples is also used during trimming to avoid audible pops.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_ResourceImporterWAV_property_force/8_bit:
  97. .. rst-class:: classref-property
  98. :ref:`bool<class_bool>` **force/8_bit** = ``false`` :ref:`🔗<class_ResourceImporterWAV_property_force/8_bit>`
  99. If ``true``, forces the imported audio to use 8-bit quantization if the source file is 16-bit or higher.
  100. Enabling this is generally not recommended, as 8-bit quantization decreases audio quality significantly. If you need smaller file sizes, consider using Ogg Vorbis or MP3 audio instead.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_ResourceImporterWAV_property_force/max_rate:
  104. .. rst-class:: classref-property
  105. :ref:`bool<class_bool>` **force/max_rate** = ``false`` :ref:`🔗<class_ResourceImporterWAV_property_force/max_rate>`
  106. If set to a value greater than ``0``, forces the audio's sample rate to be reduced to a value lower than or equal to the value specified in :ref:`force/max_rate_hz<class_ResourceImporterWAV_property_force/max_rate_hz>`.
  107. This can decrease file size noticeably on certain sounds, without impacting quality depending on the actual sound's contents. See `Best practices <../tutorials/assets_pipeline/importing_audio_samples.html#doc-importing-audio-samples-best-practices>`__ for more information.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_ResourceImporterWAV_property_force/max_rate_hz:
  111. .. rst-class:: classref-property
  112. :ref:`float<class_float>` **force/max_rate_hz** = ``44100`` :ref:`🔗<class_ResourceImporterWAV_property_force/max_rate_hz>`
  113. The frequency to limit the imported audio sample to (in Hz). Only effective if :ref:`force/max_rate<class_ResourceImporterWAV_property_force/max_rate>` is ``true``.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_ResourceImporterWAV_property_force/mono:
  117. .. rst-class:: classref-property
  118. :ref:`bool<class_bool>` **force/mono** = ``false`` :ref:`🔗<class_ResourceImporterWAV_property_force/mono>`
  119. If ``true``, forces the imported audio to be mono if the source file is stereo. This decreases the file size by 50% by merging the two channels into one.
  120. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  121. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  122. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  123. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  124. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  125. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  126. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  127. .. |void| replace:: :abbr:`void (No return value.)`