- Home /
Loading ogg though WWW results in 3D Sound, need as 2D...
How do I force though script the loaded audio to be set as 2D sound?
I'm trying try load in our music file to play in the background. When loading from WWW source I can't seem to find the option to set the audio as a 2D sound, it is intended to be an Omni sound but ends up being a 3D sound.
Answer by Sren Christiansen · Jan 05, 2011 at 12:20 PM
Hi, This will be an option in 3.2. For now use .panLevel = 0.0f on the audiosource playing the clip (this will make it play in 2D)
-Sren
Answer by Clement_Shimizu · Aug 16, 2014 at 01:08 AM
I know this question is a bit old, but I want to update the answer to be the correct answer.
The answer from XTNZ and SREN are both not ideal because the audio clip doesn't sound as good as if it was a 2D sound. For example 5.1 audio will sound muffled if you play it back as 3D sound with panelLevel at 0.
The correct way of doing it is using the fuction WWW.GetAudioClip with 3D sound parameter set to false. Please review the docs here http://docs.unity3d.com/ScriptReference/WWW.GetAudioClip.html
Answer by xtnz · Jun 23, 2011 at 06:03 PM
Jee.. This means I am doing something wrong. However the sound is constant nomather how far the camera (with listener) is from the source:
var download = new WWW (path); yield download; var clip : AudioClip = download.oggVorbis; if (clip != null) { audio.clip = clip; audio.rolloffMode = AudioRolloffMode.Logarithmic; audio.spread=0.25; audio.minDistance=1; audio.minDistance=10; audio.ignoreListenerVolume=true;
audio.panLevel = 1f;
audio.Play(); }
Any clue? Is there any way of forcing a sound to become 3d?
Not an answer. If you have a question, Ask it, don't add an "Answer" to an old question.
Your answer
Follow this Question
Related Questions
Why is Unity3d strictly using PCM Buffer size with 32bit floating in AudioClip? 1 Answer
How do I make my sound work in proper 3D space for VR 1 Answer
3D Sound Max Distance Not Working. 0 Answers
Best practice: URL address for storing streamed music files 1 Answer
Playing .Ogg audio backwards? 1 Answer