Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Ray-Pendergraph · Jun 08, 2012 at 03:13 PM · audioimportassetogg

Getting at raw imported audio data via AssetDatabase.

Is there any way to get at the raw bytes that are created by the import process? We have a customized editor based bundle creation tool and I want to use the converted WAV->OGG bytes from the import process that Unity caches (as opposed to using Vorbis command line tools) to then write the OGG bytes into an OGG file to a well know location as part of the bundling process.

I get that I can mark the assets as OGG/Stream from disc in the editor and it will create a multi-part RIFF file to access like that but that's not what we want to do.

None of the AssetDatabase methods seem to deal in bytes so is there any other way to do this?

Edit: Also it looks like dealing with the asset in the Library/cache folder is not useful as it appears to be some (non .NET) object serialization scheme? Does anyone know what format these are?

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
0
Best Answer

Answer by Ray-Pendergraph · Jun 08, 2012 at 07:06 PM

After some brute force perusing through the editor APIs looks like EditorUtility.ExtractOggFile does the trick. Seems like a little of an odd place for it but it works. Here is a simple code example to demonstrate for searchers later on

 [MenuItem("Assets/Export OGG")]
 public static void ExportOgg()
 {
         UnityEngine.Object[] oggAsset = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.TopLevel);
         EditorUtility.ExtractOggFile(oggAsset[0],"a/special/place/assetname.ogg");
 }


Edit: There is also the new ability build into the engine but of course this comes with some caveats.

  • The "StreamingAssets" folder seems to only be recognized in the root level unlike the "Resources" folder.

  • The files are moved untouched from their original format. So I wanted Unity's OGG output for a given WAV original, this will not work for me. It plops the WAV into the StreamingAssets folder in the game. Sometimes this is what you might want and sometimes it's not. It seems to me that this is a feature; the file should obey the import settings in the inspector even for streaming.

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 fil · Nov 26, 2012 at 02:53 PM 0
Share

hi, with this is possible to save the sound to a file? i'm trying use it but i don't understand. could you help me? thanks

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Is it possible to import my own .ogg files? 1 Answer

Import asset and scale factor is set to 1 and cannot be changed? 1 Answer

Import Blender Model - Assigning Materials 3 Answers

Compression slider in audio import settings doesn't seem to affect anything. 1 Answer

Adding custom metadata when importing an asset 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