Audio Bugs + Balancing

I’ve been up to my eyeballs in audio the past handful of weeks, and I know I need a break from it, and you probably do too. BUT!! This week was spent re-writing large parts of my audio engine and roughly balancing the audio of the game.

What’s with me and constantly re-doing things? Well, I’ve been using the same audio code for almost 8 years now, adding to it here and there when I needed to but keeping it mostly intact. The amount of polish Joonas brings to the audio really highlighted major problems in my code and forced me to make it a lot better! I’m about ready to record a trailer, but I don’t want to have obviously crappy audio in it, especially when Joonas is doing such awesome work, soooooo this was the time it had to be done.

An example of a problem I was having: I showed long ago how sounds fade the farther they were from the player, like so.

It’s neat, but it produces unpredictable results. Depending on how zoomed-out the camera is, sounds can be on-screen but faded, or even completely silent. So, a boss could be right there in plain view warming up an attack and you’d never even hear it. Not cool.

I changed the circle to encompass everything the camera could see instead, but that just produced a different flavour of unpredictability, since now sounds can be way off-screen in some cases and still heard, or barely off-screen and not heard.

In the end I re-did the whole thing to use rectangles instead. Now any sound inside the view area plays at max volume, and fades out more or less evenly in all directions.

If you care how I did it: the game traces a line from the center of the screen to the sound’s position. It finds the point where that line crosses through the edge of the red ‘faded sound’ rectangle — that’s the sound’s max distance (any father away and the sound won’t be heard.) Finally, it compares the length of the two lines and figures out how loud to play the sound.

This is me trying to work it out on a random envelope (so indie, right??) You’ll notice I don’t really use fancy equations, I just kind of make up my own and find out what works by experimenting and testing my theories. If I had’ve been more attentive in math class I’m sure this would have gone a lot quicker! Who knew it would actually be applicable to my work??? (My teacher, probably.)

That and many, many other bugs/glitches/errors aside, I also gave a pass at balancing the game’s audio! In this context, ‘balancing’ means adjusting the loudness of every sound effect so that they all work harmoniously together with each other and with the music. I do my best at this stuff but I’m a bit of a novice, so it takes me a while and I second-guess myself a lot. I guess what I’m saying is, don’t take what I’m about to say as gospel — it makes sense to me but it doesn’t mean it’s right.

Anyways, there’s a lot going on in any given moment of Bleed 2. Gunfire, yells, explosions, impact sounds, ambient noises, etc etc etc. If all the sounds play at the same volume it turns into an interminable cacophony (how do you like those words, huh?) so I have to decide which ones to make louder than others. My approach in general is to make the most impactful and important events the loudest — so a sound that alerts you to a boss’ attack gets top priority, and so do sounds that correspond to major player actions, like when you reflect a big attack. Sounds that mean less to the gameplay and are more for flavour are pushed back, like the ambient hum of a motor, or events occurring in the background.

Everything else lies somewhere in-between. For instance, it’s obviously important to have a sound for when the dual pistols fire, but they fire extremely fast and after a while practically become an ambient noise themselves. As a result I have the pistol fire sounds somewhere in the middle, with the sounds of them actually hitting something a bit louder. I also randomly adjust the volume and pitch of sounds like that to give them some variety, which makes it easier on your ears to hear over and over again.

Wheeeewie! So now that that’s all taken care of, I guess I’ll be going at making a trailer!! No idea how long preparing it and marketing will take, but hopefully not long! I can’t wait to share what I’ve been working on!