More clock stuff. This one says the time using sounds found in games. I wrote this in 2001 but never released it. One weekend I wrote this using cygwin and wxWidgets on Windows 98. It still works in Windows 7 although I’ve long lost the source code.
Many PC 3D first person shooter games have some interesting stuff inside that can be re-purposed. The game content was stored as a file hierarchy compressed like a zip file and contained 3D models, level maps, music, sounds and so on. The gaming community started making game modifications for new levels, players, weapons, sounds, etc. and this was embraced by the game studios who also provided editing tools to support this.
For example, the original Half Life game (Sierra at the time and now Valve) used several background voices which were broken into phrases and words.This way the game designers could construct a rudimentary text to speech system for background sounds such as the female automated voice of Gordon Freeman’s HEV suit or male military radio chatter. It turned out, these phrases included numbers (one, two… nineteen…) and time phrases (“The time is now …”).
So I made a PC clock out of the half life sounds phrases as a simple 32bit PC taskbar app. I have zipped the executable (Windows only) and a readme. The MD5 checksum for the zip file is:
Download -> voxclock (627)
I wrote this for Windows 98 in C++ using cygwin and wxWidgets at the time and it has worked on 2000,NT, XP, and Windows 7. It saves the phrases to the registry but doesn’t create any files. Installing requires copying the voxclock folder to your program files (or program files(x86)) folder.
I don’t provide the wav files, for these you need to own the game and extract them yourself. For the original Half-Life, the sounds were in the pak0.pak files after install and authentication. For the Valve Half-Life under Steam, these are changed to half-life.gcf files. Find the Steam folder in program files or program files(x86), gcf files are located in Steam’s subfolder steamapps. There are several extractors on the web, just search for them and I used Nem’s GCFScape for my Valve copy.
Inside half-life.gcf with GCFScape, browse for valve/sounds. Inside here are two folders: fvox and vox directories, drag these folders to the voxclock program folder. Launch voxclock and right click for the popup menu. Select options which will bring up the preferences window. From here, set the directory to point to the fvox or vox folders. Note they don’t have the same phrases and if it can’t match to a wav file it plays nothing.
The next step is to set the phrase. The phrase is made of the filenames without the .wav extension separated by spaces. So type “danger” (without the quotes) and press test. It should play the file “danger.wav”. Type “danger deactivated”, it should play danger.wav followed by deactivated.wav. The don’t have the same phrases, so each has to be tailored to the voice. Both do have numbers, one.wav, two.wav… nineteen.wav,… thirty… and so on. The program uses a subset (numbers only) of the strftime syntax for constructing the date and time phrases. Instead of filename, use %<letter> from here:
%I Hour in 12hr format (1 - 12) %H Hour in 24hr format (0 - 23) %M Minute (0 - 59) %S Seconds (0 - 59) %p AM or PM %m Month as a decimal number (1-12) %y Year as last two digits (00 - 99) %d Day of the month (1 - 31)
If the current time is 1:32pm, if the phrase is “%H hours %M minutes”, it will play one.wav, hours.wav, thirty.wav one.wav minutes.wav.
For female voice, “time_is_now %I %M %p” for twelve hour time.
For male voice, ” time is %H hours %M minutes %S seconds” for 24 hour time.
Play the time by clicking on the icon. It has an alarm, I don’t recall if it works.
voxclock by Bob Alkire is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.