You are not logged in.

#1 2010-04-19 04:39:56

sironitomas
Member
From: Cordoba, Argentina
Registered: 2009-11-28
Posts: 174
Website

Alarm clock with MPD

Hi there. I'm currently using MPD to wake up with just these 2 commands

sleep 6h && mpc play

But i'd like to have some script able to turn up the volume progressively. The ideal parameters would be: [% of starting volume], [% of final volume] and [time step]. I'm relatively new to linux, so if someone can help scripting, I will be thankfull.

PS: I think MPC can be useful for make this script.

Offline

#2 2010-04-19 05:59:00

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Alarm clock with MPD

Just set your script to run mpc volume +10 repeatedly. For bash parameters google for that phrase, there's tons of information online.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-04-19 07:57:09

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: Alarm clock with MPD

Well, one possible way of achieving this would be a cronjob.

crontab -e

There you can give a time and a command. The command will be executed at the given time/interval.

30 7 * * * /usr/bin/mpc play

for example. You can also specify intervals:

35/5 7 * * * "command to increase volume"

would increase volume every 5 minutes, starting at 5 minutes after mpc play.

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#4 2010-04-19 14:35:49

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: Alarm clock with MPD

This is what I have been using to make sure I don't oversleep.  It works quite well:

#!/bin/bash
### Wake-Up Alarm ##############
# Version 0.1 by Scott Garrett #
# Wintervenom [(at)] gmail.com #
################################

# In case we are connected to an amplifier.
volume Master 20

# So our Last.fm account doesn't get filled with night-playlist entries.
killall mpcscribble

mpc clear
mpc load 01-Night
mpc next
mpc play


# Wait until the time specified by the user (in %H%M format) to wake up.
echo "Sleeping until $1."
until [ "`date +'%H%M'`" = "$1" ]; do
  sleep 2
done

# We can start scrobbling again.
mpcscribble &
mpc pause

# Crank the volumes past eleven!
volume Master unmute
volume Master 100
volume PCM unmute
volume PCM 100
volume Beep unmute
volume Beep 100

speak It is time to wake your ass up

# Guarenteed to wake the whole dorm wing up when connected to an amplifier.
# (Needs ALSA's PC speaker beep emulation.)
beep -f3200 -l200 -d30 -r50

volume Master 0
mpc clear
mpc load 99-Everything
mpc next
mpc play

# Gracefully increase the volume of our music after having the living demons
# waken within you.
for ((x=0; x<100; x++)); do
  volume Master $x
  sleep 0.1
done

Offline

#5 2010-04-19 16:29:19

sironitomas
Member
From: Cordoba, Argentina
Registered: 2009-11-28
Posts: 174
Website

Re: Alarm clock with MPD

Thanks Wintervenom, I was looking for something like that. I will make my own script based on yours, and I'll post it when it's finished. Regards!

Last edited by sironitomas (2010-04-19 16:29:46)

Offline

Board footer

Powered by FluxBB