MPD Alarm Clock
#!/bin/bash | |
# Volume to start with | |
mpc_volume=$1 | |
# Fade-in time in seconds | |
fade_in_time=$2 | |
# Alarm Clock playlist | |
playlist="$3" | |
function get_mpc_volume() { | |
mpc_volume="$(mpc volume)" | |
mpc_volume="${mpc_volume##volume:}" | |
mpc_volume="${mpc_volume%%%}" | |
echo "${mpc_volume}" | |
} | |
mpc -q volume $mpc_volume | |
mpc -q clear | |
mpc -q load "$playlist" | |
mpc -q shuffle | |
mpc -q play | |
# Increase volume gradually every second | |
while [[ $mpc_volume -lt 100 ]]; do | |
(( mpc_volume = $(get_mpc_volume) )) | |
(( fade_in_time -= 1 )) | |
(( volume_inc_step = (100 - $mpc_volume) / $fade_in_time )) | |
mpc -q volume "+${volume_inc_step}" | |
sleep 1 | |
done |
This comment has been minimized.
This comment has been minimized.
See what happens when we set the same volume with
Decibels magic. :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
A Cron job example: