Help on How to Configure sounds to TPF

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


  • Hey guys!


    So with the release of TPF, I felt it necessary instead of posting in the TF threads, that I bring it to the TPF threads.


    Anyway, as to seeing some TF mods add in a braking or wheel squealing sound and bell sound at certain speed.. like the GO Transit mod. From 0-32 MPH/ 32-0 MPH the train played the bell file. At about 0-15/ 15-0 MPH the train played the squealing sounds.


    Does any modder have any ideas regarding adding these sounds in TPF?


    I've figured out how to add in my own whistle/horn sounds, and also the fact that they have to be mono files, for that matter im guessing all files have to be mono.


    So what I'm currently working on is adding a custom 4-4-0 bell sound to play when the train reaches certain speeds as to simulate entering stations, or leaving stations.


    I also wanted to add in the squeal when the train takes off from a dead stop. The trains already play a squealing sound when braking, can this be changed to reflect both sides of speed acceleration and not just deceleration? Looking into the files so far it seems that some of the sound functions use the soundeffectsutil.lua. For Chuffs, clacks, and brakes. Would I have to add in something to this LUA? Thing is I want to give the majority of locomotives their own sounds.. the 4-4-0 or a steam loco bell is different from a modern day diesel bell. I wouldn't want the same bell playing for all locos.


    Also want to start looking into changing the curvature of the tracks that trigger wheel squeal as the train goes into a curve.


    Any ideas? I'm a complete noob to this. If I can figure this out here I can work on all other locos!


    I currently have the file set this way



    local soundeffectsutil = require "soundeffectsutil"


    function data()
    return {
    tracks = {
    { name = "vehicle/Train_4-4-0/idle.wav", refDist = 25.0 },
    { name = "vehicle/Train_4-4-0/fast.wav", refDist = 25.0 },
    { name = "vehicle/Train_4-4-0/wheels_ringing2.wav", refDist = 25.0 },
    { name = "vehicle/Train_4-4-0/_brakes.wav", refDist = 25.0 },
    },
    events = {
    horn = { names = { "vehicle/Train_4-4-0/4-4-0_Whistle.wav" }, refDist = 50.0 },
    chuffs = {
    names = {
    "vehicle/Train_4-4-0/chuff_1.wav",
    "vehicle/Train_4-4-0/chuff_2.wav",
    "vehicle/Train_4-4-0/chuff_3.wav",
    "vehicle/Train_4-4-0/chuff_4.wav",
    "vehicle/Train_4-4-0/chuff_5.wav",
    "vehicle/Train_4-4-0/chuff_6.wav",
    "vehicle/Train_4-4-0/chuff_7.wav",
    "vehicle/Train_4-4-0/chuff_8.wav",
    "vehicle/Train_4-4-0/chuff_9.wav",
    "vehicle/Train_4-4-0/chuff_10.wav"
    },
    refDist = 25.0
    }
    }, {
    clip = "vehicle/Train_4-4-0/4-4-0_bell.wav",
    gainCurve = {
    nodes = {
    { 0.0, 0.0 },
    { 0.01, 1.0 },
    { 0.2, 0.8 },
    { 0.21, 0.0 },
    { 1.0, 0.0 },
    }
    },
    pitchCurve = {
    nodes = {
    { 0.0, 0.0 },
    { 0.01, 1.0 },
    { 1.0, 1.0 },
    },
    refDist = 25.0,
    }
    },


    updateFn = function (input)
    local chuffsFastFreq = 12.0
    local refWeight = 45.0
    local chuffs = soundeffectsutil.chuffs(input.speed, input.chuffStep, chuffsFastFreq, input.weight, refWeight)
    return {
    tracks = {
    chuffs.idleTrack,
    chuffs.fastTrack,
    soundeffectsutil.squeal(input.speed, input.sideForce, input.maxSideForce),
    soundeffectsutil.brake(input.speed, input.brakeDecel, 0.8)
    },
    events = {
    horn = { gain = 1.0, pitch = 1.0 },
    chuffs = chuffs.event
    }
    }
    end
    }
    end

  • Bump-


    Still trying to figure out sounds.. its rather difficult to really understand how all these files mesh together. I get the though of the MDL file telling the game what sound set to us. Got it..


    What Im getting lost on is all the nodes and math or how the game is telling its self to use "FILE X" when train reachs node X or 0.0 or what ever is going on in these files.
    soundeffectsutil- Is clearly an overall sound for wheel squeal as it comes around the corner, braking sounds, and chuffing for steam locomotives.
    The questions regarding Soundeffectutil is .. how to add more too it. How does one use this file to tell the game when TRAIN XYZ is at speed of ### to play sound A
    I Don't understand this file at all. I figured out how to have braking sounds start playing when the train brakes.. made 2 numbers match each other.. Kind what I wanted, kinda not..


    In TF, the locomotive LUA file told the game when the play sounds, based off what looks like the nodes, which I have no understanding to those either, I just plugged n play for what I was looking for because others figured it out.


    I've created my own audio files for Steam loco's Chuffing, Fast, and horn. I've also created audio files for Diesel Locos's of Idle, Driving, and horn.


    I hate that diesel locos use a sound file of "Idle_Drive" I hate it. Really does do much for what I'm trying to do.


    My idea, which IMO is semi logical, is to kinda set up a diesel loco to work like a steam loco. How? Use the Chuffing. My thought is, you have the seperate files of Idle, have the chuffing set up for the diesel locomotive throttling up, and then having a fast sound after the transition of the chuffing to fast like a steam loco. Thing is, I wouldn't want 10 different chuffing files to play a powering up sound, how can I make it just 1? How would one, switch over things to get the diesel using the same lines as steam? My next step is to literally take a whole steam loco's LUA and paste it in the diesel and switch names around.. (I'm working on Maikc's GP40)


    Thought 2- I want to add in a bloody bell! To play while a train enters a station and departs. Now I realize that it probably doesn't work when as an event to have a train leave the station, but tie it to speed. I was thinking of having it use the same concept of chuffing. Instead of chuffing, it would be a bell. How would one have multiple chuffing(concept) files playing?


    This all comes back to the file Soundeffectsutil. Because braking, chuffing, wheel squeal is all in there. To which my thinking is, add lines of code to this file to tell the game what to do, and in turn add them to the locomotive LUA in the config sound set files.


    Any thoughts peeps? If I could figure this out, I could make alot of good audio for this game.


    Do you all see my logic in using the Chuffing sounds for powering up/down and bells?


    @DukeaufDune Any thoughts? I'm somewhat basing things off your Go Transit/SD 40 mod from TF. Just for reference.

  • gainCurve is volume, pitchCurve speaks for itself


    first value is gain/pitch, second is speed, you can work out the rest


    I would try a gainCurve like this for your bell { 0.0, 0.0 },{ 0.0, 0.2 },{ 1.0, 0.21 },{ 1.0, 0.25 },{ 0.0, 0.26 }


    this would make it play at 1.0 volume only when the speed is 0.21-0.25, play around with that

  • Thank you. Another question would be, where should it be placed? Should it be placed with each individual locomotive LUA, or soundeffectsutil? I feel I'd have a good shot mimicing chuffing, though I did try to use a steam locomotives LUA script instead, didnt work. So hmm..


    Also wonder, if it is possible to tell the game to use different sounds, at certain times. I'd like to separate "idle_drive" under diesels. I think that would have to be a function of some sort added to the soundeffectsutil, it would have to be something different than chuffing, but along the same line(ish) I think.


    What I'm looking at is..


    local soundeffectsutil = require "soundeffectsutil"


    function data()
    return {
    tracks = {
    { name = "vehicle/GP40/idle_drive.wav", refDist = 25.0 },
    { name = "vehicle/GP40/wheels_ringing1.wav", refDist = 25.0 },
    { name = "vehicle/GP40/_brakes.wav", refDist = 25.0 }
    },
    events = {
    clacks = {
    names = {
    "vehicle/clack/modern/part_1.wav",
    "vehicle/clack/modern/part_2.wav",
    "vehicle/clack/modern/part_3.wav",
    "vehicle/clack/modern/part_4.wav",
    "vehicle/clack/modern/part_5.wav",
    "vehicle/clack/modern/part_6.wav",
    "vehicle/clack/modern/part_7.wav",
    "vehicle/clack/modern/part_8.wav",
    "vehicle/clack/modern/part_9.wav",
    "vehicle/clack/modern/part_10.wav"
    },
    refDist = 15.0
    },
    horn = { names = { "vehicle/GP40/GPhorn.wav" }, refDist = 50.0 }
    },


    updateFn = function (input)
    local axleRefWeight = 10.0


    return {
    tracks = {
    {
    gain = soundeffectsutil.sampleCurve({ { .0, .45 }, { .05, .9 }, { 1.0, 1.0 } }, input.power01),
    pitch = soundeffectsutil.sampleCurve({ { .0, 1.0 }, { .05, 1.1 }, { 1.0, 1.2 } }, input.power01)
    },
    soundeffectsutil.squeal(input.speed, input.sideForce, input.maxSideForce),
    soundeffectsutil.brake(input.speed, input.brakeDecel, 0.5)
    },
    events = {
    clacks = soundeffectsutil.clacks(input.speed, input.weight, input.numAxles, axleRefWeight, input.gameSpeedUp),
    horn = { gain = 1.0, pitch = 1.0 }
    }
    }
    end
    }
    end




    I've added


    {
    clip = "vehicle/GP40/bell.wav",
    gainCurve = {
    nodes = {
    { 0.0, 0.0 },
    { 0.0, 0.2 },
    { 1.0, 0.21 },
    { 1.0, 0.25 },
    { 0.0, 0.26 },
    }
    },
    pitchCurve = {
    nodes = {
    { 0.0, 0.0 },
    { 0.01, 1.0 },
    { 1.0, 1.0 },
    }
    }



    I placed it after Horn={... did not work, but that also from TF, there must be a new way that TPF does it, because there is nothing like that writing(for the bell) in TPF

  • So I've made progress.. (not for my bell though)



    I have The GP40-2's using a steam locomotives LUA script.... Partially.. It currently sits like this..


    local soundeffectsutil = require "soundeffectsutil"


    function data()
    return {
    tracks = {
    { name = "vehicle/GP40/Idle.wav", refDist = 25.0 },
    { name = "vehicle/GP40/fast.wav", refDist = 25.0 },
    { name = "vehicle/GP40/wheels_ringing1.wav", refDist = 25.0 },
    { name = "vehicle/GP40/_brakes.wav", refDist = 25.0 }
    },
    events = {
    horn = { names = { "vehicle/GP40/GPhorn.wav" }, refDist = 50.0 },
    clacks = {
    names = {
    "vehicle/clack/modern/part_1.wav",
    "vehicle/clack/modern/part_2.wav",
    "vehicle/clack/modern/part_3.wav",
    "vehicle/clack/modern/part_4.wav",
    "vehicle/clack/modern/part_5.wav",
    "vehicle/clack/modern/part_6.wav",
    "vehicle/clack/modern/part_7.wav",
    "vehicle/clack/modern/part_8.wav",
    "vehicle/clack/modern/part_9.wav",
    "vehicle/clack/modern/part_10.wav"
    },
    refDist = 40.0
    },
    chuffs = {
    names = {
    "vehicle/GP40/chuff_1.wav",
    "vehicle/GP40/chuff_2.wav",
    "vehicle/GP40/chuff_3.wav",
    "vehicle/GP40/chuff_4.wav",
    "vehicle/GP40/chuff_5.wav",
    "vehicle/GP40/chuff_6.wav",
    "vehicle/GP40/chuff_7.wav",
    "vehicle/GP40/chuff_8.wav",
    "vehicle/GP40/chuff_9.wav",
    "vehicle/GP40/chuff_10.wav"
    },
    refDist = 15.0,
    }
    },


    updateFn = function (input)
    local chuffsFastFreq = 12.0
    local refWeight = 90.0
    local chuffs = soundeffectsutil.chuffs(input.speed, input.chuffStep, chuffsFastFreq, input.weight, refWeight)


    return {
    tracks = {
    chuffs.idleTrack,
    chuffs.fastTrack,
    soundeffectsutil.squeal(input.speed, input.sideForce, input.maxSideForce),
    soundeffectsutil.brake(input.speed, input.brakeDecel, 0.5)
    },
    events = {
    horn = { gain = 1.0, pitch = 1.0 },
    chuffs = chuffs.event
    }
    }
    end
    }
    end


    What is not working is the chuff's. I'm using the chuff's for a throttling up sound of a GP40-2 going from neutral to notch 8 aka to full power.
    So I have tried 2 things so far..


    This is what I started with(below) Also, yes, I know sounds have to be mono type and .wav format.


    chuffs = {
    names = {
    "vehicle/GP40/Throttleup.wav"
    },
    refDist = 15.0,


    Didn't seem to work. I also just named it


    chuffs = {
    names = {
    "vehicle/GP40/chuff_1.wav"
    },
    refDist = 15.0,
    }


    Didn't work


    I then turned to..


    cutting the 11 second file I have to 1 second . wav files.

    chuffs = {
    names = {
    "vehicle/GP40/chuff_1.wav",
    "vehicle/GP40/chuff_2.wav",
    "vehicle/GP40/chuff_3.wav",
    "vehicle/GP40/chuff_4.wav",
    "vehicle/GP40/chuff_5.wav",
    "vehicle/GP40/chuff_6.wav",
    "vehicle/GP40/chuff_7.wav",
    "vehicle/GP40/chuff_8.wav",
    "vehicle/GP40/chuff_9.wav",
    "vehicle/GP40/chuff_10.wav"
    },
    refDist = 15.0,
    }


    Still doesn't work.


    Other tests-


    I have taken vanilla engine SD40 and changed the Train_diesel sound config file to the Steam_Train_Modern config file. Idle, and Fast work, but again no chuffing. I feel like this is telling me it has something directly related to the animation perhaps? I must be missing something. Does anyone have a clue? Any one of you modders who model a steam locomotive, do you assign something to the animation of the rods pushing the wheels around on locomotive? I have also tried editing the model LUA file and change the type from Diesel to Steam, that failed as the game crashed on starting a new map which the crash was Metadata, railvehicle in the mdl file.


    I have also renumbered the chuffs from like 21-30. I've also added the chuff_silence in, no luck.


    Reading what Gwinda has said, though he has limited knowledge of sound files, he did say that the sounds are hardcoded in this game. Anyone know if this is true? That the only thing we can do is actually change the sound its self. Reason I ask is because when it comes to functions, I have changed braking sounds in terms of when they play. Vanilla game the brakes sound off at about 15 MPH when a train is stopping. What I have edited in the soundeffectutil file is the brakes so that they play immediately when the train starts braking. Leading me to think that perhaps theres a bit more we can do to this file.


    Anyone?

  • I will have a look at it... haven't gotten into this with TpF yet...
    - I don't think any sounds are "Hard-Coded" anywhere in this game... that sounds pretty weird. Why would they want to do this?


    The idea with the chuffs for a Non-Steam engine sounds like an interesting idea.
    I tampered quite a bit with sounds on TF, earlier.... and I can't imagine that TpF is THAT different.
    - will let you know...
    cheers

    iMac 21' i5 4-core 2,5 Ghz - (8GB RAM / 512MB Graphik / SSD) • OS 10.11.6[Geekbench: SC: 3237 / MC: 7968 - O.CL: 4738]

BlueBrixx