audio_effects.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. :article_outdated: True
  2. .. _doc_audio_effects:
  3. Audio effects
  4. =============
  5. Godot includes several audio effects that can be added to an audio bus to
  6. alter every sound file that goes through that bus.
  7. .. image:: img/audio_buses4.webp
  8. Try them all out to get a sense of how they alter sound. Here follows a short
  9. description of the available effects:
  10. Amplify
  11. ~~~~~~~
  12. Amplify changes the volume of the signal. Some care needs to be taken, though:
  13. setting the level too high can make the sound digitally clip, which can produce
  14. unpleasant crackles and pops.
  15. BandLimit and BandPass
  16. ~~~~~~~~~~~~~~~~~~~~~~
  17. These are resonant filters which block frequencies around the *Cutoff* point.
  18. BandPass can be used to simulate sound passing through an old telephone line or
  19. megaphone. Modulating the BandPass frequency can simulate the sound of a wah-wah
  20. guitar pedal, think of the guitar in Jimi Hendrix's *Voodoo Child (Slight
  21. Return)*.
  22. Capture
  23. ~~~~~~~
  24. The Capture effect copies the audio frames of the audio bus that it is on into
  25. an internal buffer. This can be used to capture data from the microphone
  26. or to transmit audio over the network in real-time.
  27. Chorus
  28. ~~~~~~
  29. As the name of the effect implies, the Chorus effect makes a single audio sample
  30. sound like an entire chorus. It does this by duplicating a signal and very
  31. slightly altering the timing and pitch of each duplicate, and varying that
  32. over time via an LFO (low frequency oscillator). The duplicate(s) are then
  33. mixed back together with the original signal, producing a lush, wide, and
  34. large sound. Although chorus is traditionally used for voices, it can be
  35. desirable with almost any type of sound.
  36. Compressor
  37. ~~~~~~~~~~
  38. A dynamic range compressor automatically attenuates (ducks) the level of the incoming
  39. signal when its amplitude exceeds a certain threshold. The level of attenuation
  40. applied is proportional to how far the incoming audio exceeds the threshold.
  41. The compressor's Ratio parameter controls the degree of attenuation.
  42. One of the main uses of a compressor is to reduce the dynamic range of signals
  43. with very loud and quiet parts. Reducing the dynamic range of a signal
  44. can make it fit more comfortably in a mix.
  45. The compressor has many uses. For example:
  46. - It can be used in the Master bus to compress the whole output prior to being hit by a limiter, making the effect of the limiter much more subtle.
  47. - It can be used in voice channels to ensure they sound as even as possible.
  48. - It can be *sidechained* by another sound source. This means it can reduce the sound level
  49. of one signal using the level of another audio bus for threshold detection.
  50. This technique is very common in video game mixing to "duck" the level of
  51. music or sound effects when in-game or multiplayer voices need to be fully audible.
  52. - It can accentuate transients by using a slower attack.
  53. This can make sound effects more punchy.
  54. .. note::
  55. If your goal is to prevent a signal from exceeding a given amplitude
  56. altogether, rather than to reduce the dynamic range of the signal,
  57. a :ref:`limiter <doc_audio_buses_limiter>` is likely a better choice
  58. than a compressor for this purpose. However, applying compression before
  59. a limiter is still good practice.
  60. Delay
  61. ~~~~~
  62. Digital delay essentially duplicates a signal and repeats it at a specified
  63. speed with a volume level that decays for each repeat. Delay is great for
  64. simulating the acoustic space of a canyon or large room, where sound bounces
  65. have a lot of *delay* between their repeats. This is in contrast to reverb,
  66. which has a more natural and blurred sound to it. Using this in conjunction
  67. with reverb can create very natural sounding environments!
  68. Distortion
  69. ~~~~~~~~~~
  70. Makes the sound distorted. Godot offers several types of distortion:
  71. - *Overdrive* sounds like a guitar distortion pedal or megaphone. Sounds distorted with this sound like they're coming through
  72. a low-quality speaker or device.
  73. - *Tan* sounds like another interesting flavor of overdrive.
  74. - *Bit crushing* clamps the amplitude of the signal, making it sound flat and crunchy.
  75. All three types of distortion can add higher frequency sounds to an original sound, making it stand out better in a mix.
  76. EQ
  77. ~~
  78. EQ is what all other equalizers inherit from. It can be extended with Custom
  79. scripts to create an equalizer with a custom number of bands.
  80. EQ6, EQ10, EQ21
  81. ~~~~~~~~~~~~~~~
  82. Godot provides three equalizers with different numbers of bands, which
  83. are represented in the title (6, 10, and 21 bands, respectively).
  84. An equalizer on the Master bus can be useful for cutting low and high
  85. frequencies that the device's speakers can't reproduce well.
  86. For example, phone or tablet speakers usually don't reproduce
  87. low frequency sounds well, and could make a limiter or compressor
  88. attenuate sounds that aren't even audible to the user anyway.
  89. Note: The equalizer effect can be disabled when headphones are plugged in, giving the user the best of both worlds.
  90. Filter
  91. ~~~~~~
  92. Filter is what all other filters inherit from and should not be used directly.
  93. HardLimiter
  94. ~~~~~~~~~~~
  95. A limiter is similar to a compressor, but it's less flexible and designed to
  96. prevent a signal's amplitude exceeding a given dB threshold. Adding a limiter to the final point of
  97. the Master bus is good practice, as it offers an easy safeguard against clipping.
  98. HighPassFilter
  99. ~~~~~~~~~~~~~~
  100. Cuts frequencies below a specific *Cutoff* frequency.
  101. HighPassFilter is used to reduce the bass content of a
  102. signal.
  103. HighShelfFilter
  104. ~~~~~~~~~~~~~~~
  105. Reduces all frequencies above a specific *Cutoff* frequency.
  106. .. _doc_audio_buses_limiter:
  107. Limiter
  108. ~~~~~~~
  109. This is the old limiter effect, and it is recommended to use the new HardLimiter
  110. effect instead.
  111. Here is an example of how this effect works, if the ceiling is set to -12 dB, and the
  112. threshold is 0 dB, all samples going through get reduced by 12dB. This changes the
  113. waveform of the sound and introduces distortion.
  114. This effect is being kept to preserve compatibility, however it should be considered
  115. deprecated.
  116. LowPassFilter
  117. ~~~~~~~~~~~~~
  118. Cuts frequencies above a specific *Cutoff* frequency and can also resonate
  119. (boost frequencies close to the *Cutoff* frequency). Low pass filters can be
  120. used to simulate "muffled" sound. For instance, underwater sounds, sounds
  121. blocked by walls, or distant sounds.
  122. LowShelfFilter
  123. ~~~~~~~~~~~~~~
  124. Reduces all frequencies below a specific *Cutoff* frequency.
  125. NotchFilter
  126. ~~~~~~~~~~~
  127. The opposite of the BandPassFilter, it removes a band of sound from the
  128. frequency spectrum at a given *Cutoff* frequency.
  129. Panner
  130. ~~~~~~
  131. The Panner allows the stereo balance of a signal to be adjusted between
  132. the left and right channels. Headphones are recommended when configuring in this effect.
  133. Phaser
  134. ~~~~~~
  135. This effect is formed by de-phasing two duplicates of the same sound so
  136. they cancel each other out in an interesting way. Phaser produces a
  137. pleasant whooshing sound that moves back and forth through the audio
  138. spectrum, and can be a great way to create sci-fi effects or Darth
  139. Vader-like voices.
  140. PitchShift
  141. ~~~~~~~~~~
  142. This effect allows the adjustment of the signal's pitch independently of its
  143. speed. All frequencies can be increased/decreased with minimal effect on
  144. transients. PitchShift can be useful to create unusually high or deep voices.
  145. Do note that altering pitch can sound unnatural when pushed outside of a
  146. narrow window.
  147. Record
  148. ~~~~~~
  149. The Record effect allows the user to record sound from a microphone.
  150. Reverb
  151. ~~~~~~
  152. Reverb simulates rooms of different sizes. It has adjustable parameters that can
  153. be tweaked to obtain the sound of a specific room. Reverb is commonly outputted
  154. from :ref:`Area3Ds <class_Area3D>`
  155. (see :ref:`Reverb buses <doc_audio_streams_reverb_buses>`), or to apply
  156. a "chamber" feel to all sounds.
  157. SpectrumAnalyzer
  158. ~~~~~~~~~~~~~~~~
  159. This effect doesn't alter audio, instead, you add this effect to buses you want
  160. a spectrum analysis of. This would typically be used for audio visualization.
  161. Visualizing voices can be a great way to draw attention to them without just
  162. increasing their volume.
  163. A demo project using this can be found `here <https://github.com/godotengine/godot-demo-projects/tree/master/audio/spectrum>`__.
  164. StereoEnhance
  165. ~~~~~~~~~~~~~
  166. This effect uses a few algorithms to enhance a signal's stereo width.