You are not logged in.
Hi there. I want to try and make my computer into a progressive wake up alarm clock of sorts. Im not sure how i would do this, but i want it to gradually make the screen brighter and brighter, a solid color, like yellow or white, and maybe play some gradually louder and louder mp3 file. Is there anyway at all that this would be possible? even just the screen part would be good, sorta like a timed screensaver. Any help would be greatly apreciated, thanks!
Offline
Do you want to write your own program or just use existing tools? I've personally used atd and crond to play mp3 files as an alarm. This could be extended by having them run a script that sets the initial volume, plays the mp3 in the background, and then makes periodic calls to amixer to set the volume in a for loop.
The screen display thing might be harder because of powersaving features that turn the monitor off; I'm not sure how you programmatically re-enable it. The easiest thing to do here, I think, is to have the same script that's running your mp3 player also run a program in the background that creates a maximized window that has the behaviour you describe. (I'd say about 20 lines of python code would do it.)
Dusty
Offline
Well if i could use existing tools that would be good, because im not really a programmer or anything. Altho 20 lines of code doesn't sound too hard... im pretty sure i can disable the auto off for the monitor tho. But even if I could just get a bright display pic up, maybe not a gradual thing (tho that'd be better i think) it would still be good.
Offline
I think you can do it using standard tools. I don't have time to draft it up in bash, but here's some pseudocode
pacman -S atd
man at
man cron
Those two programs can be used to run other programs at specific times or recurring intervals. Use at if you want to set your alarm each night, use cron if you want it to automatically go off at specific intervals.
Now you want to write a bash script. Call it gekoalarm or something. Save it someplace easy to remember. If you put it in /usr/bin, it'll be on the path, which is nice for passing it to at and cron. Give it execute permissions.
chmod a+x gekoalarm
Now, you can make this script do the things you want -- play the alarm sound and do the bright screen. Make it do it on a one time basis, and it will do it each time you test it. Use cron or at to make it recur.
Then create a directory of images. Each image should be a blank square that is the colour. Save them as geckoalarm1.png, gekoalarm2.png, etc, where 1 is black and 2 is white, or whatever colour you prefer. There should be one for each volume setting, or else modify the script. (Note, another way to do this is to use one image and experiment with the -b and -c options to qiv to show the image repeatedly at different brightnesses or contrasts, I'll leave this as an exercise) Another alternative is to use imagemagick.
the script should look somethnig like this -- my bash syntax may be a bit off, I'm not testing it, and I'm used to python. If I were you, I'd basically test it a few lines at a time, use echo $var strings to see what you're getting for the volumes and stuff.
volume=1
MAX_VOLUME=75 #don't blow your eardrums
amixer sset PCM ${volume}% #set the volume low first
mpg321 /path/to/your/mp3 & #you could do random stuff to select from a directory too
qiv /path/to/your/gecko/images/directory/geckoimage${volume}.png &
while [ $volume -lt MAX_VOLUME ] ; do
amixer sset PCM${volume}%
((volume=$volume+1))
killall qiv #to keep the windows from stacking up
qiv /path/to/your/gecko/images/directory/geckoimage${volume}.png &
sleep 1 # decide how long to sleep between volume increases
doneOffline
.
Last edited by benplaut (2021-06-25 12:35:17)
Offline
haha, for sure!
Dusty
Offline
you could utilise X's display power management support to stop it turning off. use:
xset dpms off
xset s off
should.... prevent any screen blanking. I remember a friend of mine used xsetroot in a script ages ago to go through colours on the root window. If you can make a bash script that goes through the hex values for the colours you could try that.
James
Offline
mpg321 /path/to/your/mp3 & #you could do random stuff to select from a directory too
That would be mpg123 instead of mpg321.
"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."
SETH / Jane Roberts
Offline
thanks for being so helpful guys! ok so heres my script so far :
volume=1
MAX_VOLUME=75 #don't blow your eardrums
amixer sset PCM ${volume}% #set the volume low first
mpg321 /home/colbster/media/music/Chicago.mp3 & #you could do random stuff to select from a directory too
qiv /home/colbster/alarm/geckoalarm${volume}.png &
while [ "$volume" -lt "$MAX_VOLUME" ] ; do
amixer sset PCM${volume}%
((volume=$volume+1))
killall qiv #to keep the windows from stacking up
qiv /home/colbster/alarm/geckoalarm${volume}.png &
sleep 10 # decide how long to sleep between volume increases
done and heres the output i get:
Simple mixer control 'PCM',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 3 [1%]
Front Right: Playback 3 [1%]
Specify what you want to set...
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.59q (2002/03/23). Written and copyrights by Joe Drew.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Title : Chicago Artist: Sufjan Stevens
Album : Illinois Year : 2005
Comment: HiGH iNTELLiGeNCE tRoLLS Genre : Folk
Directory: /home/colbster/media/music/
Playing MPEG stream from Chicago.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
/home/colbster/geckoalarm.sh: line 12: 6803 Terminated qiv /home/colbster/alarm/geckoalarm${volume}.png
Specify what you want to set...
Specify what you want to set...
Specify what you want to set...Offline
amixer sset PCM${volume}% You need a space there:
amixer sset PCM ${volume}% One advise, when you copy/paste bash scripts from the internet, try once to run it command by command.... you don't want a rm -rf hidden there somewhere... if you did this, you'd easily notice that something's wrong with that amixer command, and `man amixer` would've helped you.
Offline