Converting music libraries on MacOS
August 29, 2017 in digital music by Dan Gravell
My favoured way of maintaining a lossy library alongside a lossless one is to not have a lossy library. That's not a glib, snobbish comment on lossy libraries. Instead it's an expression of my usual solution: mp3fs.
mp3fs creates an "impersonation" of a lossy library by using a lossless one as its source. Sometimes though we can't have perfect solutions, and this only works on Linux, so what's a way of getting this to work for MacOS, say?
In a recent thread on Computer Audiophile, glider contributed their script for getting this done.
This works by creating a copy of the library, not an 'impersonation' (as I call it). The script scans through every file in a designated root folder and uses XLD to convert it. (I called out XLD as the no-nonsense choice for audio file converting before).
XLD here is the command line (CLI) version. The CLI version is included in the XLD download, but separate to the XLD GUI app, so you might need to go back to the DMG to extract the CLI version.
You could save the script to your Desktop, then open Terminal and execute like so:
~/Desktop/converter.sh "~/Music/iTunes/iTunes Media" "~/Music/mp3-mirror" mp3
That's:
- ~/Desktop/converter.sh
- The path to the script (in this case inside the user's Desktop folder).
- ~/Music/iTunes/iTunes Media
- The source music library (here the user's iTunes library).
- ~/Music/mp3-mirror
- The destination of the new music library.
- mp3
- The desired format.
What are the output formats for XLD?
The output formats for XLD are, strangely, not listed on its website. You can get the latest list for your version if you use the CLI version without any arguments:
-f: Specify format of decoded file wav : Microsoft WAV (default) aif : Apple AIFF raw_big : Raw PCM (big endian) raw_little : Raw PCM (little endian) mp3 : LAME MP3 aac : MPEG-4 AAC flac : FLAC alac : Apple Lossless vorbis : Ogg Vorbis wavpack : WavPack opus : Opus
So that's a decent number of different output options.
A note...
This attempts to convert every file. If it fails, it simply copies it to the destination folder. So if, for example, an image file is sent, it will fail and simply be copied. This works, but it is less efficient, so you could make some improvements.
Hope this helps converting a music library!
Thanks to Dominik Scythe for the image above.