Animating sound
So far throughout our training, all of our animations were focused visual elements, but the fact of the matter is that anything can be animated. For example, we can animate sound. In this lecture, we're going to take a look at how can we animate sound, opening the door to animating things that are not visual.
Video Transcript
00:00Welcome back. So what I wanted to do next is to talk about the last plugin and we're actually not going to even use it
00:06So there's two plugins
00:08I want you to be just be familiar with and they're mainly important when you have a
00:12Soundtrack on your movie clip itself, which is usually not very recommended in general
00:17But if you're an animator and you already are used to that type of setting then you could dynamically
00:23Animate the sound as well by using the volume plugin
00:27Or you could use the import comm green sock plugins
00:33And use the sound transform plugin now
00:36I don't personally use both of them mainly because I like using the sound object and it's a little bit hard to figure out and
00:43It doesn't actually really work as far as I know working directly with the sound object
00:47So I want to show you how to do it yourself. So I'm gonna go ahead and
00:53To do a quick pause just to give credit to the creators of this music library
00:57You'll find the the music that we're gonna be using in a second
01:00We should you could download from their site and I just aligned a little bit of the text and make sure that it will
01:04Be above that shape that we've added in the last lesson
01:08What I want to do is I'm gonna move on and actually create a new sound object
01:12So to do that, I'm just gonna create a new sound object. I'm gonna call it S&D for sound and
01:18new sound and
01:20I'm gonna send a new URL request into it and send to it the path of our file
01:26So let me just grab the path and you'll actually find it inside of our folder
01:30You'll find inside of the assets folder the actual file itself. So let me just copy the name there
01:36so it's gonna be inside of the asset folder if you download our source files and you'll find it in that as we said assets and
01:43the name of the file and
01:45Let me just make sure that it works. I'm gonna click on S&D play
01:50and just run it for a second and we should expect once the
01:54Music starts, right? Perfect. Now what I want to do is for the music to play for a couple of seconds
01:59Maybe let's say four or five seconds and then automatically fade out
02:03So let's get that sorted out
02:05So the next step is for this to actually happen
02:08I want to I need not only want I need to have a sound transform object and
02:14The sound transform object that I want to create and really use I want to fetch it from our actual
02:20I want to start off from a sound transform object that is completely full and then
02:26Basically faded faded out. So what I'm gonna do is I'm just gonna create a new sound transform ab object
02:32And I'm gonna call it st for sound transform. It's just gonna be a new sound transform
02:40Don't need to send any properties into it and I'm just gonna make sure that when I'm playing my object
02:45I'm just gonna send to it my sound transform object, which is the third property first one being a
02:50What second of this track do you want to start and how many times do you want to loop?
02:53We don't want to loop at all
02:54So we're just gonna send in our sound transform
02:56But we could have set here the volume to a different volume if you wanted for example if we wanted it to fade in
03:01So we could set that in our stand transform before we even start
03:04But that's not our intention and the next thing is we want to capture our channel
03:09so it's gonna be our sound channel and
03:13That's gonna come back when return to us when we start playing our element last but not least
03:18It's time for us to animate our our sound transform
03:22So I'm gonna create a new tween light and I'm gonna animate my st my sound transform
03:27I want that animation to take let's say two seconds and
03:31I want to
03:33Figure out what are the properties I want to give to it
03:36So for one is I want to set what volume I want to get to so I want to get to 0.1
03:41Or 0. even it's gonna be really low. So let's take it one. So it's gonna be 10% of its volume
03:46We're gonna put here a delay of let's say 5 seconds and we want to call the on update function function
03:53Now I'm gonna create an inline function and the reason is very simple
03:57I want to create an inline function mainly because I want to be able to communicate with all the variables that I have here
04:03without the need of actually sending them through it's kind of a
04:07Little cheat because we're while we're inside of this function
04:11We're also inside of this one thus we will have access to all these functions
04:14Well, if we call a function that's external then we wouldn't have access to all these files anymore
04:20So what I'm gonna do is I'm gonna go approach my sound
04:24Channel and I want to set the sound transform
04:27So I'm gonna set my sound transform and I'm gonna just set that value to the sound transform that we're actually animating
04:33And by the way, we're animating the volume
04:36But we could have animated any one of the properties of the sound transform or a few of them
04:40So for example in the sound transform, we could have set the
04:44Right to left or right to left left to right and so on and so forth we could or the pan and
04:50But we're just gonna go simple keep it simple because that's what we like doing
04:54So now if we play this we will expect our animation to fly off of the screen
05:00we'll see our royalty copy the music will play and
05:04then
05:06fade out all
05:07The way down to zero to 1% well 10% of the sound original sound volume
05:13All right. So there you go. So that's how I personally recommend creating sound transforms
05:17And this just gives you a hint of those capabilities. We saw that as we were creating tweens with text and
05:23Now creating tweens with sound you don't really have to use every plug-in
05:27You could play around and animate numbers and then use that on update to then create the actual
05:33Actual event that you want happening
05:35So in this case, we actually animated the sound transform and then we updated the sound transform of our channel each time
05:43There was an update. So that's it. So that's it for tween light in general
05:47That's it about plugins in general in the next lesson
05:50We're gonna jump right into tween max and see what's the difference between tween max and tween light. So see you there
