set volume output volume 100 -- system volume
property p : "Recent" -- name of playlist to play
property t : 100 -- number of seconds to get to final volume
property v : 50 -- final volume
tell application "iTunes"
set sound volume to 0
set shuffle of playlist p to true
play playlist p
set view of front browser window to playlist p
repeat while ((sound volume) is less than v)
set sound volume to (sound volume + 2)
delay ((t / v) * 2)
end repeat
end tell
Based on comments on this macosxhint (checking for the presence of a BlueTooth phone is a great idea) and Doug Adam's hints.