TANKS! Unity Tutorial - Phase 8 of 8 - Audio Mixing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Phase 8 - Audio With the GameManager selected we're going to put in some music for our game, so we need an audio source. So select the GameManager game object, Add Component, type in 'sou' hit return and you'll have yourself an audio component. Then if we click on the circle select and choose BackgroundMusic as the clip. Then finally check Loop So choose the BackgroundMusic clip, check Loop at the bottom. I'm just going to keep saving my scene to update it. We're going to create what's called and audio mixer. In Unity we have audio sources, they output all of the sound, they might be on game objects in the scene, they might be on instantiated objects. But basically they all need to route in to a mixer in order to balance them with one another. So select the AudioMixers folder in the project. Click the Create button and choose Audio Mixer. So this is a Create button on the project window. Choose Audio Mixer. I'm just going to rename this MainMix. Then I'm going to go to Window - Audio Mixer So it's control8 on pc, command8 on mac. And I'm just going to grab this and dock it somewhere sensible, I like to do it next to the game view, I just find that useful, but you might want to do it during the game so it might make sense to dock it by the scene view, it's totally up to you. The idea is that we want to route each audio source that we've made during the day in to a particular, what we call group. If you've used audio software before you might call these tracks or channels depending on which package you use, but Unity calls them groups. So each group of sounds needs it's own group. Makes sense? So our master is where all of those groups will end up, so what you'll see if you look at the mixer Is that we have things on the side with + buttons, so Groups is one of those. So if I click on this + button I can make a new group. The first thing that I'm going to do is make a group for my music Then each time I make a new group I need to reselect the master because I want each of those groups to be a child of that. So I reselect my master, I hit +, and the next group I want to make is for the sound effects, so I just call it SFX. And then finally we need one more for our driving audio. So the idling and the engine sounds. Remember I'm making these and reselecting the master each time so that they're children of that. So now we need to go through all of our audio sources and route them in to the correct group that we've just made. Then we'll actually do the balancing but first we need to hook everything up. So the first thing I'm going to do is select my Tank prefab, so I go to my Prefabs folder and I select Tank. And this should become second nature once we've done a couple of them but the first thing I'm going to do is to look at the audio sources there. So if I zoom in a little bit for you, what you'll see under each audio clip, the second parameter there is Output, and that is which group this is going in to. So the first audio source we know is for driving, so I'm going to click on the circle select and you'll see MainMix and you'll see CompleteMainMix which is used for the complete game, so ignore that, look at the MainMix and we're going to select Driving. So Engine - Sounds in the first audio source will go to there, remember the second audio source was for sound effects so under Output we'll choose SFX. So one more time, the first audio source should be routed to Driving, the second to SFX. And that's our Tank setup. Then the next thing that had an audio source was our Shell. and if you expand the Shell you'll see the ShellExplosion which has the audio source attached to it. So in the prefab, in the project, just click the arrow next to it to see the child object ShellExplosion and then you'll be able to route that also to the SFX mixer group. So what else needs routing? Well we just added our GameManager and we just put on BackgroundMusic so we need to set that up as well. So for that audio source I'm just going to click the Output and set that to Music. So the TankExplosion also has to be routed as well so in the Prefabs, TankExplosion prefab, the audio source there needs setting to sound effects. The SFX mixer group. Okay, so now we're ready to mix, everything is hooked up in to that so I'm just going to show you really quickly, please don't do this, I'm just going to demonstrate. So what you'll see in the mixer is that all of these levels are moving around and when I actually do something, the SFX gets a level too. But nothing is balanced yet, so we're going to do that but we're also going to use an effect to make sure that the sound effects can cut through everything else. So the Music group, I'm going to set the attenuation, and by that I simply mean the level, of the music down a little bit. It's kind of loud, it's compressed as you'd expect. I'm going to bring that down to -12, so do that now. Drag that fader down to -12. Then I'm going to select the Driving group and set that way down to -25. So it's super loud and super obnoxious sounding and we don't really want that, we'll drag it all the way down so that it's nice and subtle in the mix. -25. Then for the Music we want the music to be ducked down every time there's an explosion, so we want the music level to dip every time a sound effect comes in. So we do that with something called ducking. So ducking basically means that you can use 1 source to decrease the attenuation of another. At the bottom of the Music group I'm going to click on Add. So here I can add a Duck Volume effect. And when I do that you should see it on the inspector, I get this effect, so when you select any of these groups, so you can see I can click on them and they highlight in blue. When I select Music I've just added Duck Volume, And it says it's first thing is a warning saying 'No Send source is connected. There's basically no other group sending a signal to this group in order to tell it to duck, so we need to sort that out. So what I'm going to do is go to my SFX group. My SFX, I will select it, and then at the bottom of SFX I'm going to add a send. And that send has a receive. So you need to just basically send the signal of this to something and the only thing that we've got is this Duck Volume effect on the Music group. So I'm just going to select that and then how much of this do we want to send? Well we want to send the entire level So instead of nothing, -80 decibels, we're going to drag it all the way to the top. So we're not going to add this or reroute the signal, we're just using it to command that effect, so drag it all the way to the right I.E. full. What does Duck Volume mean? Duck Volume is basically using one signal to subtract from another. What you'll see in a moment is that we have a certain threshold for how much signal is going to be required to decrease that. Okay, so I'm going to reselect my Music. And I'm going to look at that Duck Volume. What you'll see is that we have a meter here effectively, so I'm just going to show you how that works. So when I play the game this Duck Volume is waiting for something to be played from the sound effects, so if I fire something you see that this yellow comes up from the left to the right. But there's a white line which is representing the threshold So what I'm going to do is reduce the threshold so that it starts to pull down the volume of the music out of a particular amount of signal coming in from the SFX group. so I'm going to pull that threshold down to round about -45. So now I'm just going to turn this up so you can hear what I'm doing. Now when I actually play it You can hear the music gets pulled down as that threshold comes in. Then what I'm also going to do is change a couple of other settings there, I'm going to change my Ratio to 250%, so it's going to curb it even further, and my Attack Time to 0. So as soon as there's any signal at all that's passing that threshold it's going to come in to effect. The attack time is usually how long it waits to come to full effect, but we don't want it to wait, we want it to start straight away. So Attack Time should be 0. Ratio should be 250. So now. It's nice and prompt. As soon as I start hitting the music goes down. So it's going to be hard for you guys to hear on these speakers and obviously you can check it out with headphones as well. But that's exactly what's happening. So it's time for you to save your scene, and play it one more time, because we have completed our training day. Subtitles by the Amara.org community
Info
Channel: Unity
Views: 60,630
Rating: undefined out of 5
Keywords: Audio Mixing (Film Job), Tutorial (Media Genre), music, mixing, sound, audio, unity, tutorial, game, development, unite, training day, boston
Id: h1vWeglOS_w
Channel Id: undefined
Length: 9min 31sec (571 seconds)
Published: Wed Oct 14 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.