This shows you the differences between two versions of the page.
Last revision Both sides next revision | |||
modding:developerinfo:soundsets [2019/03/19 10:18] 127.0.0.1 external edit |
modding:developerinfo:soundsets [2019/06/24 14:42] yoshi Add new description of soundeffectsutil |
||
---|---|---|---|
Line 152: | Line 152: | ||
Constructions trigger random events at different frequencies, which can be used to play arbitrary sound sources regularly. They are named ''randomX'', where X is a number between 1 and 64. For example ''random16'' is an event, triggered randomly at an average frequency of 16 seconds. | Constructions trigger random events at different frequencies, which can be used to play arbitrary sound sources regularly. They are named ''randomX'', where X is a number between 1 and 64. For example ''random16'' is an event, triggered randomly at an average frequency of 16 seconds. | ||
+ | |||
+ | ==== Soundeffectsutil ==== | ||
+ | |||
+ | Transport Fever provides a number of scripts with utility functions. The soundeffectsutil.lua contains functions for creating soundsets: | ||
+ | |||
+ | * ''sampleCurve(nodes,x)'' | ||
+ | * ''makeRoadVehicle2(speeds, idleSpeed, idleGain0, driveSpeed, speed01)'' | ||
+ | * ''squeal(speed, sideForce, maxSideForce)'' | ||
+ | * ''chuffs(speed, chuffStep, chuffsFastFreq, weight, refWeight)'' | ||
+ | * ''clacks(speed, weight, numAxles, axleRefWeight, gameSpeedUp)'' | ||
+ | * ''brake(speed, brakeDecel, maxGain)'' | ||
+ | |||
+ | Some of these functions are described below. | ||
+ | |||
+ | == makeRoadVehicle2(speeds, idleSpeed, idleGain0, driveSpeed, speed01) == | ||
+ | |||
+ | This function provides gain and pitch curves for a two track sound set of a motorized road vehicle. The first track is for the idle sound, the second one for the drive sound. The function requires the following parameters: | ||
+ | * ''speeds'': a list of 3 speed fractions between 0 and 1 to determine the "keyframes" for the sound curves.* | ||
+ | * ''idleSpeed'': parameter for the pitch of the idle noise | ||
+ | * ''idleGain0'': parameter for the gain of the idle noise | ||
+ | * ''driveSpeed'': parameter for the pitch of the drive noise | ||
+ | * ''speed01'': speed parameter (usually ''input.speed01'') | ||
+ | |||
+ | * The three values are used for: | ||
+ | - point at which the idle noise can be heard at full volume | ||
+ | - point at which the driving noise starts and the idle noise subsides | ||
+ | - point at which only the driving noise can be heard at full volume | ||
+ | |||
+ | An exemplary call to this function: | ||
+ | <code lua> | ||
+ | soundeffectsutil.makeRoadVehicle2({ .05, .1, .3 }, .075, .6, .4, input.speed01), | ||
+ | </code> |