Book Image

Game Audio Development with Unity 5.X

By : Micheal Lanham
Book Image

Game Audio Development with Unity 5.X

By: Micheal Lanham

Overview of this book

Game Audio is one of the key components in making a game successful and it is quite popular in the gaming industry. So if you are a game developer with an eye on capturing the gamer market then this book is the right solution for you. In this book, we will take you through a step by step journey which will teach you to implement original and engaging soundtracks and SFX with Unity 5.x. You will be firstly introduced to the basics of game audio and sound development in Unity. After going through the core topics of audio development: audio sources, spatial sound, mixing, effects, and more; you will then have the option of delving deeper into more advanced topics like dynamic and adaptive audio. You will also learn to develop dynamic and adaptive audio using the Unity Audio Mixer. Further, you will learn how professional third party tools like FMOD are used for audio development in Unity. You will then go through the creation of sound visualization techniques and creating your own original music using the simple yet powerful audio workstation Reaper. Lastly, you will go through tips, techniques and strategies to help you optimize game audio performance or troubleshoot issues. At the end of the book, you’ll have gained the skills to implement professional sound and music. Along with a good base knowledge audio and music principles you can apply across a range of other game development tools.
Table of Contents (21 chapters)
Title Page
Credits
About the Author
About the Reviewer
Acknowledgments
www.PacktPub.com
Customer Feedback
Dedication
Foreword
Preface

Randomizing audio


Randomizing audio is the practice of tuning an audio source playback in a random manner to avoid exact repetition in your games audio. Of course, another way to avoid audio repetition is create multiple sound effects for the same noise, music or dialog, and then randomly select one each time the audio needs to be played. While using multiple variations of the same audio clip is preferred it does increase memory resource usage and asset management.

For this section, we are going to borrow a couple techniques we already used to slightly alter or randomize the playback of our audio without needing to provide multiple variations. Open up Unity and follow the following exercise to randomize the scene audio:

  1. Locate the axController script in the Project window and then double-click on the script to open it in your editor.
  2. Scroll down to around line 21 as shown here:
 if (audioSource.isPlaying) return; 
  1. After that line, enter the following lines of code:
audioSource.pitch = 1.0f + Random...