Skip to content

Instantly share code, notes, and snippets.

@enenra
Last active April 7, 2020 20:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enenra/a6024d4e62311409236336190c0095ad to your computer and use it in GitHub Desktop.
Save enenra/a6024d4e62311409236336190c0095ad to your computer and use it in GitHub Desktop.
Creating Block Sounds for SE

Tutorial: Creating Block Sounds for SE

This guide will focus on creating a set of sounds for a block from source sound effects and then implementing it into the game. In order to be able to do that, we will first cover setting up the necessary folders and programs, and then go through the preparation of a sample sound set to be implemented into the game.



Setting up the necessary environment

First off, we want to prepare the things we'll need to do all the work that needs to be done.

Folder structure

Nothing too fancy is required, but I recommend the following structure within your SE Modding folder:

audio\          - This is where finished sound effects are saved to.
audio\projects\ - This is where Audacity projects will be saved to.
audio\source\   - This is where all source sound effects are placed.

Required tools

You'll pretty much only require Audacity, a way to play .WAV files (pretty much any audio player can do this) and a text editor (notepad if you have nothing else). I recommend going to Edit --> Preferences... --> Interface within Audacity and setting it to the dark theme. That is what I'll be using during this tutorial. If you have another audio editor - most of what is done here is fairly basic so it should be possible to be done in most other editors as well.

Creating a Sound Set

A sound set will usually consist out of three sound files - a start sound that is played when the block is powered on, a loop sound which is looped continuously until the block is turned off, and finally an end sound that is played immediately after the loop sound has ended when the block has been turned off. Note that "turning off" is just an example here: The same set is also used for when a Refinery starts actively refining, for example, or when a thruster is activated because the player presses W to go forwards. Thus, while the trigger changes, the flow of start --> loop --> end stays the same.

All that is to say that ideally you'll already have a source sound effect that consists of these three parts. In that case, the process becomes a lot easier as you'll be able to skip a lot of the editing and go straight to the section where we're adjusting the sounds to flow from one to the next nicely. But if you only have one file, that's fine as well. This is also going to be what we'll be starting with in this tutorial: We're going to be creating the engine sound set of the A-Wing for inclusion with Spacebar's A-Wing Kit.

Choosing your source sound effects

For the source sound file we're starting with you want to be sure that it already is close to looping. Making a completely new sound effect is beyond this tutorial, so the prerequisite is to have a sound effect ready that is suitable. I'm going to be starting out with two sound effects that feel usable:

First off, I'm going to open up Audacity and import the two sounds into separate tracks. Then I'm going to save this as a project in the audio\projects\-folder and name it armco_awing_engine. I strongly recommend deciding on a good naming scheme and sticking to it. It will save you many a headache in the future and make it much easier to spot errors.

Cutting the sounds

The first thing we can see with these two tracks is that, well, there actually seem to be three waveforms. That is because one of my tracks is in stereo and the other is in mono. That's an issue because the game will only play back mono sounds correctly. If you add a stereo sound to the game, you'll only hear it on one side. However, that's not an issue for right now - we'll just have to remember to split the track before exporting.

Also take note, in case you aren't that familiar with the Audacity interface, of the Mute and the Solo buttons you have per track. Those will come in very useful as they will allow you to work on multiple tracks within the same project easily. Further remember this hotkey: Shift + Spae. It will loop the current selection indefinitely and that's very useful when you're trying to tell whether a sound loops properly.

Now onto the sounds themselves. You'll immediately notice that the flyby sound is much louder than my engine sound. That is fine in this case, because the startup can have a bit more punch to it and we'll be able to set its volume later in the game files. You'll also likely notice that my engine sound is much shorter. This is also fine in this case, because it loops well. But in general, especially if the sound effect contains a lot of parts that stand out recognizably, you'll want a longer loop because then it becomes less obvious.

The first thing we're going to do in this case is cut down our future startup sound a bit. Long silent periods at the beginning or end of sounds is generally a bad idea because if they're at the beginning of a file, it'll feel like the sound plays delayed. If they're at the end, unless they're the end track, it will interfere with smooth transitions between sounds of a set. As we want to match up the end of the startup sound to the loop, we're going to cut the end of the flyby sound at a place where the volume is roughly the same as the loop sound:

Note that you can always copy and paste the beginning of the loop to the start track to better see if they roughly match up. Just remember to delete it again after.

Now we'll next want to work on the transition between the startup and the loop. This means that we'll take a part of the loop sound and cut it away from the loop to add to the startup to help it transition into the loop. Because our loop is already a bit short, we're going to simply copy it (double click to select track) and then add it to the end of its own track, thus doubling its length. Be sure to zoom all the way in (Ctrl + Mousewheel) and use the arrow keys to do fine adjustments of the cursor position, then paste the loop in.

Next up we're going to first duplicate the loop track, by simply copy / pasting it to below. We'll now start cutting out a part of the loop to add to the startup sound. However, that part of the loop will also have to be removed from the loop itself, as we'd otherwise have the same part playing twice just after itself. As a result, we have to make sure that the new beginning of the loop - the place where we will cut from - also matches the end of the loop. And because we will also have to cut off a part of the end of the loop to create the end sound, that end of the loop is actually variable. To illustrate:

Blue: related to start-sound / Red: related to loop-sound / Green: related to end-sound

As you can see, the red square will become the loop sound, and as a result it has to be matched up nicely to its own end. The way I generally go about doing this is actually quite simple:

  1. Search two points where the sound has roughly the same volume. Those will become the beginning and end of our "red area".
  2. Ensure the two points roughly match up. Remember to use Shift + Space. Knacks in the audio are fine, we can deal with that. But if it doesn't match up at all it won't work.
  3. For each point, search for a point that is close but also is exactly on the waveform's zero. You can find these by zooming in: Note the direction the waveform goes into before it arrives at that point. We want the waveform for both of our points to be going down over the zero point.
  4. Select the part to the left of the first point and go to Edit --> Remove Special --> Split Cut. Then paste it to its own track. Do the same with the second point but to its left. Also paste it in the same manner to its own track.
  5. Now use the arrow dropdown list on the leftside panel next to each track's name to rearrange the tracks so that you end up with: Startup, First cut, Loop leftover, Second cut, Original loop.

With this we have finished cutting and get to now progress to the next stage: Making it sound nice.

Rearranging the tracks

But before we can do that, we need to first rearrange the tracks so that they start at the correct times. This isn't particularly hard, but can be a bit fiddly. First select our first cut and then use the Time Shift Tool to move it to where it's around half over the flyby sound's end. We do this because we want to transition to the first cut completely before we then transition from the first cut into the loop as we've made sure the first cut's end matched up with the loop.

Next double click on our loop leftover and then paste it to exactly where the first cut ends. Do this by zooming in all the way and adjusting the cursor using the arrow keys. Finally go to the second cut and do the same as for the leftover loop, but with the end of the leftover loop. You'll end up with this:

Don't skimp on the precision. Any gaps or overlaps will likely result in audible knacks in the audio.

To check whether everything is in order, select from the beginning of the first cut up until the end of the second cut and hit Shift + Enter. If you hear any audible transitions when the playback goes over the edges of the tracks, that's not good.

Sound effects

Audacity has a bunch of different sound effects available. I recommend you go through them and experiment a bit with what they do. We're going to be using a few of them to work on this sound effect.

Transitioning sounds

The first thing we'll work on is integrating the flyby sound file that we've only cut a bit so far, and the first cut. Together they will become our start sound. In order to do this we're going to use the two effects Fade In and Fade Out: We're going to fade out the end of the flyby sound and at the same time fade in the beginning of the first cut. For the fade out, select roughly the area from where the first cut starts up until the end of the flyby sound within the flyby track. Then apply the fade out. Similarly, select from the beginning of the first cut to the end of the flyby sound within the first cut and apply the fade in. It should end up looking like this:

Be sure to now select the tracks from the beginning to the end of the loop and listen to them repeatedly. Make adjustments as needed - be that to cut away more of the flyby sound or to move the first cut. In my case I wasn't happy with the initial result and ended up cutting and moving quite a bit. I also changed the length of the fades until I was happy with the sound. This is what I'm left with:

Now because we don't have a specific source effect to use for the end, we will be creating a nice power down sound from just the second cut. In order to do that, for now just add a fade out to it that is most its length. Just be sure that the beginning of the track is untouched and that it ends in silence. Keep that part selected. If we did not have the flyby sound, the first cut would be adjusted in the same, way but with the reverse fade.

Sliding Time Scale / Pitch Shift

Now we will make our future end sound that is the second cut more "power-down-y". To do that we'll use the Sliding Time Scale / Pitch Shift-effect. Choose it from the menu and use the following settings on the already selected area from earlier:

Play around a bit with the settings but in general you'll want to have a change to a slower tempo and lower pitch for power down. Incidentally, if we did not have the flyby sound and needed to make our own power up, we'd be doing the same pitch shift effect but in reverse: start with lower tempo and pitch and go back to normal.

Try listening to all the sounds now, your work here is pretty much finished.

Creating "realistic" sound effects

This is based on experimentation I've done trying to approach the sound effects in "realistic sound" mode in Space Engineers. I'm going to be covering the effects and their values I've used, but they vary to a large degree depending on the sound. Sometimes it comes out sounding great, sometimes not so much. You'll unfortunately likely have to play it by ear and adjust values track-by-track to produce good-sounding realistic sound effects. I'm not going to be making those for the A-Wing, but I'll cover the effects. Be sure to apply those to all parts of your sound set with the same values.

Reverb

The first of the two effects I generally use for this is Reverb. There are a lot of values to play with here but the important one is the checkbox for "Wet Only". Be sure to always keep it checked. These are my default values I use as a base:

Equalization

The second of two effects. This one is a bit of a pain to set up so be sure to save it as a preset. Imitate my curve by placing dots on the line and then dragging them. Again you'll likely have to experiment a bunch to get it right. These are my values:

Amplify

This one I use when I notice the waveform of the tracks reaching the limits of the display, when they get very loud. In those cases I revert the above effects and first run Amplify over them with a negative value, then reapply the effects. You can also just use amplify afterwards of course.

Matching tracks again

Now comes the annoying part. You've probably noticed that your track's waveforms have changed quite a bit. And change means that they don't match up anymore. This is unfortunately invevitable and means you'll have to go back to the cutting board and match up the tracks by cutting away from them. Again I recommend to always cut on the zero point with a downward curve in areas where the volume is roughly the same.

Exporting

We now have three files within the same project. This is not an issue, as we can export selection only. Be sure to mute all other tracks than the ones you want to export together but that's just for safety. In my case, I'm first going to select the flyby sound as well as the first cut and then go to File --> Export Selected Audio and save it as armco_awing_engine_start_arc.wav with the type WAV (Microsoft) 32-bit float PCM to my audio\-folder. BUT we can't forget that that the flyby track is still in stereo! Go to the arrow next to its name and select Split Stereo to Mono and voilà.

Then I'll do the same for the loop, but save it as armco_awing_engine_loop_arc.wav with the same type. I'll do the same again for the second cut and save it as armco_awing_engine_end_arc.wav, again same type.

Copy these files to the Audio\-folder within your mod. I recommend creating and maintaining subfolders within that folder if you're working with more than a few audio files but this is up to you.

These are the results:

Creating the SBC entries

Now that we have our audio files in place, we need to create the necessary entries in the Audio.sbc file of our mod to link to our audio files. I'm not going into all the details of SBC modding in this tutorial, but I recommend you simply take an existing entry and copy it to your file to start from. If you're making a thruster sound (like I am), then copy a thruster sound entry, etc.

This is the entry I'm going to start with as it exists inside of Spacebar's A-Wing Kit mod:

    <Sound>
      <Id>
        <TypeId>MyObjectBuilder_AudioDefinition</TypeId>
        <SubtypeId>awingthruster</SubtypeId>
      </Id>
      <Category>SHIP_JET</Category>
      <MaxDistance>3000</MaxDistance>
      <PreventSynchronization>0</PreventSynchronization>
      <DynamicMusicCategory>HeavyFight</DynamicMusicCategory>
      <DynamicMusicAmount>35</DynamicMusicAmount>
      <Volume>.05</Volume>
      <Loopable>true</Loopable>
      <Waves>
        <Wave Type="D3">
          <Start>Audio\awingthruster.wav</Start>
        </Wave>
      </Waves>
    </Sound>

Be sure to make your SubtypeId unique. On first look, the MaxDistance (that the sound plays at) is a bit far, but that's for another time. First we're going to set up the audio file links. If you have any Wave Type="D2" in there, delete them. Those are afaik deprecated and not used anymore, or only as a fallback. We'll only be using D3.

Standard start, loop, end

In order for the sounds to be played correctly, we're going to be using these three tags. In practice, this will look like so:

    <Sound>
      <Id>
        <TypeId>MyObjectBuilder_AudioDefinition</TypeId>
        <SubtypeId>awingthruster</SubtypeId>
      </Id>
      <Category>SHIP_JET</Category>
      <MaxDistance>3000</MaxDistance>
      <PreventSynchronization>0</PreventSynchronization>
      <DynamicMusicCategory>HeavyFight</DynamicMusicCategory>
      <DynamicMusicAmount>35</DynamicMusicAmount>
      <Volume>.05</Volume>
      <Loopable>true</Loopable>
      <Waves>
        <Wave Type="D3">
          <Start>Audio\armco_awing_engine_start_arc.wav</Start>
          <Loop>Audio\armco_awing_engine_loop_arc.wav</Loop>
          <End>Audio\armco_awing_engine_end_arc.wav</End>
        </Wave>
      </Waves>
    </Sound>

There are some blocks that only use a loop or only use a start sound, but thruster sounds and most block sounds do support these three, even if in the vanilla game they're not always all used.

Gunshot sounds

Lastly, gunshots are a bit special and suitable to demonstrate another mechanic. Look at the vanilla gatling shot entry as an example:

    <Sound>
      <Id>
        <TypeId>MyObjectBuilder_AudioDefinition</TypeId>
        <SubtypeId>ArcWepShipGatlingShot</SubtypeId>
      </Id>
      <Category>SHOT</Category>
      <MaxDistance>200</MaxDistance>
      <PreventSynchronization>0</PreventSynchronization>
      <DynamicMusicCategory>HeavyFight</DynamicMusicCategory>
      <DynamicMusicAmount>3</DynamicMusicAmount>
      <DistantSounds>
        <DistantSound DistanceCrossfade="10" Distance="200" Sound="WepShipGatlingShotDistant1" />
      </DistantSounds>
      <Volume>0.7</Volume>
      <Waves>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d01.wav</Start>
        </Wave>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d02.wav</Start>
        </Wave>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d03.wav</Start>
        </Wave>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d04.wav</Start>
        </Wave>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d05.wav</Start>
        </Wave>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d06.wav</Start>
        </Wave>
        <Wave Type="D3">
          <Start>ARC\WEP\ArcWepShipGatlingShot3d07.wav</Start>
        </Wave>
      </Waves>
    </Sound>

As you'll likely notice, it doesn't just possess one wave but multiple, with one start sound each. Ingame this means that one of these waves, and thus sound files, will be randomly chosen. This is great for weapon shots because always having the same sound effect play doesn't sound very good, especially if you hear it often due to a fast firing rate. For shot sounds, just make sure that they're not too long, don't contain much of any echo, and that you trim away all the silence before the waveform starts and after it ends. Work with fade outs to make it end sooner.

This concludes the tutorial. I hope it helps. :)

Ingame sound demo video (This also includes the other sounds I made for the A-Wing Kit.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment