Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: speaking alarm clock

  1. #11
    Join Date
    May 2008
    Beans
    12
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: speaking alarm clock

    Quote Originally Posted by skiwithpete View Post
    RSS link to weather.com

    http://rss.weather.com/weather/rss/l...ss&par=LWO_rss

    I just can't figure out how to switch from English to Metric... Hope someone can help.
    Quick word of advice: write a short function that takes English measurements and spits out Metric. Weather.com does not seem to support metric fully and as such the conversions need to happen on your end. If you're using python, the 're' package is your friend.

  2. #12
    Join Date
    Aug 2007
    Beans
    92
    Distro
    Ubuntu

    Re: speaking alarm clock

    Am trying to find my old code, but I think you're already well past where I got to.

    Some notes:
    - I found the email I'd received from Accuweather (as I'd like it to be able to work for the world not just USA), though the people of Accuweather had several conditions, including displaying the logo and having a click to forecasts... I guess there is no world, standard, free weather service... at least not that I've found.
    - I was using wget and festival as well, though never made a parsing script.


    Features I'd like to request
    1) Metric
    2) London, UK included

    Thanks dude, and stay in touch (have PMed you),
    P

  3. #13
    Join Date
    Sep 2007
    Beans
    27
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: speaking alarm clock

    i'm going to be looking into this as well later tonight, seems like a really cool idea.

  4. #14
    Join Date
    Aug 2007
    Beans
    92
    Distro
    Ubuntu

    Re: speaking alarm clock

    Quote Originally Posted by whiterabbit7500 View Post
    i'm going to be looking into this as well later tonight, seems like a really cool idea.
    Can I make a suggestion? if (IF) you're going to make separate versions, I think you should make an extensible version.

    Start with a basic alarm clock, and then add "plugins" to it for the various commands, including weather, news, etc. ...even a screen with custom information.

    Also, have found a link and am going to try to learn python. Advice welcome.
    Last edited by skiwithpete; March 18th, 2009 at 03:03 AM.

  5. #15
    Join Date
    May 2008
    Beans
    12
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: speaking alarm clock

    python is my language of choice and as such pretty much anything i'll do will be in python (i've done the majority of my full application programming in Java, but i'm now trying to go python as i like it more) so i would reccommend strongly learning python, it is really powerful and succint as far as programming languages go.

    I will look further into the "base app + plugin" idea.

    Right now i haven't actually written the "alarm" part, i'm just getting all the things i will want read back to me WHEN it is run. I'm not exactly sure how I would do a base app and plugins, as i've not really done this level of interfaces before (most of my stuff is just for personal use only and as such I usually end up leaving it with command line only access) but I will try to figure out the best way to do that. I found a way to get London, UK weather on weather.com:

    http://www.weather.com/outlook/trave...ative/UKXX0085

    what i'm working on currently is taking in those strings and turning "45F" into 45 degrees fahrenheit OR xx degrees celcius. Once i get that, it should pretty easy to get UK weather and turn it into celcius by a few settings.

  6. #16
    Join Date
    Aug 2007
    Beans
    92
    Distro
    Ubuntu

    Re: speaking alarm clock

    In terms of the alarm (or setting it to run at particular times) I understood that cron was the way to go.

    http://en.wikipedia.org/wiki/Cron

    Again, I know very little about this, and I may be stating the obvious, but thought I'd say it anyways.

    Mini - I'd still love for you to send me the source at the moment, just so I could learn from it. I learnt HTML from looking at page sources, so I reckon if I have a look at what you're doing in python it will help me to understand how it works.

    Cheers,

    P

  7. #17
    Join Date
    Aug 2007
    Beans
    92
    Distro
    Ubuntu

    Re: speaking alarm clock

    Minivitale,

    I really wish you'd send me the current source so I could help you build this thing. At the moment I'm just waiting for it...

    Trying to learn Python in silly examples from the inet just isn't as useful as seeing what you've written.

    Let me know,

    P

  8. #18
    Join Date
    Oct 2008
    Beans
    13

    Arrow Re: speaking alarm clock

    Quote Originally Posted by skiwithpete View Post
    http://rss.weather.com/weather/rss/local/UKXX0085
    is sufficient


    Quote Originally Posted by minivitale View Post
    find the feed closest to you:
    http://www.weather.com/weather/rss/subscription
    Last edited by An85Zk9tc8rfjV8i; April 26th, 2009 at 08:40 PM.

  9. #19
    Join Date
    May 2010
    Beans
    2

    Re: speaking alarm clock

    This is what I have managed to complete so far putting an alarm clock together. It plays mp3, Uses festival as a text to speech engine. It reads time correctly, and weather based off of weather station near you. It pulls weather info via weather-util from http://weather.noaa.gov/ and then just choose your location for ID. Also Gradually increases volume. Uses two files alarm1 in home directory, and wakeup-volume in /usr/local/bin

    code for Alarm #
    #!/bin/bash

    sleep 3

    PLAYER=/usr/bin/mplayer
    SONG="$HOME/alarms/alarm.mp3"
    killall wakeup-volume
    /usr/local/bin/wakeup-volume&
    $PLAYER -loop 1 "$SONG"
    sleep 5
    echo "Good Morning, I hope you slept good and I hope you have a great day" | festival --tts

    echo "The time is $HR $MIN" | festival --tts


    # Used by Glenn Weber <bngweber@gmail.com>
    # Created by Ernest N. Wilcox Jr.
    # I can be contacted at <ewilcox@bex.net>

    # This script is released under the GPL v 2 as is.
    # I accept no liability if you choose to use it.
    # If you choose to improve my script, and make
    # your changes public, you must do the following:
    # 1. include my comments.
    # 2. identify yourself,
    # 3. note your changes under these comments.
    # 4. provide contact information

    # Set up a variable to hold the current minute
    # of the hour using the date command:
    MIN=$(date +"%M")

    # And another to hold the current Hour:
    HR=$(date +"%l")

    # Use a case statement to change the minute
    # number to the equivalent word, but make the
    # zero minute "o'clock". Handle all sixty minutes
    # of the hour so this works correctly for any time.

    case $MIN in
    "00") MIN="o'clock";;
    "01") MIN="Oh - one";;
    "02") MIN="Oh - two";;
    "03") MIN="Oh - three";;
    "04") MIN="Oh - four";;
    "05") MIN="Oh - five";;
    "06") MIN="Oh - six";;
    "07") MIN="Oh - seven";;
    "08") MIN="Oh - eight";;
    "09") MIN="Oh - nine";;
    "10") MIN="ten";;
    "11") MIN="eleven";;
    "12") MIN="twelve";;
    "13") MIN="thirteen";;
    "14") MIN="fourteen";;
    "15") MIN="fifteen";;
    "16") MIN="sixteen";;
    "17") MIN="seventeen";;
    "18") MIN="eighteen";;
    "19") MIN="nineteen";;
    "20") MIN="twenty";;
    "21") MIN="twenty one";;
    "22") MIN="twenty two";;
    "23") MIN="twenty three";;
    "24") MIN="twenty four";;
    "25") MIN="twenty five";;
    "26") MIN="twenty six";;
    "27") MIN="twenty seven";;
    "28") MIN="twenty eight";;
    "29") MIN="twenty nine";;
    "30") MIN="thirty";;
    "31") MIN="thirty one";;
    "32") MIN="thirty two";;
    "33") MIN="thirty three";;
    "34") MIN="thirty four";;
    "35") MIN="thirty five";;
    "36") MIN="thirty six";;
    "37") MIN="thirty seven";;
    "38") MIN="thirty eight";;
    "39") MIN="thirty nine";;
    "40") MIN="forty";;
    "41") MIN="forty one";;
    "42") MIN="forty two";;
    "43") MIN="forty three";;
    "44") MIN="forty four";;
    "45") MIN="forty five";;
    "46") MIN="forty six";;
    "47") MIN="forty seven";;
    "48") MIN="forty eight";;
    "49") MIN="forty nine";;
    "50") MIN="fifty";;
    "51") MIN="fifty one";;
    "52") MIN="fifty two";;
    "53") MIN="fifty three";;
    "54") MIN="fifty four";;
    "55") MIN="fifty five";;
    "56") MIN="fifty six";;
    "57") MIN="fifty seven";;
    "58") MIN="fifty eight";;
    "59") MIN="fifty nine";;
    *) echo "error with minute $MIN" | festival --tts;;
    esac

    # Use another case statement to do the following:
    # Use the echo command to assemble the output
    # text for the current time statement, change the
    # number for the current hour to the equivalent
    # word, and pipe the result to festival.

    case $HR in
    " 1") echo $INTRO "one, $MIN" | festival --tts;;
    " 2") echo $INTRO "two, $MIN" | festival --tts;;
    " 3") echo $INTRO "three, $MIN" | festival --tts;;
    " 4") echo $INTRO "four, $MIN" | festival --tts;;
    " 5") echo $INTRO "five, $MIN" | festival --tts;;
    " 6") echo $INTRO "six, $MIN" | festival --tts;;
    " 7") echo $INTRO "seven, $MIN" | festival --tts;;
    " 8") echo $INTRO "eight, $MIN" | festival --tts;;
    " 9") echo $INTRO "nine, $MIN" | festival --tts;;
    "10") echo $INTRO "ten, $MIN" | festival --tts;;
    "11") echo $INTRO "eleven, $MIN" | festival --tts;;
    "12") echo $INTRO "twelve, $MIN" | festival --tts;;
    *) echo "error with hour $HR and minute $MIN" | festival --tts;;
    esac


    sleep 1

    echo "The current temperature is " | festival --tts
    weather-util -i KUZA | grep Temperature | cut -c16-19 | festival --tts;
    echo "degrees outside and" | festival --tts
    weather-util -i KUZA | grep Sky | cut -c19-35 | festival --tts;
    sleep 2
    echo "why don't you enjoy some more music" | festival --tts
    sleep 5

    PLAYER=/usr/bin/mplayer
    SONG="$HOME/alarms/alarm2.mp3"
    killall wakeup-volume
    /usr/local/bin/wakeup-volume&
    $PLAYER -loop 1 "$SONG"

    sleep 3

    exit


    code for wakeup-volume #

    #!/bin/bash


    for ((i = 35; i <= 100; i++)) do
    /usr/bin/amixer sset Master playback $i%
    sleep .5
    done
    Last edited by bngweber@gmail.com; May 5th, 2010 at 05:38 AM.

  10. #20
    Join Date
    Oct 2010
    Location
    Iowa
    Beans
    43
    Distro
    Ubuntu

    Smile Re: speaking alarm clock

    awesome. Thank you for posting this script.

    In addition, Ubuntu has an Alarm Clock app (or two) in its software center that can trigger scripts (in case you do not want to fiddle wwith crontab to trigger this).

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •