Re: Crazy Clock!

72 views
Skip to first unread message
Message has been deleted

Ghica

unread,
Jan 17, 2016, 10:04:41 AM1/17/16
to MIT App Inventor Forum
This is because other things may be going on, and App Inventor is not so fast. Maybe you would have more luck when you would write it in Java, but then your phone may still decide to do background tasks first before handling a clock event.
Cheers, Ghica.

Taifun

unread,
Jan 17, 2016, 10:10:04 AM1/17/16
to MIT App Inventor Forum
It does not look like you have used the forums yet, as a search using the search box above would have returned several threads about this topic.
Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 



Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.

sa as

unread,
Jan 19, 2016, 8:00:53 AM1/19/16
to MIT App Inventor Forum
Sorry I deleted by mistake the original message:

Hello,

I have a serious problem with the Clock Component. I want to make a simple metronome but is impossible. 
In the picture below you can see the difference between a regular 60 bpm and the time generated from App Inventor at 1000 ms (green track).

I tried with different values (time.interval) but the frequencies is always irregular. 
Considering the latency I tried also to exporting .apk in a different machines, but nothing to do.

Only one question: why?

Thanks,
S

P.S.: I found some answers in this conversation. But I still do not understand why App Inventor has this banal bug...


ai2_timer_60bpm.jpg

Scott Ferguson

unread,
Jan 19, 2016, 8:22:08 AM1/19/16
to mitappinv...@googlegroups.com
App Inventor is an educational tool, not a precision instrument like a metronome.
You can approximate a metronome using the suggestions in the thread you mentioned by using the Clock duration block and checking each clock tick for the actual elapsed ms.
If they are greater than the target ms then subtract the overrun ms from the next cycle.
That should keep the metronome in sync as much as possible.
I would set the Clock TimerInterval to 0 for maximum accuracy.
See this example.
---
sf

sa as

unread,
Jan 19, 2016, 8:46:06 AM1/19/16
to MIT App Inventor Forum
Thank you Scott, you've been very helpful.
Reply all
Reply to author
Forward
0 new messages