[jawsscripts] Re: Saying two messages with a specific period of silence in between

Hi friends,
I think the following can be a solution  for this problem. Although  the
calculation is not doing with high accuracy ,but it is a way to do this job.
In this program, (That is my first time Scripting in jaws), I am using Pause
function to provide two type of delay.
One delay to provide enough time that is required   to speech the first
string, and second delay for requested silence time after reading the first
string.
because the speed rate of voice is assigned  by user, I get this value by
using the following function that return the current voice speech rate:
GetSettingInformation (V_RATE,VCTX_GLOBAL , MinRate, MaxRate)

The first and second parameters are  two  Constant which are  coming from
hjconst.jsh" header file. (notice to, the "Include" statement  before start
of script). and the third and forth parameters ar two variable which get the
minimum and maximum of the speed rate of Voice Context or  any things that
is requested by the two first parameters.
after that I am finding the length of the first string. Then in a formula
all this values are combining together with silence time and two other
constant numbers.
The number 28 is for balancing the Rate and the number 6 is for balancing
the requested silence time.

All of them make the total number of the time that we are using the Pause
function.

As I said, the calculation is not very accurate but it works for the
different string length. As you all know, it is easier to convert this
script to a function. In this case the function has to include two
parameters, FirstString and SilenceTime. and  the return value, can be an
integer to show if the function end by itself or someone hit a key to end it
manually.

the function "StopSpeech ()",  is good for make any speech  off before,  and
after the using saystring command..

 Please let me know if it works for you. I Will be happy to get any
feedback.

----------





include "hjconst.jsh"



Script TestScripting ()

var int count

var int CurrentRate, int MinRate, int MaxRate, int StrLen, int SilenceSecond

var string FirstString, String secondString

let SilenceSecond = 3

let FirstString="The Script Manager is a JAWS script editing program with
all the features necessary for you to create scripts"

let secondString="So, continue Talking."

let CurrentRate=GetSettingInformation (V_RATE,VCTX_GLOBAL , MinRate,
MaxRate)

let StrLen=StringLength (FirstString)

let count = (StrLen / CurrentRate +1) * 28 + SilenceSecond * 6

StopSpeech ()

saystring(FirstString)

While (count > 0) && (not IsKeyWaiting ())

Pause ()

let count = count - 1

EndWhile

StopSpeech ()

SayString (secondString)

EndScript

Regards,
Sina Sotudehnia
Independent  Insurance Advisors Group
Email: sina@xxxxxxxxxxx Web: WWW.IIAGROUP.CA
Direct Tel: (416) 496-9300
Office Tel: (905) 479-0888 Ext. 249
Fax: (905) 479-0856
Address: IDC Financial , Toronto East
# 3000 Steeles Ave. East.   Suite 103
Markham  L3R 4T9
Ontario  Canada



----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Sunday, July 13, 2008 5:12 PM
Subject: [jawsscripts] Re: Saying two messages with a specific period of
silence in between


> Unfortunately there is no airtight solution to this problem.  Even if
> you just consider Eloquence, users can vary the timing by changing the
> speech rate, which renders the pause-with-delay technique ineffective.
> If you take other synthesizers into account, the problem multiplies
> beyond tractability because there is no way at all to detect when some
> synthesizers are done saying something.  I think the best solution
> would be to get Freedom Scientific to give us some sort of direct
> access to the active synthesizer's indexing feature, for synthesizers
> that support this.  That would be a modification to the JAWS scripting
> language though.  I see no sufficiently effective solution without
> such a modification.
>
> On Sat, Jul 12, 2008 at 10:11:01PM -0400, Kamil wrote:
> Hi folks,
>
> I would like JAWS to say two messages with exactly two-second silence in
> between.
> Neither Delay (20), nor twenty Pause () commands works,
> since both starts right after the first message is sent to the TTS, not
> when
> it's completely spoken.
> I tried counting number of words in the first message,
> and calculating the time needed for it to be completely spoken using the
> current speech rate.
> The result varies based on the total number of sylabels in the message.
>
> Can you think of a better solution?
> As far as I know, there is no function such as TtsIsDoneEvent or
> IsTtsBusy.
>
> Thanks,
>
> Camille
>
> __________?
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> -- 
> Doug Lee, Senior Accessibility Programmer
> SSB BART Group - Accessibility-on-Demand
> mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
> "While they were saying among themselves it cannot be done,
> it was done." --Helen Keller
> __________
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>

----- Original Message ----- 
From: "Kamil" <kamilimak@xxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Sunday, July 13, 2008 9:34 AM
Subject: [jawsscripts] Re: Saying two messages with a specific period of 
silence in between


> Thanks Martin for your quick response,
>
> Unfortunately, as I mentioned before, JAWS doesn't wait for the message to
> be spoken, and then executes next statement.
> In your code, try changing the first message to something like,
>    "The Script Manager is a JAWS script editing program with all the
> features necessary for you to create scripts."
> Then you will see that the second message will be spoken right after the
> first one completes,
> without any silence in between.
>
> Cheers,
>
> Camille
>
> ----- Original Message ----- 
> From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Sunday, July 13, 2008 3:59 AM
> Subject: [jawsscripts] Re: Saying two messages with a specific period of
> silence in between
>
>
>> Hi Kamil,
>>
>>  You can include the speaking of a short silence within a while loop to
>> produce any length of silence, as in the code below.  I've included some
>> code to measure the total duration of the silence.  I've also included a
>> pause command within the loop, which means that as you vary the initial
>> value of the count variable, the duration of the loop changes in
>> increments
>> of about 140 milliseconds.  I imagine that if you removed that command,
>> you
>> would have to have a much bigger initial value of count, but would end up
>> with much finer control of the loop duration.
>>
>>  hth, Martin
>>
>> Script test ()
>> var int count, int start, int end
>>
>> let count = 16
>> SayString ("hello ")
>> let start = GetTickCount ()
>>
>> While (count > 0) && (not IsKeyWaiting ())
>>  SayString (" ")
>>  Pause ()
>>  let count = count - 1
>> EndWhile
>>
>> let end = GetTickCount ()
>> SayString ("world")
>>
>> MessageBox ("silence was " + IntToString (end - start) + " milliseconds
>> long")
>> EndScript
>>
>>
>> ----- Original Message ----- 
>> From: "Kamil" <kamilimak@xxxxxxxxxxx>
>> To: <jawsscripts@xxxxxxxxxxxxx>
>> Sent: Sunday, July 13, 2008 3:11 AM
>> Subject: [jawsscripts] Saying two messages with a specific period of
>> silence
>> in between
>>
>>
>>> Hi folks,
>>>
>>> I would like JAWS to say two messages with exactly two-second silence in
>>> between.
>>> Neither Delay (20), nor twenty Pause () commands works,
>>> since both starts right after the first message is sent to the TTS, not
>>> when
>>> it's completely spoken.
>>> I tried counting number of words in the first message,
>>> and calculating the time needed for it to be completely spoken using the
>>> current speech rate.
>>> The result varies based on the total number of sylabels in the message.
>>>
>>> Can you think of a better solution?
>>> As far as I know, there is no function such as TtsIsDoneEvent or
>>> IsTtsBusy.
>>>
>>> Thanks,
>>>
>>> Camille
>>>
>>> __________
>>> View the list's information and change your settings at
>>> http://www.freelists.org/list/jawsscripts
>>>
>>>
>>
>> __________
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>>
>
> __________
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
> 

__________ 
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: