Loading .wav file from persistent data path on startup

Updated on July 28, 2018 in [A] Audio
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
5 on April 30, 2015

Im making an app that lets you record a sound and then play it back. As of now i am able to record a sound and save it to the apps persistant data path. the .wav files are right there within my reach, i just cant figure out how to load them back as clips for the audio source the next time i start the app. let me be as clear as possible,
1: record sound in app and save as .wav file, done.
2: able to play back sound in app, done.
3: close app and restart, load .wav back as clip, not done.

if anyone can help in anyway, even just nudge me in the right direction, it would be appreciated. using c# on android.

  • Liked by
Reply
0 on April 30, 2015

I think google is going to be bankrupt…
It seems that nobody uses it anymore!

No really, in under 1 minute of googling I found this:
http://stackoverflow.com/questions/15948046/how-to-play-sounds-loaded-on-the-fly

  • Liked by
Reply
Cancel
1 on April 30, 2015

i dont know what this “google” you are referring to is.. but ask.com came up with nothing, 😉 thanks, ill look that over. i guess my mind has been melting from this project.

Guru
on April 30, 2015

No worries, just search thoroughly before asking next time 🙂

Show more replies
  • Liked by
Reply
Cancel
0 on May 1, 2015

after much frustration this and all other “solutions” have/has not worked. the closest ive gotten is by using 
WWW www = new WWW(“file://” + Application.persistentDataPath +”FILENAME.wav”);
and 
clip1 = www.GetAudioClip(true, true);
aud.clip = clip1;

that actually sets the audiosorce.clip to a file. but the set file is empty. i notice that if i change the filename at the end of the WWW path to anything (as long as it has .wav) it will do the same thing.

so its finding where the file is, its setting /something/ in the inspector but the clip has nothing to play.

  • Liked by
Reply
Cancel
0 on July 28, 2018

I’m at the exact same point of struggle myself.

I can load the file to an AudioClip – but it is completely empty.

Even trying to read the raw PCM data from the file and AudioClip.SetData() to do it the long way, but no examples of such…

  • Liked by
Reply
Cancel