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
2
Question by DustyScreen · Jun 22, 2011 at 12:43 PM · audiocompressionaudio filesaudio properties

Change properties on multiple audio files

I always do compression of audio at the end of my workflow. This is an extremely boring, clumsy and time consuming process, where I have to go through the Audio Importer for each of the files, change a range of properties and press Apply.

Can this be done for all (or a range of) audio files in the project at once?

Note - Unity finally fixed this.

You can now select multiple AudioClip, and change them all at once. Phew.

I would really like to try out various compression levels on a general level. This is simply impossible, handling one audio file at a time.

Hacks are very welcome, if there are no official way! :)

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

Answer by rhys_vdw · Sep 26, 2012 at 08:56 AM

Note, unity fixed this around 2014. Just select multiple AudioClip in the Project. (You do have to expand all folders before doing so, and here's a critical tip on that!)

Historic answer......


You need to create a custom AssetPostprocessor script in the folder 'Assets/Editor'. Define a function called OnPreprocessAudio, and set the clip properties with the AudioImporter object.

This script will then automatically get called whenever an asset is imported. This means whenever an asset is added to your project, or whenever you reimport an asset (using its context menu in the project explorer). To reimport a range of assets, select them all and then reimport.

Here is an example script I made to set imported sounds to 2d by default:

 using UnityEngine;
 using UnityEditor;
 
 public class Force2dAudio : AssetPostprocessor {
     void OnPreprocessAudio () {
         AudioImporter importer = (AudioImporter) assetImporter;
         importer.threeD = false;
     }
 }
 

NOTE: The inspector is not updated when you reimport an asset that you have selected, but if you click away and click back you will see the changes.

Comment
Add comment · Show 5 · 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 theprojectabot · Nov 27, 2012 at 11:20 PM 1
Share

THAN$$anonymous$$ YOU SO $$anonymous$$UCH!

avatar image rhys_vdw · Nov 27, 2012 at 11:56 PM 0
Share

@theprojectabot You're welcome. Please upvote my answer if it helped.

avatar image RichardEng · Jun 13, 2013 at 11:51 PM 0
Share

Just be wary that if you have mixed 2D and 3D sounds, the next re-import will change ALL of them... Learn from my fail.

avatar image ign · Jan 29, 2014 at 07:25 PM 0
Share

Great advice, short and to the point. Thanks a lot!

avatar image xiaoken · Apr 28, 2015 at 04:19 AM 0
Share

Thank you. Worked perfectly! Upvoted.

avatar image
1

Answer by Bravini · Jun 22, 2011 at 01:35 PM

I still didn't tinker enough on this but I believe you gonna have to load the assets in a folder into an array and then process them. useful links : Resources.LoadAll http://unity3d.com/support/documentation/ScriptReference/Resources.LoadAll.html

compression http://unity3d.com/support/documentation/ScriptReference/AudioImporter-compressionBitrate.html

untested code I was doing for my project:

[CODE] //verifies if there is music to import and if it is 2D function OnPreprocessAudio () { var audioImporter : AudioImporter; if(audioImporter.format != AudioImporterFormat.Compressed){ audioImporter.format = AudioImporterFormat.Compressed; audioImporter.loadType = AudioImporterLoadType.CompressedInMemory; //audioImporter.loadType = AudioImporterLoadType.StreamFromDisc; //audioImporter.loadType = AudioImporterLoadType.DecompressOnLoad; Debug.Log(audioImporter.assetPath+" is being compressed"); }

 if(audioImporter.threeD){
     Debug.LogWarning(audioImporter.assetPath + " is not a 2D audio. Changing it to 2D");
     audioImporter.threeD = false;

} [CODE/] I hope this helps

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 rhys_vdw · Sep 26, 2012 at 09:01 AM 0
Share

Thanks for the help. I've added a new answer based on experimenting with your advice. There is no need to use Resources for this.

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

6 People are following this question.

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

Related Questions

Avoiding audio transcoding in Unity? 1 Answer

Audio Noise Removal 0 Answers

Unity Sound Quality Problem 0 Answers

Should Voice Overs be compressed? 4 Answers

Music compression not doing anything? 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