Please have iTunes and kJams running before launching this script and have a playlist selected in iTunes.
The simple logic of the script assumes that if iTunes is playing and this script is run, you want to cross fade over to kJams..
Alternately, if iTunes is not playing a track, it assumes you want to cross fade over to iTunes. When you are ready to cross fade to kJams, make sure your next song is highlighted/selected. It will NOT automatically go to the next track in your kJams playlist.
Cut and paste this code into a new script in Script Editor (comes standard on OSX) and save to wherever you'd like. Make sure you change the file format to "Application" and uncheck the "Startup Screen" check box in the Save As dialog!
I'd recommend you just make an icon for this script on your dock and click on it.. It won't bring up any dialog.
Although I have tested this code, I make no guarantees with this code, use at your own risk!!
Dave, my upgrade license to kJams Pro will be coming through this week, thanks .
And this is my first attempt at Applescript, so don't laugh! Any fixes/cleanups are welcomed.. I'm a Python guy .
Code: Select all
-- Please have iTunes and kJams running before launching this script and
-- have a playlist selected in iTunes
-- The simple logic of the script assumes that if iTunes is playing and this script is run,
-- you want to cross fade over to kJams.. Alternately, if iTunes is not playing a track,
-- it assumes you want to cross fade over to iTunes.
-- when you are ready to cross fade to kJams, make sure your next song is
-- highlighted/selected. It will NOT automatically go to the next track in
-- your kJams playlist.
-- Although I have tested this code, I make no guarantees with this code,
-- any disasters that occur are not my fault. Use at your own risk!!
tell application "kJams Pro" to set kSpeakers to 0
--sets how much in percentage the volume is decreased per step
set fadeStep to 5
--sets how long in seconds between each step in the fade
set fadeDelay to 0.1
set kScriptCommand_PLAY_PAUSE to 1
set kScriptCommand_STOP to 2
--this is the max volume settings.. iTunes and kJams must share this for proper mixing.. Change to whatever you like.
set MaxVolume to 80
--this is the minimum volume setting
set MinVolume to 0
tell application "iTunes"
if (player state is playing) then
set kJamsVolume to MinVolume
set iTunesVolume to MaxVolume
set the sound volume to MaxVolume
tell application "kJams Pro" to set volume kSpeakers level MinVolume
tell application "kJams Pro" to docommand kScriptCommand_PLAY_PAUSE
repeat until iTunesVolume ≤ 0
set iTunesVolume to (iTunesVolume - fadeStep)
set kJamsVolume to (kJamsVolume + fadeStep)
tell application "iTunes" to set the sound volume to iTunesVolume
tell application "kJams Pro" to set volume kSpeakers level kJamsVolume
delay fadeDelay
end repeat
tell application "iTunes" to pause
else
set iTunesVolume to MinVolume
set kJamsVolume to MaxVolume
tell application "kJams Pro" to set volume kSpeakers level MaxVolume
tell application "iTunes" to set the sound volume to MinVolume
tell application "iTunes" to play
repeat until kJamsVolume ≤ 0
set iTunesVolume to (iTunesVolume + fadeStep)
set kJamsVolume to (kJamsVolume - fadeStep)
tell application "iTunes" to set the sound volume to iTunesVolume
tell application "kJams Pro" to set volume kSpeakers level kJamsVolume
delay fadeDelay
end repeat
tell application "kJams Pro" to docommand kScriptCommand_STOP
end if
end tell