Hi,
in my App I have an wavefile as an System.IO.Stream in c# and trying to push this as Clip for an AudioClip. Is there anyway to do so. Actual I write the Bytes of the Stream to HD and calling Resource.Load method. This works but it is a really bad hack.
Is there any possibility to solve that? Actual I’m using the free Version but I’m thinking of buying the pro version.
Thanks in advance
Hi, welcome to the forum!
I don’t think there is any direct way to pass audio data from a stream to Unity’s audio system. If you can convert the audio file to Ogg Vorbis, you can load it using the WWW class. Just use a file:/// URL and use the audioClip property to access the data as a standard Unity AudioClip.
Hi and thanks for response,
I cannot see the advantage of using www class. With this solution I have to convert the clip in ogg, write it again to disk and use the file url actual I don’t want to write it down. Also I don’t know if there is an ogg converter available in c#.
Maybe I can inherit from the AudioClip Class and convert the Sream in the Dataformat this class uses. is there any documentation available except the audioclip inspector docs?
Thanks
There isn’t any documentation or API for doing this. The only approach I can think of is using the WWW class as I suggested above.