Phonespeak Command

Use this forum to request and discuss features you would like to see added to Ascendis Caller ID.
Post Reply
Frostye
Posts: 4
Joined: Sun Jun 19, 2005 10:37 am
Location: Seattle Tacoma

Phonespeak Command

Post by Frostye »

Hello Bill,
My question is a very technical one. Boils down to the incorporation of a hybrid Speak and Phonesound compilation = Phonespeak command we spoke of incorporating into Ascendis CID as a future feature earlier this year. My goal is to have CID answer the phone after business hours and tell the incoming caller that our office hours are 8am to 9pm and to please call back between those times.

I have tried this command in the current beta and it does not work:

//LANGUAGE=DWS
Speak('the caller is' + CallInfo.Name ); if (Time > StrToTime('9 pm')) and (Time < StrToTime('8 am')) then
begin
Speak('Call from ' + CallInfo.Name + ' at ' + CallInfo.Number);
Phonespeak('Hello, thank you for calling' + CallInfo.Name);
Phonespeak('The current time is' + CallInfo.TimeStr);
Phonespeak('Our office is closed at this time. Please call again during business hours 8 a m to 9 p m');
HangUp;
end;
//Do nothing


So have we added that Phonespeak command commend yet? if not when can we expect it?
Best regards.

:D
IT Professional
PREI Business Manager/Owner
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Phonespeak Command

Post by Bill Root »

Hi Frostye,

As I mentioned in my email, we haven't added this command. I still think it's a good idea, but other, more often requested, features have higher priority at this point. I'm afraid I can't offer a time frame either. In the interim, I suggest you record a wave file in your own voice, or use a program that generates wave files from speech. The former could not use any dynamic information, like the caller's name in your example. The latter could only if the program could be called from the command line and save the sound to a file suitable for the PhoneSound command.

Finest regards,
Bill Root
Ascendis Software
Frostye
Posts: 4
Joined: Sun Jun 19, 2005 10:37 am
Location: Seattle Tacoma

Wav file out

Post by Frostye »

Thanks Bill
Yes sir, I presently go into script editor and have Ascendis Speak with True Voice TTS and say whatever and record it to another computer patched through speaker to mic connections.

It's a bit troublesome, but I have made it for 6 months... what's another six? Right?

Frosty
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Wav file out

Post by Bill Root »

Hi Frostye,

There are easier ways to convert speech to to a wave file. Offhand I can't remember a free one, but the Cepstral voices come with SwiftTalker which can record to WAV files:
http://www.ascendis.com/callerid/voices.php

TextSound is another program that can convert speech to text:
http://www.bytecool.com/textsnd.htm

Finest regards,
Bill Root
Ascendis Software
bwm
Posts: 11
Joined: Tue Sep 15, 2009 9:31 am

Re: Wav file out

Post by bwm »

I've tried the Cepstral software and it works well. There seems to be a problem using the run() command in DWS however. It seems run() spawns a parallel process and then continues executing the script. I can create the desired sound file to play a custom message with a call to the Cepstral software in the DWS script as follows:

Run('C:\Program Files\Cepstral\bin\swift','"'+CustomMessage+'" -o "C:\testfile.wav" -p audio/encoding=pcm16,audio/sampling-rate=8000');

However, if my script immediately follows this with a

sound('C:\testfile.wav');

This results in a script error: Could not find sound file named "C:\testfile.wav".

Watching the script run, I can see that the run() has not yet created the .wav file before the sound() command tries to play it. Is there any way to get the script to pause when calling run() until the program being called exits so that the file needed by the next command will exist?
Last edited by bwm on Sun Oct 11, 2009 8:26 am, edited 2 times in total.
bwm
Posts: 11
Joined: Tue Sep 15, 2009 9:31 am

Re: Wav file out

Post by bwm »

I've found a workaround for the Run() command working in parallel and the script trying to play the sound file before it is generated. At first I thought I'd simply wait for the file to exist with a "repeat until FileExists('C:\testfile.wav');" command, but that doesn't work as the file is created and the script moves on to play the sound before the sound is actually completely written to the file.

However, if I name the sound file one thing, call the sound generator to create it, and then wait until a rename of that file is successful, the wait works - I'm guessing because the rename fails while the sound generator has the file open. A bit ugly, but it works:

var CustomMessage : String = 'This is my custom message to be converted into a sound file.';
if FileExists('C:\testfile.tmp') then DeleteFile('C:\testfile.tmp');
if FileExists('C:\testfile.wav') then DeleteFile('C:\testfile.wav');
Run('C:\Program Files\Cepstral\bin\swift','"'+CustomMessage+'" -o "C:\testfile.tmp" -p audio/encoding=pcm16,audio/sampling-rate=8000');
repeat until RenameFile('C:\testfile.tmp'), 'C:\testfile.wav');
sound('C:\testfile.wav');

This works with phonesound() too to play the message to the caller if your device supports it.

Some caveats:

1) If your message string is too long, this approach will likely overflow the command line causing problems. The only way around this I can think of would be to write the message text to a file and then have the Cepstral software create the sound file from that (see Cepstral documentation for command line format to do this). Be sure to set the time alotted to maximum phonesound() message appropriately (Options > Devices > Advanced) if you're using that function.

"On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters." http://support.microsoft.com/kb/830473

2) There is some lag while the script waits for the sound file to be generated. During this time the phone continues to ring. The lag isn't problematic on my system but your mileage may vary.

3) This was easy to implement as above for a single phone line. You'd have to manage file names better to avoid file name collisions with multiple lines.[/url]
Last edited by bwm on Thu Oct 15, 2009 6:13 pm, edited 1 time in total.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Wav file out

Post by Bill Root »

Hi bwm,
bwm wrote:There seems to be a problem using the run() command in DWS however. It seems run() spawns a parallel process and then continues executing the script. ... Is there any way to get the script to pause when calling run() until the program being called exits so that the file needed by the next command will exist?
In the current version there is no way to make Run() wait until the process has completed. However, I'm hopeful that we'll have something in the next beta release (should be this week) that does what you need. It should be more reliable than your clever workaround.


sigaFinest regards,
Bill Root
Ascendis Software
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Wav file out

Post by Bill Root »

bwm wrote:2) There is some lag while the script waits for the sound file to be generated. During this time the phone continues to ring. The lag isn't problematic on my system but your mileage may vary.
You should be able to get Ascendis Caller ID to pick up the phone sooner by playing a brief (possibly even silent) silent sound file using PhoneSound() before starting the process to convert speech to a sound file. Of course, the caller will still have to wait...


Finest regards,
Bill Root
Ascendis Software
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Wav file out

Post by Bill Root »

A new beta version (2.2.0.3) that includes a "RunWait" command in DWS scripts is now available. The beta page is available here:
http://ascendis.com/callerid/beta.php

Finest regards,
Bill Root
Ascendis Software
bwm
Posts: 11
Joined: Tue Sep 15, 2009 9:31 am

Post by bwm »

Hi Bill,

RunWait works like a champ. Script above to generate on the fly text messages converted to speech for phonesound() using external Cepstral software is now:

var CustomMessage : String = 'This is my custom message to be converted into a sound file.';
if FileExists('C:\testfile.wav') then DeleteFile('C:\testfile.wav');
RunWait('C:\Program Files\Cepstral\bin\swift','"'+CustomMessage+'" -o "C:\testfile.wav" -p audio/encoding=pcm16,audio/sampling-rate=8000',SW_HIDE);
phonesound('C:\testfile.wav');


Thanks much. Your responsiveness to input is is unparallelled in my 25 years of IT experience with vendors and makes using your software a true pleasure (on top of the fact that it is best of breed).
Post Reply