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 dhkd1157 · Dec 28, 2012 at 05:24 AM · audiosoundaudioclipoggogg vorbis

Why is Unity3d strictly using PCM Buffer size with 32bit floating in AudioClip?

unity3d includes below of PCM audio functions:

AudioClip.Create, AudioClip.PCMReaderCallback, AudioClip.SetData ---> it is a 32bit float array.

Usually, MP3, OGG Vorbis and WAV use 16bit buffer size because of the hardware size and Ram issues. However, In Unity3d, AudioDatas Convert 32bit float (-1.0f ~ 1.0f) instead of 16bit short (-32767 ~ 32767) as usual. ie) 2min 16bit stereo 44100 hz Audio File Converted as below

120sec x 2(stereo) x 2(16bit-short) x 44100 = 21168000 byte

21168000 / 1024 / 1024 = 20.2 MB.

But in Unity3d,

120sec x 2(stereo) x 4(32bit-float) x 44100 = 42336000 byte

42336000 / 1024 / 1024 = 40.4 MB. (twice bigger than ordinary audio converted system)

It means whenever I convert audio datas(such as ogg/mp3) to PCM, It uses twice data size than other platforms.

It doesn’t matter when using unity3d in PC or MAC, But the problem is in Mobile platform for our team which uses many soundData files to make music games. (I already have some issues with ‘iOS – didReceiveMemoryWarning()’ Problems which caused by twice bigger converted memory)

Do I Have to Using OpenAL or OpenSL-ES instead of Unity3d Audiosystem to avoid this issue?

(FYI : Unity3d uses mp3 which restrict converted from ogg, I uses ogg vorbis decoder(from http://ogg.org) to using ogg in mobile platform. Do you guys can include ogg decoder in unity3d as a standard library?)

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

Answer by ipeerbhai · Mar 15, 2017 at 09:13 PM

The answer is quanitzation noise. PCM16 is much more susceptible to this kind of noise when mixing channels. Most audio engines that mix samples use IEEEFloat32 for audio samples today, and PCM16 is really relegated to Windows or other "ancient" Wav formats.

Converting samples between Float and PCM16 is easy -- just do: int16 thisSample = (int16)(AudioClip.Data[sampleIndex] * int16.MaxValue);

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

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

9 People are following this question.

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

Related Questions

Existing solution for load MP3 from disc ? 2 Answers

Decrease volume of individual sounds over time 0 Answers

Audio: -3db automatic attenuation on any audio playing? 0 Answers

Question about audio (AudioSource). My ingame sound doesn't sound like the original audio file? 3 Answers

Stop audiosource clip from playing 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