- Home /
Can you load an AudioClip from the file system w/o using WWW?
I need to load audio files at runtime from the file system into AudioClips for playback. Everything I've read seems to suggest the "right" way to do this is via the WWW class. Create a WWW instance using the file:// protocol, yield, and then the AudioClip is automatically generated by the WWW class in WWW.audioClip.
Now, this works, but I don't like it. For starters, this feels like a hacky workaround to me. So, I was never that comfortable with it to begin with. But what I really want to do is write a synchronous function that takes a filename and returns an AudioClip immediately. I don't want to deal with coroutines and yielding and callback delegates. That all just feels like unnecessary hassle.
Basically, I'm trying to write the AudioClip equivalent of Texture2D.LoadImage() (which I think should be in Unity to begin with).
Anybody think this is possible?
Your answer
Follow this Question
Related Questions
www.getAudioClip() Bug: One Second being cut off MP3. 2 Answers
WWW Audio and PlayOneShot: Playing the same AudioClip Twice Cuts off First Instance 1 Answer
Record/Save/Playback of Audio clips.. How to? 3 Answers
How can I load an AudioClip from a local audio file using UnityWebRequests? 1 Answer
WWW.audioClip error: Unable to determine the audio type from the URL 1 Answer