View RSS Feed

The Ill-Tempered Audiophool

Controlling Audirvana in Stand-Alone Mode with iTunes and

Rating: 2 votes, 3.00 average.
I had been using Audirvana in iTunes-integrated mode since it became available, but have now returned to using it in stand-alone mode because the integrated mode is incompatible with Dirac room-correction software.

In the time that I have been using Audirvana in integrated mode, the plug-in that I hacked together (with considerable help from Bob Stern) stopped working; it is incompatible with the latest iTunes and/or OS, and I haven't been able to fix it.

I found a much simpler work-around, but it costs $5: EventScripts. I've described it in the blog-posting below subtitled "EventScripts and its companion free iOS app."

For our purposes, we need just one of its features, the ability to run an Applescript or shell script each time iTunes starts to play a track (which is the same thing my plug-in did in a very hackish clunky manner.) So if you are willing to suck it up and pay the EventScript $5, you can do this. It also gives you a whole lot of other highly useful functionality, like being able to re-map all the Apple physical IR remote commands, direct them to a single program (like Audirvana), and the ability to run any shell script or AppleScript from the comfort of you iOS device. In other words, you get your $5 worth. (This is beginning to sound like an advertisement, so I should note I have no affiliation. It actually irks me to pay money for something I used to be able to do myself for free, so this is more like post hoc self-justification.)

Here is how I am doing it.

1. Purchase and install EventScripts: $5.

Eventscripts creates a directory within the user's own Library directory (aka folder), called ~/Library/Application\ Scripts/net.mousedown.EventScripts Don't worry, you can open that directory from the EventScripts icon that appears in the menu bar. Simply place whatever shell script or AppleScript you want to use with it in that directory, and then attach it to a command within the EventScripts interface. (We will get back to this, with more explicit directions, in step 3.)

2. Make an AppleScript to load selected albums or tracks into Audirvana

In collaboration with Bob Stern, I've made two AppleScripts corresponding to two different ways to use the interface, depending on a user's preferences. The second option actually does everything, so you might simply prefer it. However, the first option, which is limited to loading a single album at a time, is my default preference, as it is significantly faster and matches my listening habits (I like to listen to one complete album, and then take a break -- I have a very short ADHD attention span.) Anyway, pick one of these first two, or write your own or modify one of these.

As an alternative to cutting and pasting, here are the AppleScripts I am using to control Audirvana:

2a. Load an Album into Audirvana and play it.

Cut and paste the following into an AppleScript editor and save it to the ~/Library/Application\ Scripts/net.mousedown.EventScripts directory:

-- Script to hand off playing Albums in iTunes to Audirvana Plus. 
-- Conditional test to prevent handing over non-music files.
-- Assumes you have bound command-k to "Delete" menu item
-- William Scott, January 30, 2014
-- Works with for automated functionality

tell application "iTunes"
	set iTunesFileKind to kind of the current track
	if "audio file" is in iTunesFileKind then -- do this only if it is an audio file, not a movie etc.
		pause -- Now that we have the info, stop playing iTunes and use Audirvana
		set filePath to location of current track
		set theTune to POSIX path of filePath
		set shellCommand to "dirname " & "\"" & theTune & "\""
		set dirPath to do shell script shellCommand
		tell application "Audirvana Plus"
			activate -- here we use Audirvana Plus rather than iTunes to play the album after clearing the playlist
			tell application "System Events" to keystroke "a" using command down
			tell application "System Events" to keystroke "k" using command down
			delay 1
			open dirPath
		end tell
		stop -- stops iTunes playback and clears it.	
	end if
end tell -- app iTunes
I've commented the script so you can probably figure out what each line does. The keystroke command-a and command-k deletes the previously-added items in the Audirvana current playlist window. For this to work, you have to do two things. These are described in part 2c.

2b. Load selected tracks into Audirvana and play them.

Cut and paste the following into an AppleScript editor and save it to the ~/Library/Application\ Scripts/net.mousedown.EventScripts directory:

tell application "iTunes"
	set trackName to name of current track
	set CurrentAlbum to album of current track
    pause -- Now that we have the info, stop playing iTunes and use Audirvana
	set filePath to location of current track
end tell

-- here we use Audirvana rather than iTunes to play the track
set theTune to POSIX path of filePath
tell application "Audirvana Plus" 
    open theTune
end tell

tell application "iTunes"
	next track
	if  (trackName is name of current track) then
	    set x to 1
	    set x to 0
	end if
end tell

if x = 1 then
    tell application "System Events"
         set visible of process "iTunes" to false
         set visible of process "Finder" to false
    end tell
    return -- prevents endless repeat of the last song on the playlist
end if
2c. A few tweaks to make this work properly.

1. Turn on Accessibility (formerly Enable Assistive Devices) so that the AppleScripts will work.

2. Bind the Command-k to "Delete" menu item in Audirvana Plus. You can do this in the "System Preferences > Keyboard" preferences pane, under the "shortcuts" tab. Here is a picture:


3. Attach the AppleScript to EventScripts via the interface.

For details, see the EventScripts documentation. However, this is fairly self-evident:



Updated 03-07-2014 at 12:43 PM by wgscott

Personal Blogs , computer


  1. Carl Mawer's Avatar
    I had a go at using events scripts to load an album and play it into Audirvana in stand alone mode.
    It worked fine using Remote on my ipad to select an album.(I used the event iTunes track changed from the menu attached to the script PlayAlbuminAudirvana)
    It did not clear the album from the Audirvana playlist box when it finished playing. I didn't manage to follow the instructions re command k etc. (the screenshots are not readable when enlarged).Can you please help?
    Ideally I would like the script to clear the existing tracks out of Audirvana automatically when I select a new album rather than add the tracks to those already in the Audirvana playlist. This is so that I can change albums when my wife insists that she doesn't like what I am listening to. Is this possible or do I need to get a new wife?

    Thanks for your great work. Just what I was looking for while Damien works on 2.0 .
    Carl Mawer (
  2. Carl Mawer's Avatar
    Please disregard the previous Comment.
    This Dufus has found that by clicking on the screenshots, rather than zooming, they are easily readable.
    I copied the ClearAudirvana script into the PlayAlbuminAudirvana script immediately after the command, pause. When I select a new album using Remote on my iPad, the previous album is deleted and the new album loads into Audirvana and begins playing.
    Who needs 2.0?

    Regards Carl