Understanding Sound_sets

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


  • Hello on all of you.


    I'm trying to get sounds working for my vehicle and I'm studying the original script "ship_steamer.lua". This is a small script as you can see in attached screen shot. My problem is to understand some parts of the content. I hope there is someone that can explain the meaning of:


    • refDist (in box number 1)
    • gain (in box number 2)

      • and the first and second numbers inside soundeffectutil.sampleCurve
      • the numbers after input.power and input.speed (in this example = 01)
    • pitch (in box number 2)

    I have copied this .lua and only changed the track names to my own sounds and I can hear only the sound from the first config row
    ( _ship_diesel_old_drive.wav ). I would be glad if I could hear a completely different sound when the vehicle is in idle or shifting between medium and full speed.


    Anyone that knows if it exists some documentation of the game scripts?


    Best regards
    melectro


  • By the way, here is the part of the function "soundeffectsutil.sampleCurve", but I'm totally lost what this is doing.


    function soundeffectsutil.sampleCurve(nodes, x)
    local value = 0.0

    if 1 < #nodes then
    local n0
    local n1
    for i = 2, #nodes do
    n0 = nodes[i - 1]
    n1 = nodes[i]
    if x <= n1[1] then break end
    end
    value = math.mapClamp(x, n0[1], n1[1], n0[2], n1[2])
    else
    value = nodes[1][2]
    end

    return value
    end

  • Hello,


    gain is the "volume" of the sound, while pitch is the "speed" at which the sound will be played.
    The first gain and pitch will modify the first wav (diesel_old_drive), the second one will apply to steamer_idle.wav, etc ...


    For Train Fever, the wav files needed to be mono and 44.1khz to work properly, i'm not sure if this is still the case.


    Beside the wav file, what you may want to modify is the value of the gain/pitch lines. For the first gain line :

    Code
    gain = soundeffectsutil.sampleCurve({ { 0.0, 0.0 }, { 0.025, 0.5 }, { 1.0, 1 } }, input.power01),


    "input.power01" means that the values will be based on power, you can also use "input.speed01" to base effect on speed instead.


    {0.0, 0.0} : The first number is the amount of power (0 is 0%, 1 is 100%) in this case, would be the speed if you use input.speed01. The second one is the gain of the sound file (you can go above 1 for this one). It mean that at 0 power, the volume of _ship_diesel_old_drive.wav sound will be 0%.
    { 0.025, 0.5 } mean that at 0.025% power, the volume will be 50%
    { 1.0, 1 } mean that at full power (100%) the volume will also be at 100%
    You can add more sounds points if you want. The gain/pitch will be modified proportionnaly by the soundeffectsutil.sampleCurve function between the point you manually fixed.


    Here is an exemple of what i did for my Z8100, as i wanted this sound to be hear when at slow speed but only when accelerating. :


    I'm not really sure about refDist, but i think it's the distance from which the sound volume start to decrease when you move the camera away.


    Hope this help.

  • Great answer, Anachron13, thanks a lot, this helps me with the conversion for some Train Fever vehicles to Transport Fever and understanding it a little bit better.

  • I'll bump this thread since I got bit hard time to understand how truck soundsets work, they don't seem to work like trains which I've managed to edit successfully.


    tracks = soundeffectsutil.makeRoadVehicle2({ .05, .1, .3 }, .075, .6, .4, input.speed01),


    This line I can't figure, if I try to make it and add gain and pitch values like examples above game will end up in error.


    Has someone any tips? I'd like edit my Volvo F12 soundset, at the moment it has only one audiofile which then pitches higher when speed raises. I'd like to try and make the sound more variable.

BlueBrixx