Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 ulgerang · Mar 05, 2013 at 04:39 AM · androidsounddelay

sound delayed on my android device.

i am making mobile game which kill monster by touching. so I write codes for making a sound when it touched. but the sound delayed a little bit about 200~ 500ms. it is less then 1sec. some people have same problem like me.

http://answers.unity3d.com/questions/60096/android-audio-delayed.html

i already changed setting of DSP buffer size in AudioManager. but it doesn't work.

is there solution for it?

Comment
Add comment · Show 5
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 Ben-Stoneman ♦♦ · May 01, 2013 at 03:51 PM 0
Share

What version of Unity are you using?

avatar image hunz · May 01, 2013 at 11:13 PM 0
Share

I found there is a slight decrease in latency if you do the following;

  • Change Buffer size (which you've done)

  • Audio Format : Compressed ($$anonymous$$PEG)

  • 3D Sound : un-select

  • Load Type : Decompress on load

  • Create a SFX Pool

I'm working on a rhythm game and I've had to approach it differently so that it works and feels in time. I hear it works fine on iOS

avatar image ulgerang · May 02, 2013 at 02:32 AM 0
Share

thanks for answers. my Unity version is 4.1.2f1 . for that problem, i made android plugin which have functions that make sounds. and it works.

anyway, thanks for your anwsers.

avatar image hunz · May 02, 2013 at 02:38 AM 0
Share

Oh sweet. I'm no coder. I use play maker to do all my logic and am stuck with whatever flaws exists in those frame works. If you ever felt like sharing/selling the plug please P$$anonymous$$ me.

avatar image fadden · Apr 29, 2015 at 10:57 PM 0
Share

Simple plugin and Unity project are available here: https://github.com/fadden/android-audio-bypass

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ulgerang · May 03, 2013 at 01:09 AM

sorry, hunz. my plugin is customized for my app. and also i think it would be little bit hard to make it general. but making the plugin is not so hard. if you can write few line of code, i think you can make it work. anyway, my solution is using SoundPool.

following code is from my android plugin. if you know some programmer. it will be very helpful to make your plugin.

for making android plugin, you need to read it. http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html

and my code.

private void initSound() { sound_pool = new SoundPool( 20, AudioManager.STREAM_MUSIC, 0 );

     soundNumbers[0] = sound_pool.load( this.getApplicationContext(), R.raw.bhammer, 1 );     
     soundNumbers[1] = sound_pool.load( this.getApplicationContext(), R.raw.bhole, 1 ); 
 ...
 public int playSound(int i,boolean isForever){

     return sound_pool.play( soundNumbers[i], 1f, 1f, 0, isForever? -1:0, 1f );

 }

 public void stopSound(int i){
     sound_pool.stop(i);    

 }


 protected void onCreate (Bundle savedInstanceState)
 {

     super.onCreate(savedInstanceState);
     
     initSound();

...

if you don't know any programmer, you can send me email for that. (my email is 'ulgerang@gmail.com')

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 sa- · Jun 17, 2013 at 09:41 PM 0
Share

Not sure if posting your email ID is a wise idea.

avatar image
0

Answer by ChristopherCreates · Jun 16, 2015 at 05:45 AM

I've written an asset that uses the native Android audio system for low-latency playback.

Check it out. :)

Asset Store: Android Native Audio

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

16 People are following this question.

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

Related Questions

Android Sound Delay 0 Answers

What would be the best audio file atributes for handheld device? 0 Answers

How to know if my speakers are mute? c# android/ios 0 Answers

Android screen rotation very slow and my audio keeps going but the graphics stop 0 Answers

How do you use speakerphone in Android games? 0 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