audio_effects.rst 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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.png
  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. HighPassFilter
  94. ~~~~~~~~~~~~~~
  95. Cuts frequencies below a specific *Cutoff* frequency.
  96. HighPassFilter is used to reduce the bass content of a
  97. signal.
  98. HighShelfFilter
  99. ~~~~~~~~~~~~~~~
  100. Reduces all frequencies above a specific *Cutoff* frequency.
  101. .. _doc_audio_buses_limiter:
  102. Limiter
  103. ~~~~~~~
  104. A limiter is similar to a compressor, but it's less flexible and designed to
  105. prevent a signal's amplitude exceeding a given dB threshold. Adding a limiter to the final point of
  106. the Master bus is good practice, as it offers an easy safeguard against clipping.
  107. LowPassFilter
  108. ~~~~~~~~~~~~~
  109. Cuts frequencies above a specific *Cutoff* frequency and can also resonate
  110. (boost frequencies close to the *Cutoff* frequency). Low pass filters can be
  111. used to simulate "muffled" sound. For instance, underwater sounds, sounds
  112. blocked by walls, or distant sounds.
  113. LowShelfFilter
  114. ~~~~~~~~~~~~~~
  115. Reduces all frequencies below a specific *Cutoff* frequency.
  116. NotchFilter
  117. ~~~~~~~~~~~
  118. The opposite of the BandPassFilter, it removes a band of sound from the
  119. frequency spectrum at a given *Cutoff* frequency.
  120. Panner
  121. ~~~~~~
  122. The Panner allows the stereo balance of a signal to be adjusted between
  123. the left and right channels. Headphones are recommended when configuring in this effect.
  124. Phaser
  125. ~~~~~~
  126. This effect is formed by de-phasing two duplicates of the same sound so
  127. they cancel each other out in an interesting way. Phaser produces a
  128. pleasant whooshing sound that moves back and forth through the audio
  129. spectrum, and can be a great way to create sci-fi effects or Darth
  130. Vader-like voices.
  131. PitchShift
  132. ~~~~~~~~~~
  133. This effect allows the adjustment of the signal's pitch independently of its
  134. speed. All frequencies can be increased/decreased with minimal effect on
  135. transients. PitchShift can be useful to create unusually high or deep voices.
  136. Do note that altering pitch can sound unnatural when pushed outside of a
  137. narrow window.
  138. Record
  139. ~~~~~~
  140. The Record effect allows the user to record sound from a microphone.
  141. Reverb
  142. ~~~~~~
  143. Reverb simulates rooms of different sizes. It has adjustable parameters that can
  144. be tweaked to obtain the sound of a specific room. Reverb is commonly outputted
  145. from :ref:`Area3Ds <class_Area3D>`
  146. (see :ref:`Reverb buses <doc_audio_streams_reverb_buses>`), or to apply
  147. a "chamber" feel to all sounds.
  148. SpectrumAnalyzer
  149. ~~~~~~~~~~~~~~~~
  150. This effect doesn't alter audio, instead, you add this effect to buses you want
  151. a spectrum analysis of. This would typically be used for audio visualization.
  152. Visualizing voices can be a great way to draw attention to them without just
  153. increasing their volume.
  154. A demo project using this can be found `here <https://github.com/godotengine/godot-demo-projects/tree/master/audio/spectrum>`__.
  155. StereoEnhance
  156. ~~~~~~~~~~~~~
  157. This effect uses a few algorithms to enhance a signal's stereo width.