Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14242 > unrolled thread
| Started by | "djmpark" <djmpark@comcast.net> |
|---|---|
| First post | 2013-04-19 05:15 +0000 |
| Last post | 2013-04-20 09:55 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Easy to get the audio out of sync with the graphics (Repost) "djmpark" <djmpark@comcast.net> - 2013-04-19 05:15 +0000
Speak errors (was Re: audio) Richard Fateman <fateman@cs.berkeley.edu> - 2013-04-20 09:55 +0000
Re: Easy to get the audio out of sync with the graphics (Repost) Clif McInnis <c_mcinnis@hotmail.com> - 2013-04-20 09:55 +0000
| From | "djmpark" <djmpark@comcast.net> |
|---|---|
| Date | 2013-04-19 05:15 +0000 |
| Subject | Re: Easy to get the audio out of sync with the graphics (Repost) |
| Message-ID | <kkqjsk$nom$1@smc.vnet.net> |
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"]
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)] :=
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 *)
]
David Park
djmpark@comcast.net
http://home.comcast.net/~djmpark/index.html
From: Clif McInnis [mailto:c_mcinnis@hotmail.com]
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
Manipulate[
Pane[Column[{Text[
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]}]]],
Row[Table[Graphics[{
Darker[Green], Disk[],
Text[Style[numerals[[ r]], Orange, "Label", 48], {0,
0}]}], {r, 1, n}]
]}, BaseStyle -> {LinebreakAdjustments -> {1., 10, 0, 0,
10}}], {525, 300}],
Row[{Button[
" Start \n ", {n = 1,
Speak["lets count the numbers 1 to 9 out loud. One"]}],
Spacer[55],
Button[
"\[FilledLeftTriangle]\[FilledLeftTriangle] Start Over", {n = 1,
Speak["one"]}],
Button[
"\[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],
Button[
"More \[FilledRightTriangle]", {If[
n > 8, {n = 9,
Speak["Lets learn the numbers from one to nine before we go \ on."]},
{n += 1, Speak[n]}]}],
Button[
"All \[FilledRightTriangle]\[FilledRightTriangle]", {n = 9,
Speak["nine"]}]
}],
{{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"};
[toc] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2013-04-20 09:55 +0000 |
| Subject | Speak errors (was Re: audio) |
| Message-ID | <kktom6$c87$1@smc.vnet.net> |
| In reply to | #14242 |
The audio etc subject line was sufficient to get me to try Speak[],
and I immediately found two serious errors.
{Speak[x*(x + b*(c + x + z))], Speak[x*(x + b*(c + x) + z)]}
show that Mathematica's Speak program is inadequate to distinguish
two distinct mathematical expressions.
SpokenString tells us they are the same but this is a lie:
{"x times the quantity x plus b times the quantity c plus x plus z",
"x times the quantity x plus b times the quantity c plus x plus z"}
oops.
The other is that Mathematica does not know how to pronounce the
A in A+B. What you really want is something like Hay plus Bee.
Not Ahh plus Bee.
Much of the solution to this speaking issue can be resolved quite
without Mathematica because (I suspect) common browsers are happy
to speak phrases, numbers, etc, directly from XML. See
http://msdn.microsoft.com/en-us/library/ms717077%28v=vs.85%29.aspx
Furthermore, there are lots and lots of detailed specifications for
text-to-speech that are quite inaccessible in the current Mathematica
design.
Also for what it is worth, there are programs to utter mathematics (into
XML)
CORRECTLY. Fundamentally, one needs only a few lines of code to do
"in-order tree traversal" plus a bunch of data e.g. to pronounce Cos as
cosine, etc. To do a really bang-up job one should diddle with the
speed, volume, and such details as to maybe use SPELLING to pronounce
certain variable names.
The current program fails on the in-order tree traversal, apparently.
On the larger issue, of getting kindergarten children to pronounce the
numbers from 1 to 10. Uh, do you really need to use a computer? Running
Mathematica?
RJF
[toc] | [prev] | [next] | [standalone]
| From | Clif McInnis <c_mcinnis@hotmail.com> |
|---|---|
| Date | 2013-04-20 09:55 +0000 |
| Message-ID | <kktona$c8l$1@smc.vnet.net> |
| In reply to | #14242 |
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
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web