Wanted: 'Train approaching, please remain behind yellow line' sound

Status
Not open for further replies.

flusi737

SBB Cargo Germany
Ok, the title should tell you what i'm searching for ;)
I asked 3 people before to do a trigger with this sound, they said all yes they'd do it but nothing happened (2 months ago)
Could someone please do this? Would be really nice :D

Felix
 
I'll see what I can do. The most I've ever heard of it was a friend who modified bnsf50's crossing bell-only pole to play it.

Cheers,
Joshua
 
Thank you :D But do you know how this 'slogan' is used on the NEC stations? Only if trains approach or is it played every 20 seconds or something? I'm from Germany, so i don't know it sorry :)
 
That massage is on the DLS somewhere i used to use it in 10.
I too would like to use it again but don't remember what it was called.
 
I've send a sound file to Felix with the "train approaching, please remain behind yellow line" sound.

Since there may be other Trainzers that want to know how to play a sound file in a session, I'll do so in this thread so others can learn how to do this. I'm using TS12, so I don't know if other versions require different procedures.

I'll do this in several posts as we go along. First we need to create an HTML Asset, then place the sound file in that asset, then use some Rules to play it in a session.

Sound files are placed in an asset of the kind called "HTML Asset". An HTML Asset is also used to store HTML files for use in message popups in a session. The "HTML Asset" is separate from the session asset.

To create an HTML Asset:

1. In Content Manager, select File|New Asset. You'll now see CM created an new item called "New Asset".

2. Right-click on the New Asset and select Edit|Edit in Content Creator Plus.
When CCP opens, you'll see a list on the left with all the Kinds that you can assign to an asset. Select "Html-asset" and click New.

3. On the next screen, you'll see the kuid of the asset, the trainz-build version and other info. In the "username" field you can enter the name that you want to assign to this asset.
I generally give them the same name as the session with the letters HTML added to the end. For example, I have a session on the DLS called "The Goldsboro Local". The HTML Asset for that session is named "The Goldsboro Local HTML". This way I know which kuid is the session and which is the HTML asset for that session.

4. Select File|Save. You will get a message that the config file was written successfully. Click OK.

5. Select File|Exit.

Now you'll exit out of CCP and back to CM. Now you need to commit the changes you just made.

6. Right-click on the new asset and select Edit|Commit. (or highlight it and hit Ctrl-m).

Now you will see that the name of the new asset has changed to the name you gave it in the "username" field. If you right-click on the asset and select View Config File you will see that the kind is "html-asset".

We have now created a new asset and told Trainz it is of the kind "html-asset". Next we'll put the sound file in that asset.

Todd
 
Last edited:
OK, now that we've created an asset of the type "HTML-Asset" we need to place the sound file inside the asset. For the non-computer experts, I'll try to give detailed instructions as possible.

For the purposes of this example, I'll assume the asset is named "HTML_Test" and the name of the sound file we'll be using is "trainapproaching.wav".

First, use Windows Explorer and find the sound file on your hard drive.

Second, open Content Manager and find the HTML Asset named "HTML_Test" that you created in the previous post. There should be a filter called "My Content" where you will see all the content created under your KUID.

Right-click on "HTML_Test" and select Edit|Edit In Explorer. (shortcut is ctrl+shift+E). This will open a new Windows Explorer window. The window will open to a folder containing all the files that are part of the asset. Currently, the only file in the folder will be Config.txt.

As a note, the folder will be Auran/TS12/UserData/editing/"name of the asset". In our case, Auran/TS12/UserData/editing/html_test

Go the the Windows Explorer window were you have stored the "trainapproaching.wav" file. Right-click on it and select Copy. Note: DO NOT select Cut! Using Copy leaves the original file stored on your hard drive outside of Trainz. If you use Cut, the only copy of the file will be inside the Trainz asset. If you ever delete the asset - your file is gone.

Now go to the Windows Explorer window that CM opened. Highlight the "html_test" folder, right-click and select Paste. Windows will now copy the sound file into the folder.

Close the Windows Explorer window that CM opened for you.

In CM, right-click on the "HTML_Test" asset and select Edit|Commit. (shortcut ctrl-m).

CM will commit the changes and you now have the sound file inside the HTML Asset ready to be used in a session.

In my next post, we'll use some Rules to play the sound inside a session.

A technical note on the type of sound files that Trainz can play. Files need to be in WAV format, and recorded in mono at a 22kHz sampling rate.
If I remember correctly, Trainz doesn't like having spaces in the filename of the sound file. I either eliminate all spaces or replace them with an underline. So "trainapproaching.wav" is OK as is "train_approaching.wav". It won't like "train approaching.wav".


Todd
 
Last edited:
We have to do one more operation before we can use our newly created HTML Asset in a session.

If you look at "HTML_Asset" in Content Manager, you'll see the red exclamation point that indicates the asset is faulty. If you right-click on it and select View Errors and Warnings, you'll see Trainz complaing that "Error: The tag 'image' in container '0' is empty."

This is because TS12 requires each asset to have a preview image. Ours doesn't, so the assets is shown as faulty. We must correct this for the asset to be able to used in the game.

First, find a picture file to use as a preview image. If you're just making a session for your personal use or just messing around, you can use any picture file with a JPG extension. The pixel dimensions of the picture doesn't matter. If you're going to be releasing a session (or any asset) on the DLS or web, then you'll want to create a custom preview image for the asset, like you see on other content in Trainz.

We'll use some of the skills we learned in the above posts to add our preview image. I'll assume the image is named "preview.jpg" in this example.

To insert the image file, use the same procedure that you used to insert the sound file into the asset: Right-click on "HTML_Asset", select Edt|Edit In Explorer, copy the image file to the folder CM opened for you. Again, use COPY not CUT to move the image file!

Don't Commit the changes just yet. We need to add a section to the Config.txt file with the details of our image file. We'll do this in Content Creator Plus.

Right-click on "HTML_Asset" and select Edit|Open in Content Creator Plus. You should see this:

ccp1.jpg


Click on the plus sign next to "html-asset". You'll see a subsection open under "html-asset" called "thumbnails", click on the plus next to it. Click on the "0" under "thumbnails" and you should see this:

ccp2.jpg


Enter the height as 180 and the width as 240. These two numbers must ALWAYS be 180 and 240, no matter what the pixel dimensions of the file are!

Click the button to the left of the NEW button, the one with the three little dots. Windows will now open a standard file selection window. You'll see all the image files that are in the "HTML_Asset" folder. Select your preview image and click Open. Like this:

ccp3.jpg


Now you should see this:

ccp4.jpg


CCP now knows the file to use as a preview image for this asset and the size to display it at.

Select File|Save and CCP will write the changes to Config.txt

Select File|Exit to exit CCP.

Back in CM, right-click on "HTML_Asset" and Commit the changes (ctrl-m or select Edit|Commit).

You should now have an error-free asset ready to be used in a session!

Todd
 
Woah, thank you so much!!! I'll try to do what you wrote as soon as possible, maybe next weekend ;) I'll also make the sound available if someone is interested :) Thanks for your help :D
 
Woah, thank you so much!!! I'll try to do what you wrote as soon as possible, maybe next weekend ;) I'll also make the sound available if someone is interested :) Thanks for your help :D

I'm working on the final part and will post it tonight. Plenty of screenshots to help make it clear what to do. I know it looks like a lot, but if you go carefully step by step it isn't too difficult to do.

Todd
 
I'll kept a eye open for this sound. Like to have it.

Maybe after I finish with the final post I could put the sound file into an HTML-Asset and post it on the DLS. That'd make it available to those that would like to use it, both in this tutorial or in a session.

Todd
 
Now we are ready to use the sound file in our HTML Asset in a Trainz session.

I'll assume you have some familiarity with Surveyor and know how to place objects and such. This will be a bit long but I've made screenshots to help you out. Go step by step and you'll be able to do this.

Fire up Trainz, go to Surveyor and start a new session. I'm using the Wilson Mills & Mount Olive Route in this example as it includes several passenger stations.

Find the location on the tracks where you want the sound file to play. I'll put mine next to a passenger station.

Next we need to place a trigger on the track where we want the sound to play. Select the Track flyout, then click the Trackmark Mode button. Select Trigger and place it on the track.

A dialog box will pop up that will show the name of the trigger as assigned by Trainz. In my exmaple, I'll use the default of "Trigger 1". You can change the name to anything you like. If you have many triggers in a session, you'll want to avoid confusion by coming up with a naming scheme so you know what each trigger is to be used for.

This is how it looks in Surveyor. I've placed a loco and cars on the track before the station. The trigger is placed right before the station platform.

Soundfilelession01.jpg


Click the "Edit Session Rules" button - upper left, button in the middle.

This is what the Session Rules window will look like. (I've deleted a few of the default rules to make this clearer).

Soundfilelession02.jpg


At the bottom of the Session Rules window click ADD. This brings up a dialog box with all the available Rules you can choose from. Scroll down and click on "Trigger Check". Click on the checkmark button to add the Rule.

Note there is another rule called "Trigger Rule". That is a old version, like from TRS2004. I use Trigger Check as it has some additional useful options.

You should see this:

Soundfilelession02a.jpg


Note: You can move a Rule up and down in the window by highlighting the rule and using the UP and DOWN arrow buttons at the bottom of the Session Rules window.

Soundfilelession07a.jpg


Click on the Trigger Check rule to highlight it, then click on the EDIT button at the bottom of the Session Rules window.

Now we can set all the criteria for this Rule.

You should see this:

Soundfilelession03.jpg


Click on Add Trigger. You'll get a list of all the triggers available in this session and route. Select "Trigger 1" and click the checkmark button.

Soundfilelession04.jpg


Now we have this:

Soundfilelession05.jpg


Note there are several options listed.

Checking "Trigger only once" means the trigger will be activated one time when the first train crosses it and not ever again in the session. Leaving it unchecked means the rule will activate on every train that crosses it.

The "wait for child rules" is for advanced, complicated sessions. Leave it unchecked.

You can choose to only trigger the rule if a train is running forward or backwards into the trigger. Only useful occasionally in very complicated sessions. Leave it unchecked.

"Accept all trains" is the default and will activate the rule when any train crosses the trigger.
If you choose "Accept trains matching specific criteria" you can choose to only have this rule activate when a specific vehicle (loco or traincar), driver or type of car crosses the trigger. This can be useful if you want this sound to play only, for example, when the players train crosses the trigger and not when the AI trains cross it.

To make this simple, leave the options at they are (top three unchecked, Accept All Trains).

Finally, note that you can add multiple triggers to this rule. If you want this sound to play at all 10 stations on a route you can place a trigger at each station then add all 10 triggers to the rule.

Click on the checkmark button in the lower right to save all your changes.

Now we've added all the criteria to the Trigger Check rule. Here is what the Session Rules window looks like. Note the Trigger Check rule now shows which triggers it is assigned to check.

Soundfilelession06.jpg


Now we'll add the rule to play the sound.

At the bottom of the Session Rules window click ADD. Scroll down and select "Play Sound" and click the checkmark button.
Use the UP and DOWN arrow buttons to move the Play Sound rule underneath the Trigger Check rule. Play Sound MUST be directly underneath Trigger Check!

You should see this:

Soundfilelession07.jpg


Now click on the Play Sound rule to highlight it. At the bottom of the Session Rules windows click the RIGHT arrow button to indent the Play Sound rule.

You should see this:

Soundfilelession08.jpg



What indenting does is make the Play Sound rule a "child rule" of the parent rule above it (Trigger Check). This means Play Sound will only run if all the criteria of the Trigger Check rule have been met.
Those that know computer languages will recognize this an IF-THEN situation. If Trigger Check is true, THEN Play Sound.
Non-computer geeks can think of it like a parent-child relationship. The child rule can only activate if the parent says it's OK.

For example, if Trigger Check is set to only accept a train driven by the "Adair" driver and a train with any other driver assigned crosses the trigger - then Trigger Check will not run Play Sound because all the criteria were not met. When the train with Adair assigned to it crosses the trigger, then Trigger Check will allow Play Sound to run because all criteria were met in that case.

This is a key concept to understand. The child rule (Play Sound) only runs when the parent rule (Trigger Check) gives it permission. I hope I made that clear to the non-computer geeks among us.

---- continued in Part Two ----
 
Now we need to setup the Play Sound rule. Click on the Play Sound rule to highlight it and click the EDIT button.

You'll see this:

Soundfilelession09.jpg


Click on the underlined "default.wav" link. You'll see a dialog box where you can enter the name of the sound file. Do not enter the file extension. Our sound file is named "trainapproaching.wav" so I'll enter "trainapproaching". Watch your spelling. If you misspell, the file won't play!

Click on the checkmark button to add the filename to the rule.

Soundfilelession10.jpg


Now click on the "click to select" link. You'll get a dialog box listing all the HTML Assets installed in Trainz. Scroll down and select the correct one - in our case "html_test".

Like this:

Soundfilelession11.jpg


Now you should have this. The rule is now set to play the file "trainapproaching.wav" in HTML Asset "html_test". Click the checkmark button to save those changes.

Soundfilelession12.jpg


Here is our completed set of rules. You can see both Rules list the criteria you entered so you can see what each Rule will do without opening each one individually.

Soundfilelession13.jpg


Click Main Menu|Save and save the session. Give it whatever name you like.

Let's go driving! Click on the Quick Drive button in the upper left to drive the session. When your train crosses the trigger, you should hear the sound file play.

This is a short video of the result: http://www.youtube.com/watch?v=z3Vf882a2d4

The train is approaching the station. The trigger is placed just before the platform. As the train approaches the trigger, Trigger Check checks to see of all the criteria we set were met. They were, so it allows the child rule - Play Sound - to play our sound file.

The sound file is a bit quiet. If I was doing this session for public consumption, I'd use a sound editing program to make it a bit louder. I could also change the file to play the announcement several times in a row instead of just once, like you'd hear at a real station.

Note: Once you've added Play Sound to the session, the HTML Asset listed in that Rule will be added to the KUID list for the session. If someone downloads the session from the DLS or other site, the HTML Asset you made will be shown as an asset that must be added, just like any other Trainz asset.

There are many other rules that can be used with Play Sound.
"Check Trackmark" can be used to check when trains have crossed not only a trigger but also a trackmark or junction. It can also check if a train has stopped at, entered or left a trackside object.
"Consist Check" could be used to check when a player has picked up all his assigned cars and then tell Play Sound to play a "mission completed" sound.

The possibilities are endless.

To see an example of how sounds can be used in a session, download my "The Goldsboro Local" session from the DLS. It's for the Wilsons Mills & Mount Olive route, also on the DLS. I made extensive use of sounds in that session. You can also look at the session in Surveyor and see how I used Rules to make the session work. The session does use a lot of third party content, look for the official "The Goldsboro Local" thread on the forums for details.

Whew! I hope that was helpful to those of you looking to add sounds to your sessions. Personally, I love adding sound as they really increase the realism of a session.

Todd
 
I made an HTML-Asset containing the sound file. I just uploaded it to the DLS, it'll take a day or two at least before it is available.

I raised the volume a bit since the original was too quiet.

I made four versions of the file. One file plays the announcement once, the others play it 2, 5 and 10 times with 3 second pauses in between each announcement. This will give you several options to use.

I'll post a message in this thread then the file clears the DLS...

Todd
 
Great thread, Thanks for sharing RacerTodd. Do the announcements play route wide? Or just at the trigger?

The announcement will play any time a train that meets the criteria in the Check Trigger rule are met. You could be way on the other side of the route and if a train passes the trigger and Check Trigger decides that train meets its criteria - it'll play the sound.

Typically, you want this sort of a station announcement to only play when the players train hits the trigger. So you'd want to select criteria that no other train in the session can match.

Todd
 
Trains4621,
1) Please don't bump dead topics.
2) Your suggestion is related but not quite what we're talking about. We want a sound that plays as the train approaches a station.

Come to think of it, this seems like it would have a solution similar to the level crossings, perhaps we can use an ATLS slave for this.
 
Status
Not open for further replies.
Back
Top