Blog homepage

Audio Tools and Experiments in UE4, using Wwise: A Spline Based Audio Emitter / Volumetric Audio Emitter For Custom Shapes

Sound Design / Wwise Tips & Tools

 

Hello people! This is the first entry in a series of small blog posts about audio tools, experiments, and fun using Unreal Engine 4 in combination with Wwise. Hopefully they can get us all thinking and talking, and in the end become better developers. I really want to just share stuff with the community and I’d LOVE to hear you folks' opinions on the topics that we touch upon. As this is the very first entry from my series, I find it appropriate to very briefly introduce myself. My name is Troels, and I’m what you would probably refer to as a technical sound designer, and I am also composer.

Over the last year and a half, I’ve spent countless evenings and weekends learning Unreal Engine 4, making game prototypes, and working on very non-commercial projects, and I just can’t stop! Now, I also started picking up Unreal Blueprint in my professional work and some of the things that I have learnt have been related to audio tools, which (among other things) made we want to write this blog. So here I am!

Now let’s unveil the first topic! I present to you...

The Spline Based Audio Emitter, probably better known as a Volumetric Audio Emitter.

My colleague and I started creating this tool because we couldn’t find an existing tool or solution for creating custom audio emitting area shapes in UE4.

 

Spline

What is it useful for?

The tool makes it easy to block out large, non-cubic, boxy, or spheric areas in UE4, inside or outside of which you’d like to add audio, such as a forest or swamp area. Please note, a simple shape version can easily be derived from the Spline based version and already exists.

Why would anyone use this?

Because you can make your ambience sounds fade in / out the closer you get to an area shape that you have defined, and so you aren’t tied to using basic shapes only. It can save lots of time, especially when prototyping and when the level / environment is changing rapidly. Additionally, if you have an encapsulated area with entrances, and the AkComponent has occlusion enabled, it will also make the inside / outside ambience play through the entrance without playing through the walls, so more convincing. Also, it only uses one emitter, and this can potentially keep your voice count down as well. Here’s a video on how it works. Note that this video is a very brief overview of its core functionality. Additional functionality not covered: inside / outside States, follow player height, and area fade distance RTPC for use with 2D or 3D sounds with user-defined position source.

 

What it does:

  • The Spline Based Emitter uses a closed spline loop. It locates the point on the spline curve closest to the player and places an audio emitter at that point. The audio emitter location is updated continuously.
  • The Spline Based Emitter has two states: Outside State and Inside State. When the player moves into the closed loop, the State changes to Inside and from that point the audio emitter location is now set to follow the listener as well as its orientation. The moment the player moves outside the spline loop, then State changes to Outside and the location of the audio emitter is once again “attached” to the spline curve and is continuously set to be positioned at the point (on the curve) closest to the player.

How it works:

To get an understanding of how the tool works, you could go through the Blueprint in UE4 - it’s thoroughly documented. Note that the tool also has several publicly exposed variables that makes it a bit more versatile. You can download it here.

The two main ingredients / node functions this tool relies on are:

  • Get closest point on spline curve (for emitter location).
  • Dot product (for knowing if we're inside or outside our closed spline loop).

 

How to use it:

  • Place the Blueprint in your scene and create the shape you need. Personally, I prefer to change to Top view during this process.
  • In the exposed variables in the details panel, add your sound and inform the Blueprint what RTPC you use for Area Fade.

You need to be aware of two points that might break the tool:

  • V / concave shapes can be troublesome if the emitter attenuation is too long. I really want to come up with a solution to this issue. If you make a concave shape and locate the listener in the center between the two sides (as seen in the image below), you’ll end up with the emitter immediately jumping from one side to the other when the player moves across or within in the V shape.
  • Make sure not to make any points in the spline loop cross one another. The relationship between the spline points’ rotation is essential for the Inside / Outside State to work.

 

Image 2 ConcaveNotGood

Optimization:

Since I expect the CPU time for this Blueprint to be considerably longer compared to the already existing ambience shapes / tools, we added a little optimization to it. When the player / listener gets X distance away from the closest point on the spline curve the tick rate of the Blueprint is drastically reduced.

Troels Nygaard

Troels Nygaard

Investigate North - Technical Sound Designer and Composer

Troels Nygaard is a technical sound designer and composer with a BA in Sound Design (2014) and a MSc in game design with focus on audio integration and user experience (2016). Additionally, Troels is a Wwise Certified Instructor, and music producer.

nordictones.com

Comments

JungKun Park

August 02, 2018 at 02:38 am

That's Cool! I'm just sparking my curiosity about knowing if the listener is inside or outside. Could you tell me more how to work it?

Parag Oswal

August 02, 2018 at 02:40 am

Nice One!!!!

Troels Nygaard

August 02, 2018 at 02:49 pm

Hi Jungkun, yes! :) Though I'd suggest you had a look at the BP itself. You can download it from the article. Inside is determined by the value of a Dot product function (it's a node function in UE4 BP) The Dot Product takes the relationship between to vectors (Player and Spline point's right (y) vector) and returns a number between -1 and 1. 1 means left of the point and therefore inside and -1 means on the right side of the spline point's right vector and therefore outside. 0 would be exactly on top of each other. Please don't ask me about the details on how it's calculated, I'm not that good at the math ! :0)

Zac S

August 02, 2018 at 04:12 pm

What version is this being implemented in?

Troels Nygaard

August 06, 2018 at 07:49 am

We've been using this tool in both UE4.18, 19. The initial tool was created in UE4.18. The BP and content was migrated from 4.19.1. It won't work OOB, you'll have to replace some cast nodes and character references to fit with your game :) Don't worry, it will complain until all of that has been fixed and it's pretty straight forward

Hannah Lee

August 06, 2018 at 09:19 pm

This was extremely helpful! Thank you. :) I've checked out the uploaded BP and it was quite easy to understand too, thanks to the detailed comments. I do have one question though.. When the player is outside of the spline curve and you set the emitter to follow player's elevation, it seemed like the emitter location is set to the pawn's exact location instead of the closest spline curve location. Is this maybe to give it sort of a 2D effect?

Mitchell Kenny

August 08, 2018 at 10:55 am

Any advice on how to import the .uassets into a project? Unreal seems to not recognise its own file format.

colin bale

August 09, 2018 at 10:55 am

does this work on the Z plane as well as X and Y please? i.e is it always directional when outside of it even when above or below? I wonder how useful it would be for a game where you can float around for example. thanks

Hannah Lee

August 21, 2018 at 08:07 pm

You can put the file into the desired folder using windows explorer and it will work immediately.

Troels Nygaard

August 24, 2018 at 06:20 am

Hi Colin, sorry about the slow response. In the details panel of the BP there's a checkbox 'Follow player elevation'. The intention of this is to set the emitter's Z world location to be the same as the player's. So, X + Y follow the spline curve, while it elevates with the player's Z location. However, HANNAH LEE made me aware that I might made a mistake in the BP and the checkbox 'Follow player elevation' will unintentionally set the location of the emitter to the player's exact location. Later today I'll research this and if it's broken I'll fix it. Please let me get back to you on this (will do as a response here). Have a great day

Troels Nygaard

August 24, 2018 at 06:28 am

Hey Mitchell, as Hannah suggests you should be able to use it if you copy it to the Content folder of your UE4 project. Please note that if you're using an older version of UE4 (Below 4.18) It might not want to load as intended

Troels Nygaard

August 24, 2018 at 06:33 am

Hi Hannah, so sorry about the slow response here. It is possible that I made a mistake and the location is set to the player's exact location. It could also be that only the debug speaker is on the exact location and the emitter is actually at the correct location on the spline curve's X+Y. As I mentioned to Colin I'll check later today and then I'll get back to you with a solution and link to an updated generic BP that will work with any character. Regardless what is going on it should be a relatively easy fix I think :)

Troels Nygaard

August 24, 2018 at 03:08 pm

Hi again Hannah, it appears that I made a mistake in the BP, sorry about that. However, the fix was very simple, just 2 connections need to be replaced from already existing nodes. Here's an image that shows the correct setup: https://www.dropbox.com/s/0ixftzohgi3naes/Correction.JPG?dl=0 And the updated version of the BP + a static mesh based version can be downloaded from my Dropbox (I'll also ask Audiokinetic to update the link in the blog): https://www.dropbox.com/s/tf6txyb6fimcok3/UpdatedSplineEmitterPlusMeshEmitter.zip?dl=0

Troels Nygaard

August 24, 2018 at 03:10 pm

Hi again Collin, please download the new fixed version with working 'Follow player elevation' here. Appears that I made a mistake related to the bool, sorry about that: https://www.dropbox.com/s/tf6txyb6fimcok3/UpdatedSplineEmitterPlusMeshEmitter.zip?dl=0

Hannah Lee

August 26, 2018 at 10:23 pm

Hi Troels, thanks a lot for the update!

Russell Shaw

February 07, 2019 at 08:10 am

Excellent post, Troels. I designed something along these lines myself a good few years back for Fable. We implemented a paintable layer in Unreal using different colours for different ambience types (forest, running water, shoreline, scrubland, desert etc.) when the camera was directly over a coloured block I made the associated ambience head-relative which took care of immersion.

Benjamin Von Cramon

May 11, 2019 at 01:48 pm

Sorry if I'm not following protocols here, but I'm new to WWise, found my way in while searching for a spline-based volumetric audio emitter, thought I'd ask here how to kick it into second gear. I have WWise installed and BP shows up in my project, drug bp_ac_AkVolumetricStaticMesh to the Canvas, read here how I'm to create a spline shape, but see no instructions how to do that. The GUI appears to be the Viewport tab within the Blueprint, so now what? Thanks for throwing a newb a bone. Benjy

Luka Loncaric

June 11, 2019 at 01:44 pm

Does this work with UE 4.22?

Chris Terry

June 28, 2019 at 04:57 pm

Can this be used for rivers and does it still work for 4.22

Alexander Smiths

August 16, 2019 at 02:45 am

Hello, could you help with following: your Blueprint stopped working. It doesn’t calculate Ampient sound correctly. It defines zones correctly. The condition of trigger’s turning on works correctly on debug regime, everything is calculated right, but all the time the sound follows the player without attenuation outside of designated zone. In what can the mistake be? Thank you in advance!

Rikki Zimmermann

December 13, 2019 at 03:21 pm

Thank you very much for this Tutorial! I managed to implement it into my test environment, but everytime I start the Game, the AK-Event (A long recording of Wind) gets triggered right away and isn't affected by the player moving or anything. I think the problem lies in the part about " inform the Blueprint what RTPC you use for Area Fade." but I'm not sure, since I'm primarely an audio engineer and am new to Wwise and UE4. So do I have to set up my own particular RTCP in Wwise and connect it to the blueprint? If so, what game parameter(s) does it need to be set up with and how do I do all that? I would really appreciate your help :)

Brennan Anderson

March 18, 2021 at 07:15 pm

Nice post! Couldn't you solve the concave shape and the source jumping between distant points by getting the closest point on the path to an intersecting vector from the listener to the center of the shape? So you would get the vector between the listener and the center of the shape, then find where on the spline that vector hits or intersects. This would solve the issue if you were in the middle of the V shape. It would put the emitter in the divot, rather than snapping it to the absolute closest point to the listener. This would only work if you are on the exterior of the shape. If you were on the interior, you would go back to getting the closest point.

Leave a Reply

Your email address will not be published.

More articles

Behind the Beautiful Sound of Monument Valley 2: Interview with Todd Baker

This interview was originally published on A Sound Effect With Monument Valley 2, Ustwo Games not...

16.1.2018 - By Anne-Sophie Mongeau

Simplifying WAAPI

If you’ve never used the Wwise Authoring API (WAAPI) before, I’m hoping I can convince you to give...

29.5.2018 - By Adam T. Croft

Authoring Plug-ins for Wwise 2021.1 | Part 1: History and Goals

One of the least known characteristics of the Wwise ecosystem is its extensibility. Companies create...

5.2.2021 - By Michel Donais

Making Interactive Music in Real Life with Wwise

I decided to dive deeper into interactive audio some time ago. I wanted to create a project related...

25.2.2021 - By Ressa Schwarzwald

9 Simple Steps to Authoring and Profiling Audio Objects in Wwise

So, you're interested in taking a look at the new Object-based Audio pipeline in Wwise but don't...

8.4.2021 - By Damian Kastbauer

Star Wars Jedi: Survivor | Q&A With the Audio Team

Star Wars Jedi: Survivor is a third-person, galaxy-spanning, action-adventure game from Respawn...

2.5.2024 - By Respawn Entertainment

More articles

Behind the Beautiful Sound of Monument Valley 2: Interview with Todd Baker

This interview was originally published on A Sound Effect With Monument Valley 2, Ustwo Games not...

Simplifying WAAPI

If you’ve never used the Wwise Authoring API (WAAPI) before, I’m hoping I can convince you to give...

Authoring Plug-ins for Wwise 2021.1 | Part 1: History and Goals

One of the least known characteristics of the Wwise ecosystem is its extensibility. Companies create...