Calomel.org :: Open Source Research and Reference

Half-Life 1 Talking Clock (1998 series)



Calomel.org Home Page     RSS Feed


We really enjoyed the original Half-Life 1 game back in 1998. As a tribute to such a great series we made a simple perl script to say the current time in voice of the ''FVOX'' (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.

How does it work? When the perl script is run it 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. That's about it.





How do I setup the talking clock ?

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. Enjoy.



What does the half-life_clock.pl perl script look like ?

Here is a copy of the perl script itself for review. This is exactly the same script in the tar bzip file.

#!/usr/bin/perl

use strict;

#
## Calomel.org Half-Life 1 (1998 series) talking clock
## https://calomel.org/half_life_talking_clock.html
# 

my $base="wavs";

## collect the system time using the date binary
my $hour=`date +%I`; 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
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
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 {
  push(@audio,"$base/$minute.wav");
}

## add AM or PM to the time stamp
push(@audio,"$base/$APM.wav");

## Speak the time in series to avoid pauses between files
system(`play -q @audio[0] @audio[1] @audio[2] @audio[3] @audio[4]`);




Questions?


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.

#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!





Questions, comments, or suggestions? Contact Calomel.org or



Calomel.org Home Page :: Open Source Research and Reference
Calomel.org :: Open Source Research and Reference