Hi everyone !
When I’m loading clips from web I’ve got this issue.
private IEnumerator WaitAudioclipLoad(string shortCode, string url)
{
WWW ww = new WWW(url);
yield return ww;
if (ww.error != null)
{
Debug.Log("ErrorOccured :" + ww.error);
OnAudioclipLoaded(shortCode, null);
}
else
{
var audioClip = ww.GetAudioClip(false, false, AudioType.MPEG);
audioClip.LoadAudioData();
File.WriteAllBytes(Application.dataPath + "/" + shortCode + ".mp3", ww.bytes);
Debug.Log("
");
Debug.Log("channels " + audioClip.channels);
Debug.Log("frequency " + audioClip.frequency);
Debug.Log("length " + audioClip.length);
Debug.Log("loadState " + audioClip.loadState);
Debug.Log("loadType " + audioClip.loadType);
Debug.Log("preloadAudioData " + audioClip.preloadAudioData);
Debug.Log("samples " + audioClip.samples);
Debug.Log("
");
CacheProvider.CacheProvider.Instance.AddToCache(shortCode, ww.bytes, audioClip);
OnAudioclipLoaded(shortCode, audioClip);
}
ww.Dispose();
}
i load the clip via www ( and wait til the clip is loaded). ater that I save the clip locally ( exaple is for editor) and dump AC data to console.
and some strange things I sow in console:
-
if frequency is 44100Hz - length is normal
-
if frequency is 24000Hz - length is multiplied by two
Is there any way to get normal lenght ?