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:

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
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

Applescript to Remove Artist Names from Track Names

I just realized I never posted this online. I did this a couple months ago, and have been using it frequently (because I’m a chronic music pirate).

I occasionally get a bunch of tracks in iTunes that have the Artist Name in the Track Name as well. For example:


…and it’s just a pain to go through and remove all the artist names from each track title… the task is a prime candidate for automation.

Usage: Select songs in iTunes (it will skip songs that don’t have the artist name in the track name), Run the applescript (I use QuickSilver for this). Result:


So, here’s my applescript: (download)

tell application "iTunes"
set these_tracks to the selection
if these_tracks is null then display dialog "No tracks are selected."
repeat with i from 1 to the count of these_tracks
set thisTrack to (item i of these_tracks)
set originalName to the name of thisTrack
set theArtist to the artist of thisTrack
if originalName contains " - " then
if originalName contains theArtist then
set newName to characters ((count of characters of theArtist) + 4) thru end of originalName as string
if (characters 1 thru ((count of characters of theArtist) + 4) of originalName as string) contains theArtist & " - " then set the name of the thisTrack to newName
end if
end if
end repeat
end tell

From the top of a Redwood

From the top of a Redwood, originally uploaded by Rex Pechler.

I’m on top of a funky tree in the meadow below the UCSC Music Center…

I took this with the Camera PRO iPhone app, which allows you to take
photos with a self-timer. I clipped my phone to a high branch to get
the shot.

I’m actually not too happy with this self-portrait, but Camera PRO
only let’s you use the self-timer 5 times before forcing you to pay
$20. In fact, I tried to purchase the app, but the purchasing website
is very clumsy on the iPhone. And I’m still waiting for my activation