Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by AVividLight · Feb 16, 2013 at 07:55 PM · c#audiobyte

Play audio from byte array

Hey guys,

I've searched around a bit, but didn't find anything helpful. If I missed something, please let me know! Anyway, I have an encrypted wav file that I want to play using Unity's built-in audio system. The issue is that once I decrypt it, it can't be within reach of the user, so I have to keep it as a byte array. But, I can't find any way to play audio from a byte array, and that's my issue.

So, if you have any suggestions, tips, comments, et cetera, please let me know!

Thanks for taking the time to read this! - Gibson

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by GerryM · Feb 16, 2013 at 09:00 PM

You could make an asset bundle with your (decrypted) sound file. Then encrypt the bundle file.

To play, load that file into memory, decrypt it at runtime and use CreateFromMemory to access your asset. Then you could load the audio source and play it. Just an idea.

edit----

Or you could load your custom data, decrypt it, then convert the byte array to a float array. Then you can create an audio clip and fill it with your float data.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AVividLight · Feb 17, 2013 at 01:56 AM 0
Share

-EditEdit- After some critical thinking (something I guess I don't excel at, considering how long it took for me to figure this out), I've realized I can make the audio an asset bundle before I upload it. I feel really stupid, dismissing this option because I couldn't make an asset bundle from my file in memory. Anyway, I think that the asset bundle option is what I'm going with, so thanks for suggesting it to me!


-Edit- Both options won't work, sorry, but thanks for the ideas! The issue with the second is that I need to use compressed WAVs, and I can't seem to get samples from them.


The first option won't work, because it isn't in memory; it's downloaded at runtime, already encrypted. But, the second option might work. What do you mean, "load your custom data"? Also, after the file is decrypted, it's in a byte array, so would I just convert that to a float array, or would I have to get samples from it, or something?

Thanks for the help, I really appreciate it!

avatar image jingbidao · Aug 26, 2013 at 05:47 AM 0
Share

oh!Just Give this to JAVA or IOS API can achieve your goal。

avatar image jingbidao · Aug 26, 2013 at 05:52 AM 0
Share

I have encountered this problem,THE audio I use to Play is down from server as Byte[]。$$anonymous$$y solution is Give this to JAVA or IOS API。Sometimes, You will find that you must Convert the simple things To asset bundle ......Oh,Fuck the Shit asset bundle

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Audio Mixer Snapshots not transitioning properly after build,Audio Snapshots not transitioning properly after build. 0 Answers

Audio listener to mono then to left or right speaker? 2 Answers

if statement isnt working 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges