Spoken Caller Id on your PC using YAC

My project to get Caller ID detected on a PC off a UK landline is nearly complete. Click here to read about the full project, which includes finding a compatible modem, sending the caller ID to other PCs (or XBMC) on your network, and generating an RSS feed of incoming calls.

On my gaming box, the standard YAC notifications for a new call won’t be seen whilst I’m actually in a game:

YAC

Having the option for the PC read out the caller information would overcome this. YAC in it’s current incarnation (v0.16) doesn’t support speech, but fortunately the author has made the source code available under the GPL :-)

Extending YAC

The changes I made to YAC were kept as generic as possible (i.e. they’re not specifically tied to text-to-speech). When an incoming call is detected by YAC it does the usual notifications, but also executes a script called yac-helper.cmd (if it exists in the same folder as yac.exe).

Parameters are passed into yac-helper.cmd that enable you to do whatever you like with the incoming call. In my case, I’m simply passing control to a piece of VBScript that instantiates the Microsoft text-to-speech engine.

Sample Scripting

Here’s some sample code (which is included in the unofficial YAC 0.17 build I’m hosting on this site):

yac-helper.cmd

@echo off

rem  ----------------------------------------------------------
rem  Matt Collinge :: www.mattcollinge.co.uk :: 17 April 2007
rem  ----------------------------------------------------------
rem  Helper Script for YAC 0.17. When present in the same 
rem  folder as "yac.exe" this will be run each time a call is 
rem  received. The type of data being passed through 
rem  in %2 & %3 is specified in %1. 
rem  
rem    %1 = ( call | message )
rem    %2 = either the calling number or text-based message
rem    %3 = the calling name (not set for a text-based message)
rem  ----------------------------------------------------------

rem This next line simply passes the parameters on to a piece of VBScript. But you can
rem modify this line to call any app you like :)

wscript "c:\\yac\\yac-speech.vbs" %1 %2 %3

yac-speech.vbs

' --------------------------------------------------------
' Matt Collinge :: www.mattcollinge.co.uk :: 17 April 2007
' --------------------------------------------------------
' Take an incoming call from YAC and use the default voice
' to speak it back to the user.
' --------------------------------------------------------

Dim voic
Dim message
Dim messagePrefix

calltype = WScript.Arguments(0)

Set voic = WScript.CreateObject("SAPI.SpVoice")
Set voic.voice = voic.GetVoices("", "Language=809").Item(0)

select case calltype
	case "call"
		sNumber = WScript.Arguments(1)
		sName = WScript.Arguments(2)
		if (sName = "No Name") then
			messagePrefix = "Incoming call from number "
			message = sNumber
		else
			messagePrefix = "Incoming call from "
			message = sName
		end if
	case "message"
		message = WScript.Arguments(1)
		messagePrefix = "Incoming message "
end select

voic.Speak(messagePrefix + message)

Set voic = nothing

Job Done

When an incoming call is sent to the YAC listener on my gaming PC, it will fire the scripts above and text-to-speech allows it to read out the caller info. Dead simple really.

Voices

The default voices that are installed with XP are pretty basic, but you can buy others that sound spot on. Try out the AT&T Natural Voices demo for an idea of how good it can sound.

Downloads

Below you’ll find an unofficial build of YAC 0.17 (which I’m hosting until the original author integrates similar changes into the main build). Full source code for this build is also available, and is licensed under the GPL.

YAC 0.17 binaries for win32 (tested on XP)
YAC 0.17 source code

Build 0.17 Installation Instructions

I couldn’t be bothered creating an installer for this unofficial build. You’ve read this far so you must like messing with code, and don’t mind extracting a few files from a .zip

  • First off install 0.16 from the original author’s website
  • Next, simply extract the files in the binaries .zip file over the top of the 0.16 files
  • Edit yac-helper.cmd to your liking (including the path to yac-speech.vbs if you’re trying this example)
  • Run YAC and try testing the listeners to see if everything works

4 thoughts on “Spoken Caller Id on your PC using YAC”

  1. “You’re so wise. You’re like a miniature Buddha, covered in hair.” – Anchorman

Leave a comment