The Linear Canvas
This journal is about the wrongs and rights of the world, as I see them.

The Linear Canvas

Music Distribution for Apple TV’s; How To Operate a Full-Time iTunes Server

October 1st, 2011 . by Alexander Fisher

Apple-TV-remoteI bought an Apple TV network device a few months ago. There are many of these network appliances out there that act as an interface between your television, the internet, and your home computer. They will play music and video usually from any network source they are connected to. Looking at the other network devices available made me realize some of them had more content providers available on them than the Apple TV, and there is always that exclusive Apple country club tax involved when buying an Apple product. But still I knew I had to have the Apple device and the under $100 I paid for the latest version Apple TV seemed almost like a bargain.

Most new TV’s and nearly everything else anymore, contain some kind of web app for anything from Netflix to Pandora. My 2006 Hitachi plasma TV doesn’t include any internet connectivity. But you’ll never get me to replace my plasma for lack of network apps. There’s no need for that currently anyway, as my Apple TV adds that same connectivity, within the Apple world, which is both good and bad.

I purchased the Apple TV for a couple of reasons, but the reason I bought the Apple instead of another network device, was my reliance already on iTunes for my music. I bought a 20GB iPod in 2004 and have been using Apple music products when I could ever since. I also have an iPhone. But I still use a PC. I am too deeply invested in PC software to change to a Mac now. But I have a lot of reverence for any product with the Apple name on it. My next computer could be an Apple, now that they have some PC compatibility.

The Past

I had been using a Universal Plug and Play (UPnP) audio device on my network, so this wasn’t a stretch by any means to convert to the Apple TV. That Netgear MP101 device was actually able to read an iTunes folder on a computer to play my iTunes music only.

I use a program called GoodSync to duplicate my iTunes folder on the music server from my computer. I could manually update the files, but that would be too tedious. The Netgear device didn’t care that iTunes was not actually installed on the server, as long as the folders were arranged as when it is present. This way I didn’t have to have my personal computer on to play music. I could just use any old computer on the network to serve my iTunes folders to my stereo upstairs. That was easy enough.

This Netgear music player did a very good job of serving music around the S/PDIF digital audio network I have constructed around the house. I was converting the analog output of the Netgear into optical S/PDIF. Now I split and amplify the Apple TV‘s optical audio output to connect to my system. I then split and amplify the optical signals again to make four outputs, finally converting each optical S/PDIF to 75Ω coaxial S/PDIF. I feel comfortable running each RG6 digital audio cable around forty feet to any digital audio device that supports coaxial S/PDIF. Any further than that and the signal loss could be a problem.

The Future

The “mock” iTunes folder structure that worked well on my Netgear device was not going to work on my newest project. To begin offering a real iTunes device with Home Sharing over the network that the Apple TV requires, I first had to upgrade the computer to one running at the very minimum, Microsoft Windows XP Home, as my server. Any operating system that will run iTunes will work. My preference running Microsoft XP Professional on the server, allows me to communicate with the computer over my network using Microsoft Remote Desktop. I use Microsoft Vista Ultimate on my main computer and I am able to work on the music server’s XP desktop when needed. There are other desktop control programs out there, but if you have XP Pro it’s already installed and works very well. Some other Windows versions offer the Remote Desktop server like XP Pro. Clients can be nearly any Windows computer via a downloadable application from Microsoft. When there is any problem with my music server, I am able to fix it quickly from another computer. That also allows me to store the server physically any place I want and still access it through the network when I need to.

The Apple TV uses a feature called Home Sharing to communicate with an iTunes installation on a personal computer running iTunes. “Running” is an important part of this process as iTunes cannot be run in the background and there is no standalone iTunes server process available that I am aware of. Home Sharing is necessary and has to be selected in the iTunes preference setup. Any computer running, with iTunes loaded and Home Sharing on will show up in the menu system of the Apple TV. Most will also show up in other iTunes installations in the AirPlay menu, if it is enabled.

That was easy. Taking my iTunes content from my computer and moving those files and running the iTunes music server, on a different computer, was the trickier part.

Location, Location, Location

An iTunes installation on one computer can use the configuration and content files created on another. Whatever playlists and history you build on one computer in iTunes can be immediately transferred and put to use on another computer. Those files are the actual music files and the configuration files that contain the location of the music and any playlists or information about those files.

Each iTunes installation expects to find its files in a certain place so it can run properly. It will not find any file that is not where its data says it was found before. The iTunes program preferences can be changed for where it expects to find the music files. But the configuration files may not be in the same place on two different computers. Regardless, it will expect to find the files in the same place it always has found them. Be careful to know where the configuration files are supposed to be for that iTunes installation. If the files are in the correct locations, the iTunes installation will work normally, no matter where they came from. As long as the content is in the exact location mentioned in the iTunes preferences, in a duplicate folder tree, iTunes will find the music or video and play it.

In Windows most iTunes program content folders, will be located at:

C:\Users\your user name\Music\iTunes
(contains the iTunes configuration files)

C:\Users\your user name \Music \iTunes Media
(contains music and video files)

Those locations may vary depending on which operating system you have and when you first installed iTunes.

As I said, I keep a duplicate of my iTunes folder on my server PC. It is very simple to just copy the folders from one computer to another over a network. You can even use a flash drive in most cases. I update the files as regularly as I feel necessary, or when I remember to. With programs like GoodSync , you can set up automatic synchronization routines between local and networked shared drives. When I synchronize them to the iTunes server, my music, and now my videos, are available regardless of whether my personal PC is on or not.

If you synchronize the files across the network, then each of those server folders needs to be shared on the network. Most file synch programs will allow you to exclude unchanged files from the update process. That can speed up synchronization after the initial occurrence.

Making It All Work

Make sure iTunes is shut down prior to the copying process. The copy process may not complete correctly if iTunes is running on either computer.

It is a very good idea to keep the two iTunes program installations updated to the same version. If one gets out of date, there could be some sort of malfunction that may cause an iTunes lock up, or worse. But, I suggest that all automatic iTunes program updating be turned off for Apple and iTunes on the music server as sometimes it will ask permission to upgrade or other messages that stop the load process on restart, shutting down the server until someone acknowledges a prompt. Just be sure to upgrade the installation whenever the originating PC is updated. You can shut off software updates in iTunes preferences. Also look for an Apple software updating task in the Task Scheduler. There is an Apple update event starting from there too.

Because I need iTunes loaded for Apple TV file access, I also need to automatically restart iTunes after a power outage or other PC shutdown. I keep a UPS on the server, but as I shutdown the server each night, I need to have iTunes restart when the computer does.

The easiest way to load iTunes at startup is to put a copy of the itunes.exe shortcut into the Startup folder under Programs. A copy of the iTunes shortcut from the desktop should do. I did just that for months and had no troubles until just recently. I tried a couple of other iTunes loading options as well, including the Task Scheduler built into Windows, to run itunes.exe.

When I started having trouble, I could see the name of the song on the Apple TV or my iPhone Remote app screen, but it would not play. When I would log-in to the music server PC, trying to access music directly from the music server’s running iTunes did not work either. I could close and restart iTunes and that would clear the problem. It just seemed to get lost in its initial start up.

After some experimenting with the variables, I became convinced that Windows was not getting through its startup process quick enough somewhere. As iTunes was loading, obviously some resource that iTunes required wasn’t ready yet. I decided the answer was to delay running iTunes until after the computer had fully started up. I had a program I had downloaded a while back that claimed to do just that. It is called StartupDelayer. It is available from a company called JockerSoft and can be downloaded at:

http://www.jockersoft.com/english/startupdelayer_index.php

It is freeware and JockerSoft asks for a donation if you like the program. It seems to do the trick, when it comes to getting iTunes or any other process to run delayed at startup. Just leave the iTunes shortcut in the Startup folder to use StartupDelayer. It will import the startup programs and then it allows you to set a delay time on any of them. I just set a delay of 120 seconds initially on iTunes and it worked, so I didn’t change it. I am hoping StartupDelayer is the final answer.  Apple only get’s a C+ on this.

Once the iTunes server is operational, it can serve up audio and video to the Apple TV unit regardless of whether you have left your personal PC on or not. Any power saving modes other than the screen saver, can stop the iTunes server function from working. Allowing the iTunes server computer to go into sleep mode or into standby will shut down both the iTunes AirPlay and Home Sharing processes. These modes and any other process that would interfere with iTunes should be deactivated.

Auto-Start and Auto-Shutdown

Scheduling a server to shutdown when not needed can add some complexity. Both the software and hardware needed are usually agile enough to support many shutdowns and restarts daily. I don’t recommend leaving the PC unpowered for long as it will drain the motherboard battery some while it is powered down. Using the BIOS restart method I describe in the shutdown procedure at the link below only requires that the digital A/C timer be off for any short length of time to be powered back on. A shutdown and restart procedure can lessen the iTunes server’s power usage. I discussed creating a server computer that turns on and off regularly in my 2005 post:

Auto-Shutdown and Re-Starting My Computer Servers

I don’t know how much power I save using that procedure, but it works very well. The only change, since I wrote that article is, I added a long USB cable from the server to a USB controlled A/C switch. The S/PDIF distribution panel I have is plugged into the switch. When the server is not on, the S/PDIF conversion panel doesn’t need to be distributing, so this shuts it off. I also think the nightly power off cycle gets a good fresh operating system for the next day’s operation for all components.

Using All of This Stuff

I have a big audio CD collection. Many of which I have ripped to iTunes already. I have some videos in iTunes and that list just gets longer too. Generally I wanted iTunes running all the time so that I could access my music collection more easily. My iPhone has a free Remote app that works through Wi-Fi to control the Apple TV, the iTunes server and any iTunes installation it can communicate with. I can use my S/PDIF audio network to listen to the same program in many places from the Apple TV. I can hear the music or see the video from the iTunes server on any computer with iTunes on it. On my computer, I can do both. I can play my iPhone’s iPod on my stereo wirelessly using Apple’s AirPlay app and/or on any computer with iTunes at the same time. There really seems to be no end to the ways I can enjoy my music anywhere in my house with all my Apple products. It makes projects more enjoyable as the same music is playing wherever you go in the house. I think there are nice tablets, smart phones, and music players out there made by competent manufacturers, but Apple tried to keep everything working together to create a larger experience. That’s why I like Apple.

Final note

There is one confusing element in discussing an iTunes server. The word iTunes is the name of two things for Apple. It is the software that comes with an Apple iPod, iPhone, or iPad. Those mobile devices rely on this iTunes application for content and synchronization. There is also the iTunes Store on the internet that many people acquire music and video content for their devices from. I rarely use the iTunes Store and this article was not about the iTunes Store in any way. Apple could have thought a little further ahead with that. But other than that, they’re still OK by me. (B-)

Leave a Reply

You must be logged in to post a comment.