Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Loading Audio

cpetercpeter
edited April 2017 in Questions And Answers

Using Unity 5.5.1

I'm trying to load a .wav file at run time in unity. I've tried using WWW but I feel like that runs into the same issue that it does with .mp4 videos.

I get a Access Denied Error where ever the file is located.

    WWW www = new WWW("file://" + path);
    print("loading " + path);

    AudioClip clip = www.GetAudioClip(false, false, AudioType.WAV);
    while (clip.loadState != AudioDataLoadState.Loaded)
        yield return www;

    Debug.Log("Done loading audio clip.");

    audioSource.clip = clip;
Tagged:

Best Answer

  • Options
    cpetercpeter
    Answer ✓

    I ended up solving it by using a filestream to load in the .wav as a byte[]. Then parsed through the byte[] to create a float[] of samples that could then create an audio clip.

Answers

  • Options
    cpetercpeter
    Answer ✓

    I ended up solving it by using a filestream to load in the .wav as a byte[]. Then parsed through the byte[] to create a float[] of samples that could then create an audio clip.

Sign In or Register to comment.