Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by straydogstrut · Apr 07, 2010 at 10:29 PM · audiosoundrolloff

Area based sounds / Correct approach using rolloff factor

I'm having a lot of difficulty trying to set up my audio to meet my needs. I have various audio sources in my environment, a school with various rooms. Sometimes there are multiple audio sources in the same room. The game I am creating is all about representing sound visually so there is a corresponding guiTexture for each audioSource that is displayed once the player is within a specified range.

Now I know that realistically sound never just 'goes away', but I do need to artificially constrain the sound to certain locations. The problem i'm having is trying to find the right rolloff factor to balance the sounds. For example, in the bathroom there is a shower running. With a roll off factor of 0.5 the sound drops off quite quickly and when I leave the bathroom the sound is still perceptible, but quiet enough. In the lounge, at the opposite end of the corridor, I have a stereo playing. This room is a little larger and yet, with a rolloff factor of 1.0, the music is still quite audible when I reach the bathroom. I have to crank it up to a figure like 10 to make it nearly fade out, but i'm thinking this is ridiculous since it should be a number between 0 and 1? I'm assuming this is partly to do with the different volumes of the original sounds, but trying to find the right settings is getting me very confused.

These are just two of several location based sounds that I need to adjust to create the right atmosphere. Since i'm toggling the visibility of the guiTexture with a custom radius, i've experimented with setting the AudioSource volume to 0 outside this range, but it's unbelievably sudden. I couldn't find a good marriage with the rolloff factor with this approach. I'm also checking that there are no colliders between the player character and the sound source to toggle the guiTexture, for example, if the player shuts a door between them and the sound. But this doesn't work so well for audio sources since the single raycast shuts off the sound abruptly as soon as it's not in clear sight. I may remove that check anyway since I wasn't able to selectively avoid it for something like, for example, footsteps, which I want to show regardless of whether there is a wall in the way.

I can accept some overlap of sounds - to leave the shower running, for example, is quite realistic - but other sounds need to be heard distinctly, such as the music in the corridor (a hip hop beat) and the music in the lounge (a gentle piano), which are designed to create different moods.

I've set all the sounds to Force Mono (since some were Stereo to begin with), and enabled 3D sounds. I had to turn off the Doppler Effect since the piano music was distorted whenever I turned away from the sound otherwise. I don't think I need it anyway since I have no fast moving objects, assuming I understand correctly what the Doppler Effect is.

I'll be honest, I know next to nothing about audio (Sadly I gave up the guitar lessons years ago!), so if someone could shed some light on this i'd be grateful. I've done some basic trimming of audio in Audacity, but I wouldn't know where to begin with waveforms and whatnot, so if there's something I need to be doing to the sound before I bring it in, please treat me gently;-)

Thank you very much for your time.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by straydogstrut · Apr 08, 2010 at 01:56 AM

So after much tweaking I gave up trying to get the effect I wanted. I've now turned off 3D sounds and i'm using the code I had for fading out the guiTexture with distance to alter the volume of the Audio Source. Probably not the best way to do it, but the roll off is a lot smoother than my experiments with 3D sounds, and it's directly linked to the range so I just have to change one variable to control both the sound and the guiTexture that goes with it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Adam.du · Apr 14, 2010 at 10:27 AM

It seems to me that there shouldn't be any doppler effect when your character turns.... if your AudioListener is connected to the right object. If you have it connected to the camera, move it to the character. Doppler effect shouldn't come in to effect unless things are moving pretty quickly, swinging the camera around can do that.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nicolaj Schweitz · Apr 14, 2010 at 11:48 AM 0
Share

http://unity3d.com/support/documentation/ScriptReference/AudioSource-velocityUpdate$$anonymous$$ode.html

avatar image
0

Answer by STARFLEETJUNKY · Jul 06, 2013 at 07:33 PM

Hi This may or may not be your issue, but try this. select the object that has the audio source on, then place your character controller next to it. I have setting custom roll off, max distance set to 500 though i don't think this matters too much choose your own max distance. then run your game or move your character controller away from the sound source. notice in your curve animation graph, as your audio listener connected to your character controller moves away from the sound source. you should see a red line moving across the curves with listener highlighted in black at the top. use your volume curve control points or right click on your volume line and add key and drag a key frame all the way to the bottom at the distance you want your sound to stop.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Logarithmic Rolloff Sounds Plays After Max Distance 0 Answers

No Sound at all 12 Answers

how can I play 2D sound from all output devices 0 Answers

Why can't I hear my audio? 5 Answers

Why my sound it's not attaching to my Flashlight 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges