Search The Inn

Friday, March 10, 2023

Grade Crossing Signal For ESU Decoders

A while ago there was some discussion on the LokSound forum concerning the Grade Crossing Signal and it being missing from the sound selections of the various LokSound decoders. The main reason ESU did not provide one, in their reasoning, was that the signal would always sound the same and the author agrees with this. There should be variation everytime this signal is sounded. It depends on the engineer.

Before we start this discussion you have to again realize that you cannot do what we are going to do with a Select decoder. You have no access to sounds schedules. 

This was solved (ingeniously) by forum member George Hofmann (Hello George!) with his sound schedule of this horn signal. It has a little bit of variability and also allows prolonging the final horn blast which is controlled by the operator. It's built utilizing the Leslie RS3L horn so a user will have to replace those sound segments with the ones from the horn his engine is using.

In addition, this sound slot file uses a semi-documented function in sound schedules called RANDOM. The random function appears as rand(x,y) where x is the lower value and y is the upper value. A better explanation is an example: u3 = rand(1, 4) assigns either 1, 2, 3 or 4 to u3. This variable (u3) can be manipulated in various ways as you will see shortly.

The main loop is shown in fig 1. The user registers 1 through 3 are used as follows: user 2 counts from 1 to 4 corresponding to the 4 horn blasts. The rand function is used with user 1 to vary the 3 long horn blast lengths and the silence in between them. The rand function is used with user 3 to produce an occasionally shorter short horn blast. Releasing the horn function key allows the horn sequence to complete automatically. Keeping the function on will hold the last horn blast until it is released.

Figure 1 Grade crossing horn basic loop

Figure 2 shows the internal workings of the Loop container shown in figure 1. This is where the various horn blasts are sounded and the lengths of the blasts are controlled by the various user variables.

Figure 2 Loop controlling the horn blast length

The author could go step-by-step through the logic of these loops and he is sure that your eyes will start glazing over after about 15 seconds and you will wake up a few minutes later. The best way to learn the logic is to load this file into the simulator and play it until you understand what is going on.

This sound file is available for download here. You can then incorporate it into your projects through the templates import that I have discussed in previous posts. You will have to, of course, substitute the horn sound files of your choice. Which is simple drag-and-drop as demonstrated here

This is an outstanding example of how to make use of the user variables and the random function. Hopefully you will learn quite a lot.


If you have an idea for a blog post here, let me know. If I can comment on it, I will or I'll see if someone else can and post it 

No comments:

Post a Comment