📜 ⬆️ ⬇️

We mix favorite bits in the Unity 5.0 program

Work on sound is one of the main directions in the preparation of Unity 5.0. After it became clear what functions would have to sweat, we included the sound in the list of priorities.
That everything was on ointment, we had to go back and to place accents over those areas of a sound which would be involved in Unity. In order for you to connect as many good, high-quality sounds as you like in your games, we had to decide on codecs and make sure that such a scheme would really work. I will try to paint all the nuances in a more detailed article, but for now I will tell you about our first sound addon to Unity 5.0, AudioMixer.

Step one

If you use Unity, your sound may not be bad. Or so-so. He just has to be the best! Because in addition to a solid foundation for working with it in the future, you have something else - a new super function that proves that we are not wasting on trifles and are doing everything to arm you to the teeth in a war with sound.
In future releases, we will improve more and more areas of work with sound. Sometimes these will be minor changes, such as fixing bugs in an existing feature set, which has already shown itself to be the best. Some will be more serious, such as the ability to create stunning interactive sounds with full immersion and control the entire sound landscape in its entirety.

Why AudioMixer?

To answer this question is quite simple - before this feature was not available. In the past, all sounds were played on AudioSource, where you could add various effects as Components, and then mix all the game sounds into an AudioListener and incorporate them into the sound landscape.
We chose AudioMixer as a solution, and in order not to poke a finger at the sky, we decided to do more, and put together many functions that can be found in well-known Digital Audio Workstation applications.

Sound categories


')
Every sound engineer knows how comfortable it is to work with sounds that are divided into categories, rather than processing each sound separately. The ability to put all the sounds together while working on sound effect parameters in the context of the game provides global control over the entire sound landscape. And this is very important! Perhaps this is the best way to create the mood you need and the level of immersion in the game. A good sound mix and a suitable track will allow the player to experience the full range of emotions, and create an atmosphere that the graphics alone are not capable of.

Unity Mixing

This is the main purpose of AudioMixer - with its help, users can control the set of all sounds in the game. Thus, all the sounds that are played in the scene are included in one, two, as many AudioMixers as you like, which break them into categories and then edit them.



In each AudioMixer, you can create branched category systems, which in our context are called AudioGroup. You will have before your eyes a selection of these same AudioGroups and a classic mixing panel, as is customary in the music and film industry.

DSP

But that's not all! Each AudioGroup can contain a bunch of different DSP audio effects that are activated one by one as the signal passes through the AudioGroup.

This is already interesting, right? Now, not only can you create custom tracing schemes and apply mixing to individual categories. You can distribute any cool DSP pieces across the entire signal length, add any effects and enjoy unlimited power over the sound landscape. You can even add an empty track to process only a certain part of the signal.

But what if the built-in effects of Unity are not enough for you? Previously, this was solved by returning the OnAudioFilterRead script and only that allowed you to independently process audio samples directly in your scripts. This is enough for simple effects and the development of your own filters. But sometimes to increase immersion in the game you might want to compile the desired effects yourself, right? From now on, you can prescribe such complex effects as tuning up the convolution of an echo or multiband EQ.



We are happy to please, now Unity supports custom effects of the DSP plug-in. This means that users can write their own DSPs, and maybe even use the Asset Store to share super creative ideas with others. A whole world of new opportunities opens up before you, such as creating your own engine or managing other sound applications like Pure Data. These custom DSP plug-ins can request sidechain support and use relevant information from any part of the mix! Super!

One of the interesting innovations when working with the set of effects in the AudioGroup is that you can use the attenuation where you want. You can even bring the signal to + 20dB (we have worked on it). Use the built-in VU meter in test mode to see how the signal is modified at the time of decay.



Together with non-linear DSP, Sends / Receives and our new Ducking chip (which I will describe in detail later in the article), you get a super powerful tool for controlling the audio signal through a mix.

Changing the atmosphere in the game

I have already mentioned the use of sound landscape mixes to control the atmosphere in the game: you can add or remove new music components or background sounds. Or play with the mood of the mix itself. For example, to change the volume level at different intervals or, if we are talking about working on sound effects, move from one state parameter to another, immersing the player in the environment you need.

Speaking frankly, AudioMixer has the ability to recognize snapshots that capture the state of all parameters. Here you can save and execute transitions between absolutely any parameters.



You can even use saved snapshots in any order you like, creating new complex states, and apply them as you like.

Imagine that you leave the open area on the map and go into an ominous cave. What do you hear there? You can use the transition between mixes to emphasize other, subtle sounds, or to include in your ensemble new instruments and change the characteristics of the echo in the new noise design. Imagine that for all this you do not need to write a single line of new code.

Multidirectional signals

Sends


In addition to the DSP effects inserts already available in Unity, you can insert “Send” into any part of the mix. Thus, you can qualitatively send a sound signal to where you left “Send”, and decide how much signal you want to use.

Further more! Given that the signal level used for branching is part of the snapshot system, you can think about how to combine changes in signal flows and transitions between snapshots. And it started ... potential installation opportunities grow like a snowball.

But where does the branched signal go? In the latest version of Unity, Send is used together with two other functions: Receives and Volume Ducking.

Receives

... fairly simple processing elements. These are the same inserts as all the other effects, and they just collect all the branded audio from all the Send's, which were selected and mixed before, and all this is transferred to the next effect in the AudioGroup.

Of course, if we are talking about groups of effects or a fading moment in an AudioGroup, you can insert Receives anywhere. This gives you a lot of leeway in terms of when to use the branched signal in the mix.

Volume ducking

In addition, Sends interact with Volume Ducking inserts. As with Receives, these elements can be inserted in parallel with other DSP effects anywhere in the mix.

When Send is aimed at inserting a Volume Ducking, it behaves in many ways like the sidechain compressor protocol, which means that you can use the sidechain from anywhere in the mix and redirect the attenuation of sound to anywhere from there!

What does this mean for those who are not in the subject? Imagine that you are busy mixing sounds for your shooter and you really want to stun the player with the sounds of gunfire and explosions. Well, this is reasonable, but how about this situation: here you are approaching a non-game character on the battlefield and trying to listen to his thoughtful muttering. And ... you can not make out anything. Volume Ducking allows you to dynamically turn down the volume of individual mix segments (in this case, the sounds of artillery), completely and completely, without at the same time affecting other segments (the conversation of the characters). Simply use Send from the AudioGroup, which contains the character dialogue, and redirect it to Volume Ducking in the AudioGroup containing the sounds of the battlefield.

For global tuning of all effects, you could use sidechain compression in dynamic mode to compress the rest of the instruments separately from the bass track.

But the coolest thing is that you can do all this in the editor without creating a single line of code!

Instead of conclusion

And although I only superficially described the possibilities of AudioMixer in this article, I hope this is enough to interest people in working with sound in Unity 5.0.

From now on, we will continue to bring the future of sound processing into games, and provide you with a set of tools to create a first-class sound landscape!

From the translator: I am still happy with questions and criticism, as well as suggestions on topics about translations about Unity

Source: https://habr.com/ru/post/231841/


All Articles