Re: Easy to get the audio out of sync with the graphics (Repost)

*To*: mathgroup at smc.vnet.net*Subject*: [mg130555] Re: Easy to get the audio out of sync with the graphics (Repost)*From*: Clif McInnis <c_mcinnis at hotmail.com>*Date*: Sat, 20 Apr 2013 05:46:50 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <17744967.14121.1366277874273.JavaMail.root@m06> <kkqjsk$nom$1@smc.vnet.net>

Debguy, I have tried to work with pausing and the problem that I am encountering with pausing is that what ends up happening is the displaying of the disks is delayed and while the buttons are delayed they are not disabled, so it still allows that audio to become out of sync. On Friday, April 19, 2013 12:15:00 AM UTC-5, djmpark wrote: > Clif, > > > > I think your question is an important one for incorporating spoken phrases > > into a dynamic presentation. But I wouldn't go straight for a Manipulate > > statements but would prefer to do a simpler model. > > > > But first I have complaints about the Speak function. It seems very > > unreliable just with simple strings and one can waste a lot of time just to > > get something intelligible. How do these two commands work on your computer? > > > > Speak["two"] > (* Sounds about right, almost said as if 'she' is asking a question*) > > > Speak["You have chosen two as the number to be used."] > (* "You have chosen (silence) as the number to be used" I tried this several times*) Speak["You have chosen three as the number to be used."] (* In addition my computer "speaks" this phrase well. I had noticed in doing another project that it had a problem with saying "two" (but thought that it was just 'her') and had just switched to "to".*) > > > On my computer the first sounds great and the second awful. The "two" is > > completely eliminated and the last word is clipped. It's another case of > > WRI providing a facility that only works well on a few carefully selected > > examples. Of course, there is all the facility for speaking Mathematica > > expressions, but for custom dynamic presentations I would just be happy if > > it would do a good job at annunciating simple sentences. > > > > Here is a toy example. The user can choose 1 of three integers. Once a > > choice has been made the SetterBar is disabled until a calculation is > > performed. Then when the Calculate button is used a result is generated and > > the SetterBar is again enabled. The Dynamic statement in the SetterBar uses > > the extended form of the second argument of Dynamic. First a routine to > > generate the spoken phrase: > > > > spokenPhrase[n : (1 | 2 | 3)] := > > Module[ > > {basePhrase1 = "You have chosen ", > > basePhrase2 = " as the number to be used."}, > > Speak[basePhrase1]; Speak[n]; Speak[basePhrase2] > > ] > > > > Then the dynamic presentation: > > > > DynamicModule[{n None, choiceEnabled = True, actionDone = False}, > > Column[{ > > Dynamic@ > > SetterBar[ > > Dynamic[n, {None, (n = #) &, > > Function[n, spokenPhrase[n]; choiceEnabled = False; > > actionDone = False; Pause[3]]}], {1, 2, 3}, > > Enabled -> choiceEnabled], > > Dynamic@ > > Row[{Button["Calculate", choiceEnabled = True; > > actionDone = True;], Spacer[10], > > If[actionDone, StringForm["The square of `` is ``", n, n^2]]}] > > }](* Column *) > > ] > > (*This is a nice "toy" and seems to operate just about the way I was hoping to get the buttons on the manipulate to operate. I am not familiar at all with Dynamic, (I assume that it woks differently from Manipulate) so it may take me while to get acquainted with its operation. I would also assume that SetterBars and Buttons work differently, so that for instance I could not just set up my four buttons (Stat over, Less, More and ALL) as a Setter Bar. Many thanks for responding and for working on this, for the first time in a few days I have some hope that I may be able to get this working.*) > > > > David Park > > > http://home.comcast.net/~djmpark/index.html >