‫Hello and welcome.
‫We are going to be randomizing our sounds in this lecture so you can hear the soundscape is far less
‫boring than it was in the last lecture.
‫We're going to be using a feature built into unreal called sound cues that allow us to do this.
‫Let's dive in and see what they are.
‫So our sounds are a bit monotonic as it stands.
‫And I have alluded to the fact that there's something called a sound cue which allows us to fix this
‫in Unreal.
‫It's a new type of asset, so let's see how to create it.
‫First of all, I want to create a new folder for the sound cues for both of our shot and our impact.
‫So this folder is going to be called SFX for Sound Effects, and we're going to go into there right
‫click, go to the Sounds menu and then select the sound cue in here.
‫Now the naming convention here is that we start with an a underscore, as we would with a sound wave.
‫Then I'm going to give it a useful name such as the rifle shot and then underscore Capital C.
‫Q So it's saying that it's an audio asset and it's specifically a sound cue at the end.
‫Now we can go ahead and open this asset and you can see we get this fun little blueprint editor with
‫a node editor in the middle, which is a bit like the material editor, the animation editor, in that
‫it has this output pin ready for us to plug stuff into.
‫And the way we could start plugging something in is if we write clicked and looked for wave.
‫You can see there is a wave player node, select the wave player node and go to the details pane.
‫Over on the left I could select one of the sound wave files to play and then I can pull out of its output
‫pin and plug it into our output node.
‫And essentially I can use the play buttons at the top of the queue to preview what this queue is going
‫to sound like.
‫But an impressively, it's just going to play that one clip.
‫Obviously, this is not why we put a sound cue in place.
‫What we really want to be able to do is to do other cool stuff.
‫And if you right click, you can see there's a whole load of nodes that we could choose from.
‫There's attenuation branching concatenation, so we can do all sorts of stuff such as play different
‫sounds depending on the material of what's being impacted.
‫We can add some looping, we can do cross fades and so on and so forth.
‫But what I'm really interested in here is some randomization.
‫So there is a random node here where you can add as many pins as you like.
‫And what it's going to do is it's going to switch between its inputs and give one of them out randomly
‫as its output.
‫There's a few properties that you might be interested here in the details pane.
‫The most interesting one for me was the randomize without replacement, and this is basically saying
‫that the type of random it's going to use won't cause you to replay anything until you've played all
‫of the clips on the left hand side.
‫It's basically a random shuffle.
‫So what we're going to do is we're going to output assault rifle, shot one in to the random node and
‫then output that in to the global output here.
‫And I'm also going to copy and paste that assault rifle shot one and do a shot two and put that into
‫the random node as well.
‫And I'm just going to delete the extra inputs that we had here.
‫And now you can hit the play queue and you can see how it's basically just switching between these random
‫outputs because of this randomize without replacement.
‫If we uncheck that, then you're going to see that occasionally it will play the same clip two times
‫in a row.
‫And that's why oftentimes it's useful to have that randomize without replacement so that we don't hear
‫the repetition in our game.
‫Okay, so that's cool.
‫What other interesting nodes do we have here to help us have a more random sounding effect?
‫Well, one of them is the modulator node, and if you select that, the details should give you a bit
‫of a hint as to what's going on here.
‫It's got a min and max pitch and a minute max volume.
‫And as you might guess, the whole purpose of this modulator node, if we just plug it in to one of
‫our clips and to the output, is that it's going to randomize the volume and the pitch.
‫Let's try it out.
‫Now, the effect is not very noticeable there because we don't have very big ranges.
‫So I'm going to go between half volume and two times volume and see if we can hear that now.
‫Hopefully you're able to hear the variations there.
‫Let's also try some bigger variations in pitch two times, pitch and half pitch, and let's just reset
‫the volume.
‫So hopefully you're able to hear the difference there in the min and max pitch as well.
‫So then what we can do is we can put these two nodes one into another and we're then going to get random
‫clips and additional modulation on top of that.
‫Now we have a lot more clips here than just these assault rifles shot one and two.
‫So I want to get bring all of these in, but it can be a bit tedious to duplicate and select the clips.
‫So here's a little shortcut for you.
‫If we go over to our content folder, go down into the asset packs, shoot a game sounds, and then
‫the weapon assault rifle, mono.
‫You can see we've got the clips that we want here.
‫So I'm going to select from shot one to shot six.
‫Then I'm going to go over to my cue editor and I'm going to right click in there.
‫And you can see there is this from Selected Option, which allows us to bring in multiple clips in to
‫various nodes that take multiple clips.
‫And the one we're interested in is the random node.
‫And if you select that.
‫And you get six different wave players all inputting in to a random node so we can now delete the other
‫random node we had manually created and we can use this new random node instead.
‫And that's sounding much better.
‫Now, I just want to tweak the settings here for our pitch.
‫I don't think we want such a big variation in pitch, so I'm just going to reset those down to the defaults.
‫I do want a slight more variation in volume though, so I'm going to go 4.7 to 1.3 and then let's go
‫ahead and play that.
‫I think that's a good variation and it definitely doesn't sound boring anymore.
‫I'd like you now as a challenge to apply the same process to the impact sound effect.
‫So create a sound queue, add randomization, add a modulator, and then play around with the volumes,
‫the values, rather to see what works best for the impact sound.
‫Pause the video and have a go.
‫Okay.
‫Welcome back.
‫Let's give this a shot.
‫So we're going to go over to our content SFX right click and we're going to try and create a new sound
‫asset.
‫And it's a sound cue.
‫So a underscore we're going to call it rifle impact and then underscore cue.
‫Let's go ahead and open that one up.
‫And we essentially want to do the same thing here.
‫So first of all, I'm going to add in a modulator and output that to the output node.
‫Then we're going to go over to our sandbox, skin up to the root content asset packs, shoot a game
‫sounds weapon mono.
‫And then I'm going to select from all of the impact, sound effects, there should be six of them and
‫then going to go over to the impact cue right click and add in the random node and output that random
‫node into the modulator.
‫And then from my playing around, I found that the modulator works better here to have a bigger pitch
‫difference because something plinking off concrete or whatever substance that is could make various
‫sounds depending on what angle it's hitting it at.
‫So I'm going to go between 0.5 and two with less of a volume variation here.
‫Let's go ahead and try playing this queue.
‫Okay.
‫So I think that sounds good with a good amount of variation.
‫Now all that's left to be seen is if we can put this into our rifle and you may have already tried doing
‫this, we can just go over to where we have our sound effects in the beep rifle and change out the wave
‫that we were using for a sound cue so we can swap it out for the rifle impact or shot cue on the muzzle
‫sound.
‫Then the impact sound we're going to switch out for let's go and find it should just be something called
‫impact they go rifle impact cue.
‫We can go ahead and play that now and we can hear a good amount of variation in the sound that was going
‫on there, that the different muzzle flashes sounded different and the impact sounds sounded different.
‫Now, if you're playing this with headphones, you will notice that it all sounds a little bit flat,
‫like there isn't a sense of space.
‫That's what we're going to be dealing with in the next lecture.
‫So in this lecture, what we have done is we've over viewed what a sound cue is and how it can allow
‫us to do lots of cool stuff with sound, including adding randomization and making our sounds less boring.
‫I'll see you in the next lecture.