WEBVTT 00:00:00.290 --> 00:00:02.790 The Audio Listener component is the equivalent 00:00:02.790 --> 00:00:04.335 of your ears in the game. 00:00:04.771 --> 00:00:07.616 It receives, or listens, to audio sources 00:00:07.616 --> 00:00:08.844 that are in the game world. 00:00:09.238 --> 00:00:11.657 The control of the audio's behaviour is done on 00:00:11.657 --> 00:00:13.201 the audio source component 00:00:13.201 --> 00:00:16.116 and therefore the listener itself has no settings. 00:00:17.436 --> 00:00:20.469 This is attached to a camera in your scene by default 00:00:20.469 --> 00:00:22.469 but can be placed on any object. 00:00:22.691 --> 00:00:24.691 Often this is attached to a character 00:00:24.691 --> 00:00:26.946 and crucially there can be only one listener 00:00:26.946 --> 00:00:29.814 per scene in order for it to function correctly. 00:00:29.950 --> 00:00:33.131 You can test an audio listener from any position in the world 00:00:33.131 --> 00:00:35.131 by moving the scene camera around 00:00:35.131 --> 00:00:38.324 with the audio preview toggle enabled. 00:00:54.115 --> 00:00:56.492 This gives you live testing of audio sources 00:00:56.492 --> 00:00:58.614 in your environment without having to move 00:00:58.614 --> 00:01:00.991 the real listener or play test the game. 00:01:02.912 --> 00:01:05.951 Audio sources are components that playback audio. 00:01:06.192 --> 00:01:08.459 Think of them as speakers in the game world. 00:01:08.608 --> 00:01:12.021 In this example our turbine has an audio source attached 00:01:12.021 --> 00:01:14.795 with the turbine audio clip that's been applied to it. 00:01:14.917 --> 00:01:17.101 We can assign a clip by dragging and dropping, 00:01:17.101 --> 00:01:19.886 or by using code to select a clip to play. 00:01:19.997 --> 00:01:22.560 We can mute, bypass any filters, 00:01:22.560 --> 00:01:25.167 choose whether to play this audio source on awake, 00:01:25.167 --> 00:01:27.009 as in - when the game begins 00:01:27.009 --> 00:01:28.567 and whether to loop the clip. 00:01:28.567 --> 00:01:32.180 Priority varies between 0 and 255, 00:01:32.180 --> 00:01:34.407 0 being the highest priority. 00:01:34.828 --> 00:01:38.035 It's advisable to have music set as the highest priority 00:01:38.035 --> 00:01:39.856 to avoid other clips from overriding 00:01:39.856 --> 00:01:41.602 when many clips are being played at once. 00:01:41.724 --> 00:01:43.912 Volume determines how loud the clip is played 00:01:43.912 --> 00:01:45.490 based on it's original waveform. 00:01:45.740 --> 00:01:47.740 Pitch controls the pitch of a clip. 00:01:47.999 --> 00:01:49.857 If you're working with 3D sounds 00:01:49.857 --> 00:01:51.412 the settings are more detailed. 00:01:51.595 --> 00:01:53.970 Doppler level defines how much the Doppler Effect 00:01:53.970 --> 00:01:54.824 will be used. 00:01:54.894 --> 00:01:57.693 This is a perceived shift in frequency as the listener 00:01:57.693 --> 00:01:59.693 or the ear in real terms 00:01:59.693 --> 00:02:01.693 is moving past the sound source. 00:02:02.075 --> 00:02:04.075 It will seem higher approaching it 00:02:04.075 --> 00:02:06.075 and lower as it moves away. 00:02:06.429 --> 00:02:09.178 Think of an emergency vehicle's siren as it passes you 00:02:09.178 --> 00:02:09.997 for example. 00:02:09.997 --> 00:02:12.473 Volume roll-off determines the type of roll-off 00:02:12.473 --> 00:02:14.111 to be used by the sound 00:02:14.111 --> 00:02:15.970 as the listener moves away from it. 00:02:16.041 --> 00:02:18.788 This can be logarithmic, linear, 00:02:18.788 --> 00:02:22.508 or customised manually using a curve 00:02:22.508 --> 00:02:24.508 and adding keys as shown. 00:02:29.789 --> 00:02:31.789 The minimum distance defines how close 00:02:31.789 --> 00:02:33.362 to play the sound at full volume. 00:02:33.362 --> 00:02:35.362 So if you are designing 3D sound 00:02:35.362 --> 00:02:38.009 use this value to make the sound source louder. 00:02:39.003 --> 00:02:41.483 This can be adjusted using the spherical Gizmo 00:02:41.483 --> 00:02:42.776 in the scene view. 00:02:48.903 --> 00:02:50.903 And it works in the conjunction with the 00:02:50.903 --> 00:02:52.903 maximum distance setting below, 00:02:52.903 --> 00:02:55.649 which by default is set to 500 metres 00:02:55.649 --> 00:02:57.901 and is a distance after which 00:02:57.901 --> 00:02:59.668 the sound rolls off. 00:03:04.334 --> 00:03:07.734 Pan level defines how truly 3D the sound is. 00:03:08.123 --> 00:03:10.123 This defaults to 1 for 3D sound 00:03:10.123 --> 00:03:12.302 making it fully panned when the stereo listener 00:03:12.302 --> 00:03:13.039 is moved past it. 00:03:13.303 --> 00:03:15.570 Spread is the control of the angle of spread 00:03:15.570 --> 00:03:18.430 from 3D stereo to multichannel sound. 00:03:19.209 --> 00:03:22.146 Finally for 2D sound pan can be controlled 00:03:22.146 --> 00:03:23.465 at the bottom of the component. 00:03:23.631 --> 00:03:25.430 As a rule elements such as music 00:03:25.430 --> 00:03:27.014 should be set to 2D sound, 00:03:27.014 --> 00:03:28.944 whilst diegetic sound that should be 00:03:28.944 --> 00:03:30.982 fading realistically should be set up 00:03:30.982 --> 00:03:33.418 as 3D and positioned accordingly. 00:03:33.723 --> 00:03:35.863 The 2D and 3D values of a sound 00:03:35.863 --> 00:03:38.867 are controlled by an audio clip's import settings. 00:03:39.915 --> 00:03:41.915 When selecting a clip in the project 00:03:41.915 --> 00:03:43.592 you will be able to see the import settings 00:03:43.592 --> 00:03:44.511 in the inspector. 00:03:44.511 --> 00:03:47.149 You can choose the audio format to use, 00:03:47.149 --> 00:03:50.105 whether it should be 3D or 2D sound, 00:03:50.105 --> 00:03:53.268 whether you want to force your stereo sound to mono, 00:03:53.268 --> 00:03:56.972 how to load it and what compression to use. 00:03:57.305 --> 00:03:59.636 You can also preview sound at the bottom, 00:04:01.193 --> 00:04:03.193 choose whether to loop whilst previewing 00:04:04.756 --> 00:04:06.756 and set the inspector to auto-play 00:04:06.756 --> 00:04:08.756 whilst browsing through clips.