This week, we want to look at our favorite customization app, Tasker, and use it to control our music. Perhaps down the road we will create a full music player, today all we want to create are a sleep timer that shuts down your music automatically, and another timer to fire up your music after a set amount of time, let’s call it an alarm clock.
In the end, today’s project is mostly a lesson in using Tasker’s Task Timer widget.
Before we get started
You will require Tasker for our project today. Tasker is $2.99 in the Google Play Store. Be sure to check out some of the capabilities of Tasker and a few of the other projects we’ve built with it, if you are not sure it is worth the price.
Create a simple Tasker Task and name it concisely and uniquely, I’ll call mine “StopMusic.”
You may have the urge to hit that Music Stop button, resist it. Instead, select Media Control.
Under Cmd, select Stop.
Tap the system Back button.
In the bottom right corner, tap the icon with the nine little squares in a grid. You are now setting up an icon for the Task, so follow through the selection method and choose something that appeals to you.
Tap the system Back button, all the way out of Tasker.
Before we continue, it is crucial that we test out the Task we’ve just built. Fire up some music on your device, re-open the Tasker Task and tap that little run button that looks like a media play button. If it does not work, you’ll need to modify the Task a bit. Try turning off Simulate Media Button for starters. If that does not do it, you may actually try out that Music Stop option. The only right or wrong option here is to choose the one that works on your device.
Create the Task Timer widget to stop music
Find an empty 2×1 space on your Homescreen and perform the actions required to place a widget. For most of you, that means long pressing the empty space. Stock Android users will be able to choose the widget from within the applications dock.
Select the Tasker widget called Task Timer.
Choose your “StopMusic” Task.
Verify all looks well and hit the system Back button to save and complete.
As an added tweak, you may choose to resize the widget to 3×1, if you find that the text does not display properly.
Using your new music sleep timer
To put your sleep timer to work, tap on the icon portion of the widget, on the left hand side. This will open up the time selection tool. Set your desired time and tap OK to start the countdown.
I suppose you’ve chosen just a few seconds at first, just to test things out. If all went well, go ahead and pump it up to half hour or an hour or more, fire up your tunes and head on to bed.
Wake to music in the morning
As I hope you gathered, the process to create an alarm clock is almost exactly the same as your sleep timer.
Create your new Task, named appropriately, perhaps “StartMusic” will do.
This time out, in your media control choose Play [Simulated Only].
It will again need an icon and you will again want to test it out before continuing. This time out, there is a Toggle Pause option that may also work on your device.
With the Task created and tested, follow the same instructions as above to place the Task Timer widget for your alarm clock. Once created, simply choose your amount of time and tap OK to be awoken by your own music come morning.
You have a bunch of options available to you on this project. You may, perhaps, have a very regimented schedule, in which case you could skip the widget and simply create Tasker Profiles that will stop music at an appropriate time each night and fire up the tunes every morning, without having to bother with the widget.
You should find that once you’ve used the timer once, instead of tapping the icon of the widget to re-select a countdown, you can simply tap the timed countdown numbers to restart the timer using the previous value.
Myself, I like have a visual confirmation of the action. In my Task, I’ve added Alert -> Flash -> “Music Stopped.”
Finally, and I apologize if you’ve made it this far without success, you’ll find that Tasker’s media controls are not very precise. I am working on an Android device with Google Play Music as my main music player, and I have a music widget set on my Homescreen. You should not need to have these yourself for the project to work, just be aware that Tasker is firing off generic start/stop media commands that may not work with your desired music player all that well.
Considering the commands are fairly generic, it is also very important to note that the StopMusic Task will stop all media. If you are watching a video on your device when your widget countdown reaches zero, expect that your video player will accept the stop media command and come to a halt.
If you absolutely do not like how this project works, Tasker has the ability to select and play local media files. If you have a single song or folder of songs on your device that you would like to wake to each and every day, you’ll want to use the Media -> Music Play or Music Play Dir options. Just be sure to also have a Tasker built StopMusic tool, or it’ll just keep playing.
Next Thursday will be Thanksgiving day in the United States, and that means that Christmas is only a short time after that. But just how many days is it exactly until Christmas? Wouldn’t you know it, we’ll use next week’s Android Customization post to create a Christmas countdown for you.
Since most of you will have the day off, we’ll make this a crazy one. We’ll make it a voice activated project that does some hard core variable manipulation to reach our goal. I’ll explain the process as we go, for those that wish to use these tools for other projects. At the same time, I’ll make it easy to just follow along, so you can be up and running with your own ‘days to Christmas’ reminder in no time. For those that do not celebrate Christmas exactly, don’t worry, you can use this project to count down to any day that you desire.
I hope you find a use for the Task Timer through Tasker. Using this tool to play music as an alarm clock, and stop music as a sleep timer, are fairly simple implementations, what great uses have you come up with?