MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

How would someone go about saving Audio Clips?

Open dtb49 opened this issue 9 years ago • 5 comments

Overview

I've seen in several Microsoft promotional videos of users being able to record their voice and have it saved so that they can come back to it later (i.e Ford spotlight). I am able to record and play back my recording but how would I go about saving them for later use?

I didn't see any scripts in the tool kit relating to this so, possible future request also.

dtb49 avatar Nov 20 '17 20:11 dtb49

I had to do this myself and found two ways of implementing. At first I use this custom SavWav class to convert an AudioClip to a .wav, which you can find here: https://gist.github.com/darktable/2317063 Got that working pretty easily, but then I got the Unity Asset File Manager, which had a method built in to do that too. Converting to an .mp3 file is a more involved process, but doable.. Found an implementation for that here: https://github.com/BeatUpir/Unity3D-save-audioClip-to-MP3 but I haven't tried it yet.

Skquark avatar Nov 22 '17 02:11 Skquark

Fortunately I don't need to convert them to an MP3, .wav works fine for me. I basically used WavSav to save them and then I took the file path string and saved it to a PlayerPrefX String Array and I also saved the user's cursor position and stored that into a PlayerPrefX Vector3 array. Then I instantiate a cube with an AudioSource at that position and use www to load the AudioClip onto the AudioSource and then when I airtap on the cube it plays the AudioClip back to me.

Whenever I start back up the app I retrieve my arrays and instantiate all the cubes back to their positions. When I get the position of the cursor before I save it I get my Anchor.transform.InverseTransformPoint on my cursor's position to save it relative to the anchor.

That is what I have so far anyway. Still working out the kinks of it, but I think its pretty good so far.

dtb49 avatar Nov 22 '17 17:11 dtb49

@DaveSullivanAtWork would the new audio bank system help with this?

StephenHodgson avatar Nov 22 '17 18:11 StephenHodgson

@StephenHodgson No, this functionality used to be in the MicStream code (HoloToolkit.Unity.InputModule.MicStream) that seems to have been removed (WACK Failure on the supporting dll sited).

DaveSullivanAtWork avatar Nov 23 '17 10:11 DaveSullivanAtWork

MicStreamSelector dll is back in the toolkit!

david-c-kline avatar May 21 '18 22:05 david-c-kline