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 Paul · Dec 08, 2009 at 06:51 PM · audio

Audio stops playing while loading

Hi,

(Unity v 2.5 - C#)

i have a music manager that plays an audio (streamed using WWW object).

When new level loaded, audio stops playing even though it wasn't calling audio.Stop().

And, i tried 'DontDestroyOnLoad()' and also, 'LoadLevelAdditive()'. It did not work.

Using debug, i printed whether the music manger was destructed. It was not.

I also printed audio playback time (audio.time) in Update().

I noticed that the audio.time stay constant once the new level loaded (i.e: it does seem to stop playing), and audio.isPlaying is still true.

This was ogg file which reside in web server. I checked progress of downloading, and it downloaded all complete, and played it (all good for streaming). But, when new level is loaded, audio stops 'playing', but, the flag was still set to be playing, and, playback does not update.

Any idea?

Thanks in advance.

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

Answer by Jaap Kreijkamp · Dec 09, 2009 at 02:27 AM

Have you tried updating to Unity 2.6.1? Don't know if it solves your bug but it's always worth trying. You can also try having the audio added as asset to the project instead of streaming it.

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 Paul · Dec 09, 2009 at 10:18 PM

Thanks for answer.

It actually works on v2.6. It seems like a bug in v2.5.

Something is strange in unity audio library. There are what i found:

v2.5:

  • when you stream ogg file (checking after isready as well as stream.isdone), audio.length returns zero, and isplaying is still true when the song is over. (this does not happen at v2.6)

v2.6:

  • accessing ogg file to get the length(orgVorbis) of the song sometimes crashes. But, it did not happen at v2.5 player.

  • Suddenly, i am getting doppler effect of the song played when my character moves left or right. In the UI (no chracter movement), i don't have this problem. This effect does not happen in v2.5.

ABOVE ALL,

I can fix all that based on what version of library EXCEPT this crazy doppler effect. I tried to set:

audio.velocityUpdateMode = AudioVelocityUpdateMode.Fixed;

at the update loop, but, it did not help. Rolloff Factor was set to zero for audio source.

I am not sure what causes this strange sound effect.

Thanks.

Comment
Add comment · Show 3 · 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 Jaap Kreijkamp · Dec 09, 2009 at 10:27 PM 0
Share

You're welcome, but to make sure others see that question is answered you should click on the V sign next to my (or your own) answer :-) About the doppler effect, in 2.6.x stereo sounds can be positioned in 3D, I guess to prevent this you could connect the audiosource to the camera.

avatar image Paul · Dec 10, 2009 at 12:05 AM 0
Share

Actually, audio source is following the camera (which is listener). But, the doppler is still there. It almost like velocity takes account where i can see the effect of camera moving.

It does not make sense to have this effect when the source and listener is moving together.

avatar image Waz · Feb 18, 2011 at 12:36 AM 0
Share

You can now-a-days do:

dopplerLevel = 0

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

Loading music for initial scene loading takes a very long time 1 Answer

Audio skipping 2 Answers

Adaptive audio / channel switching 0 Answers

c# bandvol 0 Answers

Invoke a function when an audio clip is done? 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