Page 1 of 1

Speech output of phone numbers

Posted: 24 Mar 2014 08:31
by BobF
I feel sure there's a simple answer to this but I can't find it! :|
I have a flow which reads out when an incoming call arrives. It works fine if the caller is in my contacts, but if they're not, the speech output treats it as a number i.e. if the caller is 01234567890, it starts by saying something like "one billion, two hundred and thirty four thousand .." etc.

Anyone know a way to have it read digit by digit?

Re: Speech output of phone numbers

Posted: 24 Mar 2014 12:00
by Joost van Gils
You should add a space after each digit. You can do this by adding a script action and code something like:

l=length(incoming_number);
counter=1;
while (counter<=l)
{
nr=nr + substring(incoming_number,counter,1) + " "; //Here the space is added
counter=counter+1;
}

The variable "nr" holds the Phone number with spaces in between....

Re: Speech output of phone numbers

Posted: 24 Mar 2014 12:37
by BobF
As easy as that! I've tried that and it does the job. Just need to tinker with it now. Thank you very much!

Re: Speech output of phone numbers

Posted: 24 Mar 2014 14:58
by BobF
I tried this, but if a phone number began with 0 (zero) the speech output said 'null' for that digit.
Quite by accident I found it seems there's an even simpler solution.

all that's needed is this:

nr = " " + incoming_number

This adds a space in front of the number.

I'm guessing this makes the speech engine see it as a string, and it then reads the caller's number out perfectly with the leading zero said as a 'zero'. All that said, the original idea was for the number to be read out to me while driving. Whichever way it reads it out, it struck me I won't be able to do much with it, so I may just go back to having it say 'unlisted' after all ! :D