FORUMS: list search recent posts

# Audio gain and panning in relation to camera in 3D space

FAQ   •   VIEW ALL
 Audio gain and panning in relation to camera in 3D space on Sep 12, 2012 at 3:41:32 am

I've been looking through all the old audio posts and haven't found one that really tells how to do what I want. I'm pretty bad with expressions right now, but I currently have a project that has a 3d camera that moves to a new position about every 30 seconds, and is focusing on an area that has a point light attached to a null object that has a wiggle expression on it that flies in and out of the shot. I would like to essentially attach an audio layer of an energy buzz sound to the null's position: as the object gets closer to the camera it gets louder and also pans through the left and right channels as it goes off screen to the left and right.

Thanks for any help or suggestions.

 Re: Audio gain and panning in relation to camera in 3D spaceon Sep 13, 2012 at 1:13:14 am

Maybe I'm making this too complicated or I'm not explaining it well.

I would like to take the difference between the null object's x,y,z position and the camera's and use that to control the sound's dbs. I would then like to take the difference in the null's x position compared to the camera's and use that to control the percent of the sound going to the left and right channels.

Thanks again for any help or input.

 Re: Audio gain and panning in relation to camera in 3D spaceon Sep 16, 2012 at 3:41:56 am

Thank you to no one in the community because no one gave me any advice what-so-ever.
If anyone else is ever in need and would like to see how I did it. Here's my expression on the audio layer:
p1 = thisComp.layer("Null 1").transform.position;
p2 = thisComp.layer("Camera 1").transform.position;
dB = (p1 - p2)/100;

I pickwhipped the position of the null object, 3D and all. And did the same for the camera. I subtracted them to get the distance and told it to be equal to the dB. I don't know why it worked, but it added a second value to the decibels in the audio level, and panned left and right, while increasing overall loudness as the object is animated closer to the camera. I divided by 100 to make the variations smaller since the camera goes from really close to the object to really far away at times so it kind of "normalized" the high's and low's.