<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Charles Socci - Information Technology &#187; Linux Talking Clock</title>
	<atom:link href="http://charlessocci.com/tag/linux-talking-clock/feed/" rel="self" type="application/rss+xml" />
	<link>http://charlessocci.com</link>
	<description>IT and Amateur Radio K1DNR</description>
	<lastBuildDate>Fri, 20 Jan 2012 07:46:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A Linux Talking Clock</title>
		<link>http://charlessocci.com/2009/05/27/a-linux-talking-clock/</link>
		<comments>http://charlessocci.com/2009/05/27/a-linux-talking-clock/#comments</comments>
		<pubDate>Thu, 28 May 2009 04:52:10 +0000</pubDate>
		<dc:creator>csocci</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[Linux Talking Clock]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://charlessocci.com/?p=96</guid>
		<description><![CDATA[I used to use an application in Windows called Speaking Clock Deluxe. It sat in my system tray and announced the time in my choice of languages and voices. I thought it would be a fun project to make my own speaking clock for Linux. Here is a very simple project that will get you [...]]]></description>
			<content:encoded><![CDATA[<p>I used to use an application in Windows called <a href="http://www.lux-aeterna.com/">Speaking Clock Deluxe</a>. It sat in my system tray and announced the time in my choice of languages and voices.</p>
<p>I thought it would be a fun project to make my own speaking clock for Linux. Here is a very simple project that will get you started with some basic shell scripting and using the crontab.</p>
<p>My first version of the clock used espeak &#8211; which is a synthesized voice. It isn&#8217;t very appealing. For my second version I went to the<a href="http://public.research.att.com/~ttsweb/tts/demo.php" target="_blank"> AT&amp;T Labs site</a> and used their form to create .wav files of human speech for the numbers one through twelve. I created a .wav for &#8220;AM&#8221; and another for &#8220;PM&#8221;. Then I created a .wav that says, &#8220;Hello, the time is now: &#8221;</p>
<p>I used the command line application aplay, and output from the date function. It is very simple.</p>
<p>Since I&#8217;m kind of lazy, I didn&#8217;t bother creating all the minutes. I only want my announcements on the hour and half hour anyway.</p>
<p>I call the script from two crontab jobs, one that runs on the hour and one that runs on the half hour.</p>
<p><a href="http://www.socci.com/time_voice.rar">You can download my scripts and audio here</a> &#8211; check it out and then make your own, but don&#8217;t forget to share your success and send me your result!</p>
<p>The basic steps are as follows:</p>
<p>1. Create .wav files of the spoken numbers 1 through 12, the number 30, &#8220;AM&#8221;, &#8220;PM&#8221; and &#8220;The time is: &#8221;</p>
<p>2. Create a script to run on the hour similar to this example (change the paths to where you saved your files):<br />
<code><br />
#!/bin/bash</code></p>
<p>aplay -q /home/charleys/time_voice/hellothetimeisnow.wav</p>
<p>HOUR=$(date +%-l)</p>
<p>AMPM=$(date +%p)</p>
<p>EXT=&#8221;.wav&#8221;</p>
<p>aplay -q  &#8220;/home/charleys/time_voice/$HOUR$EXT&#8221;</p>
<p>aplay -q &#8220;/home/charleys/time_voice/$AMPM$EXT&#8221;</p>
<p>#end script</p>
<p>3. Save as hour.sh Make the script executable</p>
<p><code>chmod +x hour.sh</code></p>
<p>4. Create a schedule to run the script using crontab</p>
<p><code>crontab -e</code><br />
<code><br />
0 * * * * /home/charleys/time_voice/hour_human.sh</code></p>
<p>5. Repeat the steps above, except you are going to add the &#8220;30&#8243; .wav file, like this:</p>
<p><code>aplay -q  "/home/charleys/time_voice/$HOUR$EXT"<br />
aplay -q "/home/charleys/time_voice/30.wav"<br />
aplay -q "/home/charleys/time_voice/$AMPM$EXT"</code></p>
<p>NOTE: You MUST use upper case PM and AM for your file name. You MUST use 1.wav, 2.wav, etc for your file names. This is because the file is chosen based on the ouput from the date command. <code>date +%-l </code>outputs only the numbers 1-12 for the hour. Likewise, <code>date +%p</code> outputs either AM or PM. The &#8211; just removes the space from in front of the digits 1-9. Aplay only works with ALSA audio I&#8217;m told, however there are many other choices in command line audio players you can try.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://charlessocci.com/2009/05/27/a-linux-talking-clock/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

