Thursday, April 7, 2016

Managing music on iOS devices

The Problem
I have had many and varied conversations with people over the years regarding their favourite computer based music player and some have been more interesting than others. The solution I describe here is just one but it may assist in developing you own solution. As far as I understand it this complies with the current Australian law.

When I started collecting music the benchmark was the vinyl record, with some people actually purchasing high quality reel to reel tapes (yes, that was a thing) for ever higher quality. People would spend many thousands of dollars on the turntable alone, let alone amplifiers and speakers. I had a friend who boasted that he built custom enclosures from concrete and filled them with sand. I never heard them but I can imagine that they would not have lived up to the expense and effort involved. Then in the 80s the CD emerged and to this day there is a furious debate over the efficacies  of digital vs analogue format.

Now there are many forms of digital music and as with the past there are facts and there are fallacies and unfortunately the fallacies reign supreme whilst the facts languish amidst the ignorance of those who know enough to be dangerous but not enough to know what they are talking about. In the next two paragraphs (which you may skip or skim if you wish but I suggest you do try to understand if you are at all interested in music).

Digital Vs. Analogue
First let me try to explain the difference between analogue and digital formats. Old formats such as tape and records (shellac and vinyl) record the music in a form that reflects what we would understand sound to look like, waves. Sound is just pressure waves in air and on tape the signal is a varying magnetisation of the tape that looks exactly like the sound waves. On the record there is a groove that looks exactly like the sound waves. Thus these are analogue formats, analogue meaning to closely resemble or represent. When the tape or record is played then your sound system converts these variations into electrical signals which are eventually turned back into sound pressure waves that come from your speakers or headphones. There are serious limitations with both tape and vinyl however. The accuracy of the sound depends on various factors including how accurately the sound is converted from pressure waves into electrical signals, how well that signal is transferred to the recording device and the particle size on either the vinyl record or tape. You can hear it the most with the old shellac 78 RPM recordings where you can hear a constant hiss. You get the same thing with both tape and vinyl but there are ways of limiting its effect, but even so it is still there. There are also limitations in the mechanism that lay the sound onto tape and vinyl and also getting the signal back out. Both of these media are fragile and easily damaged and the sound on tape degrades over time and records can be worn by the stylus or scratched.

Consumer digital started with the release of the CD. There are a number of advantages with digital. The first is that it is easier for computers to process so that you can do many smart things with the digital file to process the recorded sound that are impossible, or extremely difficult with analogue. Next there is no loss to the signal when you process it. With analogue every time the editor processes the track it adds all of the inconsistencies of the analogue transfer and over time this can degrade the signal. Not so with digital. Then there is the preservation of the original sound. Once you have the digital file that represents the recorded sound it cannot degrade (in theory). If you look after that file it never changes and will be exactly the same forever unlike analogue formats. You scratch a record you damage the sound. You keep a tape for too long, get too hot or expose it to too much moisture the sound goes to pot. No so digital. You can copy it over and over and it stays exactly the same.

Digital Distribution
There are now a plethora of digital media, some of which have come and gone but the one that has stuck with us due to its cheap cost is the CD. I read that a factory can stamp out a recorded music CD for 20c per disk. This means that the remainder of the money you pay for the CD goes into distribution less royalties, which is precious little if you buy from your average music outlet. Most of the money you pay goes to the label. Of the sticker cost 13% (or 13% of 90%, there is a 10% deduction for supply chain losses) goes to the musician (more if you have negotiating power such as Madonna or Sting). This sounds a lot but your musician also has overheads so in truth you average musician takes about 0.23% of the CD which if it was a $15 CD, about average these days, (it is only your Madona or Sting  who can expect to still get away with charging $30) you musician only gets about 3.5c per CD. Not a lot to live on for the smaller artist. For your typical CD run this makes it hardly worth while getting out of bed. This has given rise to a lot of independent music distribution sites such as CD Baby, and Blue Coast music which leaves the musician with much more recompense. Even better are those musicians who self publish. Many more new musicians are going down the route of self publishing as the become more tech savvy. Indeed there is one musician I know of, Daria Musk  who streams her concerts live over Google Plus.  She also produces and distributes her music herself but she is very technically knowledgeable and has teamed up with another musician who is her producer. Digital music files are now becoming more popular and are not limited to the quality of CD or two track stereo. Surround and higher bit rates are proving to be more popular now.

I collected a large number of music CDs over the years but the problem is that music CDs will deteriorate over time, especially if stored in damp and cold environments. Also putting a CD into a music player is a pain. CDs are excellent media but they have their limitations. Most of the music I have bought recently has been from the artist either on their web site or from Kickstarter. I have also bought a number of albums from iTunes where the artist does not sell direct.
The old CD distribution mechanism via large record producers is probably the lease beneficial way for the artist to be reimbursed for their work. the next best is iTunes the next via independent distribution such as CD Baby, Blue Coast and the like. Finally the best is from the artist themselves. I choose the options from the last to the first for this reason. There are a few artists whom I support by buying direct from them either digitally or by buying their CDs. So how to manage this music?

Managing Your Music Library
I use iTunes because it is the most convenient way of managing large music libraries and supports all of my mechanisms for playing my music. I have tried a number of different music library managers in the past but I always come back to iTunes.
First CDs. I simply pop the CD into my CD drive in my computer and it automatically imports into iTunes. I have set the default format to Apple lossless which encodes the bits exactly as they come off the CD so you loose no quality. Once the CD is in the drive iTunes goes out and finds the album information (it uses the signature of the tracks on the CD to match it to online databases of CD information). If there are multiple entries, for instance different people have entered the same CD  or different regions or different release dates then you get to pick from a selection. Once it is "ripped" into iTunes you then have the digital copy and it appears in your iTunes library. In Australia this is allowed for in the legislation. If you own the CD you may make copies of it for your own personal use for playing in different formats. For digital media simply drag your downloaded music into your iTunes library and it automatically catalogues it but this does depend on the music format.

Once in my iTunes library I can backup the library. To see where your songs are stored you can look in settings or you can right click on any song and look at Get Info.
Now that you have all of your music there you can do things such as create play lists. There are smart play lists where you specify all of the attributes and iTunes automatically adds music to that play list any songs with that attribute. For instance you can crate a John Mayer playlist and specify artist as containing John Mayer. You can also create normal play lists. For instance create a Christmas play list and drag all of your Christmas songs into it. then when Christmas comes around shuffle play all of your Christmas songs to the endless delight (or disgust depending on your relative tastes) of your family. I created play lists for my children's weddings with several play lists specifically designed for various parts of the evening. You can also see the timing of each play list which helps with the programming.
Once your library is set up you then turn on Home Sharing which enables you to see your library from anywhere in the house. You can see it on your Apple TV, your iPhone, iPad or any other computer running iTunes. You can also selectively sync tracks to your iOS device if you want the music on the go. You can choose to sync in the original format for high quality music or if you want you can select to compress your music which gives you about a 50% reduction in file size for a loss in quality.

Additional Tools
These days I get most of my music via a streaming service but I do still purchase music, mostly from places such as Blue Coast and CD Baby, and even from the artist. In the case of downloads the format is typically FLAC which iTunes does not recognise. In addition I like to play music on other players which do not decode Apple Lossless. To convert between formats I use dBpoweramp. The basic version is free but I bought the license which is a small one off purchase which adds an mp3 license, multi parallel conversion plus more. Major upgrades though do require an upgrade fee but it is not a huge cost. I have a reasonably powerful 8 core PC and I can convert a full CD to/from Apple lossless/FLAC format in under 30 seconds.


The Video Lan Client (VLC) player is free and supports all major audio and video formats and is a great media player. It is available for PC, Mac, iOS, Andriod and Apple TV V4. If anything will not play in iTunes then it will most likely play in VLC.

Kodi is a powerful and versatile media player that first saw light as XBMC (XBox Media Player) that was developed for the rooted XBOX One but is now available for every conceivable platform. A port has been developed for iOS called Mr MC. This is a paid app available for the iPhone, iPad and Apple TV in a cut down form to comply with Apple's restrictions. This can play every conceivable format including Apple Lossless.


My PC does not have an internal optical drive so I use an external optical drive to read my media. These are not expensive and are very convenient.


Storage and Backup
There  are many options for storage. You can use external USB drives, internal drives, NAS (Network Access Storage or via your router's USB port. Each has advantages and disadvantages.

An external USB drive is relatively cheap and can store many hundreds of CDs. However unless you keep a copy of the external drive you have no backup and will loose everything when your single drive fails. You can get multi drive external boxes which include data redundancy but this is not a particularly robust solution. There are better ways of storing your music.

You can use internal drives inside your PC to store the music. Windows allows you to use RAID (redundant array of inexpensive disks), in the case of Windows this is specifically 2 disks which store exactly the same data (RAID 1) so that if one disk fails then you still have the data. You can then replace the failed disk and re-synchronise the RAID. I have two 2T disks for storing data on my PC but that is not my only copy.

Probably the most robust solution is what is termed a NAS or Network Attached Storage. This uses a dedicated box, either a PC or purpose built containing several hard drives of (usually) identical model and size with redundancy so that if a drive fails you can simply replace the drive and it will resync in the background. If you are technically minded you can use a free program such as FreeNAS with a standard PC but the better solution for the rest of us is to use a "NAS Box" such as the Thecus 4 drive NAS N4310which is $249 from MSY. You need to then add hard drives. You can use a web interface to configure the system to alow you to access this from anywhere on your network including your smart phone, PC, Apple TV, generic media player, smart TV, the list is endless. You should then still backup the NAS but it is a good robust solution for storing all of your data.

Summary
I use iTunes to rip my CDs then dBpoweramp to convert to FLAC when necessary. I store them on my server which is a standard PC with FreeNAS installed and using RAID quality drives.

I can access all of my music from my media players on my home theatre, Apple TV, PC and mobile devices.I can use iTunes with home sharing or Mr MC on my Apple TV and iTunes on mobile devices. Thus I have lossless high quality music wherever I am.