In the past few years, the Unity game engine became quite popular among video game makers. At the same time, there aren’t too many resources for beginners discussing FMOD, a middleware software for managing sound and music in games. This series was originally written as a book, so you may encounter phrases such as “in this book” throughout the series.
While our site focuses on orchestral music, a lot of people would like to compose in this genre for video games, thus we provide an introduction course :).
This little guidebook is an attempt to share the basic knowledge and show the readers how to work with FMOD and Unity, and how to make interactive (adaptive) music in Unity, that is music which reacts to things happening on the screen. I decided to focus on music, because this is what I work with mainly.
Fortunately, most elements discussed in this book also work for general sounds, not just music – so by extrapolation, you will learn be able to make interactive sounds of footsteps, car engines and so on, all by yourself.
Sound is an important element of each game, and when done, it allows the player to immerse himself in the game world. The basic audio features of the Unity engine are quite nice, yet we can achieve so much more with FMOD, a dedicated DAW-like software to control audio in your game.
FMOD is one of the most popular middleware programs for controlling audio in games. It’s very easy to use and can achieve a lot. It’s also free to download and learn. Oh, and because it’s a middleware, it can be integrated with other game engines, too, for example with Unreal Engine.
FMOD is free to some degree. You can download it and work with it for free even on commercial games as long as this commercial game is still in development. Before releasing it, though, you need to purchase a proper license. Free games do not require a license. And, as long as you’re
FMOD is similar to most DAW programs, so people with experience in digital audio workstations won’t have too many problems learning FMOD. The software itself is quite popular among both indie developers, and AAA companies.
Another most popular middleware for game audio is WWise, which is a bit more complicated. It can be downloaded for free, as well, if you’re a learner, but it also requires a license when releasing commercial games.
A lot of things I will discuss in this book can be later used in other game engines, such as Unreal Engine, because what we do in FMOD doesn’t change – only the ways we use the project in the engine itself change. More advanced programmers won’t have problems integrating FMOD with other engines, and FMOD itself provides API and documentation.
With some simple lessons in this book, you will learn how to add music and control it through FMOD. You will learn how to add files, call them, play them, and work with some basic C# scripts in Unity itself. You will also learn how to work with FMOD events, the mixer and snapshots.
For the purpose of this book, I assume you already know how to work with Unity, and you also have experience with working with audio and DAW software. Thus, some concepts won’t be discussed in this book. If you do not know how to work with Unity (because you may be interested in gamedev, yet have no experience), you can find a lot of books and courses on-line. Personally, I’ve learned Unity from Unity in Action: Multiplatform Game Development in C# with Unity 5 by Joe Hocking. Although, it’s a book from 2015, so you may want to look for something newer, but I really learned a lot from that one.
Anyway, you need to know how to work with Unity Editor, and how to code basic things in C# (at least know the syntax).
Such basic knowledge is mandatory, but it’s easily accessible in the Web.
This book will teach you:
- How FMOD manages sounds, why each sound file is a separate module, placed within events.
- How to loop fragments of music in game.
- What are parameters and how to use them to control sound through C# scripts in Unity.
- How to use triggers, which are special game objects, to change music in game depending on the area of the game in which the player walks.
- How to use multisound modules to add random elements to music.
- How to create snapshots to dampen the sound when the health level of your hero drops below 50%.
- How to use horizontal and vertical adaptive music.
With this “music knowledge”, you will be able to add any sound to your game.
One more thing – I have written this guide with Unity 2017 and FMOD 1.10.05 – I hope things I have used won’t change in later version of these two programs.
Files for This Book
I have prepared some files for this book, which you can download and use throughout this book.
Within the download package you’ll find ogg files with music and music elements that will be used for this book. You’ll also find a .unitypackage file with a very simple scene that uses standard assets offered by Unity – because I’m no 3D artist, so I can’t create my own.
If you want, you can prepare a scene yourself, though.
- Download files for this guide (20.7 MB from Dropbox)
Within the package, you’ll find folders and files:
- Basic Music – 4 audio files for chapter 3., and a single stinger file.
- Horizontal Layering – files for the chapter about horizontal adaptivity.
- Vertical Layering – files for the chapter about vertical adaptivity.
- fmod_book_V3.unitypackage – a package for Unity with a basic scene, scripts and prefabs.
- Fmod_project_package.zip – a ready package with an FMOD project we’ll make for this book, just for reference.
A note: the package contains no player character nor cameras – you can download these yourself, because I have used standard assets for Unity, offered for free by Unity Technologies in Unity editor.
In the next part of this series, we’ll learn how to install FMOD, and then we’ll take a look at the basic interface of FMOD.