简体   繁体   中英

Converting a complex variable to byte[] or Audioclip in Unity3d

I have a complex variable that is actually a wav file that I receive back from a request to AT&T. The variable is stored as ATT_MSSDK.TextToSpeechv1.TextToSpeechResponse (var). I would like Unity to be able to play this as an audioclip but I cannot for the life of me figure out how to do it. Do YOU have any suggestions? If I can some how parse this variable into a byte[] I could possible convert it into an audio clip but I can't figure out how to parse a complex non-primitive variable into byte[] or AudioClip. Please help me!

TextToSpeechResponse object has SpeechContent property of type byte[] ( https://wprod.code-api-att.com/MSSDK/PROD/docs/a00139.html ).

So there's nothing to convert, just use that property value.

But you should probably check ContentType property first to determine audio format. You might need to decode it before playback.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM