‫Welcome back.
‫In this video, I'll show you how you can create your own sounds that you can then use in your games.
‫And we'll keep it very simple.
‫In this case, we're just going to create a slight sound which we will simulate with our mouth, and
‫then we'll just use that for our game.
‫And you can use audacity for that.
‫It's a free tool, which is great for recording and editing sounds, and it's for free, which is amazing.
‫So you can find the Windows download here.
‫It's available on Macintosh as well.
‫So I'm going to download the audacity file here.
‫The 2.2 version is the latest version for me, so I'm just going to install that.
‫And as soon as that's done, I can open it up.
‫So that's audacity.
‫And I can simply press the recording key here, and I'm going to try to simulate a knife sound or a
‫cutting sound.
‫All right.
‫So let's try and record something that would sound like a knife cutting through fruits so you can choose,
‫by the way, which microphone you want to use.
‫I have this mic here and let's try that.
‫And that was my actually that was my first try here.
‫And maybe it's too intense, so let's delete that.
‫And maybe that was better.
‫All right, let's try that.
‫So now let's get rid of all the areas that we don't need.
‫So let's mark them here.
‫Just this area here, and let's get rid of it.
‫And now zoom in.
‫And let's get rid of the beginning as well.
‫It's really important to get rid of the beginning actually in here.
‫So and let's zoom out a little bit because I can barely get through the beginning.
‫All right.
‫And delete those.
‫Delete.
‫What's the end?
‫Now we only have the sound left.
‫All right, so let's go back and let's play it.
‫And what's really important here is that you cut off the beginning because otherwise you might have
‫a delay before the sound starts.
‫So that was one very basic sound effect that we're going to export now.
‫So let's save.
‫And save other and export as wav file and let's call that 1/. wav.
‫Save it wherever you want to.
‫And I'm not going to add any additional information about the artist name and so forth.
‫So now we can import that into our game, into our assets.
‫So let's go to our assets folder and I'm going to drag it in here.
‫So the slash is in here now.
‫So let's also create a new folder for that and let's call it sounds and let's drag our slash in there.
‫Now let's see if that sound works well in unity.
‫So let's open up the inspector and let's press play here.
‫All right.
‫You might not hear it as I'm not sure what.
‫I'm recording the audio of my device, but you can download that file if you want to.
‫You can download the whole project and you will find the file anyways.
‫Next, we want to implement that of course, and a good position is the game manager.
‫So let's open up the game manager and add two more variables in here and I'm going to create a new header
‫and I'm going to call that one sounds because below that I'll have all the sounds variables and the
‫one that I want to use is for one the audio clip, audio clip array, which could be multiple slice
‫sounds.
‫So I could have ten different slice sounds.
‫For example, one slide sound for the bump, one for the fruits and so forth.
‫And then I need a private audio source, which is the position from where the audio actually comes.
‫So I'm going to call that audio source and that one should be private.
‫So that public one, that's where we position it.
‫An audio source is actually going to be the audio source of the game manager itself.
‫And as this one is private, we, of course, at one point need to initialize it because we can't initialize
‫it from the outside, so we cannot drag an audio source into our game manager.
‫So let's do that here.
‫Audio source is going to be get component and get the audio source component.
‫Now, of course, we need to get an audio source assigned to our game manager.
‫So let's assign a component called audio
‫source and that will need we'll need an audio clip.
‫So as you can see here, slice sounds, there are zero slice sounds.
‫Let's add one.
‫And now we need to drag an audio clip in here.
‫All right.
‫And here we drag now our sound that we've created.
‫So sounds.
‫Let's go back to the game manager.
‫Let's drag that slash sound into here, into the element zero.
‫Of course, you could have multiple ones here.
‫So if you add two, you would have two different slash sounds or whatever, as I said.
‫So let's well, let's get that back to one.
‫We only have one sound so far, and now we need a method to play that slash sound.
‫And the best position, of course, is the game manager for that as well.
‫So let's create a new method and let's call that public void.
‫Play random, random sound or slice sound, maybe even slice sound.
‫And in here we simply creating you audio clip, which is going to be a random sound and I'll take the
‫slide sounds that I have and I'm going to simply play a random slide sound so random thought range and
‫I want to have one between zero and slides.
‫Sounds, actually slight sounds at length.
‫So in our case, it's always going to be just one sound because we only have one sound in our sly sound.
‫But if we had five different ones, it would simply create a random one here and now.
‫In order to play it, we need to get our audio source and play one shot.
‫It's only going to play an audio clip and scales the audio source volume by volume scale.
‫All right.
‫And it needs an audio clip for that.
‫That's exactly what we have.
‫We have a random sound, which is an audio clip.
‫All right.
‫So now the play Random Slice Sound should be called at one point.
‫And where would be the best point for that?
‫Well, of course, whenever we slice something so in create sliced fruit would be a good position.
‫So in here.
‫So let's go ahead and play that sound, play slice sound and it's going to be find object of type.
‫Let's search for the game manager.
‫And there let's call the play random slice sound method.
‫Let's save that script and let's go back to Unity.
‫And now before we test that, let's deactivate play on sound because what that will do, it will simply
‫well, in this case, it will not do anything because there is no audio clip in here by default.
‫But let's deactivate that and make sure that loop is deactivated as well.
‫And now let's start the game and see if we get this beautiful slight sound.
‫So you might hear that how I'm slicing through all the different objects and now I'm getting the ad
‫and yeah, that's pretty much it.
‫So now you know how to add sounds and you could of course add a sound to your bomp as well.
‫So you could create the same you could use the same approach that we've just used for creating a sound
‫for the BOM.
‫So you would simply call in on hit pop or what's the name of the bom here?
‫It's most moving now.
‫It's actually on the game manager.
‫So here on Bom hit would simply play a sound similarly to that one.
‫Only that it's not random, but it's a specific bom sound.
‫All right, so I hope you had fun.
‫If you think that there are features missing, please let us know and we can add them.
‫Or if you feel like trying to add them yourself, please go ahead and do so.
‫And then we're very happy to see whatever you do with this game, if you should publish it, to restore
‫to the App Store or to the play store, please do so and send us a link so that we can check out your
‫game.
‫I'm very interested in seeing what you can do and yeah, see you in the next chapter.