Unity Community


Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 41

  1. Location
    Switzerland
    Posts
    88
    Sample rate 44100 Hz
    Channels 2
    Bitrate 128 kbps
    Codec MP3
    Codec profile MP3 CBR
    Tool LAME3.98r

    I had the same problem with an uncompressed WAV file. Both generated with Audacity.

    The audio file plays well on the device (Kindle Fire Music Player) and I think that Unity re-encodes the MP3 file, even if I chose the same bitrate in the engine as the original file has.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  2. Location
    Italy
    Posts
    468
    Try to use .ogg format for all your sounds, and see what happens.


  3. Location
    Switzerland
    Posts
    88
    I tried but still the same. Why do you think this should help? The .ogg files get converted to mp3 by the importer anyway. The result should not differ from using uncompressed audio files.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  4. Posts
    50
    Can you create a small project containing the issue and minimal code snippets to make it work so we can look at it? Any audio file that gives the same result is fine, as long as whatever you send can reproduce the problem.


  5. Location
    Switzerland
    Posts
    88
    I created a small project with the main track (no code necessary). If you PM me your email address, I will send you the Unity scene file as well as the MP3 file.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  6. Posts
    1
    I was using the code in the following on iPad2, it's working:
    audio.PlayOneShot(voiceP0);

    But after I converted to Kindle Fire today, not working with same code. I have to change my code to:
    AudioSource.PlayClipAtPoint(voiceP0, camera.transform.position);

    But a new issue came out, I don't how to stop the audio with this new code...anyone?


  7. Location
    Italy
    Posts
    468
    PlayClipAtPoint will pop out a new game object that will be auto destroyed when finished playing.
    See also this code if you want to implement this manually, and may help you. I'm also interested in Unity Kindle performance.

    Code:  
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class example : MonoBehaviour {
    5.     public AudioClip theClip;
    6.     AudioSource PlayAudioClip(AudioClip clip, Vector3 position, float volume) {
    7.         GameObject go = new GameObject("One shot audio");
    8.         go.transform.position = position;
    9.         AudioSource source = go.AddComponent<AudioSource>();
    10.         source.clip = clip;
    11.         source.volume = volume;
    12.         source.Play();
    13.         Destroy(go, clip.length);
    14.         return source;
    15.     }
    16.     void Example() {
    17.         PlayAudioClip(theClip, transform.position, 1);
    18.     }
    19. }

    http://unity3d.com/support/documenta...ipAtPoint.html


  8. Posts
    19
    Just wanted to add my experience with Kindle Fire audio to this thread.

    I have the following issues:

    - All audio is delayed by about half a second.
    - I get intermittent pops/clicks.
    - Sounds often do not play at all. This seems to be most common with very short clips.


  9. Posts
    110
    I saw this on the latest Marmalade news and wondered if it was relevant:

    We recently added two new projects to GitHub related to using sound with Marmalade. On the Kindle Fire when using s3eSound there can be some latency due to the type of hardware used in this device. We have implemented s3eSoundPool, an extension that allows you to pre-load sounds for playing, and s3eSoundBoard providing an example of how to use the extension.
    And from the project:

    s3eSoundPool is a Marmalade extension for the Android SoundPool API. It allows for preloading of sound samples, which can help achieve low latency.
    So maybe there's something UT can do to help on the Fire.


  10. Location
    Switzerland
    Posts
    88
    Unity support told me that they could reproduce the clicking and popping sound issue and that they do not have any workaround to offer for now. They will investigate into this matter for another release.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  11. Posts
    19
    I've managed to work around one of my sound issues on the Kindle Fire. It seems that very short sound files play sporadically. If you pad the sound out with some silence, though, it works reliably. Not sure what the exact minimum length is, but 1/2 second works fine.

    I haven't been able to solve the agonizing sound latency issue, though. Sound latency on the Fire seems to be bad in general, but Unity is definitely making it worse.


  12. Posts
    9
    I'm having the same problem on the Kindle Fire. I spent a few hours trying various things with my source audio (changing its sample rate, format, encoding options, etc), but in all cases, the audio pops when played on a Kindle Fire. I assume it's some sort of bad interaction between Unity's MP3 encoding and the Kindle Fire's audio decoding. For a game that I've spent some 7-8 months on, I'm not willing to release it on the Amazon Appstore with such an obvious and unprofessional flaw, so I did the only thing I could think of to get around Unity's audio encoding: play my background music with Android's MediaPlayer class. It's a workaround that I'm not thrilled with, but it does work. Info and code for anyone interested...

    NOTE: With Android's MediaPlayer, there's a very slight (but audible) gap when my audio loops. I'm still trying to figure out how to deal with that. [UPDATE: Using an OGG file instead of an MP3 file allows for gapless looping]

    Put a copy of the mp3 file you want to play in your Assets folder under Assets/StreamingAssets/. It'll be accessible as a raw, unprocessed file on the Android side of things.

    To play the audio on iOS and non-Kindle devices, I use this class (BackgroundAudioPlayer.js):

    Code:  
    1. #pragma strict
    2.  
    3. var m_audioSource : AudioSource;
    4.  
    5. function Initialize (clip:AudioClip) {
    6.     m_audioSource = gameObject.AddComponent (AudioSource);
    7.  
    8.     m_audioSource.playOnAwake = false;
    9.     m_audioSource.loop = true;
    10.     m_audioSource.clip = clip;
    11. }
    12.  
    13. function IsPlaying () : boolean {
    14.     return m_audioSource.isPlaying;
    15. }
    16.  
    17. function Play () {
    18.     m_audioSource.Play ();
    19. }
    20.  
    21. function Pause () {
    22.     m_audioSource.Pause ();
    23. }

    And then on a Kindle Fire, I use a subclass of BackgroundAudioPlayer instead:

    Code:  
    1. #pragma strict
    2.  
    3. class AndroidMediaBackgroundAudioPlayer extends BackgroundAudioPlayer {
    4. #if UNITY_ANDROID
    5.  
    6.     var m_mediaPlayer : AndroidJavaObject;
    7.     var m_isPlaying : boolean;
    8.  
    9.     function Initialize (fileName:String) {
    10.         m_isPlaying = false;
    11.  
    12.         var playerClass : AndroidJavaClass = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
    13.         var activityObj : AndroidJavaObject = playerClass.GetStatic.<AndroidJavaObject> ("currentActivity");
    14.    
    15.         var assetManager        : AndroidJavaObject = activityObj.Call.<AndroidJavaObject> ("getAssets");
    16.         var assetFileDescriptor : AndroidJavaObject = assetManager.Call.<AndroidJavaObject> ("openFd", fileName);
    17.         var fileDescriptor      : AndroidJavaObject = assetFileDescriptor.Call.<AndroidJavaObject> ("getFileDescriptor");
    18.        
    19.         m_mediaPlayer = new AndroidJavaObject ("android.media.MediaPlayer");
    20.         m_mediaPlayer.Call ("setDataSource", fileDescriptor, assetFileDescriptor.Call.<long> ("getStartOffset"), assetFileDescriptor.Call.<long> ("getLength"));
    21.         m_mediaPlayer.Call ("prepare");
    22.         m_mediaPlayer.Call ("setLooping", true);
    23.     }
    24.  
    25.     function Play () {
    26.         m_mediaPlayer.Call ("start");
    27.         m_isPlaying = true;
    28.     }
    29.  
    30.     function Pause () {
    31.         m_mediaPlayer.Call ("pause");
    32.         m_isPlaying = false;
    33.     }
    34.  
    35.     function IsPlaying () {
    36.         return m_isPlaying;
    37.     }
    38.  
    39.     function OnDestroy () {
    40.         m_mediaPlayer.Call ("stop");
    41.         m_mediaPlayer.Call ("release");
    42.         m_mediaPlayer = null;
    43.     }
    44.  
    45.     // The Android MediaPlayer will keep playing while our app is suspended, so we need to handle that when the app is suspended or resumed.
    46.     function OnApplicationPause (pause:boolean) {
    47.         if (pause) {
    48.             if (m_isPlaying)
    49.                 m_mediaPlayer.Call ("pause");
    50.         }
    51.  
    52.         else {
    53.             if (m_isPlaying)
    54.                 m_mediaPlayer.Call ("start");
    55.         }
    56.     }
    57.  
    58. #endif
    59. }

    It's not a perfect solution...I end up with two copies of the mp3 in my final build, one for the Kindle Fire and one for other devices. But if you really need a way to play background music on a Kindle Fire, it's the best workaround I've found so far.
    Last edited by Radazen; 05-08-2012 at 12:20 PM.


  13. Posts
    9
    Update: I converted my audio file to OGG, which does have native support for gapless looping on Android, and now my audio loops perfectly.


  14. Location
    Switzerland
    Posts
    88
    Wow! You did a great job! I hope this helps you sell your game on Amazon. Regarding the Kindle platform, all I got from Amazon since months is "Please note that we may review your app separately for Kindle Fire." with no further comment about a Kindle specific issue (the sound). The small number of units I sold in their appstore run probably on other devices.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  15. Location
    Oregon
    Posts
    5
    Quote Originally Posted by ladron View Post
    I haven't been able to solve the agonizing sound latency issue, though. Sound latency on the Fire seems to be bad in general, but Unity is definitely making it worse.
    We're having the same issue. Anyone find a solution to the latency problem?


  16. Posts
    50
    I've been having the same issue too, but strangely enough it only seems to happen on one of my projects and not the other.
    For anyone curious this is what the popping sounds like https://dl.dropbox.com/u/17977639/Un...ppingSound.wav

    One big thing I noticed on my non-popping project is that I reduced the volume of the BG music down to 75% since it seemed to be playing exceptionally louder than normal with the default settings.


  17. Location
    Switzerland
    Posts
    88
    Unity support acknowledged the issue some time ago (cf. above post) and the last time I tested my game on a Kindle it was acceptable (apk built with Unity 3.5.3). Unfortunately I do not know whether this issue has been officially addressed with in a recent Unity update.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  18. Location
    3dautosports.com
    Posts
    66
    Sorry to bring up an old post. But I wanted to ask if your sound issue sounds the same as mine: http://youtu.be/aTZ97HKpGMk


  19. Location
    Switzerland
    Posts
    88
    The issue I had should have been addressed and fixed. Since Solstice is free now, please download a copy from Amazon or install the APK on your Kindle from here.

    As soon as the game starts, the background music starts and in the game are several sound effects (thrusters, laser beams) so you can check if there is a similarity to your problem.

    Solstice never got rejected on the Kindle for sound issues and the downloads on Amazon where so marginal that I always released Solstice as is.
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!


  20. Location
    Switzerland
    Posts
    88
    Listening to your video on Youtube, I think that what I had was more choppy, more hardware related. I preloaded all the audio files (not 100% sure for the music anymore). What you have here is perhaps a streaming issue. Does it sound like that if you preload the files?
    Games by Deepseaweed: Solstice, a 3D Space Fleet Combat Real Time Strategy Game for Android devices. Available now!

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •