Variable:driving noise

From TTWiki
Jump to navigationJump to search

This describes the fields for defining the driving noise of vehicles.

Note: locotool 0.4.3 decodes field_11A[0-63] (= fields 0x11A to 0x159) as chars (8-bit), that is values between 0 and 255. Yet some of these variables are actually short integers (16-Bit: 0-65535). I have written these variables as, for example, field_11A[5&6], where you get the actual value with field_11A[6]*256+field_11A[5] (note the order).

Note 2: Adding new sounds can cause some problems in previous games an scenarios. You can find more information about it, and how to solve them here.

Variables

startsndtype - Defines how the driving sound is played and how field_11A[0-63(?)] works.

startsndtype 0

No driving sound. field_11A[0-63] empty.

startsndtype 1

Normal driving sound type for carriages, sampling rate changes with speed.

field_11A[0] - Unknown/Unused/Untested
field_11A[1&2] - Unknown

field_11A[3&4] - Minimum speed for the sound to be played
field_11A[5] - Speed dependency
field_11A[6&7] - Base sampling rate

field_11A[8] - Unknown

field_11A[9] - Volume at low speed
field_11A[10] - Volume at high speed; Has to be greater than field_11A[9]

startsndtype 2

Normal engine sounds, different sampling rate and volume for three modes of operation.

field_11A[0] - Unknown/Unused/Untested

field_11A[1&2] - Sampling rate for no-load (braking and idle)
field_11A[3] - Volume for no-load

field_11A[4&5] - Sampling rate for load (driving with constant speed)
field_11A[6] - Volume for load

field_11A[7&8] - Sampling rate for full-load (accelerating)
field_11A[9] - Volume for full-load

field_11A[10&11] - Fade speed from no-load or load to load or full-load sound
field_11A[12&13] - Fade speed from full-load or load to load or no-load sound

field_11A[14] - Fade speed on vehicle placement or after breakdown
field_11A[15] - Unknown (could be another fade speed)

field_11A[16] - Speed dependency for full-load; Other modes have constant sampling rates


startsndtype 3

Vehicles with multi-ratio transmission with up to four gears.

field_11A[0] - Unknown/Unused/Untested

field_11A[ 1& 2] - Idle Sampling rate
field_11A[3] - Idle volume

field_11A[ 4& 5] - Base Sampling rate

field_11A[ 6& 7] - Speed for 2nd gear
field_11A[ 8& 9] - Sampling rate decrease for 2nd gear

field_11A[10&11] - Speed for 3rd gear
field_11A[12&13] - Sampling rate decrease from 2nd to 3rd gear

field_11A[14&15] - Speed for 4th gear
field_11A[16&17] - Sampling rate decrease from 3nd to 4th gear

field_11A[18] - Driving Volume
field_11A[19] - Volume while accelerating

field_11A[20&21] - Fade speed for downshift
field_11A[22&23] - Fade speed for upshift

field_11A[24] - Fade speed on vehicle placement or after breakdown
field_11A[25] - Unknown (could be another fade speed)

field_11A[26] - Speed dependency

startsndtype 4-?

Unused/Untested. Locomotion vehicles use only type 0-3, yet there are plenty of unused fields left.

Definitions

Explanations and suggested values for the various variables.

volume
Loudness. Common values range from 150 to 210.
sampling rate
Locomotion can play sounds with variable sampling rate and thus change pitch and tempo with the vehicles speed or mode of operation. Locomotion sound files are encoded with a sampling rate of 22050 Hz, so this would be a good value to start with. Note that the perceived volume varies with the pitch too.
fade speed
Describes how long Locomotion fades from one sampling rate to another. The higher the value the shorter this fade time. Good values are around 200 for 16-bit values, and between 1 and 4 for 8-bits.
speed dependency
Describes how much the sampling rate increases with the speed of a vehicle. The lower the value the higher the pitch on full speed. I can't give an exact scale and it may depend on the base sampling rate aswell, however it is quite sensitive. Reasonable values are between 10 and 15, too small values can result in an integer overflow for the sampling rate.