- Home /
www.GetAudioClip produces harsh white noise
Hey guys, having a pretty strange issue with www.GetAudioClip. I'm loading a five-minute audio file (the user can re-record it, so it has to be loaded dynamically at runtime). Unfortunately, about half the time that I load it, what comes out is shrill white noise. It bears some resemblance to the original audio file -- silences correspond to lulls in the screaming, but all the details have been garbled beyond recognition.
To cover the obvious stuff, I've checked the audio file I'm loading several times, and it's fine in VLC (and again, sometimes the audio file comes through uncorrupted.
The code that handles it is below. Any ideas what might be up?
void loadAndPlayAudio(string name)
{
WWW www = new WWW(@"file:///" + Application.dataPath + "/Resources/" + name);
if (source.clip != null)
{
return;
}
clip = (AudioClip)www.GetAudioClip(true, true, AudioType.WAV);
while (!clip.isReadyToPlay)
{
}
if (clip.loadState == AudioDataLoadState.Failed)
{
print("Audio Load Failure");
loadAndPlayAudio(name);
}
source.clip = clip;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612050309im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Audioclip from WWW.getAudioClip(...) never gets ready 1 Answer
www.getAudioClip() Bug: One Second being cut off MP3. 2 Answers
Can you load an AudioClip from the file system w/o using WWW? 0 Answers
WWW.audioClip error: Unable to determine the audio type from the URL 1 Answer
WWW.GetAudioClip Freeze 1 Answer