Batchfile to generate Sound Mod Configuration Files (sound.sui, *.soundref)

Forum rules
SCS as a company do not wish to have paid mods on this forum. While we understand that not all paid mods use the Intellectual Property of other companies/people, it is very hard to moderate what is and isn't acceptable when money is involved. There are also concerns that it could look unfavorable to potential work partners going forward if SCS allow mods that may potentially use unlicensed branding.
Posting in the Mods forum (ATS and ETS2) is restricted to sharing free-to-the-public mods and providing support for mods. For more details, please check the Forum Rules.
al_batros
Posts: 271
Joined: 05 Jan 2022 16:50

Batchfile to generate Sound Mod Configuration Files (sound.sui, *.soundref)

#1 Post by al_batros » 08 Apr 2023 21:17

Goal: automatically generate all the files (sound.sui, *.soundref) required to use an engine sound bank.
Either direct - or via *.soundref files including "position_offset" values.

As the position_offset values are configured in the batchfile, it is fairly easy to change them and recreate all the configurations.
Or it is easy to create the same set of files for a new sound bank.

This (windows) batchfile will generate the files based on a given sound bank filename.

Example:
Given a sound bank with these files:

Code: Select all

/sound/truck/cummins_x15k.bank
/sound/truck/cummins_x15k.bank.guids
# and an optional remote bank:
/sound/truck/cummins_x15k_rm.bank
/sound/truck/cummins_x15k_rm.bank.guids
using these channels:

Code: Select all

#engine/engine
#engine/exhaust
#engine/start_bad
#engine/turbo
#remote/engine #(if remote bank is available)
directory used:
/def/vehicle/truck/_sound/ # to store all these generated files.

in def/vehicle/truck/_sound/
start batchfile: "generateSound.bat cummins_x15k" in order to create files.
start batchfile: "generateSound.bat cummins_x15k rm" in order to create files including the remote link.
The name of the sound bank ("cummins_x15k") will be used as the base name for all generated files.

1) "cummins_x15k_direct.sui":
(that can be copied to your trucks /def/vehicle/my.truck/engine/sound[_hi|_lo].sui
or can be included in your engine file via
@include "/def/vehicle/truck/_sound/cummins_x15k_direct.sui")
Direct links to the sound bank(s).

Code: Select all

# cummins_x15k 
	sounds:5 # or 4 without remote 
	sounds[]: "engine|/sound/truck/cummins_x15k.bank#engine/engine"  
	sounds[]: "exhaust|/sound/truck/cummins_x15k.bank#engine/exhaust"  
	sounds[]: "start_bad|/sound/truck/cummins_x15k.bank#engine/start_bad"  
	sounds[]: "turbo|/sound/truck/cummins_x15k.bank#engine/turbo" 
	sounds[]: "remote|/sound/truck/cummins_x15k_rm.bank#remote/engine" 
2) "cummins_x15k.sui":
Indirect links to sound bank(s) via *.soundref files that include "position_offset" values.

Code: Select all

# cummins_x15k 
	sounds:4 # or 5 with remote
	sounds[]: "engine|/def/vehicle/truck/_sound/cummins_x15k_engine.soundref"  
	sounds[]: "exhaust|/def/vehicle/truck/_sound/cummins_x15k_exhaust.soundref"  
	sounds[]: "start_bad|/def/vehicle/truck/_sound/cummins_x15k_start_bad.soundref"  
	sounds[]: "turbo|/def/vehicle/truck/_sound/cummins_x15k_turbo.soundref" 
3) The soundref files: (position_offset values can be changed in the batchfile)
/def/vehicle/truck/_sound/cummins_x15k_engine.soundref

Code: Select all

source="/sound/truck/cummins_x15k.bank#engine/engine" 
position_offset=0.0;-0.30;-0.30 
/def/vehicle/truck/_sound/cummins_x15k_exhaust.soundref

Code: Select all

source="/sound/truck/cummins_x15k.bank#engine/exhaust" 
position_offset=0.8;2.5;3.0 
/def/vehicle/truck/_sound/cummins_x15k_start_bad.soundref

Code: Select all

source="/sound/truck/cummins_x15k.bank#engine/start_bad" 
position_offset=0.0;-0.30;-0.30 
/def/vehicle/truck/_sound/cummins_x15k_turbo.soundref

Code: Select all

source="/sound/truck/cummins_x15k.bank#engine/turbo" 
position_offset=0.40;-0.30;-0.30 
/def/vehicle/truck/_sound/cummins_x15k_rm_engine.soundref

Code: Select all

source="/sound/truck/cummins_x15k_rm.bank#remote/engine" 

Getting started:
1) in your sound mod create directory /def/vehicle/truck/_sound/
2) copy batchfile to directory
3) edit batchfile (modify position_offset and/or activate position_offset for ETS2/ATS.
4) open Windows cmd-shell in /def/vehicle/truck/_sound/
5) run "generateSound.bat cummins_x15k rm"
6) copy file or content of cummins_x15k[-direct].sui to /def/vehicle/my.truck/engine/sound[_hi|_lo].sui
7) start game with activated mod and enjoy the sound ;-)


FYI: Position Offset is defined as follows:
# position_offset=-left/+right ; -down/+up ; -front/+back
where the "0;0;0" position is defined as 1 metre above the first (front) axle.
(See SCS Modding Wiki for more details: https://modding.scssoft.com/wiki/Docume ... gine/Sound)

Position offsets I came up with:
ATS: (Cab behind engine)

Code: Select all

engine=0.0;-0.30;-0.30   # & start_bad
exhaust=0.8;2.5;3.0      # single exhaust on right hand side in rear of cabin
turbo=0.40;-0.30;-0.30   # on "hot side" of engine.
in /sound/truck/default:
air_brake=0;-1.0;+4.0    # & lift_axle, reverse # main drive axle ~wheelbase
air_cutoff=0;-0.50;-0.50 # compressor at front of engine
air_gear=0;-0.7;+1.4     # & gear_grind, gear_wrong # transmission attached to engine
retarder=0;-0.7;+1.6     # retarder attached to transmission
ETS2: (Cabover)

Code: Select all

engine=0.0;-0.30;0.0
exhaust=+0.8;+2.20;1.0
turbo=+0.4;-0.30;0.0
in /sound/truck/default:
air_brake=0;-1.0;+3.5
air_cutoff=0;-0.50;-0.50
air_gear=0;-0.7;+1.4
retarder=0;-0.7;+1.6
Feedback (also on the position_offset values) is most welcome!

The batchfile is "free as in beer" - make of it whatever you want!
generateSound.txt
Enjoy!
Al Batros
You do not have the required permissions to view the files attached to this post.
User avatar
room217au
Posts: 2748
Joined: 17 Jul 2015 01:55
Location: Lakeside

Re: Batchfile to generate Sound Mod Configuration Files (sound.sui, *.soundref)

#2 Post by room217au » 09 Apr 2023 12:02

If you save the batchfile in C:\Users\your_user_name you can execute the batch from the "Run" command and not have to copy it to the relevant folder of the sound mod.
May your tanks be full and your mirrors empty.
User avatar
room217au
Posts: 2748
Joined: 17 Jul 2015 01:55
Location: Lakeside

Re: Batchfile to generate Sound Mod Configuration Files (sound.sui, *.soundref)

#3 Post by room217au » 09 Apr 2023 12:10

This would be an interesting proposition as a html page too. With clever use of javascript you could write the files from the html page. Use a form with dropdown boxes for choosing stuff for individual engines, couple of data arrays, etc. Any machine will exe the html.
May your tanks be full and your mirrors empty.

Return to “Modding Guides”

Who is online

Users browsing this forum: CCBot [Bot]