Search Unity

Audio (looped music) performance issue, random skips/stuttering sound

Discussion in 'Windows' started by Memosis, Jul 23, 2013.

  1. Memosis

    Memosis

    Joined:
    Jul 23, 2013
    Posts:
    12
    Our game runs quite well on WP8 phone (Lumia 820) with 30-40 fps, but the background music sometimes skips/stutters (no other sounds are being played at the same moment). Asset is MP3, imported as 2D sound, played via AudioSource with no additional effects. It is imported as MPEG, we have tried to change bitrate from 60 to 256 kbps, Compressed in memory to Decompress on load etc., no change. We have also changed DSPBufer Size in "Project Settings/Audio" to "Best performance", doesn't help.

    When creating new project with one empty GameObject and AudioSource the sound plays OK so this probably indicates some performance issue with our game (garbage collector?). But the game loop seems to run smoothly, we don't allocate anything on menu screen. Anyone with similar problems? How can we debug it?
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
    Try switching to Master configuration, by default when you open generated solution for the first time it's set to Debug configuration.
     
  3. Memosis

    Memosis

    Joined:
    Jul 23, 2013
    Posts:
    12
    Yes tried that, it stutters even in Master (XAP for store), every 10-20 seconds there is little pause (100-300 ms). In Debug and Release (with profiling) it stutters even more (every 3-5 seconds) so it's definitely performance related. I just don't get it how can be simple audiostreaming of one sound so problematic when the rest of the game seems to run smoothly (using 1024x1024 texture atlases etc.) at 30-40 fps.
     
  4. SoEngineering

    SoEngineering

    Joined:
    Aug 23, 2012
    Posts:
    4
    I have the same problem: My game uses 5 audio streams, so I get your issue but 5 times worse ;) :( On Windows Phone 8 (Nokia Lumia 920) it drives the CPU at 100%, burns down the battery and is not useable at all... This happens also for release build, not just debug ones. It does not matter if optimizations are on/off or if TRACE is on/off etc. pp.

    @Unity: Please fix this :p I really need multiple audio streams for the Windows Store contest :D
     
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
    I would suggest to submit a bug with a simple repro.
     
  6. SoEngineering

    SoEngineering

    Joined:
    Aug 23, 2012
    Posts:
    4
  7. Vilmantas

    Vilmantas

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    29
    Hi,

    you are probably running your game from Visual studio using Run - F5. During this mode Visual studio sends some additional info/uses some debug libraries, so performance is not optimal, and this for some reason is reflected in playback of audio. Try to run your game on a device directly launching without Visual studio attached - you should not get any audio issues and performance should be much better.
     
  8. SoEngineering

    SoEngineering

    Joined:
    Aug 23, 2012
    Posts:
    4
    @Vilmantas: I know :) As I wrote above: It still happens also for a release build with optimized code => its just a little better but still the same issue! => 100% CPU, battery burns down, stuttering all the way... :(
     
  9. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,920
    No, he means - run the application without debugger attached. Also Master is better than Release ;)
     
  10. SoEngineering

    SoEngineering

    Joined:
    Aug 23, 2012
    Posts:
    4
    Yes, I did this ;) I have compiled the app as release, deployed it to the device and then run it manually without debugger => still the same. But with my bug report, Unity should be able to test it easily, because I uploaded a test project :)
     
  11. Memosis

    Memosis

    Joined:
    Jul 23, 2013
    Posts:
    12
    Thats what we did, Master XAP installed on phone and running as standalone (not from VS, not even connected to PC). Phone (Lumia 820) is under heavy load, sound stutters, and thats just one audiosource.
     
  12. Despox

    Despox

    Joined:
    Aug 16, 2012
    Posts:
    5
    nothing?
     
  13. rextr09

    rextr09

    Joined:
    Dec 22, 2011
    Posts:
    416
    I have the same issue. Music stutters even in the main menu and fps is normal.
     
  14. Fylen

    Fylen

    Joined:
    Nov 29, 2012
    Posts:
    8
    Same problem here, nobody has a solution?
     
  15. Fylen

    Fylen

    Joined:
    Nov 29, 2012
    Posts:
    8
    Hum, setting music file (mp3) to stream from disk solve the problem...
     
  16. rextr09

    rextr09

    Joined:
    Dec 22, 2011
    Posts:
    416
    Unfortunately, "stream from disk" does not solve my problem :(
     
  17. GarryJay

    GarryJay

    Joined:
    Nov 23, 2009
    Posts:
    42
    Same problem here, stream from disk didn't solve it either. Overall the whole game stutters for no reason every couple of seconds. Nothing is loading or happening.
    It runs smooth on a $50 android but not on a $400 windows phone? Disappointed.
     
  18. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Last edited: Aug 15, 2013
  19. rextr09

    rextr09

    Joined:
    Dec 22, 2011
    Posts:
    416
    Master configuration does not solve the problem for me. Is there going to be any fix for this in the next update?
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you submit a bug report? Such bug might be a ship stopper, however, we were not able to reproduce it.
     
  21. rextr09

    rextr09

    Joined:
    Dec 22, 2011
    Posts:
    416
    I have udated Unity to 4.2.1 and NGUI to 2.6.5b. The problem is gone. I don't know which one has solved the problem :)

    Now I have issues with reflective shader on Lumia 520. I will let you know if I can't solve it.
     
  22. MandelPrup

    MandelPrup

    Joined:
    Dec 11, 2012
    Posts:
    3

    The performance problems are still there. I have Lumia920 and I run it also as master. I changed all my oneShot samples to be mono and native wav as well. the looping music I stream directly from disk. The performance is really not in correct shape with it. If needed, I can send my project for further analysis
     
  23. Memosis

    Memosis

    Joined:
    Jul 23, 2013
    Posts:
    12
    We have tried latest Unity 4.2.1f4 and the problem still persists :-/. Stuttering background music and sound on Lumia 820 master build.

    The other fixes in this Unity version look good (Application.OpenURL, WWW forms), when can we expect fix for this sound performance issue? Would it help if we send you our project?
     
  24. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It would help tremendously. We've been trying to reproduce this issue for a very long time, yet failed. If we had a project which has this behaviour, we would actually be able to fix it. If you can, fill up a bug report.
     
  25. Nidre

    Nidre

    Joined:
    Dec 12, 2012
    Posts:
    22
    Any progress about this ? I am having the same issue.The game runs fine on low-end android devices but on Lumia 520 audio performance is quite bad.Also if anyone posted a ticket can you post its reference number ? I do want to track its status.
     
  26. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Hello,

    at the moment of speaking, one of our devs is looking into it. We have a reproduction project and we're working towards fixing it.

    Unfortunately, I can't share the case number, as they are private.
     
  27. peter_on

    peter_on

    Joined:
    Jan 8, 2009
    Posts:
    63
    hi,

    hit the wall and spending the pass 24hrs trying to resolve similar issues until i stumble on this thread.

    It could be content specific, as i've 2 background music that play smoothly on ios+android, and guess what ?
    On 520, one was playing fine and another was stuttering every 10-15secs, no matter how i change the setting to master, doppler, effects, 2D , ogg, mp3, wav , reimport etc.

    So, i will leave it to the gurus and hope to hear some good news soon! thank u

    Br,
    Peter
     
  28. Nidre

    Nidre

    Joined:
    Dec 12, 2012
    Posts:
    22
    That's great to hear someone is working on.Is there any workaround for now ? We are porting our game to the WP8 contest and stuttering sound is nothing good :)
     
  29. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Build in master configuration, reduce audio bit rate and hope for the best. If there was an obvious solution, it would get fixed much faster :).
     
  30. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Was this resolved in a bug fix? We have the same issue on some of our titles. Randomly music starts stuttering/sounding corrupted.This is on a Master build, and we tried every audio setting in the book.
     
  31. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It's being worked on, but not resolved yet.
     
  32. stephan7

    stephan7

    Joined:
    Jul 3, 2012
    Posts:
    44
    Unfortunately, I have the same problem. It is a big issue, but it's good to know that someone is working to fix the stuttering! In case you need a stripped-down test project, please let me know, I would be glad to be of assistance :)

    Stephan
     
  33. games

    games

    Joined:
    Feb 18, 2012
    Posts:
    61
    Yeah, I have the same problem. Upon removing many of the features of the app (water, particle systems) the audio skipping is reduced to where I feel its ready for the store, BUT it stinks having to strip the app of what makes it look good.
     
  34. Assault

    Assault

    Joined:
    Aug 21, 2012
    Posts:
    60
    I have the same problem. If I deploy my game with the debug configuration, the audio is horribly stuttering. With master configuration it is a lot better, but still there is stuttering in the audio. I tried lowering the bitrate of the sound clips to lowest possible value (32), and even that did not remove the stuttering.

    The device is Nokia Lumia 920.

    I can also provide a build if needed.
     
  35. preatorianX

    preatorianX

    Joined:
    May 26, 2013
    Posts:
    5
    I also have the same issue and I'm testing with a Nokia 920 and 820. I just tried all the steps without luck. Reducing the sound to 8 bit provides too much noise on the song, so it is not an option. We only have 1 song playing on the background, but the issue of skips/stuttering is still happening. Any idea of when would it be solved or any work around that works without sacrificing the sound quality? The 820 has more issues than the 920.

    Thanks
     
  36. rextr09

    rextr09

    Joined:
    Dec 22, 2011
    Posts:
    416
    I can hear some stuttering on Lumia 520, but it's mostly ok. Should I try also on another phone like Lumia 820? Will they perform worse than 520?
     
  37. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    The 820 has better hardware and 512mb more RAM. These audio issues seem to be occurring when the device is either near it's processing limits or when it is running low on memory. You're better off getting your game working on a low-memory (512mb) device such as the 520. If you can't get it working on low-end, then exclude low end devices from the list of compatible products for your game to avoid bad reviews by those with low-end devices.
     
  38. rextr09

    rextr09

    Joined:
    Dec 22, 2011
    Posts:
    416
  39. preatorianX

    preatorianX

    Joined:
    May 26, 2013
    Posts:
    5
    The 920 has better specs than the 520 and the 820, but still have issues with the sound and the game is very simple. As per the developer from Unity, they were working on it on October and has not been solved, or at least they never notified anyone that it was solved... It would be nice to know if they are still working on it.
     
  40. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    We're still working on performance improvements. It's a long process, but we're getting there. In the meantime, you can check RAM usage on the phone - nearing RAM limit will cause garbage collector to act up much more, and that will cause sound issues. Also make sure you're running master configuration and not through the debugger - that is launch the application on the phone manually rather than through Visual Studio.
     
  41. stephan7

    stephan7

    Joined:
    Jul 3, 2012
    Posts:
    44
    I also had audio problems on WP8 in the past, but they went away at some point with a new Unity version. To be sure, that it wasn't something I changed in my changes or a changed setting I checked out a really old version of my project: no problem.

    I took also a look at the profiler and I noted that there were a lot of performance improvement compared to earlier versions (I saw for example that SkinnedMeshRenderer performance has improved a lot). I suspect that this might have been the cause in my case. But you never know :)

    Stephan
     
  42. imako

    imako

    Joined:
    Mar 24, 2014
    Posts:
    3
    Hi,

    Any news on this? I have pretty much the same symptoms as previous posters do. Game runs smoothly on lower end Android-devices, but on Lumia 620 background audio loop is some what choppy. I have tried nearly every setting with that audio clip, no help. And running master :)

    Memory usage is around 70MB and seems that it would not be the problem. FPS is okay, only matter is the audio.

    Using Unity 4.3.4.f1
     
  43. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Please submit a bug report. We'll gladly look into it.
     
  44. andrescavallin

    andrescavallin

    Joined:
    Mar 29, 2014
    Posts:
    11
    Hello just wanted to add that I experienced similar behavior: Game was running fine on iOS and Android but when I tested it on a Nokia Lumia 920 the performance was very bad specially the background music which stuttered all the time. For background music I used two simultaneous stereo tracks of 16 bit uncompressed WAV with a length of 32 seconds and 5.5 megabytes of size.

    The problem occurred both on Debug and Release builds, but was solved when I deployed using Master profile.
     
  45. Yesitsdave

    Yesitsdave

    Joined:
    Mar 19, 2014
    Posts:
    9
    I have this same problem on the Lumia 520, with debug / release it is very bad, with master it is generally ok but the music will still stutter occasionally, especially if the fps drops to 40 or below (but the lowest it ever gets is about 30).

    Tried various different options, reducing the bitrate helps but does not completely remove the problem.
     
  46. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    I still have this problem with Unity 4.5.

    Set the build to Master | Deploy the solution | Disconnect phone (Nokia 1520) and start the application. There is every 10, 15 seconds a hitch just before an audio clip is played.

    I'm using Audio Toolkit 6.6 form the Asset Store and the audio performance are good on an iPhone 4 (Slowest IOS device that I own) or up. The high frequency sounds are pooled and each such a sound is having it's own pool. All my sounds are loaded into memory before somebody starts to play the game.

    I imported WAV files. All files have the following settings:

    Audio Format = Compressed (MPEG)
    3D Sound = unchecked
    Load Type = Compressed in memory
    Compression = 63 kbps


    On IOS i use the following setting:
    AudioSettings.SetDSPBufferSize (256, 4);

    On Windows phone this sound better (Unity Default):
    AudioSettings.SetDSPBufferSize (1024, 4);

    Changing the audio latency makes some difference in a more constant audio/quality while playing the sound but it won't resolve the hick-up that appears and which freezes the game for a few 100 ms and after that it plays the clip and the game resumes.

    Please help because this is actual the only showstopper I have for Windows phone. :)


    Peter.
     
  47. Memosis

    Memosis

    Joined:
    Jul 23, 2013
    Posts:
    12
    I am afraid (and at least hope at the same time) this issue might be "solved" with Windows Phone 8.1. I saw somewhere among the WP 8.1 features some sys audio buffers were doubled so hopefully it will deal with it.

    Can you confirm you still have WP 8.0 on your Lumia? And can anyone with WP 8.1 (even dev version) confirm whether this issue persists?
     
  48. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    I have a 520 and 1520. Both are on the 8.0 version.

    Peter.
     
  49. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you submit a bug? I have yet to see this issue in person and thus investigate it, nobody has ever reported it even though claiming it exists on forums. We have not been able to reproduce this internally.
     
  50. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    I will compile a little demo project and post the bug number here. Please allow me a few days to create it. This month I have only the evenings and weekends for Unity. ;-)

    Cheers,


    Peter.