Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Uh-oh, audio...

Discussion in 'Editor & General Support' started by bigkahuna, Nov 29, 2006.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I'm hoping this is just a silly mistake on my part, but I'm having problems with a looping sound in my project.

    I'm using Unity 1.6 and have a vehicle that the player moves around (his point of view is on the vehicle). This is a project I created in 1.52, but now I'm using 1.6 and want to add sound. I added an "audio source" component to part of the vehicle (a 22khz .OGG file) and set its volume to 0.5 and to loop. I added an "audio listener" component to a different part in the same vehicle.

    When I run the game in Unity, there is an intermittent but definite "crackling" static noise. When I built an Intel standalone and tried to play it, it ran extremely slowly (maybe 1 frame per minute) and eventually crashed my system (had to power down to regain the system :eek: ).

    Any ideas?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Maybe try a different sound effect/encoding method and see if the problem persists? Ogg used to be kind of flaky; maybe there are still a couple of obscure bugs lurking around. And make sure you only have one audio listener...usually it's on the camera by default.

    --Eric
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks Eric, which one do you recommend, .WAV?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Ack, I was just editing my post. :) Yeah, try .WAV but also check the audio listener thing. I use Ogg without any problems now but it doesn't hurt to try .WAV just in case.

    --Eric
     
  5. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    It sounds like the game is attempting to play the sound every frame. Are there any scripts that affect this audiosource? Does the object containing the audioSource get instantiated at all?

    If not, there might be something wrong with the sound file itself. Do other sounds work?
     
  6. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Well I found the cause of the crashing... I was building PPC standalones and trying to play them on my Intel iMac... duh! :roll:

    The static problem is being more elusive though. As you guessed, I have 3 cameras and all of them had audio listeners. I deleted the audio listeners from 2 of them, and tried using a .WAV, and I'm still getting static :(
     
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Still working on this.

    I found one reference to audio in one script, I removed that. I've tried OGG and WAV files at various frequencies, still have that nasty static.
     
  8. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    When I moved the Audio Listener to another object (not the vehicle) the static noise disappeared, so I'm guessing there must be something in my vehicle that is causing this.

    There aren't any calls in any scripts to audio, so what other things in my scripts might be causing the static? Anyone?
     
  9. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Well, usually you attach Audio Listener to the main camera. I.e. to the object that is "the viewer", and only have one Audio Listener in the scene.

    If that does not help and there are some problems, send in the project folder that reproduces the bug via Report Bug.app
     
  10. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I have 3 cameras active in my scene and I tried that first. I then tried other parts of the vehicle, and still got the same problem. The work-around I've settled on is to put the listener on a camera that has a smooth follow script. That seems to work, but I've lost the "stereo" effect.

    That's a problem. My project folder has grown so large, I had a problem trying to send it last time. I'll see if I can't reduce its size and try again.
     
  11. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    Try setting the Audio Manager's Doppler Factor to zero to disable doppler effect altogether. I have been getting weird audio problems since 1.6 enabled doppler support, and I can imagine the noise it makes being described as 'crackling'. Sounds a bit like the audio buffer is under/overrunning.

    If I can isolate it, I'll submit a bug report on this matter.
     
  12. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    That seems to have fixed it! Thanks Neil!

    BTW - the help page for the audio manager needs to be updated.
     
  13. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Can everyone who has problems with doppler launch Report Bug.app, type in something like "Doppler problems" and just send a report? We'll get your machine specs that way.
     
  14. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,292
    Me too...never got audio issues until 1.6 beta...
     
  15. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    I did a little experimentation, and came to the conclusion that the problem was caused by using 8 bit samples. Try switching to 16 bit samples and see if that helps.
     
  16. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Not here. I tried 16bit .WAV files and still got the same problem. I switched to .OGG and moved the listener to a 2nd camera not connected to the vehicle and the problem went away. I'd like to set all my sounds to 8 bit 22 KHz mono .OGG but haven't figured how to do this in Audacity yet.
     
  17. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I just ran into the "static" noise on sound problem again. I was testing the "car playground" web player here: http://unity3d.com/gallery/living.html and I get a fair bit of static in the sound associated with my mouse clicks (gun shots). OTEE: Have you been able to reproduce this problem yet?
     
  18. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Yes, and we are working on it!
     
  19. taumel

    taumel

    Joined:
    Jun 9, 2005
    Posts:
    5,292
    Just wanted to note that i also experience this beside of 8 bit formats. The last one i heard it was a 16bit/44.1khz/mono ogg file. Oh and it was Moll if that helps! ;O)