Search Unity

Audio Problems

Discussion in 'Developer Preview Archive' started by PhobicGunner, Dec 23, 2011.

  1. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    It seems Flash export does not recognize 2D sounds - it treats everything as if it were a 3D audio source. Really problematic for music.

    Of course, I can crank up the Min Distance to fix this, but not exactly ideal.

    EDIT: Also, simply setting Pan to 0 (getting the sound source to ignore attenuation and panning) does not work in Flash.
     
    Last edited: Dec 23, 2011
  2. soren

    soren

    Joined:
    Feb 18, 2008
    Posts:
    123
    Hi,
    Audio support is very limited in this version of Unity Flash. 3D panning (and PanLevel) is not supported only attenuation (over distance). But we should support plain 2D - can you report a bug and post the case # here?

    thanks,
     
  3. luisanton

    luisanton

    Joined:
    Aug 25, 2009
    Posts:
    325
    In my tests, some audio effects turn into white noise, some are listened perfectly and background music is not there. I'm still digging into it!
     
  4. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I ran into the exact same problem if you try my gameh you will notice the music is treated as a 3D but in the editor its marked as 2d.
     
  5. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    I actually filed a report yesterday... let me see if I can dig up the number...
     
  6. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Last edited: Dec 23, 2011
  7. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Same problem here... No 2D sound, only noise.
    Have to use 3D clips in order to playback anything, 2D outputs only noise.
     
    Last edited: Dec 23, 2011
  8. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    I haven't investigated yet, but have heard from one user that he found that he gets white noise as audio only in the situation where he has multiple audiosources attached to a single gameobject. the first one works, but the ones after that don't. haven't verified yet though.
     
  9. luisanton

    luisanton

    Joined:
    Aug 25, 2009
    Posts:
    325
    That's my case: some objects have audiosources, but also some of their children. Not all sounds are bugged, so that could explain part of the problem.
     
  10. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Well, I managed to sort-of solve the problem by changing the Rolloff factor in the Audio Manager to 0. Obviously not a good solution for most games. I only did it because my game is primarily 2D. Perhaps you could simulate a 2D sound source with a custom Rolloff curve if you're doing a 3D game.

    I did experience white noise when, and only when, I moved the music audio source to the exact position of the camera. Maybe Flash has some sort of over-volume capability (the volume of a sound can be cranked up beyond full volume), causing sound wave clipping which makes it sound like white noise, and Unity doesn't account for that when calculating audio volume. Just a speculation.
     
  11. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    All I did was to change the "Volume Rolloff" to "Linear Rolloff". But thats a 3D function, it should not affect 2D sound.
     
  12. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    992
    No matter what import setting I use it always reverts to compressed in memory. If this is the only supported format it should not let you see the other options. I also get the white noise effect and don't know how to fix it.
     
  13. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Well, a few of us have experienced Unity treating sounds as 3D when they are actually 2D, so you're probably experiencing the same thing.
     
  14. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I think the easiest thing to do is set both rollOffScale and doppler to 0. That is unless of course you need 3d sounds with 2d music.
     
  15. cof125

    cof125

    Joined:
    Dec 27, 2011
    Posts:
    8
    So I'm not the only one thank god Thought i was doing something wrong landing up doing a bunch of research on sound and sound editing trying to solve the problem. Well anyway thanks everybody, so how many people here are entered in the contest and how many people are experiencing problems with audiosource.PlaySoundAtPoint, I'm guessing this call falls under the 3d sound catagory from what i can tell all is fine with it until it tries to play two sounds at once with it. Tested the it all day trying to figure it out.

    p.s. Also has anyone figured out how to force it to go fullscreen yet(Flash I know how to do it other wise)
     
  16. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    I was able to remove my audio issues by:
    - don't use multiple audio sources attached to one gameobject (although I've seen cases where it worked)
    - set Pan Level to 0 and volume rolloff to Linear Rolloff, even if it is a 2D sound. If I do that, suddenly sound worked again.
     
  17. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    Sweet that second part fixed my issue thanks!, but now my songs are restarting when they aren't supposed to =)

    Edit: Looks like calling .Pause() then .Play() restarts the song instead of resuming, assume this is a bug.

    Edit2: Posted case# 435300
     
    Last edited: Dec 28, 2011
  18. Zogg

    Zogg

    Joined:
    Mar 28, 2009
    Posts:
    158
    I love you! Will you marry me?

    Joke aside, the second suggestion solved my white-noise-music issue. Thanks!
     
  19. kevork

    kevork

    Joined:
    Aug 28, 2011
    Posts:
    31
    Pause doesn't seem to be doing anything for me, as the audio continues after .Pause() being called. Sorry for jumping onto this thread, but I didn't see any comments about pause anywhere else.
     
  20. SentreStage

    SentreStage

    Joined:
    Aug 8, 2011
    Posts:
    25
    Thought I would post my fix for this issue.

    It appears to me that the "WhiteNoise" effect is being caused by audiosources becoming too close to the audio listener, a fix for me, as we are working with a 2d game, is to attach the audio listener to its own object, and place that object about as far behind the camera as the camera is from my world sprites.
     
  21. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Thanks for the tip! Seems to be doing the trick for me.
     
  22. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    I was told that this will be fixed in next build. I am noticing .mute doesn't seem to work either though, wonder if that's known or just me.
     
  23. kevork

    kevork

    Joined:
    Aug 28, 2011
    Posts:
    31
    Thanks for the heads up.

    Another audio problem I'm encountering is it is taking a long time (0.5s or more) to start playing mp3s. When trying to switch between two looping background music tracks, I've had to dramatically increase the fade out time of the original track, as the new one takes a while to start.
     
  24. Deleted User

    Deleted User

    Guest

    It sounds like the problem happens if you're within the minDistance setting of the audiosource. I just fixed a similar-sounding problem by commenting out the minDistance/maxDistance settings I had in code (I was setting minDistance to a big number to make sure I heard the sound at maximum volume).
     
  25. GFX47

    GFX47

    Joined:
    Dec 7, 2010
    Posts:
    124
    Hey guys, modifying AudioListener.volume doesn't change anything in a flash build (works in editor though)...
    Do you know another way to change or disable sound volume?
     
  26. kevork

    kevork

    Joined:
    Aug 28, 2011
    Posts:
    31
    Changing it on the source works.
     
  27. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    I tried the suggestions in this thread.. but my sound effects only work for about 3 seconds after load. After that there's no noise, except for my looping background music which plays fine.

    Doesn't matter if the sounds are 2d or 3d, they all stop playing a couple of seconds in.
     
  28. ibps13

    ibps13

    Joined:
    Oct 6, 2012
    Posts:
    113
    Hi,

    I have the same problem with my project, when my character jump first time I have sound and after that nothing, just footstep sound
    Works fine in editor but not in flash build SWF 13, 14 and 15 - unity 3.5.6f4 - OSX 10.7.5 - Safari 6