Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Control spread through an RTPC (smooth transition from 3D to 2D sound)

+1 vote
Hi all,

I am looking for a way to smoothly fade some music from the diegetic space to the non-diegetic, and I was wondering what the best way to achieve this would be.

I haven't found any way to control the spread of a 3D source from an RTPC (it seems spread can only be managed through attenuations, as a function of distance to the listener).

Right now, the way I do it is I have 2 versions of my music hierarchy: one is 2D, the other is 3D, and I crossfade between both, but it's a waste of CPU/memory and it feels wrong!

Any ideas? :)
asked Mar 2, 2014 in General Discussion by Matthieu B. (750 points)

1 Answer

+3 votes

That's one way to do it, and it doesn't waste as much memory as you think (well, a few bytes).  But it is ugly, I agree. Transitioning from 3D panning to 2D panning and vice versa, without glitch, is not trivial.  You need to take spatialization in account (or maybe not, if the Enable Spatialization checkbox is off) and maybe cone attenuation.  There are ways to do that though. 

  1. Keep only one copy of your music
  2. Put an RTPC on the 2D/3D selector (just under Center % in the Positioning tab)
  3. For this step, you need programmer support.  When you start the transition from 3D to 2D, move your game object position at the right place relative to listener.  It must also face the listener.  "The right place" is defined as "the x/y/z position that will make the distance right so that the volume with attenuation and spread will be almost the same as the 2D version".  And that, my friend, is the killer, since it depends on your attenuation curves and spread.  It also depends on your audio output setup: spatialization rules are different for mono, stereo or 5.1 sounds.  You will want this "move" to be nice and gradual too, so do it over a few game frames.  Think of this as forcing your player to sit in front of the radio (actually, bringing the radio in front of him).
  4. Make a new Event in which you have to sub actions:
    1. Set the RTPC to 2D
    2. Set the Volume of your music to the volume in the 3D space (it won't be the same)
  5. Trigger the event when the game object is finally at the right place.

But I suspect at this point that you will not be happy either.  You will discover that your nice stereo music (or 5.1), when playing in 3D, is not playing exclusively in the right speakers, even when properly aligned in front of you.  3D spatialization rules make each of the channel bleed in neighboring speakers (this is made so rotating in 3D space gives a smooth transition from speaker to speaker).  So when switching to 2D, the bleed will suddenly disappear and you may notice it.  That's the current state of things right now.

But there is hope in the next version, we've added a Focus feature to control the amount of bleed in the 3D spatialization.

Did I say it wasn't trivial ? :)


answered Mar 6, 2014 by Mathieu J. (Audiokinetic) (7,060 points)