maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Interval training App (https://talk.maemo.org/showthread.php?t=60726)

Janniman 2010-08-20 06:58

Interval training App
 
I would really like an app on my phone that can beep at me at different time intervals. For example I am using a training program at the moment where I do a n exercise for 50 seconds and then rest for 10 and move straight onto the next one. This is very difficult to time using a stop watch on the phone and I can always look away whilst donig the excersise. I want something that I can hear.
Does anyone know of an app that would be suitable?

Thanks guys.
Janni

Big Phat Jan 2010-08-20 09:24

Re: Interval training App
 
This is not the most user-friendly of suggestions, but for something simple like this you could just write a small shell script, e.g.

#!/bin/sh

while [ 1 ]
do
sleep 50
#your notification action goes here
dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_activat e string:'PatternChatAndEmail'
sleep 10
#your notification action goes here
dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_activat e string:'PatternChatAndEmail'
done

In this example the phone will vibrate. This might not be a great idea if you use it a lot! If you want a beep you'll have to find a sound sample of the beep first, then substitute the dbus-send lines for an action to play it.

If you want to use this, then save the above as for example interval.sh, making sure to remove the forum introduced space in "/mce/request com.nokia.mce.request.req_vibrator_pattern_activat e", then make it executable by running:

chmod a+x ./interval.sh

To start your training run the script. To end kill it (ctrl-c). If you want to run it from a desktop widget or something you can use the command:

killall interval.sh

to stop it instead.

Cheers,
Jan

spanner 2010-08-20 09:44

Re: Interval training App
 
If we're suggesting hacky solutions:

Record a 60-second clip of silence (using recorder), saying "beep" at 50 seconds & "boop" at 60 seconds. Then play the clip on repeat. :)

johnel 2010-08-20 09:45

Re: Interval training App
 
You could try and use the "alarmed" app with "espeak"?

"Alarmed" allows you to run any command at a specified time and then configure espeak to announce something?.

Janniman 2010-08-20 09:56

Re: Interval training App
 
oooh, I like the alarmed idea. I have small video clips of the excersise to do so could run these. This could be fun!!! Will have a play around. Never used alarmed before. Any tips?
Thanks guys!

Janniman 2010-08-20 10:02

Re: Interval training App
 
what command do I need to run a video file? or open an image?

jabawok 2010-08-23 01:55

Re: Interval training App
 
Big Fat Jan's solution is very elegant, but heres a simpler method. Paste this one-liner into xterm:
Code:

SOUNDFILE="/usr/share/sounds/game-chess_illegal_move.wav" ; while true ; do aplay $SOUNDFILE; sleep 50; aplay $SOUNDFILE; sleep 10 ; done
Obviously edit times etc as required.

Janniman 2010-08-25 12:50

Re: Interval training App
 
Jabawok - thanks very much but I couldnt get this to work, it said playing file, but no sound. didnt look like it was counting anythign either. Does this cycle round until you exit the xterm?

jabawok 2010-09-01 11:12

Re: Interval training App
 
Hrm, was your volume up?
Yes it loops till you close the xterm or hit ctrl+c.

You should see something like this:
Code:

BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ SOUNDFILE="/usr/share/sounds/game-chess_illegal_move.wav" ; while true ; do aplay $SOUNDFILE; sleep 50; aplay $SOUNDFILE; sleep 10 ; done
Playing WAVE '/usr/share/sounds/game-chess_illegal_move.wav' : Signed 16 bit Little Endian, Rate 11025 Hz, Mono
Playing WAVE '/usr/share/sounds/game-chess_illegal_move.wav' : Signed 16 bit Little Endian, Rate 11025 Hz, Mono
Playing WAVE '/usr/share/sounds/game-chess_illegal_move.wav' : Signed 16 bit Little Endian, Rate 11025 Hz, Mono

It plays the chess sound, then a 50 second pause then again and then a 10 second pause etc..

Janniman 2010-09-02 14:51

Re: Interval training App
 
it did the first bit, but not the second bit

Janniman 2010-09-03 12:07

Re: Interval training App
 
whoop! I got it to work!
can i change the sound so i have a different one for the 10 second to the 50 second? the sound wasnt very loud and I kept missing it and not knowing which one it was on! also any way of turning up the sound other than the volume button of course!

Janniman 2010-09-20 10:38

Re: Interval training App
 
Is there a way that I can save this script and call on it using a command? where should I store it and in what format? At the moment I've just got it saved as a text file and I copy and paste it we very morning!! there must be a n easier way!!!!
thanks

Dousan 2010-09-20 12:50

Re: Interval training App
 
I played a little with the script and i'm no dev so there might be an other way to do this ;)

I added a SOUND line after the first called SOUND1:

SOUNDFILE="/usr/share/sounds/game-chess_illegal_move.wav" ; SOUNDFILE1="/usr/share/sounds/ui-general_warning.wav" ; while true ; do aplay $SOUNDFILE; sleep 50; aplay $SOUNDFILE1; sleep 10 ; done

I suppose you could just change directory all together and play sounds from which ever directory you want to or just add the sounds in /usr/share/sounds for the ease of it.

Maybe just call them start.wav/mp3 and pause.wav/mp3 (less rewriting) ;)...

jabawok 2010-09-23 15:18

Re: Interval training App
 
if you want to save that shell script to a file for easy running, type this from a terminal:
Code:

cat - > interval.sh
then press enter, then type
Code:

#!/bin/sh
as the first line, then paste the above script in entirity, then press enter for a new line and press CTRL+D to end the file.

Now make it executable:
Code:

chmod u+x interval.sh
and now whenever you want to run it, type:
Code:

./interval.sh
that line starts with a dot and assumes you did all of the above in your home directory, which is the default working directory when you open a terminal.

Janniman 2011-03-02 11:32

Re: Interval training App
 
I have a 20 minute workout that includes interval training of varying times. I've typed the commands up in a text file, but when I try and paste the code into xterm it only pastes half of it. Is there a limit to the length of the command line? Can i chunk it into parts? Would it work better if I stored the command? would this mean I can use a longer command?

Janniman 2011-03-02 15:41

Re: Interval training App
 
also how do I do a > in terminal?
thanks


All times are GMT. The time now is 02:14.

vBulletin® Version 3.8.8