Using iTunes with more specialized music players

Apr 15, '11 07:30:00AM

Contributed by: wgscott

iTunes can play 'bit-perfect' music losslessly, but only if you do several things. The internal volume control must be set to the max, all digital signal processing, including equalizers, must be turned off, and the sample rate of the track you want to play must be set properly in Audio MIDI Setup before you open iTunes, which means if there is a sample mismatch, you either have to close iTunes, reset Audio MIDI Setup to the desired value, and then restart iTunes.

For example, if you have a CD, you can rip it to Apple Lossless files. These have a bit-depth of 16 bits and a sampling frequency of 44.1 kHz. If you purchase and down-load higher-definition music, perhaps 24-bit, 96kHz sampled lossless FLAC files, you can convert them to Apple Lossless without degrading the content (XLD is one such free software option). Now let's say you want to play the two sets of tracks sequentially. If you start iTunes playing the ripped CD and Audio MIDI Setup is set to 44.1 kHz sampling, the ripped CD can be played without degrading the content, but when iTunes reaches the 96kHz music, CoreAudio will down-sample it to 44.1 kHz, thus negating any benefit of having the higher sampling frequency.

Obviously, stopping iTunes, manually changing Audio MIDI Setup, and restarting iTunes quickly becomes a drag, so I came up with a hack that lets you avoid this problem. It involves using iTunes as a music browser that then hands over the task of playing the music to a more specialized player application that deals with the above-mentioned complications seamlessly and automatically. There is commercial software you can pay nearly a thousand dollars for to do this. The following hack enables you to do this at no cost.

The first thing you need to do is obtain and install the open-source, free player Audirvana from GoogleCode. Make sure 'Exclusive Access' mode is set in the Preferences.

You can drag and drop a succession of playlists or albums of different sampling frequencies from iTunes into the Audirvana playlist window and then hit the play button, and Audirvana will play all the music with bit-perfection, changing Audio MIDI Setup to match each track on the fly.

However, the following allows you to completely automate the process, eliminating the need to drag and drop the music from iTunes into the playlist window. It has the added advantage of permitting you to do this using Apple's from your iPad, iPod, iPhone, etc., something Audirvana on its own cannot (yet) do.

To automate the handoff process:

What are these components?

In there are a set of shell scripts that have embedded osascript (AppleScript) directives. The one called nyquist_audirvana.zsh is for Audirvana, and the one called nyquist_decibel.zsh is for Decibel. The one called null.zsh doesn't do anything. The distributed AppleScript enables you to select from these three options.

In Itunes Plug-ins, there is a hacked version of the visualizer plug-in example that comes as an optional SDK for Xcode. iTunes runs these things whether or not you display them. Since I can't code my way out of a wet paper bag, it has one line in it that invokes the shell scripts from etc.

The script in allows you to choose to use iTunes with Audirvana, to use iTunes with Decibel, or to use iTunes by itself (or however else you normally happen to use iTunes).

[crarko adds: I haven't tested this one. I looked over the contents of the disk image and have mirrored it here.]

Comments (4)

Mac OS X Hints