Categories
Entertainment Featured Hacks Mac Music Productivity

Applescript: Fade iTunes to Selected Track

Ever playing music for other people from iTunes? And want to change the song without everyone noticing? Trying to do a manual fade is tough. This script lets you select the next song you want to play, and then fade the volume out and in to that track. Download: itunes-fade-to-selected-track.zip


property initialVolume : null
tell application "iTunes"
set speed to 5 -- lower means slower fade
if sound volume = 0 then -- if volume is all the way down, fade in
play
set initialVolume to 60
repeat until (sound volume) is greater than or equal to (initialVolume - speed)
set sound volume to (sound volume + speed)
end repeat
set sound volume to initialVolume
else -- fade out, skip to selected track, fade in
set initialVolume to (get sound volume)
repeat until (sound volume - speed) is less than or equal to 0
set sound volume to (sound volume - speed)
end repeat
set sound volume to 0
play selection
repeat until (sound volume + speed) is greater than or equal to initialVolume
set sound volume to (sound volume + speed)
end repeat
end if
end tell