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 IgnoranceIsBliss · Nov 09, 2012 at 04:36 AM · audiomusicstreamingmodding

Streaming Music from Disk

I'm trying to allow my users to place their own music into a folder (in OGG format) in standalone builds of my game.

I have playback working by using the 'WWW' class with a 'file://' URL - this gives me an AudioClip with 'stream' set to true.

However, after around about 30-40 seconds of playback I start getting errors like this - 'WWW: out of memory'.

I'm assuming this is because the WWW class is trying to extract the entire OGG track uncompressed into memory?

Is there any way that I can...

a) Force the system to load the file as COMPRESSED rather than UNCOMPRESSED (ie. the same way as checking 'Compressed In Memory' if I had built the sound file into my Unity project?

b) Failing that, increase the buffer size for the WWW class to allow a larger file to be downloaded?

c) Clear out the portion of the AudioClip already downloaded and played, to create more memory for incoming data?

The only other option I have is that I can manually decode the data directly with file IO and a library such as Mp3Sharp, managing the playing buffer myself via the PCMReaderCallback functions. However, I was hoping that Unity would have some out-of-the-box support for this.

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 Marrt · Dec 10, 2012 at 02:00 PM

after 30-40s already? strange, maybe you already have a large amount of audioData loaded in your memory as you start streaming... How are the other sound effects loaded?

also, im not sure if Unity clears the already loaded Tracks if they aren't needed anymore: I am not completely sure this works, but please try this: downloader = new WWW(url);//your Download downloader.Dispose();//get rid of the Data in memory, at least i think it does that :D

Comment
Add comment · Show 2 · 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 IgnoranceIsBliss · Dec 10, 2012 at 09:52 PM 0
Share

Unfortunately there are almost no other samples loaded, and just in case I tried running it without those loaded.

The samples that are there are only 1-2s in duration, used as audio confirmation of user actions.

avatar image Marrt · Dec 11, 2012 at 12:19 PM 0
Share

maybe another thing is dumping in your memory, however, it would seem inlikely that the small audio download would just be enough to reach the memory limit then... try to watch the task manager of your Operating System as you start the Unity WWW-download, watch its $$anonymous$$emory usage, then try running the same build without the download

You could post some of your code too...

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

10 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

Related Questions

Stream music in Unity mobile 0 Answers

Streaming music 3 Answers

Building a browserbased venue with streaming audio 0 Answers

How do I stream audio from disk? 0 Answers

Unintended audio gaps 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