Hi!
I’m using Unity 4.2.1 for developing a game, and I need to mix some short clips into a full song.
This is the code I’m using:
I create an AudioClip, then I get the data of the full song, and of the short clips, then I try to mix the clips into the song data, and set to the created clip.
After the GetData from songClip, songData is a big array of 0’s.
As I read, this issue was fixed, but don’t know if it’s not solved, or it’s my fault.
BTW, I’m not using WWW (that I’m aware of). I’ve added an Audio Source to a GameObject (which has an sprite, and some scripts), put the .ogg file from the project files to the box named Aucio Clip.
gregzo suggested me to use a Wave file instead of an OGG.
I exported the OGG to a WAV file in Floating point format, and then GetData seemed to return the correct Data.
But… why it won’t work with an OGG file?
Was about to answer, good to see you figured it out. Indeed, the default “compressed in memory” setting is the only one whith which GetData does not work. About ExtractOggFile, can’t help much, never used it…
They are not meant to be used elsewhere. If you need compressing audio to ogg, you should implement a native plugin that handles it.
Or maybe some asset on the Asset Store can help? I haven’t looked, but you never know…
You’ll have to code 2 if you want to support both iOS and Android.
It’s an asset the store really lacks - native audio tools ( resampling, compression, audiocopy etc… ). I thought about doing it a while back, but I fear the market is very small…