Sound in Scraps

So, recently I started implementing sound in Scraps. Here’s a video:

It’s early stuff (the Medium Engine sound is particularly terrible) but the basics have been laid down at least. Audio is necessarily a little more complex in Scraps than it might be in a typical driving game since the player can have any number of noise-making components on their vehicle.

General Rules

Using a naive system, a vehicle with ten of the same generator type would play ten identical generator sounds, which would come across to the player as one very loud generator sound. An obvious optimisation there might be to only play one sound, but play it louder. Doing that though, it’d still sound like they only had one generator, which isn’t very realistic, and there are a couple of things that actually create slight variation between the ten “identical” sounds:

  1. Each sound would have slightly different panning in the speakers, from the different positions of the generators on the  vehicle in the game-world
  2. Unity also has a doppler effect by default, which modifies the pitch of sounds based on movement

In my system, I allow the 3D panning but disable the doppler effect for the player’s own vehicle, as it creates some obvious phasing of the audio with identical sounds. Actually, you can hear the same thing in Kerbal Space Program (as of version 0.18 at least) when you have a bunch of the same booster, and I wonder whether they should slide their doppler slider to zero for parts connected to the ship. KSP is also developed in Unity.

Anyway, I don’t want ten generators to sound like one super-loud generator, so I vary the pitch of each one randomly, so each has its own sound. When I randomly modify the pitch, I also do it in musical intervals (e.g. a major third or a perfect fifth), which makes things sound not exactly musical, but more pleasing than a random cacophony.

It’s also necessary to limit the total volume because digital sound can only go so loud before it starts clipping – going over 100% and distorting to a flat line. For that I implemented a basic sort of compressor/limiter (see which reduces sounds from parts when the vehicle has multiple sounds from the same type of part playing at the same time. When e.g. ten generators play at once, they’ll get told to each play at reduced volume. Eventually, some will get told not the bother playing at all, which prevents clipping, has the benefit of improving performance, and doesn’t really sound different to the player.


Engines have an additional sound consideration – they need to change pitch based on RPM. Now, Scraps doesn’t really have actual RPM or gears, but it’s nice to pretend so that things sound reasonable. So OK, I give each engine a fixed (realistic) number of gears and I vary the pitch with speed and current gear. I cover a few special cases like being airbourne, where RPM is more based on throttle than speed. Now, when do I change gear?

Well, the player might build a super-fast vehicle with three engines that goes 300km/h, and we want the gear range to be able to cover that, so let’s make top gear max out at about that speed. But then maybe you built a heavy vehicle with only one engine and it never gets much above 50km/h. Now you’re going to be stuck in first or second gear (according to the audio) all the time. And what if they build something that goes 1000km/h…?

So I calculate how fast I think the vehicle will be able to go based on its mass and total engine power (later this will also have to incorporate aerodynamics), and I set the gearing accordingly per vehicle. Top gear can keep increasing pitch as it goes even faster, but (at least in my tests so far) it never gets ridiculous.

Other Sounds

The build screen now has some sounds as well, with different placement sounds for different part types (see the video above). There’s also a click sound for clicks on buttons etc. There’s also music for the main screen and several ambient piano-based tracks for the build screen (all of which I’ve just made myself). I’m not sure if the feel of things is quite right yet, but it’s a start.


For the music, I have a small home recording setup with several microphones. For sound effects out in the field I’m using a Zoom H2, which is a really excellent little recorder. Where I can get something good, I’ve recorded my own sounds. Yes, the small engine sound is my lawnmower.

When I can’t do a good version myself, I’ve been scouring for good Public Domain and Creative Commons Zero licensed stuff that I can use without attributing. That might sound a little bit harsh, but I don’t want to add a credits section to the game just so it can say everything by myself, plus a few people with names like AudioMasterDJ92 contributing a single short sound each. I do want to follow the rules, which is why I’m careful not to use anything that does require attribution. Speaking of licences, I might as well take this opportunity to plug my recent free (just enter $0) Creative Commons-licensed music album: In Our Dreams We’re Flying.

Bookmark the permalink. Both comments and trackbacks are currently closed.


  1. Posted October 16, 2013 at 7:17 am | Permalink

    I like the game its just that how do you change the sound to what you want?

    • bill
      Posted October 16, 2013 at 7:57 am | Permalink

      Hi, not sure what you mean. You can change the sound FX and music volume on the options screen, but you can’t actually change the sounds in the game to your own sounds.