Sound

Sound

From BeamNG

Since version 0.10.0 we are using FMOD as the main audio engine in our game.


Vehicle Sounds

Accompanied by the sound update you're able to create sound sets per engine instead of per vehicle.


soundConfig

Thus we introduced another jbeam section called soundConfig. This section needs to be in your engine jbeam and will give you control over several parameters which determine the behaviour of your sound files in-game.

Following an example of a soundConfig section:


    "soundConfig": "soundConfig",
    },
    "soundConfig": {
        "sampleName": "V8_2",
        "mainGain": -18,
        "maxLoadMix": 0.6,
        "minLoadMix": 0,
        "onLoadGain":1,
        "offLoadGain":0.65,
        "eqLowGain": -5,
        "eqLowFreq": 150,
        "eqLowWidth": 0,
        "eqHighGain": -5,
        "eqHighFreq": 6000,
        "eqHighWidth": 0,
        "lowCutFreq":90,
        "highCutFreq":12000,
        "eqFundamentalGain": -15,
    }


Here are some of the parameters which you can define in such a section and a short explanation of them:


sampleName:

Creates the link between this sound config and the sfxBlend2D file. We'll talk about the blend file in the next section.

As of 0.10.0.1, currently usable sampleNames are:

I4
L6
V6
V8
V8_2
V10 (unused)
B4
B4S

mainGain:

Defines the volume of the sound. The value of the parameter is between -30 and +10 with dB as the unit. The default value is 0dB. One perceives the difference from 0dB to +10dB as double the volume. Also a difference of +/- 2db is just about to be a volume change.


eqLowGain, eqLowFreq, eqLowWidth, eqHighGain, eqHighFreq and eqHighWidth:

eqLow and eqHigh allow for more custom engine sound modifications. The target frequency can be set with eqLowFreq and eqHighFreq. This is where the sound change will happen. eqLowGain and eqHighGain define the amount of boost or reduction for that target frequency. Those two parameters can be positive or negative with a range from -30dB to +30dB. The bandwidth can be set with eqLowWidth and eqHighWidth. The higher that value, the more narrow the band is. Low values also influence frequency content that is slightly below and above the target frequency.


lowCutFreq and highCutFreq:

Can be used to remove the low frequencies/bass of the engine sound. In audio terms, this parameter defines the cutoff frequency of a high pass filter. The higher the value, the more audio content below this threshold gets reduced. For example, if lowCutFreq is set to 100, all frequencies below 100Hz get reduced. The default value of 20Hz has no audible effect. Resonable values for this parameter can reach from 20Hz to 200Hz.

This is the counterpart of highCutFreq. With this parameter, the high frequencies of the engine sound can be reduced. It defines the cutoff frequency of a low pass filter. The lower the value, the more content above this threshold gets reduced and the more muffled the engine sounds. Reasonable values can reach from 5000Hz up to 20000Hz.


eqFundamentalGain and eqFundamentalWidth:

eqFundamentalGain can be used to lower or boost the fundamental frequency of the engine sound. The fundamental frequency is essentially the loudest part of the engine sound and perceived as a dominant and sometimes annoying boom or drone for low RPM values. This parameter automatically targets the fundamental frequency of the vehicle and changes dynamically depending on the vehicles RPM.



Parameter's default values:

Parameter Default value
mainGain 0
lowCutFreq 20
highCutFreq 10000
eqLowFreq 500
eqLowGain 0
eqLowWidth 0
eqHighFreq 2000
eqHighGain 0
eqHighWidth 0
eqFundamentalGain 0
eqFundamentalWidth 1

sfxBlend2D.json

Additionally you need to have a sfxBlend2d.json file which contains information about all the sound files you would like to use for your custom engine sound.

The file needs to be located in the following directory to work properly: \art\sound\blends\


These files do have naming conventions. The pre-tag of the filename corresponds to the sampleName of the soundConfig that you've created.

According to the example above it should be: V8_2.sfxBlend2D.json


And this is how it looks like:

{
    "header" : {
        "version" : 1
    },
    "eventName" : "event:>Engine>default",
    "samples" : 
    [
        [
            ["art/sound/engine/V8_2/859.flac", 859],
            ["art/sound/engine/V8_2/919.flac", 919],
            ["art/sound/engine/V8_2/984.flac", 984],
            ["art/sound/engine/V8_2/1052.flac", 1052],
            ["art/sound/engine/V8_2/1126.flac", 1126],
            ["art/sound/engine/V8_2/1205.flac", 1205],
            ["art/sound/engine/V8_2/1289.flac", 1289],
            ["art/sound/engine/V8_2/1380.flac", 1380],
            ["art/sound/engine/V8_2/1476.flac", 1476],
            ["art/sound/engine/V8_2/1579.flac", 1579],
            ["art/sound/engine/V8_2/1690.flac", 1690],
            ["art/sound/engine/V8_2/1808.flac", 1808],
            ["art/sound/engine/V8_2/1935.flac", 1935],
            ["art/sound/engine/V8_2/2070.flac", 2070],
            ["art/sound/engine/V8_2/2215.flac", 2215],
            ["art/sound/engine/V8_2/2370.flac", 2370],
            ["art/sound/engine/V8_2/2536.flac", 2536],
            ["art/sound/engine/V8_2/2714.flac", 2714],
            ["art/sound/engine/V8_2/2904.flac", 2904],
            ["art/sound/engine/V8_2/3107.flac", 3107],
            ["art/sound/engine/V8_2/3324.flac", 3324],
            ["art/sound/engine/V8_2/3557.flac", 3557],
            ["art/sound/engine/V8_2/3806.flac", 3806],
            ["art/sound/engine/V8_2/4073.flac", 4073],
            ["art/sound/engine/V8_2/4358.flac", 4358],
            ["art/sound/engine/V8_2/4663.flac", 4663],
            ["art/sound/engine/V8_2/4989.flac", 4989],
            ["art/sound/engine/V8_2/5338.flac", 5338],
            ["art/sound/engine/V8_2/5712.flac", 5712],
            ["art/sound/engine/V8_2/6112.flac", 6112],
            ["art/sound/engine/V8_2/6540.flac", 6540]
        ],
        [
            ["art/sound/engine/V8_2/859_P.flac", 859],
            ["art/sound/engine/V8_2/919_P.flac", 919],
            ["art/sound/engine/V8_2/984_P.flac", 984],
            ["art/sound/engine/V8_2/1052_P.flac", 1052],
            ["art/sound/engine/V8_2/1126_P.flac", 1126],
            ["art/sound/engine/V8_2/1205_P.flac", 1205],
            ["art/sound/engine/V8_2/1289_P.flac", 1289],
            ["art/sound/engine/V8_2/1380_P.flac", 1380],
            ["art/sound/engine/V8_2/1476_P.flac", 1476],
            ["art/sound/engine/V8_2/1579_P.flac", 1579],
            ["art/sound/engine/V8_2/1690_P.flac", 1690],
            ["art/sound/engine/V8_2/1808_P.flac", 1808],
            ["art/sound/engine/V8_2/1935_P.flac", 1935],
            ["art/sound/engine/V8_2/2070_P.flac", 2070],
            ["art/sound/engine/V8_2/2215_P.flac", 2215],
            ["art/sound/engine/V8_2/2370_P.flac", 2370],
            ["art/sound/engine/V8_2/2536_P.flac", 2536],
            ["art/sound/engine/V8_2/2714_P.flac", 2714],
            ["art/sound/engine/V8_2/2904_P.flac", 2904],
            ["art/sound/engine/V8_2/3107_P.flac", 3107],
            ["art/sound/engine/V8_2/3324_P.flac", 3324],
            ["art/sound/engine/V8_2/3557_P.flac", 3557],
            ["art/sound/engine/V8_2/3806_P.flac", 3806],
            ["art/sound/engine/V8_2/4073_P.flac", 4073],
            ["art/sound/engine/V8_2/4358_P.flac", 4358],
            ["art/sound/engine/V8_2/4663_P.flac", 4663],
            ["art/sound/engine/V8_2/4989_P.flac", 4989],
            ["art/sound/engine/V8_2/5338_P.flac", 5338],
            ["art/sound/engine/V8_2/5712_P.flac", 5712],
            ["art/sound/engine/V8_2/6112_P.flac", 6112],
            ["art/sound/engine/V8_2/6540_P.flac", 6540]
        ]
    ]
}


header:

Please keep it as is. In case the system gets updated, this will help to create compatibility-modes for former versions.


eventName:

Same here, please keep it as is for the time being. One might be able to modify this later on to apply different kind of filters to the set of sounds, for example for front-engine or rear-engine cars.


samples:

Two arrays of sound samples are in here. The first array contains off-load samples, the second one contains on-load samples. On the one hand you have to define the path of the sample, on the other hand you have to define the desired rpm of the file. The audio engine will linearly blend the sound samples corresponding to the actual rpm of the current vehicle.

Usually the sound sample files are located in /art/sound/engine/%engineSoundName%/

Starter Sounds

One can easily define which starter sound an engine should use. You just need to add the corresponding properties to the mainEngine section of your engine.jbeam.

"mainEngine": {
  "starterStartSample" :  "file:>art>sound>engine_starter>myStarter_start.ogg",
  "starterLoopSample": "file:>art>sound>engine_starter>myStarter_loop.ogg",
  "starterStartVolume": 0.4,
  "starterLoopVolume": 0.4,
  "starterStartPitch": 0,
  "starterLoopPitch": 0,
  "starterLoopTime": 0.181
}


Parameter Default value
starterStartSample "file:>art>sound>engine_starter>starter_start2.ogg"
starterLoopSample "file:>art>sound>engine_starter>starter_loop2.ogg"
starterStartVolume 0.4
starterLoopVolume 0.4
starterStartPitch 0
starterLoopPitch 0
starterLoopTime 0.181


starterStartSample:

The location of the ogg file for the starter start sample. The starterStartSample gets played just once when the user presses the starter button.


starterLoopSample:

The location of the ogg file for the starter loop sample. The starterLoopSample gets played after the start sample and until the engine has started.


starterStartVolume:

Volume of the starter start sample.


starterLoopVolume:

Volume of the starter loop sample.


starterStartPitch:

Pitch of the starter start sample.


starterLoopPitch:

Pitch of the starter loop sample.


starterLoopTime:

The length of your starter loop sample.


starterStartVolume, starterLoopVolume, starterStartPitch, starterLoopPitch and starterLoopTime are not required to add custom starter sounds to an engine. Even though it's highly recommended to add the starterLoopTime property and change the value accordingly to the length of your loop sample.


Vehicle Creation
Get started: Introduction to Vehicle Creation
JBeam
Overview
Physics
Dynamics
Visuals
Extras
Upkeep
Deprecated
See also: JBeam ExamplesJBeam Physics Theory