Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by StephanK · Feb 19, 2010 at 05:04 PM · audioassetbundleasset

Creating audio assets on the fly

I want to let the user specify an audio file during runtime, then load that audio and play it back as an audioclip. Is there a way to create audioclips from audio files(.wav, .mp3, etc.) during runtime?

A related question: Can I create assetbundles during runtime?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Mortoc · Mar 11, 2010 at 06:37 PM

Unity only has support for .ogg audio files. If you're not in the webplayer you can build an FFMpeg DLL (http://ffmpeg.org/) and load the audio with that. If you are in the webplayer, you can do the hack-ey solution I did when I had this same problem. Put a flash swf on your page that just plays audio and have unity control it through the javascript interface.

Comment
Add comment · 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
1

Answer by x4000 · Mar 23, 2010 at 05:18 PM

You can use the WWW class to get an audio clip from a location on disk, and that will even let you play the audio clip while it is still streaming that off the disk, which is particularly helpful. It's ogg-only, though -- from the documentation I'm not even certain that wav files are supported with that particular function.

Evidently you could also look into Resources.Load, but I have not messed with that myself. You can set it up to load all sorts of raw files off the disk at runtime via WWW (for streaming), or via StreamReader, etc, in System.IO (for immediate read), depending on what your needs are. But bear in mind that each copy of WWW leads to a new thread being spawned, and there is a limit to how many of those you can have going at once. So for my dynamic loading of a few hundred assets, I have it queue up the requests and only run around 4 graphics and 4 sound effect WWWs at a time.

I'm not sure if you can dynamically create AssetBundles at runtime, but I also don't think there's a compelling reason to; you can easily load individual files instead.

Comment
Add comment · Show 1 · 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 Uzquiano · May 24, 2011 at 08:53 AM 0
Share

"The data must be an audio clip in Ogg(Web/Standalones), $$anonymous$$P3(phones) or WAV format. "

http://unity3d.com/support/documentation/ScriptReference/WWW.GetAudioClip.html

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

No one has followed this question yet.

Related Questions

How to export MP3 audio to an assetbundle then to a .asset file? 0 Answers

Is there a way to decompress a unity asset bundle > 1 Answer

Is there a way to use the original colour for a texture on an asset in a scene? To stop it being affected by the scene's lighting. 0 Answers

Iphone downloadable content restrictions 1 Answer

Does AssetBundle work on mobile? 0 Answers


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