Most modern locomotives have horn valves use an all or nothing electric solenoid valve.
Part of the reason is directly related to liability - if you almost or actually hit someone, the first thing they claim is that they either didn't hear the train at all or you didn't blow it load/long enough. It's basically a no win situation created by our legal system and the forgotten concept of the requirement to apply common sense. You buy a house within a mile of the tracks - you are going to hear the trains. Trains usually won't chase you unless you're standing in the middle of THEIR tracks.
Suspicious
Person
Likely
A
Trespasser