Possible To Make A Metronome With Tasker?

152 views
Skip to first unread message

My-kl

unread,
Feb 19, 2016, 6:16:32 PM2/19/16
to Tasker
Would it be possible to make a metronome with Tasker?

Jeremy Harris

unread,
Feb 19, 2016, 10:47:34 PM2/19/16
to Tasker
Like a beep every second?

My-kl

unread,
Feb 20, 2016, 4:37:56 AM2/20/16
to Tasker
Yes. But with the ability to change the interval between beeps.

Rich D

unread,
Feb 20, 2016, 7:28:22 AM2/20/16
to Tasker Google Groups Post


> Yes. But with the ability to change the interval between beeps.

I would try a 'task timer widget' linked to a task with a beep action.

Juergen Gruen

unread,
Feb 20, 2016, 8:22:39 AM2/20/16
to Tasker

Hi,

just tested the timer widget with a one second interval. Not very accurate.


If you want to play the piano "very fast", maybe 180bpm, you need a beep every 333 milliseconds...

Maybe a scene with start, stop, exit buttons and a number picker. A Task with a loop and a wait action. At least you have to export it with app factory, I guess. Not sure if it is accurate enough then...


Juergen.


 

Rich D

unread,
Feb 20, 2016, 8:36:31 AM2/20/16
to Tasker Google Groups Post


> just tested the timer widget with a one second interval. Not very accurate.

That's too bad... :(  I was hoping that would work.  I know from past experience that 'wait' actions were never designed for this type of accuracy and have failed for me in the past. However, thinking back I believe I was trying to use them for longer periods of time so it might be worth a shot to test for this application.

@OP - What sort of range are you looking for?  

Jeremy Harris

unread,
Feb 20, 2016, 8:52:05 AM2/20/16
to tas...@googlegroups.com

This concept seemed to work okay for me...I didn't bother testing for precision though...

Screenshot_2016-02-20-08-48-35.png
Screenshot_2016-02-20-08-48-44.png
Screenshot_2016-02-20-08-49-22.png

My-kl

unread,
Feb 20, 2016, 11:21:50 AM2/20/16
to Tasker
>@OP - What sort of range are you looking for?  

30 - 200bpm would suffice, but I wanted to implement a slider to control tempo, plus buttons for going up down in intervals of 1, 5 and 10bpm.

I've only found two metronomes on the Android market that have ±5bpm buttons but one of them stops when the screen turns off (no good when I'm playing Sor's Grand Solo) and the other has started crashing my phone.

My-kl

unread,
Feb 20, 2016, 11:48:18 AM2/20/16
to Tasker
It would also need to display the tempo, no matter which method was used to change it.

Rich Belthoff

unread,
Feb 22, 2016, 4:17:17 PM2/22/16
to Tasker
You could set up a profile/task in tasker to leave your screen on while the metronome is running (i.e., the one that seems to work but cuts off when the screen is off). I just did a search in the play store and there are tons of metronome apps. You may want to try another one. If you like the one you have, you should be able to do a profile/task in Tasker that forces the screen on while it's running. I'd post an example of how I do it, but I'm on my laptop and not my phone so I can't cut/paste. Sorry. There should be examples on the web if you do a search.

My-kl

unread,
Feb 23, 2016, 5:27:00 PM2/23/16
to Tasker
Thank you, I know how to set that up, I've used that kind of thing for other apps. The problem with this is: I don't WANT to keep the screen on. If I'm playing a 10 minute piece I don't want the screen on all that time.
I tried 14 metronome apps. I've found one that's very simple, very loud but lacks the buttons for going up down in intervals of 5bpm. I'll just have to live with that.

Rich D

unread,
Feb 23, 2016, 10:33:16 PM2/23/16
to Tasker Google Groups Post


> I tried 14 metronome apps. I've found one that's very simple, very loud but lacks the buttons for going up down in intervals of 5bpm. I'll just have to live with that.
>

This may be possible with tasker. I just was testing an approach that does not use any waits and seems to be fairly accurate.

It counts every second and does not encounter any inaccuracy until runs for over 360 seconds.  At 480 seconds I had 1 to 2 second difference.

Not sure if that will work for you?

Rich D

unread,
Feb 23, 2016, 10:43:02 PM2/23/16
to Tasker Google Groups Post


Forgot to post the test task...

Music Test (736)
A1: Variable Query [ Title:input wait time Variable:%wait Input Type:Numeric / Decimal Default: Background Image: Layout:Variable Query Timeout (Seconds):40 Show Over Keyguard:On ]
A2: Variable Set [ Name:%start_task To:%TIMES Do Maths:Off Append:Off ]
<begin>
A3: Variable Set [ Name:%start To:%TIMES Do Maths:Off Append:Off ]
<start>
A4: Anchor
A5: Variable Set [ Name:%diff To:%TIMES-%start Do Maths:On Append:Off ]
A6: Goto [ Type:Action Label Number:1 Label:start ] If [ %diff < 1 ]
A7: Variable Add [ Name:%total Value:1 Wrap Around:0 ]
A8: Goto [ Type:Action Label Number:1 Label:begin ] If [ %total < %wait ]
A9: Variable Set [ Name:%tot_diff To:%TIMES-%start_task Do Maths:On Append:Off ]
A10: Notify [ Title:Wait Text:%tot_diff Icon:null Number:0 Permanent:Off Priority:3 ]

My-kl

unread,
Feb 28, 2016, 5:22:35 PM2/28/16
to Tasker
Thanks for this! Unfortunately I don't know how to input some of the settings:


>>> A6: Goto [ Type:Action Label Number:1 Label:start ] If [ %diff < 1 ]
If I select 'Type:Action Label' there is no 'Number' option. If I select 'Type:Action Number' there is no 'label' option except after 'If'.
The same goes for A8.

Rich D

unread,
Feb 28, 2016, 6:19:05 PM2/28/16
to Tasker Google Groups Post

That is just the way the export description is shown.  You want to select type:Action Label.  Then hit the mag glass to see all available labels.

The first label is just a label assigned to the action.

<begin>
A3: Variable Set [ Name:%start To:%TIMES Do Maths:Off Append:Off ]

So in the edit screen for action A3. You would select the label option then type in 'begin'

The other one is the action / task / anchor . This is specifically used as a label (anchor) for the goto action.

<start>
A4: Anchor

Let me know if that is not clear.

My-kl

unread,
Feb 28, 2016, 8:06:27 PM2/28/16
to Tasker
I didn't realise <begin> is for A3, I thought it was A2!

I'm still not clear about A6:

>>> A6: Goto [ Type:Action Label Number:1 Label:start ] If [ %diff < 1 ]

I've selected Action label but where does Number:1 come in?

Rich D

unread,
Feb 28, 2016, 8:27:53 PM2/28/16
to Tasker Google Groups Post


> I'm still not clear about A6:
>
> >>> A6: Goto [ Type:Action Label Number:1 Label:start ] If [ %diff < 1 ]
>
> I've selected Action label but where does Number:1 come in?

Not sure why it is listed like that but Number:1 does not apply.  You would just choose a label. 

Rich D

unread,
Feb 28, 2016, 8:35:11 PM2/28/16
to Tasker Google Groups Post
Screenshot_2016-02-28-20-33-42.png
Screenshot_2016-02-28-20-32-53.png
Screenshot_2016-02-28-20-33-14.png

My-kl

unread,
Feb 29, 2016, 4:46:49 AM2/29/16
to Tasker
OK, great, so I've programmed that correctly after all :-) The problem now, and this is a little embarrassing, is that i haven't got a clue what to do with it! When I run the task the li'l green symbols flash a bit and then a notification appears that says 'Wait 1456738542'. I haven't got a clue what it's actually doing or how to use it!

Rich D

unread,
Feb 29, 2016, 7:03:54 AM2/29/16
to Tasker Google Groups Post


) The problem now, and this is a little embarrassing, is that i haven't got a clue what to do with it! When I run the task the li'l green symbols flash a bit and then a notification appears that says 'Wait 1456738542'. I haven't got a clue what it's actually doing or how to use it!

This is simply a proof of concept to test the accuracy of the timer approach.

Music Test (736)
A1: Variable Query [ Title:input wait time Variable:%wait Input Type:Numeric / Decimal Default: Background Image: Layout:Variable Query Timeout (Seconds):40 Show Over Keyguard:On ]

// this displays a message and lets you set variable %wait to the number of seconds you want the test to run for.   
//

A2: Variable Set [ Name:%start_task To:%TIMES Do Maths:Off Append:Off ]

// this sets the variable %start_task to epoch time (the time in seconds since a certain date in time)
//

<begin>
A3: Variable Set [ Name:%start To:%TIMES Do Maths:Off Append:Off ]

// this sets the variable %start to epoch time (the time in seconds since a certain date in time) and is the start of the outer loop to count now many seconds have past
//

<start>
A4: Anchor

// this is label for the goto action to goto and the start of the internal loop to wait 1 second.
//

A5: Variable Set [ Name:%diff To:%TIMES-%start Do Maths:On Append:Off ]

// sets %diff to the start time minus the current time in seconds.  This will be 0 untill a second in time has past
//

A6: Goto [ Type:Action Label Number:1 Label:start ] If [ %diff < 1 ]

// go back up to action A4 if %diff is less then 1
//

A7: Variable Add [ Name:%total Value:1 Wrap Around:0 ]

// Increments the value of %total by 1
//

A8: Goto [ Type:Action Label Number:1 Label:begin ] If [ %total < %wait ]

// goto action A3 if the amount of seconds entered in action A1 has not passed
//

A9: Variable Set [ Name:%tot_diff To:%TIMES-%start_task Do Maths:On Append:Off ]

// gets the actual time in seconds that has past since the task started
//

A10: Notify [ Title:Wait Text:%tot_diff Icon:null Number:0 Permanent:Off Priority:3 ]

// sets notification of actual time that passed during the test
//

So if you enter 30 in the variable query the task should run for 30 seconds and display 30.  If it displays 31 then there was a 1 second inaccuracy in the timer.

You can not get a accurate test by using the play button for the task because tasker is trying to display to much information as the task loops. You need to assign the task a icon (lower right in task edit screen) then make a task shortcut on your home screen(like you would make a widget but it is a shortcut instead)  and run the task from your home screen)

To build this project will require some (somewhat) advanced tasker skills. There is no reason you will should not be able to accomplish this. I would start by viewing the beginner videos at menu / info / guides.  This should give you enough information to start changing the task to your needs. For example you will need to do some maths to get it so your input will be in 'beats per min'  and you will want to add a beep action.

Once you have the task working the way you want and verify it will work for your needs,  you will need to build a scene to put it all together. You should be able to find a video for that as well.

To find specific information in the guide use the menu / search tasker option.  This will search all your tasker data and the guide as well. For example you would search for %TIMES  and it will show you all references to %TIMES.   

Another invaluable tool is the run log. Menu / more  / run log.

When you get stuck and can not find what you need with a search then post back here for help. Include a exported description of your task and details on what is and is not working.

To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).

Rich D

unread,
Mar 1, 2016, 6:46:36 AM3/1/16
to Tasker Google Groups Post



One more note on this. You need to set the task to 'keep device awake'  this is in the task properties. In the task edit screen, the three slider icon in lower right.

Oh, just so you are aware this will block any other tasks with a lower priority from running but we can address that once you determine you want to use this.

Music Test (736)
A1: Variable Query [ Title:input wait time Variable:%wait Input Type:Numeric / Decimal Default: Background Image: Layout:Variable Query Timeout (Seconds):40 Show Over Keyguard:On ]

A2: Variable Set [ Name:%start_task To:%TIMES Do Maths:Off Append:Off ]

<begin>
A3: Variable Set [ Name:%start To:%TIMES Do Maths:Off Append:Off ]

<start>
A4: Anchor

A5: Variable Set [ Name:%diff To:%TIMES-%start Do Maths:On Append:Off ]

A6: Goto [ Type:Action Label Number:1 Label:start ] If [ %diff < 1 ]

A7: Variable Add [ Name:%total Value:1 Wrap Around:0 ]

A8: Goto [ Type:Action Label Number:1 Label:begin ] If [ %total < %wait ]

A9: Variable Set [ Name:%tot_diff To:%TIMES-%start_task Do Maths:On Append:Off ]

My-kl

unread,
Mar 9, 2016, 5:54:55 PM3/9/16
to Tasker
Thank you for all your help so far. I'm not a newbie: I've made scenes using variables and automated all kinds of other things. At the moment I'm too busy with other things to work on this. I may come back to it later.
Reply all
Reply to author
Forward
0 new messages