Happy Monday everyone! This is Mr. Slate with another ramble. This week I'm going to share some of my experiences implementing the audio in our action RPG.
If you haven't seen... I suppose I should say *heard* our audio then I would point you towards our YouTube channel where you can get up to speed and find even more videos detailing our dev process. And just for good measure here's our latest video, featuring combat audio:
There are a fee things you need for good audio in your game.
First you need the clips. Duh. Here's the thing, there's a ton of places to get audio libraries from. The most cost effective I've found by far is Humble Bundle. Specifically software bundles . You have to be a little careful to make sure the package isn't legally locked on one platform (it can only be used in content made with Game Maker or Unity for example) but other than that you can get some amazing sound effects and ok music this way. Don't get me wrong, sometimes you get amazing tracks. The reason I say that the music is ok is because it is usually quite generic and it's unlikely you will have enough since these packs usually only provide a few tracks per genre.
Then you need an audio editing software - Audacity has been and still is a very powerful free tool that will help you a lot. There is a slight learning curve to using it but there is some good documentation out there so don't be afraid to give it a try.
You need to have a clear world concept. To know what your game's world is like and pick sounds that complement it. For example, our game's world is that of an industrialized medieval society. There is magic everywhere but no one knows how to control or shape it so simple machines are used in day to day live. This made me choose clunky wood and iron sounds for the UI. These are the kind of choices you need to make before you start implementing audio in your game.
Decide on technical implementation. There are plenty of tools on the Unity store and plenty of people who will tell you to do things one way or another. Based on the scope of your game you can go complicated or simple. On the most basic level you'll need a way to play audio through a centralised utility/system that will manage your Audio Mixer groups and Audio Listeners. Slight side note - use the Audio Mixer. Just. Use it. It's not that hard and it makes your life so much easier. Anyway. I didn't need anything complicated and I had experience using this previously so I settled on this basic utility. It's under the MIT license. It's simple and easy to use. Give it a look.
Speaking of technical stuff - prepare your game from the start. Do the above prep and then make sure to use whatever configs and hooks you have in your code. Turn it off during normal dev if necessary, but make sure that when it's turned on it sounds right and it starts and stops where it should. There are plenty of audio bugs that are just waiting to happen so implementing it as the project is going along is going to save you lots of time.
And lastly a few tips that might help you with your game:
Use Audacity to convert your audio files to ".ogg". Quality 2 or 3 should be sufficient. File sizes go down to about 10% of the original. I am not an audio engineer and I don't know what this does to the audio file but using a pair of good headphones I couldn't hear any difference. The other caveat to this is that we're making a game for mobile so audio will be played through headphones and not-that-great speakers so I'm not that worried about music album quality audio.
When you have complex layered sounds (for example if you have a click-slide-hit sequence) - combine them in one clip. This will save you file space, the hassle of adjusting them all individually and will remove a bit of the audio performance overhead.
Some audio (effects and music) comes with long dead air pauses. Remove those using your audio editing software.
Unless the effect/music is too quiet on the highest volume, do not change the volume of the clip in audio editing software. Louder is always better because audio that is too quiet can't be made louder using volume but loud audio can always be made quieter. Find a way to associate a volume control to audio files and adjust it that way. The utility I've linked above will let you do that using scriptable objects.
Unless in a dramatic/cinematic moment music and ambiance should always be quieter than sound effects. Your UI or combat's audio feedback will almost always be more important than music.
Volume is not linear. Lowering a clip's volume to 50% doesn't feel like it's 50% quieter. I'm not sure about the math behind it but I know that it is in fact the case. Don't be afraid to play around with individual clip's volume. You'll end up with some odd values but as long as it sounds balanced it's ok, after all you still have the Audio Mixer to adjust group volumes. You have the Audio Mixer, right?
Unless it's intentional, fade music out instead of stopping it. Even a fraction of a second feels better than a sharp cut.
Make sure to keep an instance of audio objects and stop them in OnDestroy, OnDisable or your clean-up functions. This will save you a lot of headaches.
You will have audio bugs. Clips will carry over further than they should, effects will trigger more frequently than they should etc. etc.. That's it. Prepare for annoying bugs.
Whatever you estimate time wise - you will be wrong. Once again, that's it. Audio is awkward and will always take longer than you think. Just keep at it.
I think that's enough for today. I promise I meant to make this a short one. I don't think the above list is exhaustive in the slightest but maybe it'll put you in the right mindset. I hope it helps someone. As always, this has been Mr. Slate, have a great week and I'll see you next Monday!