I’ll just explain my situation, but say “you” instead of “I” because I’ll assume it applies to you, too. If it doesn’t, you won’t have much use for this library anyway.

You have a large collection of music. After several misguided attempts at ripping all your CDs to mp3s or something, it’s finally mostly ripped (“for the last time”) to a lossless format like FLAC. But you still have a bunch of other lossy formats thrown in because…well, just because.

Now you want to take some of that music, shrink it in size, and put it on a portable device. You fire up some GUI program, drag the folders you want onto it, and ask it to give you back some Oggs. Or mp3s. Or whatever.

Ah yes, but now you’ve incurred the wrath of the information theory gods.

While you succeeded in shrinking your pristine FLACs, you have also indiscriminately transcoded your lossy files into a different lossy format. Depending on how smart the program was, you maybe even encoded a file into the same lossy format but using a higher bitrate. Scandalous!

Plus, you don’t just have one portable device. You have a phone, your wife has a tablet, there are three or four mp3 players floating around the house that belong to different people, and you want some music on your work laptop. But some of those have more memory than others, plus you only want some of your massive library on any one of them.

Lossfully isn’t your usual, “drag a bunch of music files on me and press go” music converter. You write a small script to describe what actions to take on all or a subset of your music library. Something along the lines of, “convert all of my lossless files to vorbis, and go ahead and convert all the lossy stuff too as long as it has a bitrate over 192 kbps.” You would do that by writing

require 'lossfully'

Lossfully.generate '~/share/music' => '~/share/music_lossy' do
  threads 2
  clobber true

  encode :lossless => ['.ogg', 6]
  encode [:lossy, 192] => ['.ogg', 4]

It might be easy enough for someone who doesn’t even know ruby, as long as they have some examples they can stare at and modify. Check out the documentation on RubyGems.org for more examples and to learn how to write your own. Code is on GitHub.

It uses sox to do the actual conversion, so you have to, you know, have that. And you might need to recompile it if your distribution has LAME support turned off. Might work on Windows, or it might not. And it definitely willthrow nasty errors at you if you call it the wrong way, for now anyway.