# How to get ListAnimate to click at each step?

It would be nice if, at each step in ListAnimate, there could be a clicking sound to draw attention to the new step.

I hope to use the single click sound sample available at: https://www.fesliyanstudios.com/royalty-free-sound-effects-download/mouse-click-2

Below is some to work on. Most of the code in Graphics[...] is not relevant so I displayed it on a single line. But you will need to use it for the example to show the proper context, namely, that of a short line segment, b, being used to pace off along the length of segment a.

ListAnimate[Range[10], AnimationRunning -> False, AnimationRepetitions -> 1.0]


A similar question was asked at:

However, the present case arises within Manipulate, which has its own constraints and affordances.

• your code posted does not run. it has syntax error. An improperly formatted option head (Plus) was encountered while reading a GraphicsBox. The head of the option must be Rule or RuleDelayed. did you check it before posting? btw, since you say there could be a clicking sound to draw attention to the new step, would it not be better to make a small MWE to use for this? As all the other stuff is not relevant to the sound being generated at each click. The simpler the MWE, the more answer you will get. – Nasser Sep 27 at 16:43
• @Nasser, I posted a MWE, as suggested. – DavidC Sep 27 at 23:15

there could be a clicking sound to draw attention to the new step.

You could do this with Manipulate?

I also do not know if this does what you want. Will delete this if not.

The issue is, when making a sound, is how long do you want to pause before the next step? Else the clicks will all merge together, and what sound to make? I use a C tone. You can change this.

Manipulate[
tick;

If[i < max,
i++;
tick = Not[tick];
EmitSound@SoundNote["C",pause]; (*play the "click" sound*)
Pause[pause];
];

i,

(*controls below*)

Grid[{{"Max steps?",
Manipulator[
Dynamic[max, {max = #; i = 0; tick = Not[tick]} &], {1, 10, 1},
ImageSize -> Small, ContinuousAction -> False], Dynamic[max]}}
],

{{pause, 0.03, "Pause time?"}, 0, 2, 0.01, Appearance -> "Labeled",ImageSize -> Small},

{{tick, False}, None},
{{i, 0}, None},
{{max, 1}, None},
TrackedSymbols :> {tick}
]


The above will play a short sound each time the number is incremented. You can change the pause amount all the way to zero.

• Wonderful! You appear to be using the inherent looping of Mathematica in a way that emulates more explicit looping functions such as Do, While, or For. This gives considerable control over the internal workings of the loop. – DavidC Sep 28 at 4:54