Dev Diary - Barnstorming Remake: Sound Manager

The Sound Manager was one of the last things to be implemented into the game, yet none the less a very important one. For playing the game, audio feedback is as important as visual feedback. I didn't get to implement all the sound effects into the game. Music was one thing that is missing, but for a small game like this, it's not that necessary. 


These are the sound effects that were used in the game. All of them were taken from except for two. The "Collision" sound was made by me in Audacity by mixing together 3 different sounds. A metal hit, wood hit and a punch sound effect. I couldn't find a proper quick car collision sound on, so I had to make one.

The second sound was the "GasStationPassthrough" sound effect. That was made by first getting a gas filling sound effect and increasing the tempo overtime to 200%. Then having a bell ding sound effect afterwards. It's a quick sound effect so that the player can easily tell when they've gone through a gas station.

The car's engine sound is tied directly to the car's horizontal velocity. The pitch was changed to emulate the engine moving faster. The formula used is:

pitch = (xVelocity / maxSpeed) * 2

On the menu, there is a small speaker icon. Clicking this, either mutes or un-mutes the audio. I saw through testing the game in the editor, that I was constantly muting the audio in the game screen. The car's engine noise was annoying at times and I thought that for people playing the game, the problem could also be there. So an audio toggle button was added.

It's quite simple. When you click on it, it checks whether or not the three audio sources are enabled or not. If they are, then disable them, if they are not, then enable them.

Speaking of audio sources, there were 3 of them.

  • The car's AudioSource.
  • The car engine's AudioSource.
  • The train AudioSource.

Why is there an audio source for both the car and it's engine? Well since the engine sound effect is tied to the velocity and its pitch is changing constantly, if the player was to hit something, then that sound would be wildly different. So having the engine audio source just play the engine sound and having the car audio source just play collision sounds, that would fix the problem.


Now, how were all these sound managed? Well, they were all controlled by the SoundManager.cs script. Whenever a sound needed to be played, a function in this script was called.

An alternative would be to just play the sound in whatever script was responsible, yet that would be a mess. Having all the sounds in one place, managed by one thing is easier to manage, fix bugs and implement upon if new things are to be added.