Cities: Skylines

Cities: Skylines

Vehicle Effects 1.9.5
 This topic has been pinned, so it's probably important
Acc3ss Violation  [developer] 6 Jan, 2018 @ 4:46am
Custom Sounds - Tutorial + sharing
Sometimes you just want a custom sound instead of using one of the defaults. Making a plugin just to add one sound effect is a bit much. That's why you can now (version 1.7 and up) use Vehicle Effects' build-in sound effect loader to create a custom sound effect with a simple xml file. These xml files can be included in either a mod or asset directory and Vehicle Effects will load them automatically. All you need is a text editor and a sound file in a suitable format (.ogg always works, check the Unity documentation for a proper list).

The config
A file containing sound effects should be called SoundEffects.xml and must be placed in a mod's or asset's root folder, same as with VehicleEffectDefinition.xml. Below is the contents of VE's own SoundEffects.xml file, showing 6 of the sound effects included in the mod.
<?xml version="1.0" encoding="utf-8" ?> <SoundEffectsDefinition> <Effects> <SoundEffect name="Steam Train Movement" base="Train Movement" file="sounds/steam-engine-a3-moving.ogg" type="EngineSoundEffect" volume="0.7" /> <SoundEffect name="Diesel Train Movement" base="Train Movement" file="sounds/diesel-engine-sd45-moving.ogg" type="EngineSoundEffect" /> <SoundEffect name="Rolling Train Movement" base="Train Movement" file="sounds/rolling-stock-moving.ogg" type="EngineSoundEffect" volume="0.8" /> <SoundEffect name="Train Bell" base="Train Movement" file="sounds/train-bell.ogg" volume="0.8" pitch="1.0" loop="true" randomtime="false" /> <SoundEffect name="Train Horn" base="Train Movement" file="sounds/train-horn-loop.ogg" fadelength="0.18" volume="0.7" pitch="1.0" loop="true" randomtime="false" /> <SoundEffect name="Train Whistle" base="Train Movement" file="sounds/train-whistle.ogg" fadelength="0.4" volume="0.7" pitch="1.4" loop="true" randomtime="false" /> </Effects> </SoundEffectsDefinition>

The important thing here are the SoundEffect tags, which have a few required attributes: name, base and file. The rest of the attributes are optional and can be used to change the sound settings. An important attribute is type, this determines the type of sound effect that will be created. It defaults to SoundEffect, but for vehicle movement (engine) sounds it must be set to EngineSoundEffect to allow for speed and acceleration dependent pitch and audio range.

The attributes
Here's a list of all attributes and what they do. A * indicates that it can only be used with an EngineSoundEffect. All numbers are floats, so you can use decimal values.

type - The type of effect, can be SoundEffect or EngineSoundEffect name - Name of the effect base - Template effect name file - Audio file location range - Range the effect is audible at (in meters?) volume - Volume, should be between 0 and 1 pitch - Pitch fadelength - Fade in and fade out duration in seconds loop - Set to true to loop is3d - Just don't touch it randomtime - When true, starts the sound at a random time *minpitch - Minimum pitch *minrange - Minimum range *pitcham - Pitch acceleration multiplier *pitchsm - Pitch speed multiplier *rangeam - Range acceleration multiplier *rangesm - Range speed multiplier

Something about load order
There are some things to keep in mind about the loading process that Vehicle Effects uses for custom sound effects. To start, mod folders are always loaded first before it checks and loads from asset folders. When it detects that another custom effect already exists with the same name it won't load any other with that same name. Error messages for duplicate effects are only displayed when loading from mod folders. This means that you can include the same effect config and sound in multiple assets without having to worry about the mod complaining or loading duplicate effects.
Last edited by Acc3ss Violation; 22 Feb, 2018 @ 6:27am
< >
Showing 1-15 of 20 comments
brunna 22 Feb, 2018 @ 3:08am 
Hi!
I made two new basic sound effect by this description.

New Electric Engine Sound: (eg: Siemens Vectron)
https://youtu.be/tOFEZojIOxM
New EMU sound: (eg: Stadler Kiss)
https://youtu.be/4Djx9W2gcfc

Here are the files:
https://drive.google.com/open?id=16ZqciqmsuiSTnYe0jQGmLQXh0aKljlg1
NewMasterChoco 4 Apr, 2018 @ 10:40am 
So, I have to create an xml file and save that in the asset folder of the game? What is the file location for that?
Acc3ss Violation  [developer] 5 Apr, 2018 @ 12:45am 
On windows it's %localappdata%\Colossal Order\Cities_Skylines\Addons\Assets
NewMasterChoco 5 Apr, 2018 @ 3:56am 
Originally posted by Acc3ss Violation:
On windows it's %localappdata%\Colossal Order\Cities_Skylines\Addons\Assets

Thank you. Although, is there any that for the sound effect of bullet train?
Acc3ss Violation  [developer] 5 Apr, 2018 @ 9:16am 
I don't have any, maybe someone else already has sound effects made for that.
KriZ 29 Apr, 2018 @ 2:52pm 
does vehicle effect require it to be inside the specific asset folder to target the specific asset? or could the vehicle be targeted by a seperate asset folder with the xml file and etc inside?
Acc3ss Violation  [developer] 30 Apr, 2018 @ 1:33am 
No, asset and configs don't need to be in the same folder. As long as a config is in any enabled asset or mod's root folder (so it gets loaded) it will work.
Distanced 26 Oct, 2018 @ 7:24pm 
Any way we could get a "delay" attribute, that delays the sound since the flag for a set amount of seconds?
Acc3ss Violation  [developer] 27 Oct, 2018 @ 2:07am 
Not really with the way the game handles those flags
Jotrain Gamer 20 Feb, 2019 @ 2:32am 
Do I just put the file in Assets folder cause i'm not entirely certain.
Acc3ss Violation  [developer] 20 Feb, 2019 @ 9:47am 
Yeah that works.
Maxthefox 25 Mar, 2019 @ 1:18pm 
Is it just me or does this mod not work anymore?
I hope this wonderful mod is still working as of the Campus DLC.
nardo 4 Jul, 2020 @ 2:51am 
Does anybody have an example folder i can copy off of? I mean i could do all this from scratch but if someone could help out, it'd make stuff easier!
THANKS!!
Acc3ss Violation  [developer] 4 Jul, 2020 @ 3:24am 
The mod itself also uses this system for some sound effects, so you can use those as an example.

The xml: https://github.com/Acc3ssViolation/VehicleEffects/blob/master/VehicleEffects/SoundEffects.xml

The sound files: https://github.com/Acc3ssViolation/VehicleEffects/tree/master/VehicleEffects/Sounds
< >
Showing 1-15 of 20 comments
Per page: 1530 50