Hello, has anyone else experienced sound issues on the Kindle Fire? I hear a constant clicking noise, nearly rhythmic. Sound works fine one Nexus S and Xoom, but I had to implement a fader because stopping an AudioSource always made noise, too. I'm importing WAV-files, 16 bit, 44100 Hz, Mono with Audio Importer setting Decompress on load. Any help appreciated!
We too are having this issue, tried various settings in the Audio Importer. Unity 3.4.2f3, API level 8
It seems to be a Unity problem. I tested a new version of the game and the audio files sound well directly on the device, but not in the game. I'm working with Unity 3.5.0f5.
No sound issues here. Using Kndle Fire and Nexus. Same Unity version too. I have already compressed my audio to mp3 though.
Great to know! I also pre-compressed one of the files for the current release but still hear noise on the Kindle. Could you note the values of your audio settings and tell me where you attached the AudioSource to? Mine is attached as child object to the camera in one scene. Even though it's a 2D sound, perhaps the distance to the camera could be a problem.
I'm having audio issues regardless of quality even if it is pre-compressed. It happens due to asset unloading in my case. Which sucks because my game has a LOT of asset loading and unloading going on during gameplay. When I contacted Unity about the problem they referred me to this feedback request: http://feedback.unity3d.com/forums/15792-unity/suggestions/2380640-sound-priority
Hi (A non techie here) We are experiencing the same issue with our apps on the Kindle Fire. The issue is Kindle Fire Specific only in our case, the apps are working fine on all other Android devices we have tested ( including the Nook color, Nook Tablet, Acer iconia, Samsung galaxy Tab, and a host of android phones), as well as working fine on iOS, Mac and PC builds Our Apps "Universal Breathing - Pranayama" And "Core Yoga" both have popping sounds on the kindle fire. These sounds occur once at the beginning whenever a new music segment is played, our apps generate their sounds by stitching and looping segments of music. Since in a 2.5 second period we stitch 3 segments of music together it makes for a lot of "popping" sounds on the kindle fire and a poor user experience.
I'm having a similar issue with audio on Android. I play a clip (OnAwake) and when the object is destroyed there is a "POP" sound. I've tried stopping the audio, muting the audio (same as setting *.volume = 0.0; ) to no avail. I'm using Unity 3d/Android Pro, latest version 3.5. I really need to fix this issue, but everything I'm trying is not helping at all.
I think the best you could do is to manually do a stair step fade using a coroutine before destroying the object completely. I doubt that this issue is specific to the Kindle.
Wouldn't that result in the same basic thing as setting it to mute? Fading (in the end) just reduces the volume. Or am I missing another reason why step-fading would be better? Thanks for the response!
A 'pop' is a sharp transition. So for example if the signal was at 1.0f and you stop and it immediately goes to 0.0f. Depending on how the internals are set up, mute should trigger a ramp (fade out) which would be just as good, the important thing is to make sure it has time to process that mute (at least a couple of frames). Step fading is always inferrior but it's all you can do from outside the mixer, I think calling mute would probably be a better way to go it if it works.
OK, I see your logic now. I am muting just before the destruction, so I'll try to break the audio from the main object and split it from the parent just before the destruct call; then give the AudioSource some time to see if it alleviates the POP sound. I'll let you know when I get to if, if it helps. I'm working on some Enemy AI scripts now, when done - I'll post. Thanks again! JS
OK, your help was appreciated and did pinpoint the issue. Here's how I implemented it. I moved the AudioSource from the GameObject prefab into a GameObject of its own, parented under the original GameObject. When I need to destroy a sound gracefully (without popping), I use the script below - ON the AudioSource GameObject under the original (parent) object. The script simply checks the GameObject that it is attached to see if it is still parented. If it is, nothing is done. If you clear the parenting of the AudioSource GameObject from the parent, the script will fade out and destroy the object the audio script are attached to over numerous frames (dependent on current volume / stepFactor setting) to smooth the audio destruction and alleviate the sharp volume transitions to prevent pop. Again, thank you, help appreciated - script below to repay the community, if anyone needs it! JS -- Script Start (javascript) -- #pragma strict var stepFactor : float = 0.05; private var aSource : AudioSource; function Awake() { aSource = gameObject.GetComponent(AudioSource); } function FixedUpdate() { // Once we detach from our parent, we'll fade and die without audio popping noises if (transform.parent != null) return; if (aSource != null) // Be sure this object actually has an audio source! { aSource.audio.volume -= stepFactor; if (aSource.audio.volume > 0) return; } else Debug.Log("Object named \"" + gameObject.name + "\" has no AudioSource!"); Destroy(gameObject); } -- Script End. Enjoy! If you use the script and you till hear audio pop, just adjust the stepFactor in the Unity GUI (Inspector view of the audio object the script is attached to). The smaller the step, the more time (and thus FixedUpdate calls) it will take to kill the audio.
My sound sources aren't attached to the camera. I can see it being an issue if you are destroying objects, but if it is the sound track (always on) it should play perfectly. Have you tried on another Kindle?
I do not have another Kindle to test but the music file runs fine in the Kindle's music player. I'm testing with a simple Unity project now: no other game objects than the camera and an empty game object with the audio source attached to it, but still no luck Audio Format: Compressed (MPEG) 3D Sound: No Load type: Stream from disc (but same with Decompress on load) Compression (kbps): 128 (same as the source file that runs fine on the device) Audio Source Priority: 0 (but same result with 128) Play On Awake: Yes Loop: Yes
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.
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.
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.
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.
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?
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 (csharp): using UnityEngine; using System.Collections; public class example : MonoBehaviour { public AudioClip theClip; AudioSource PlayAudioClip(AudioClip clip, Vector3 position, float volume) { GameObject go = new GameObject("One shot audio"); go.transform.position = position; AudioSource source = go.AddComponent<AudioSource>(); source.clip = clip; source.volume = volume; source.Play(); Destroy(go, clip.length); return source; } void Example() { PlayAudioClip(theClip, transform.position, 1); } } http://unity3d.com/support/documentation/ScriptReference/AudioSource.PlayClipAtPoint.html
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.
I saw this on the latest Marmalade news and wondered if it was relevant: And from the project: So maybe there's something UT can do to help on the Fire.
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.
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.
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 (csharp): #pragma strict var m_audioSource : AudioSource; function Initialize (clip:AudioClip) { m_audioSource = gameObject.AddComponent (AudioSource); m_audioSource.playOnAwake = false; m_audioSource.loop = true; m_audioSource.clip = clip; } function IsPlaying () : boolean { return m_audioSource.isPlaying; } function Play () { m_audioSource.Play (); } function Pause () { m_audioSource.Pause (); } And then on a Kindle Fire, I use a subclass of BackgroundAudioPlayer instead: Code (csharp): #pragma strict class AndroidMediaBackgroundAudioPlayer extends BackgroundAudioPlayer { #if UNITY_ANDROID var m_mediaPlayer : AndroidJavaObject; var m_isPlaying : boolean; function Initialize (fileName:String) { m_isPlaying = false; var playerClass : AndroidJavaClass = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); var activityObj : AndroidJavaObject = playerClass.GetStatic.<AndroidJavaObject> ("currentActivity"); var assetManager : AndroidJavaObject = activityObj.Call.<AndroidJavaObject> ("getAssets"); var assetFileDescriptor : AndroidJavaObject = assetManager.Call.<AndroidJavaObject> ("openFd", fileName); var fileDescriptor : AndroidJavaObject = assetFileDescriptor.Call.<AndroidJavaObject> ("getFileDescriptor"); m_mediaPlayer = new AndroidJavaObject ("android.media.MediaPlayer"); m_mediaPlayer.Call ("setDataSource", fileDescriptor, assetFileDescriptor.Call.<long> ("getStartOffset"), assetFileDescriptor.Call.<long> ("getLength")); m_mediaPlayer.Call ("prepare"); m_mediaPlayer.Call ("setLooping", true); } function Play () { m_mediaPlayer.Call ("start"); m_isPlaying = true; } function Pause () { m_mediaPlayer.Call ("pause"); m_isPlaying = false; } function IsPlaying () { return m_isPlaying; } function OnDestroy () { m_mediaPlayer.Call ("stop"); m_mediaPlayer.Call ("release"); m_mediaPlayer = null; } // The Android MediaPlayer will keep playing while our app is suspended, so we need to handle that when the app is suspended or resumed. function OnApplicationPause (pause:boolean) { if (pause) { if (m_isPlaying) m_mediaPlayer.Call ("pause"); } else { if (m_isPlaying) m_mediaPlayer.Call ("start"); } } #endif } 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.
Update: I converted my audio file to OGG, which does have native support for gapless looping on Android, and now my audio loops perfectly.
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.
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/Unity/PoppingSound.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.
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.
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
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.
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?
Thanks for the reply. Turns out that the issue stems from the Ultimate FPS package. We are working on the issue now, but I fixed it by taking out the UFPS Rig and just using the Unity example one. Sound issue fixed!? I still think it is a great package, and the creator has been very helpful. You are more then welcome to follow it here