Posted on the forum, I duplicate here in case. Am I the only one having these really weird bugs?
1)Hi to all!
Working on a music game for iPad, a project in which a low latency is of course crucial. I figured I would try to lower it once the project is close to completion, and everything is hunky dory except for a few strange quirks:
used AudioSettings.GetDSPBufferSize(bufferSize,numBuffe rs) to be certain of the default best latency settings. This gave me 1024 and 4.
then set it to 512 and 8 (AudioSettings.SetDSPBufferSize(512,8), to test. In the editor, a simple debug confirmed the new buffer's size. Built to iPad, no sound and the debug now giving me 256 and 4. Back to the editor, I delete the SetDSP line, run again : still 512 and 8. Had to reboot Unity to revert back to the default settings. Build again, debug still shows 256 and 4 on the iPad, but this time the audio is working, and latency has improved.
I'm a bit puzzled! I searched all my scripts, there's only one SetDSP call, and it's commented out. And where does the 256 and 4 numbers come from? Never even tried it. Is that the default setting for best latency on iOS devices? Seems like an extremely small buffer to me...
2)Just ran into another quirk, worse than the last alas!
Since the iPad's sample output rate is 24k, I down sampled all my samples (everything was at 44.1), and set the AudioSettings.outputSampleRate to 24000. No matter where I put the instruction, log and my ears show that when running in the editor, the sample rate stays at 44.1. Tried re-importing all assets, nothing. On the iPad, it works fine, no pitch shifted notes, but all offset values in Play(offset) instructions are still calculated as if the sample rate was 44.1k. It swings a lot, but that's not the idea! Something definitely fishy going around there...
Just upgraded to 5.1, no improvement. Tested thoroughly the Play(offset) behaviour, locked to 44.1 khz whatever the sample rate of the clip. Sniff. Despair. Tears.
Where'd you get this information? "the iPad's sample output rate is 24k"
@jessy http://answers.unity3d.com/questions/205085/what-is-fmods-audio-mixer-sample-rate.html last comment, and Debug.Log(AudioSettings.outputSampleRate); On the device, that is, in the editor it prints 44.1k.
Further searches indicate the comment found in the link quoted above is simply wrong. iPad's output sample rate is indeed not 24k... But why does the Log say it is?
Nobody else having these quirks?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
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, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
5 People are following this question.
music (2d audio) kills game framerate
how to downsampling audio data
Why is the data I pass into OnAudioFilterRead() resulting in glitchy audio?
Unity 4.1 Movie Texture issue
Intensity of sound.