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

Building a musical keyboard


Now that we have looked at how quickly we can create a simple empty script, let's explore the possibilities of scripting audio components. As we already saw in the last chapter, it is possible to use audio components without writing any scripts. However, scripting gives you more control over an audio source with only a few lines of code.

In this section, we are going to use scripting to build a simple keyboard that you will be able to play multiple instruments with. We will even allow the keyboard to record and play back sessions. All in less than 30 lines of code. Follow the instructions here, to start creating this script:

  1. We will continue where we left off from the last time by jumping back into MonoDevelop. Be sure the tab showing the Keyboard script is open and the script shell has not been modified.
  2. At the top of the file, just below the Keyboard class definition, enter the following lines of code:
private AudioSource audioSource; 
public int transpose = 0;

Note...