public static byte[] ExportAudio(AudioClip audioClip) { byte[] data = (byte[])audioClip.GetAudioData(); if (data.Length == 0) { return(null); } return(AudioConverter.ConvertToWav(data)); }
public static bool ExportAudio(IExportContainer container, AudioClip audioClip, Stream exportStream) { using (MemoryStream memStream = new MemoryStream()) { audioClip.ExportBinary(container, memStream); if (memStream.Length == 0) { return(false); } byte[] data = memStream.ToArray(); return(AudioConverter.ConvertToWav(data, exportStream)); } }