# Volume Fade Out Sleep Timer

I usually take a nap Sunday afternoons, and I like to hear some streaming radio during that time. I wanted something that would fade the volume down to 0 after a certain period of time (say half hour). I decided to give it a shot myself. It’s Tcl and Snack to the rescue! After twiddling with the Snack API for 5 mins, here is the code:

package require snackset line [lindex [snack::mixer lines] 0]snack::mixer volume $line v1 v2set totalTime 1800; # half hourset delay [expr$totalTime*10]for {set v 100} {$v>=0} {incr v -1} { set v1$v  set v2 $v puts "[clock format [clock seconds] -format "%T" ] -$v"  after \$delay}

It worked out well. And for the record, after I woke up, I googled to check if there is something out there that will do the same thing. There were many utilities, but the one stood out was this, based on something called AutoHotKey. I ‘ve never heard of that before, but sounds very impressive.