Hoot, Toot, & Whistle - AI traffic horn or whistle soun
Started by sniper2975 posts8 min read
Notice to all visitors and members of the Train-Sim.Com message forums: If you plan on using a signature banner in your posts, we would like to remind you that there is a maximum size for banners. That maximum is 450 pixels wide by 120 pixels high, and not to exceed 25k. Your compliance is appreciated. FORUM RULES Problems? There are two common reasons for problems with logging in and posting messages. The first is that you are running a firewall that prevents your messages from being sent to the server. The other is that you have cookies disabled; the DCForum software requires cookies to work properly.
The other thread was getting kinda full, so I thought I'd start stuffing another one. Success at last, I cloned then modified Thomas the Tank engine for invisible textures and a zero length coupling box, added this to his .sms file: Skip( **** ******************************************* **** ) Skip( **** Jim and Stu's unpatented AI diesel horn, WHONK-WHONK! **** ) Skip( **** ******************************************* **** ) ScalabiltyGroup( 0 Activation ( ExternalCam () PassengerCam () CabCam () Distance (1000) ) Deactivation ( ) Volume ( 1.0 ) Ignore3d () Streams ( 1 Stream ( Priority ( 7 ) Triggers ( 11 Variable_Trigger ( Distance_Dec_Past 900 ReleaseLoopRelease () ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "x_sd402_horn1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "x_sd402_horn1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "PONAI_silence.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "PONAI_silence.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "PONAI_silence.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "PONAI_silence.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "PONAI_silence.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "PONAI_silence.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "x_sd402_horn1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 900 PlayOneShot ( 1 File ( "x_sd402_horn1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) VolumeCurve ( DistanceControlled CurvePoints ( 3 0.0 1.0 300.0 0.9 900.0 0.7 ) Granularity ( 0.4 ) ) ) ) ) )Again, a lot of this is compromise due to limitations of the sim software. The "Ignore3d ()" statement makes it play the .wav at full volume regardless of distance (otherwise it sounds like a baby kitten mewing 2 blocks away at 100 meters, and is completely inaudible beyond that, they definitely screwed up the distance sound effects). Unfortunately it also makes it ignore a lot of other things, which is why it screws up all the other sounds when added to the AI section of a normal eng.sms file.Near as I can tell it also ignores the values in the Distance_Dec_Past trigger, just plays it at max range regardless of what's in there, then plays all the other triggers in order ignoring the Distance_Dec_Past values in those as well. The;VolumeCurve ( DistanceControlled CurvePoints ( 3 0.0 1.0 300.0 0.9 900.0 0.7 ) Granularity ( 0.4 )is important, it seems to also ignore whatever values are set for sound VS distance, but the volume curve with the Granularity ( 0.4 ) keeps it from popping, warbling, and stuttering.I took a horn wav file and reduced the volume to zero, saved it as "PONAI_silence.wav", then inserted triggers for it, so the net effect is two horn blasts at max range, then two more at a closer range, which is actually time dependent rather than range dependent. Also independent of speed, two horn waves, then six 0.6 second silent waves, for a total of 3.6 seconds, then two more horn waves. The end effect actually sounds pretty good. Coupled behind the AI train's engine, it doesn't leave a gap to the next car, since the length is zero meters. Added to any AI train behind the lead engine you hear the horn blowing off in the distance before it arrives. At the moment I get other wierd things, if I'm in the #2 view when the horns start and stay in the #2 view until the AI train arrives, I get the generic diesel growl from the lead engine with volume proportional to distance, then as that fades squeak-squeak from the cars. If I'm in the cab when the first horn goes, then switch to #2, I get squeak-squeak from the cars but nothing from the diesel. In cab there's no real growl from the diesel engine as it goes by (or maybe there is and I just can't hear it), and the cars go clickety-clack instead of squeak-squeak. guess I gotta test a default diseasel without the phantom sound car to see if it does the same, I've been around too long to assume KUJU got the original right.
RE: Hoot, Toot, & Whistle - AI traffic horn or whistle
Hmmm, so what's "granularity" anyway? I'm assuming it has something to do with "graininess" of the sound "texture" or something. In attempting to get better sounds, I replaced the exterior SD402 horn with the default geep38 horn, got *pa*pa*pa*pop*warble-stutter outta that, so I set the granularity to 0.6 and it locked up. Dropping it back down to 0.5 and changing curve points;VolumeCurve ( DistanceControlled CurvePoints ( 3 0.0 1.0 400.0 0.8 800.0 0.6 ) Granularity ( 0.5 )fixed it so it sounds good and don't lock up.The steam whistle gave a lot more trouble, and while fooling with that I discovered that one wav file with curve points and granularity set just so works fine, substitute a different wav file and it locks up.Guess I'm gonna have to beta this out, my primary concern now is that it will work on my system, but either lock up or pop-stutter-warble on someone else's machine/sound card.Any ideas?
RE: Hoot, Toot, & Whistle - AI traffic horn or whistle
I beginning to conclude that the Ignore3D() statement should be left for use in environment .sms files only, after all that's where it was found!But the same effect can be achieved with the Stereo() statement. Did you actually try out the sms script I last posted in the other thread? Here it is again.SIMISA@@@@@@@@@@JINX0x1t______ Tr_SMS (Skip ( AI test sms for sniper ) ScalabiltyGroup( 0 Activation ( ExternalCam () PassengerCam () CabCam () Distance ( 1000 ) ) Deactivation ( Distance ( 1000 ) ) Volume ( 1.0 ) Stereo() Streams ( 1 Stream ( Priority ( 6 ) Triggers ( 2 Variable_Trigger ( Distance_Dec_Past 950 PlayOneShot ( 1 File ( "x_sd402_horn1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 100 PlayOneShot ( 1 File ( "x_sd402_horn1.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) ) VolumeCurve ( DistanceControlled CurvePoints ( 4 0.0 1.0 100.0 0.8 950.0 0.15 1000.0 0.0 ) Granularity ( 0.05) ) FrequencyCurve ( DistanceControlled CurvePoints ( 2 0.0 5512 1000.0 5512 ) Granularity ( 1000 ) ) ) ) ) )This worked fine on my MSTS install. It just needs some refining to the VolumeCurve so that there is some volume loss with distance but not total loss. I have used 900m as the furthest horm trigger so that I can have a volume of 0 at 1000m to ensure that when the sms is loaded (Activated) at 1000m there are no odd effects.
"Did you actually try out the sms script I last posted in the other thread?" Uhm, no. Once I get started going down one path, I'm reluctant to abandon it for another until the "dead end" indications bite me in the ass.Now that the ignore 3D has proven to be a dead end, I did copy all the new stuff and am currently trying it. So far so good, I trashed the AIsilent.wav and the reduced volume horn wave, and am using the alternate horn wave from the default geep, so far looks much better. Chopped it down to only four triggers;SIMISA@@@@@@@@@@JINX0x1t______Tr_SMS ( Skip( **** ******************************************* **** ) Skip( **** Jim and Stu's unpatented AI diesel horn, WHONK-WHONK! **** ) Skip( **** ******************************************* **** ) ScalabiltyGroup( 0 Activation ( ExternalCam () PassengerCam () CabCam () Distance (1000) ) Deactivation ( ) Volume ( 1.0 ) Stereo() Streams ( 1 Stream ( Priority ( 6 ) Triggers ( 4 Variable_Trigger ( Distance_Dec_Past 950 PlayOneShot ( 1 File ( "x_gp_horn1_alt.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 950 PlayOneShot ( 1 File ( "x_gp_horn1_alt.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 500 PlayOneShot ( 1 File ( "x_gp_horn1_alt.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) Variable_Trigger ( Distance_Dec_Past 500 PlayOneShot ( 1 File ( "x_gp_horn1_alt.wav" -1 ) SelectionMethod ( SequentialSelection ) ) ) ) VolumeCurve ( DistanceControlled CurvePoints ( 4 0.0 1.0 100.0 0.8 950.0 0.15 1000.0 0.0 ) Granularity ( 0.05) ) FrequencyCurve ( DistanceControlled CurvePoints ( 2 0.0 5512 1000.0 5512 ) Granularity ( 1000 ) ) ) ) ) )And apparently the distance can be adjusted again, and it sounds a hell of a lot better since the volume is proportional to distance. Works perfectly on the NEC4, now I gotta try it on the PO&N.What's above is the whole enchilada:http://www.train-sim.com/dcforum/DCForumID5/6682.htmlGuy in the loco design forum gave me an invisible wagon to couple between the lead engine and the rest of the train, and being 0 meters long there's no apparent gap when the "phantom sound car" is on the train. So I took the gendieseleng.sms from the main trainsim sound folder to use as a template, and ended up replacing everything in it except the header with yours, since this new thing don't require any regular sounds.At first I just changed the ignore 3D to the stereo statement and added the frequency curve to try it out, and that worked well, but after an hour or so of running around the PO&N hearing whonk-whonk-whonk a lot of the scenery suddenly dissappeared. Wouldn't come back again even after stopping my train and switching views a few times, so thinking it might be related to all those silent.wav shots, I just eliminated all those. Don't need them if the distance works anyway.Still got more testing to do, but it definitely looks like you hit a bullseye this time!
Thanks to everybody in the loco design and sound forum. Nice thing about the train-sim.com community, by pooling our talents we come up with a lot better stuff than anyone could individually, and in a lot less time.