1 00:00:04,170 --> 00:00:05,010 ‫Welcome back. 2 00:00:05,040 --> 00:00:11,220 ‫In this video, I'll show you how you can create your own sounds that you can then use in your games. 3 00:00:11,220 --> 00:00:12,990 ‫And we'll keep it very simple. 4 00:00:12,990 --> 00:00:18,120 ‫In this case, we're just going to create a slight sound which we will simulate with our mouth, and 5 00:00:18,120 --> 00:00:20,400 ‫then we'll just use that for our game. 6 00:00:20,400 --> 00:00:22,890 ‫And you can use audacity for that. 7 00:00:22,890 --> 00:00:29,010 ‫It's a free tool, which is great for recording and editing sounds, and it's for free, which is amazing. 8 00:00:29,010 --> 00:00:31,200 ‫So you can find the Windows download here. 9 00:00:31,200 --> 00:00:33,810 ‫It's available on Macintosh as well. 10 00:00:33,810 --> 00:00:37,380 ‫So I'm going to download the audacity file here. 11 00:00:37,380 --> 00:00:42,840 ‫The 2.2 version is the latest version for me, so I'm just going to install that. 12 00:00:45,140 --> 00:00:49,160 ‫And as soon as that's done, I can open it up. 13 00:00:49,220 --> 00:00:50,450 ‫So that's audacity. 14 00:00:50,450 --> 00:00:57,020 ‫And I can simply press the recording key here, and I'm going to try to simulate a knife sound or a 15 00:00:57,020 --> 00:00:57,950 ‫cutting sound. 16 00:00:58,070 --> 00:00:58,460 ‫All right. 17 00:00:58,460 --> 00:01:06,200 ‫So let's try and record something that would sound like a knife cutting through fruits so you can choose, 18 00:01:06,200 --> 00:01:08,240 ‫by the way, which microphone you want to use. 19 00:01:08,240 --> 00:01:12,230 ‫I have this mic here and let's try that. 20 00:01:14,560 --> 00:01:20,170 ‫And that was my actually that was my first try here. 21 00:01:21,630 --> 00:01:24,690 ‫And maybe it's too intense, so let's delete that. 22 00:01:27,420 --> 00:01:29,130 ‫And maybe that was better. 23 00:01:29,160 --> 00:01:30,450 ‫All right, let's try that. 24 00:01:31,590 --> 00:01:34,500 ‫So now let's get rid of all the areas that we don't need. 25 00:01:34,500 --> 00:01:37,560 ‫So let's mark them here. 26 00:01:38,250 --> 00:01:41,100 ‫Just this area here, and let's get rid of it. 27 00:01:41,340 --> 00:01:43,200 ‫And now zoom in. 28 00:01:46,580 --> 00:01:48,860 ‫And let's get rid of the beginning as well. 29 00:01:48,870 --> 00:01:52,770 ‫It's really important to get rid of the beginning actually in here. 30 00:01:52,790 --> 00:02:00,050 ‫So and let's zoom out a little bit because I can barely get through the beginning. 31 00:02:00,050 --> 00:02:00,770 ‫All right. 32 00:02:00,770 --> 00:02:03,050 ‫And delete those. 33 00:02:03,470 --> 00:02:03,890 ‫Delete. 34 00:02:03,890 --> 00:02:04,590 ‫What's the end? 35 00:02:04,650 --> 00:02:06,080 ‫Now we only have the sound left. 36 00:02:06,740 --> 00:02:09,050 ‫All right, so let's go back and let's play it. 37 00:02:10,790 --> 00:02:14,870 ‫And what's really important here is that you cut off the beginning because otherwise you might have 38 00:02:14,870 --> 00:02:17,180 ‫a delay before the sound starts. 39 00:02:18,080 --> 00:02:23,180 ‫So that was one very basic sound effect that we're going to export now. 40 00:02:23,180 --> 00:02:25,070 ‫So let's save. 41 00:02:27,130 --> 00:02:36,970 ‫And save other and export as wav file and let's call that 1/. wav. 42 00:02:37,000 --> 00:02:38,740 ‫Save it wherever you want to. 43 00:02:41,080 --> 00:02:45,970 ‫And I'm not going to add any additional information about the artist name and so forth. 44 00:02:45,970 --> 00:02:52,030 ‫So now we can import that into our game, into our assets. 45 00:02:52,030 --> 00:02:55,840 ‫So let's go to our assets folder and I'm going to drag it in here. 46 00:02:55,840 --> 00:02:58,330 ‫So the slash is in here now. 47 00:02:59,510 --> 00:03:07,450 ‫So let's also create a new folder for that and let's call it sounds and let's drag our slash in there. 48 00:03:10,540 --> 00:03:13,420 ‫Now let's see if that sound works well in unity. 49 00:03:13,420 --> 00:03:17,440 ‫So let's open up the inspector and let's press play here. 50 00:03:19,710 --> 00:03:20,370 ‫All right. 51 00:03:20,640 --> 00:03:22,290 ‫You might not hear it as I'm not sure what. 52 00:03:22,290 --> 00:03:27,530 ‫I'm recording the audio of my device, but you can download that file if you want to. 53 00:03:27,780 --> 00:03:30,690 ‫You can download the whole project and you will find the file anyways. 54 00:03:32,640 --> 00:03:37,380 ‫Next, we want to implement that of course, and a good position is the game manager. 55 00:03:37,380 --> 00:03:46,170 ‫So let's open up the game manager and add two more variables in here and I'm going to create a new header 56 00:03:46,170 --> 00:03:53,310 ‫and I'm going to call that one sounds because below that I'll have all the sounds variables and the 57 00:03:53,310 --> 00:04:01,440 ‫one that I want to use is for one the audio clip, audio clip array, which could be multiple slice 58 00:04:01,440 --> 00:04:02,100 ‫sounds. 59 00:04:02,100 --> 00:04:05,010 ‫So I could have ten different slice sounds. 60 00:04:05,130 --> 00:04:09,420 ‫For example, one slide sound for the bump, one for the fruits and so forth. 61 00:04:09,720 --> 00:04:19,830 ‫And then I need a private audio source, which is the position from where the audio actually comes. 62 00:04:19,830 --> 00:04:25,860 ‫So I'm going to call that audio source and that one should be private. 63 00:04:25,860 --> 00:04:28,440 ‫So that public one, that's where we position it. 64 00:04:28,440 --> 00:04:34,620 ‫An audio source is actually going to be the audio source of the game manager itself. 65 00:04:37,930 --> 00:04:44,350 ‫And as this one is private, we, of course, at one point need to initialize it because we can't initialize 66 00:04:44,350 --> 00:04:48,060 ‫it from the outside, so we cannot drag an audio source into our game manager. 67 00:04:48,070 --> 00:04:50,340 ‫So let's do that here. 68 00:04:50,350 --> 00:04:58,990 ‫Audio source is going to be get component and get the audio source component. 69 00:04:59,110 --> 00:05:03,760 ‫Now, of course, we need to get an audio source assigned to our game manager. 70 00:05:04,240 --> 00:05:08,740 ‫So let's assign a component called audio 71 00:05:11,020 --> 00:05:15,580 ‫source and that will need we'll need an audio clip. 72 00:05:17,470 --> 00:05:20,950 ‫So as you can see here, slice sounds, there are zero slice sounds. 73 00:05:20,950 --> 00:05:21,880 ‫Let's add one. 74 00:05:21,880 --> 00:05:24,580 ‫And now we need to drag an audio clip in here. 75 00:05:25,720 --> 00:05:26,050 ‫All right. 76 00:05:26,050 --> 00:05:29,980 ‫And here we drag now our sound that we've created. 77 00:05:30,010 --> 00:05:31,860 ‫So sounds. 78 00:05:31,870 --> 00:05:33,130 ‫Let's go back to the game manager. 79 00:05:33,130 --> 00:05:37,660 ‫Let's drag that slash sound into here, into the element zero. 80 00:05:37,690 --> 00:05:39,700 ‫Of course, you could have multiple ones here. 81 00:05:39,700 --> 00:05:45,670 ‫So if you add two, you would have two different slash sounds or whatever, as I said. 82 00:05:45,700 --> 00:05:49,750 ‫So let's well, let's get that back to one. 83 00:05:49,750 --> 00:05:56,200 ‫We only have one sound so far, and now we need a method to play that slash sound. 84 00:05:56,200 --> 00:05:59,530 ‫And the best position, of course, is the game manager for that as well. 85 00:05:59,530 --> 00:06:06,010 ‫So let's create a new method and let's call that public void. 86 00:06:06,370 --> 00:06:14,110 ‫Play random, random sound or slice sound, maybe even slice sound. 87 00:06:17,380 --> 00:06:26,710 ‫And in here we simply creating you audio clip, which is going to be a random sound and I'll take the 88 00:06:26,710 --> 00:06:36,670 ‫slide sounds that I have and I'm going to simply play a random slide sound so random thought range and 89 00:06:36,670 --> 00:06:40,000 ‫I want to have one between zero and slides. 90 00:06:41,440 --> 00:06:46,090 ‫Sounds, actually slight sounds at length. 91 00:06:46,570 --> 00:06:52,080 ‫So in our case, it's always going to be just one sound because we only have one sound in our sly sound. 92 00:06:52,090 --> 00:06:57,670 ‫But if we had five different ones, it would simply create a random one here and now. 93 00:06:57,670 --> 00:07:04,120 ‫In order to play it, we need to get our audio source and play one shot. 94 00:07:05,650 --> 00:07:10,500 ‫It's only going to play an audio clip and scales the audio source volume by volume scale. 95 00:07:10,510 --> 00:07:11,140 ‫All right. 96 00:07:11,320 --> 00:07:13,890 ‫And it needs an audio clip for that. 97 00:07:13,900 --> 00:07:15,470 ‫That's exactly what we have. 98 00:07:15,490 --> 00:07:20,290 ‫We have a random sound, which is an audio clip. 99 00:07:22,720 --> 00:07:23,200 ‫All right. 100 00:07:23,200 --> 00:07:27,310 ‫So now the play Random Slice Sound should be called at one point. 101 00:07:27,310 --> 00:07:29,200 ‫And where would be the best point for that? 102 00:07:29,440 --> 00:07:39,340 ‫Well, of course, whenever we slice something so in create sliced fruit would be a good position. 103 00:07:39,340 --> 00:07:40,510 ‫So in here. 104 00:07:40,510 --> 00:07:51,760 ‫So let's go ahead and play that sound, play slice sound and it's going to be find object of type. 105 00:07:52,660 --> 00:07:54,730 ‫Let's search for the game manager. 106 00:07:56,380 --> 00:08:02,890 ‫And there let's call the play random slice sound method. 107 00:08:05,150 --> 00:08:08,630 ‫Let's save that script and let's go back to Unity. 108 00:08:10,190 --> 00:08:15,620 ‫And now before we test that, let's deactivate play on sound because what that will do, it will simply 109 00:08:15,740 --> 00:08:20,480 ‫well, in this case, it will not do anything because there is no audio clip in here by default. 110 00:08:20,480 --> 00:08:24,880 ‫But let's deactivate that and make sure that loop is deactivated as well. 111 00:08:24,890 --> 00:08:29,690 ‫And now let's start the game and see if we get this beautiful slight sound. 112 00:08:33,590 --> 00:08:41,360 ‫So you might hear that how I'm slicing through all the different objects and now I'm getting the ad 113 00:08:41,930 --> 00:08:43,400 ‫and yeah, that's pretty much it. 114 00:08:43,400 --> 00:08:50,210 ‫So now you know how to add sounds and you could of course add a sound to your bomp as well. 115 00:08:50,210 --> 00:08:57,050 ‫So you could create the same you could use the same approach that we've just used for creating a sound 116 00:08:57,050 --> 00:08:57,560 ‫for the BOM. 117 00:08:57,560 --> 00:09:04,370 ‫So you would simply call in on hit pop or what's the name of the bom here? 118 00:09:04,700 --> 00:09:05,660 ‫It's most moving now. 119 00:09:05,660 --> 00:09:08,540 ‫It's actually on the game manager. 120 00:09:08,540 --> 00:09:13,850 ‫So here on Bom hit would simply play a sound similarly to that one. 121 00:09:13,850 --> 00:09:17,240 ‫Only that it's not random, but it's a specific bom sound. 122 00:09:18,470 --> 00:09:20,930 ‫All right, so I hope you had fun. 123 00:09:20,930 --> 00:09:25,970 ‫If you think that there are features missing, please let us know and we can add them. 124 00:09:25,970 --> 00:09:30,200 ‫Or if you feel like trying to add them yourself, please go ahead and do so. 125 00:09:30,200 --> 00:09:35,420 ‫And then we're very happy to see whatever you do with this game, if you should publish it, to restore 126 00:09:35,450 --> 00:09:40,040 ‫to the App Store or to the play store, please do so and send us a link so that we can check out your 127 00:09:40,040 --> 00:09:40,460 ‫game. 128 00:09:40,460 --> 00:09:45,050 ‫I'm very interested in seeing what you can do and yeah, see you in the next chapter.