MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg130537] Re: Easy to get the audio out of sync with the graphics (Repost)
  • From: "djmpark" <djmpark at>
  • Date: Fri, 19 Apr 2013 01:18:27 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <17744967.14121.1366277874273.JavaMail.root@m06>


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["You have chosen two as the number to be used."] 

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)] :=
  {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},
     Dynamic[n, {None, (n = #) &, 
       Function[n, spokenPhrase[n]; choiceEnabled = False; 
        actionDone = False; Pause[3]]}], {1, 2, 3}, 
     Enabled -> choiceEnabled],
    Row[{Button["Calculate", choiceEnabled = True; 
       actionDone = True;], Spacer[10], 
      If[actionDone, StringForm["The square of `` is ``", n, n^2]]}]
   }](* Column *)

David Park
djmpark at 

From: Clif McInnis [mailto:c_mcinnis at] 

This is an attempt to help Pre-Kindergarten and Kindergarten children learn
about the numerals and numbers from one to 9. The problem is that this age
group would be prone to just pressing buttons and it is easy to get the
audio out of sync with the graphics. I have played around with
Pause[different values] and Enabled->False/Enabled->True as well as
SynchronousUpdating -> False. I was hoping that someone might be able to
tell me whether I was on the right track; if there is a different function I
should look at; or (most important) if what I am trying to do is not doable.
I would also appreciate if someone could tell me a way to follow the flow of
the way the code is read by the computer, that would give me an idea of
where to best place Pauses, etc. (I want to thank John Fultz for
contributions previously made to this manipulate.) Thank You, Clif McInnis

     Row[If[n < 2, {Spacer[160],
        Style[nnames[[n]], Bold, Large, Hue[RandomReal[]]],
        Style[" Ball", Bold, Large, Green]}, {Spacer[160],
        Style[nnames[[n]], Bold, Large, Hue[RandomReal[]]],
        Style[" Balls", Bold, Large, Green]}]]],
        Darker[Green], Disk[],
        Text[Style[numerals[[ r]], Orange, "Label", 48], {0,
          0}]}], {r, 1, n}]
     ]}, BaseStyle -> {LinebreakAdjustments -> {1., 10, 0, 0,
       10}}], {525, 300}],
    " Start  \n ", {n = 1,
     Speak["lets count the numbers 1 to 9 out loud. One"]}],
    "\[FilledLeftTriangle]\[FilledLeftTriangle] Start Over", {n = 1,
    "\[FilledLeftTriangle] Less", {If[
      n < 2, {n = 1,
       Speak["Today we are just working on the numbers from one to \
nine."]}, {n -= 1, Speak[n]}]}], Spacer[10],
    "More \[FilledRightTriangle]", {If[
      n > 8, {n = 9,
       Speak["Lets learn the numbers from one to nine before we go \ on."]},
{n += 1, Speak[n]}]}],
    "All \[FilledRightTriangle]\[FilledRightTriangle]", {n = 9,
 {{n, 9, " "}, ControlType -> None},
 Initialization :> (
   numerals = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
   nnames = {"One", "Two", "Three", "Four", "Five", "Six", "Seven",
     "Eight", "Nine"};

  • Prev by Date: Re: How to remove a singularity
  • Next by Date: Limiting Output Based on Z Axis of Plotd3d[Evaluate@Table[PDF[NormalDistribution
  • Previous by thread: Re: Easy to get the audio out of sync with the graphics (Repost)
  • Next by thread: Re: Easy to get the audio out of sync with the graphics (Repost)