5

Even in iTunes 11, there is no fade out when pausing playback or fade in when starting playback. How can I achieve this?

3 Answers 3

7

If you are using macOS, you can create a new Service with Automator, add a Run AppleScript action to it, and enter the following script:

set current_application to (path to frontmost application as Unicode text)
tell application "System Events"
    if process "iTunes" exists then
        tell application "iTunes"
            set current_volume to the sound volume
            if (player state is playing) then
                repeat
                    repeat with i from current_volume to 0 by -1
                        set the sound volume to i
                        delay 0.01
                    end repeat
                    pause
                    set the sound volume to current_volume
                    exit repeat
                end repeat
            else
                set the sound volume to 0
                play
                repeat with j from 0 to current_volume by 1
                    set the sound volume to j
                end repeat
            end if
        end tell
        tell application current_application
            activate
        end tell
    end if
end tell

You can assign a keyboard shortcut to it in System Preferences > Keyboard > Keyboard Shortcuts > Services.

1
  • This works perfectly and it should be marked as the solution. Thank you, I love it.
    – Elliott
    Feb 10, 2014 at 18:44
1

For Mac OS X v10.5 or later (Intel 32/64 bits), you can use this script, Im using this for fade out/in music when I pause or play my music, or skipping songs, its great and works fine with the built in crossfade from playback menu.its great for party play list and works just fine with the latest version of itunes (12.1.2) http://www.wildbits.com/accubeatmix/

1
  • 2
    Hi Kamran, welcome to Ask Different.If possible, add the script here for reference. Links tend to get stale. Jun 24, 2015 at 23:25
0

The script above faded out too fast for my taste so I modified it slightly (the 3 modified/added lines are in uppercase - is it possible to highlight text in a code section with e.g., bold? - just change them to lower case if you use it). My version fades out in 4 seconds, just change that digit to something else if you prefer.

set current_application to (path to frontmost application as Unicode text)
tell application "System Events"
    if process "iTunes" exists then
        tell application "iTunes"
            set current_volume to the sound volume
            SET DEL TO 4 / CURRENT_VOLUME
            if (player state is playing) then
                repeat
                    repeat with i from current_volume to 0 by -1
                        set the sound volume to i
                        DELAY DEL
                    end repeat
                    pause
                    set the sound volume to current_volume
                    exit repeat
                end repeat
            else
                set the sound volume to 0
                play
                repeat with j from 0 to current_volume by 1
                    set the sound volume to j
                    DELAY DEL
                end repeat
            end if
        end tell
        tell application current_application
            activate
        end tell
    end if
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .