• 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 jackpile · Apr 29, 2012 at 12:59 AM · audiosourceaudiolistenerstuttercutoff

Numerous simultaneous audio clips getting cut off

My iOS game creates numerous pooled AudioSource objects on demand during play when a target appears or is hit. They generally last only a short time, less than 3 seconds each. On the Mac, they all play fine, but on the device, many are not heard or played briefly then stop midway through leaving a poor game experience. Sometimes a sound is never heard that should be played - that is played on the Mac. These are all mp3-encoded and all have carefully assigned priorities. I also have checked hardware decoding on all items. With the exception of large size, long-playing music tracks from disc, they are all compressed in memory.

I'm not quite sure how to proceed to solve this. The documentation states that if the hardware decoder is in use, then FMOD software will be used, so I don't think contention for HW decoder could be the issue. I don't think priorities are the issue, but they could be. Does anyone know if there is a limit the number of simultaneous sounds that can be playing at once through an AudioListener? I'm also wondering if (lamely) that I should use PlayOneShot sound from a persistent AudioSource instead of creating a pooled AudioSource object on demand, then recycling it, as I'm doing. Writing because I'm just out of ideas right now. Thanks.

Comment
Add comment · Show 3
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 jessee03 · Apr 29, 2012 at 08:13 AM 1
Share

I'm guessing that the mobile device does not support certain encodings that your computer might have. I would maybe try exporting them as .wav files. Other than that I have had issues with 3d sound being checked for mobile games, try unchecking that box under each of your audio files inside unity.

avatar image fafase · Apr 29, 2012 at 10:05 AM 0
Share

Could it be the maximum amount of audio channels allowed by the device being reached?

avatar image jackpile · Apr 30, 2012 at 03:09 PM 0
Share

@all & @gregzo, thanks. I don't think it's 3D sound, I tried unchecking from most of my clips and had the same problem. I think it's the number of mp3's as @gregzo and @fafade point out. I think what I should have learned when starting out with Unity was to create a test app on iOS to gauge the number of simultaneous mp3's, wavs, etc that can be played without clipping. I plan to try and use the WAV version of these clips, but because I have 100's, they will take up too much memory and extend scene loading times. I'll try loading from "disc" (flash) on many to mitigate that but disc loading may have its own limitations. I'll try to report back if anyone's interested.

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by jackpile · May 22, 2012 at 01:02 AM

By the way, I also looked into FMOD tech notes on iOS playback. I was noticing some very poor performance and stuttering when playing streaming WAV or AIFF files from flash. What I found was that FMOD states the native mix rate is 24KHz, so I tried resampling all of my native sounds to this rate and now plays absolutely beautifully. All very smooth, fast and high quality -- all from "disc" (flash). So I really don't need any clips in RAM. It seems to stream multiple sources from disc simultaneously just fine. Thought I'd share that. So I only have one MP3 track being streamed from disc during my levels as well. Sometimes I use a background track in addition to music in MP3 and that seems to be streamed and decoded fine without stuttering either.

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 gregzo · Apr 30, 2012 at 06:34 AM

I'm pretty sure you cannot play even 2 simultaneous mp3's on iOS. Use mp3 for longer cues (background, non-interactive music), and wav's set to load in memory for sounds you need to spawn quickly.

Comment
Add comment · Show 2 · 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 fafase · Apr 30, 2012 at 03:34 PM 0
Share

I think when you load a sound for mobile, it is always be converted to mp3 on import. http://unity3d.com/support/documentation/$$anonymous$$anual/Audio%20Files.html

avatar image gregzo · May 01, 2012 at 01:29 PM 0
Share

The same page also states "Native: Use Native (WAV, AIFF) audio for short sound effects. The audio data will be larger but sounds won't need to be decoded at runtime. " Plus my experience with audio in Unity (coding sequencer-like apps) just tells me you may not play to mp3's at once on iOS...

avatar image
0

Answer by Jaysta · Jul 29, 2013 at 01:01 AM

EDIT* I think Unity has fixed this problem now. I do not see any info about mp3's being clipped on compressed in memory.

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 ForceMagic · Mar 24, 2015 at 06:24 PM 0
Share

Unfortunately, your link seems broken by now.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

When i put an audio source in my scene, the OVR camera renders black. Take it out, it works just fine. What am I doing wrong? 0 Answers

One sound gets quieter when other is played? 1 Answer

How to get decibel's value of game's sound? 0 Answers

sound too low in Android devices 0 Answers

Mute 1 audio channel while preserving spatialized 3D sound? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges