< Return to Video

Audio Effects - Unity Official Tutorials

  • 0:01 - 0:04
    In Unity it's possible to process
  • 0:04 - 0:08
    our audio signals with audio effects
  • 0:08 - 0:12
    and shape their timbre, frequency content,
  • 0:12 - 0:14
    or the dynamics of their volume.
  • 0:14 - 0:18
    We can do this by adding audio effects
  • 0:18 - 0:21
    to a group in an audio mixer.
  • 0:22 - 0:25
    In our scene we have 4 game objects,
  • 0:25 - 0:29
    each with an audio source which contains a loop
  • 0:29 - 0:31
    of a different element of a musical track.
  • 0:32 - 0:36
    All of these are routed in to audio mixer 1.
  • 0:38 - 0:40
    Audio mixer 1 currently has an
  • 0:40 - 0:44
    attenuation effect which is there by default
  • 0:44 - 0:46
    on the master channel.
  • 0:46 - 0:48
    If we play our scene
  • 0:50 - 0:52
    activate Edit In Play Mode
  • 0:52 - 0:55
    we can adjust the volume
  • 0:55 - 0:57
    of the attenuation effect
  • 0:58 - 1:01
    and thereby control the volume of the master group.
  • 1:02 - 1:05
    Notice that as we adjust the volume
  • 1:05 - 1:07
    the changes in volume are reflected
  • 1:07 - 1:10
    in the volume parameter in the inspector.
  • 1:11 - 1:13
    It's important to note that when we make
  • 1:13 - 1:18
    changes in play mode those changes will be saved
  • 1:18 - 1:20
    to the audio mixer asset.
  • 1:20 - 1:23
    Unlike changes made to the scene hierarchy
  • 1:23 - 1:25
    for example which will be reset
  • 1:25 - 1:27
    when we exit play mode.
  • 1:27 - 1:30
    In order to apply effects processors
  • 1:30 - 1:33
    to the audio signal passing through the master we can
  • 1:33 - 1:36
    add them from the drop down menu.
  • 1:36 - 1:41
    We're going to add a low pass simple effect.
  • 1:42 - 1:45
    The low pass simple effect is a low pass
  • 1:45 - 1:47
    filter which allows us to attenuate
  • 1:47 - 1:50
    frequencies above the cut off frequency.
  • 1:50 - 1:52
    The default is 5000hz.
  • 1:52 - 1:54
    If we play our project.
  • 1:55 - 1:57
    Edit in play mode
  • 1:57 - 1:59
    and adjust the cut-off frequency
  • 2:02 - 2:05
    We can hear that the high frequencies are attenuated.
  • 2:06 - 2:10
    Audio effects are applied sequentially.
  • 2:10 - 2:12
    So in this cast the attenuation effect
  • 2:12 - 2:15
    is going to be applied first followed by
  • 2:15 - 2:16
    the low pass simple effect.
  • 2:17 - 2:20
    We'll add a distortion effect
  • 2:20 - 2:23
    and listen to the resulting signal.
  • 2:36 - 2:39
    We can hear that the distortion
  • 2:39 - 2:42
    adds high and mid-range harmonics
  • 2:42 - 2:44
    which were not previously present in the signal.
  • 2:46 - 2:48
    In this case the distortion is sequenced
  • 2:48 - 2:52
    after the low pass simple so
  • 2:52 - 2:54
    the high frequencies are attenuated
  • 2:54 - 2:58
    and then new mid and high frequencies are added.
  • 2:58 - 3:00
    If we want to change this order we can click
  • 3:00 - 3:03
    on the low pass simple and drag it down
  • 3:03 - 3:05
    so that it now occurs after
  • 3:05 - 3:09
    the distortion in the signal chain and we can listen to the effect.
  • 3:20 - 3:22
    What we can hear is that as we
  • 3:22 - 3:25
    attenuate the high frequencies using the low pass
  • 3:25 - 3:29
    it's cancelling out the effect of the distortion effect
  • 3:29 - 3:33
    because the distorted signal is being run sequentially
  • 3:33 - 3:35
    through the low pass simple effect.
  • 3:35 - 3:37
    Let's check out another example.
  • 3:37 - 3:39
    Here we have the Nightmares project,
  • 3:39 - 3:41
    which you can download from the assets store.
  • 3:41 - 3:44
    And what we've done is we've
  • 3:44 - 3:48
    routed our background music to an audio mixer,
  • 3:48 - 3:50
    to this music group here, and we've
  • 3:50 - 3:53
    added a low pass filter effect.
  • 3:54 - 3:56
    We've also created two
  • 3:56 - 3:58
    audio mixer snapshots.
  • 3:59 - 4:01
    Audio mixer snapshots allow us to
  • 4:01 - 4:04
    save and recall the settings in the mixer.
  • 4:04 - 4:06
    In the Unpaused snapshot the cut-off
  • 4:06 - 4:08
    frequency for the low pass filter is
  • 4:08 - 4:11
    all the way up at 22000hz.
  • 4:11 - 4:15
    In the Paused snapshot we've pulled it down to 365hz.
  • 4:16 - 4:18
    This is going to attenuate the high frequencies
  • 4:18 - 4:20
    and give the music a muffled sound
  • 4:20 - 4:22
    when the paused snapshot is called.
  • 4:22 - 4:24
    The script which controls our paused menu
  • 4:24 - 4:27
    also controls the transition to these snapshots.
  • 4:28 - 4:31
    For more about snapshots and controlling them via script
  • 4:31 - 4:33
    see the information linked below.
  • 4:33 - 4:36
    Let's check this out and hear how it sounds.
  • 4:40 - 4:41
    Press escape.
  • 4:46 - 4:48
    And then press escape again to resume.
  • 4:49 - 4:52
    This is an example of how we can use
  • 4:52 - 4:55
    audio effects processing to convey information to
  • 4:55 - 4:57
    the player about the game state.
Title:
Audio Effects - Unity Official Tutorials
Description:

more » « less
Duration:
04:59

English subtitles

Revisions