We really enjoyed the original Half-Life 1 game back in 1998. As a tribute to such a great series here is a simple perl script to say the current time in voice of the Half Life 1 H.E.V Mark IV suit. You might remember this voice as the woman's computer voice giving you status updates from inside the suit. The Half-Life fan remastered Black Mesa H.E.V Mark IV suit sounds very similar. Also, you may notice that the suit voice in the game "No Man's Sky" sounds a lot like the Half life suit.
How does the clock work? When the perl script is run the script queries the current system time. The sound file names needed are added to an array and the binary "play" is used to play the files in series. For example, if the current time is "8:54pm" the script will say "The time is eight fifty four pm" in the ''FVOX'' (H.E.V Mark IV suit) voice. If you choose 24 hour time then "The time is twenty fifty four" will be spoken. That's about it.
The setup is very simple:
NOTE: you will need the binary "play" for the script to play the wav files. On Ubuntu install the sox package using "sudo apt-get install sox". On OpenBSD 5.1 use "pkg_add -i sox-14.3.2.tgz". The FreeBSD install of sox should be similar.
All done. Please enjoy.
Here is a copy of the perl script itself for review. This is exactly the same script in the tar bzip file above.
#!/usr/bin/perl use strict; # ## moneyslow.com Half-Life 1 (1998 series) talking clock # # If run from cron, make sure this is the full path to the wavs my $base="wavs"; ## collect the system time using the date binary ## 12 hour time my $hour=`date +%I`; chop($hour); ## 24 hour time #my $hour=`date +%H`; chop($hour); my $minute=`date +%M`; chop($minute); my $APM=`date +%p`; chop($APM); ## "the time is" wav push(my @audio,"$base/time_is.wav"); ## the hour time wav defined by 12 or 24 hour time above push(@audio,"$base/$hour.wav"); ## the minute wav. check for minutes which are less then 20 ## so numbers in the teens and 1-9 play correctly if($minute > 20){ my $min1=eval($minute-($minute%10)); my $min2=eval($minute%10); push(@audio,"$base/$min1.wav"); unless($min2 == "0"){push(@audio,"$base/$min2.wav");} } else { if ($minute != 0) { push(@audio,"$base/$minute.wav"); } } ## add AM or PM to the time stamp. 24 hour time will skip. if($APM) { push(@audio,"$base/$APM.wav"); } ## Speak the time in series to avoid pauses between files system(`play -q @audio`);
How do I execute the script on the hour ?
The easiest way is to use cron. This example will execute the script every hour if the script is located in the /clock/half_life_talking_clock/ directory. You may need to define the $base variable to the full path of the wavs directory from cron to work. For this example, $base="/clock/half_life_talking_clock/wavs".
#minute (0-59) #| hour (0-23) #| | day of the month (1-31) #| | | month of the year (1-12) #| | | | day of the week (0-6 with 0=Sun) #| | | | | commands #| | | | | | ## Half-Life Talking Clock hourly chime 0 * * * * /clock/half_life_talking_clock/half-life_clock.pl
How do I use different voices in the clock ?
Just replace the files in the wavs directory with the sound files with say the proper numbers. The script does not care as long as "play" can play the sound file format.
How do I change the volume ?
In the script find the last line which executes the "play" binary. Play allows you to turn up or down the volume of just these sound files relative to any other sounds on the machine. Add the argument "-v" and a number. For example, "play -v 1.5" would increase the volume 150% and "play -v 0.75" would decrease the volume to 75% of the original.
Why was this script made ?
We loved the original Half-Life 1998 game and thought it would be great to hear the HEV speak the time every hour at home. The sounds were freely available on the game disk and online. From the last google search (136 million results found) you can find all the sound files anywhere online.
To Valve, please don't send us any nasty-grams. We made this for the love of the game!