Audible, Linux and learning to cope with my error

Update: Since this I’ve learned that Barnes and Noble carry Audiobooks in the MP3 format. To download them though the Windows application OverDrive Media Console is required. Good news is that you can D/L the file and open it through the application so you don’t have to order it through Windows. Thankfully it’s a good program and does it’s job well.

Recently, I decided to get and audiobook to be able to listen to on my MP3 player. I had heard on TV the audible.com commercial that audiobooks could be downloaded and played on my computer or MP3 player. I went to Audible, found the book I wanted and downloaded it. When it started downloading, I noticed the extension was .aa. I hadn’t noticed but below the Download link was a mention of how to import the file to iTunes. The .aa extension is a specially created extension short for Audible Audio and it only works on several types of portable music players that support it. iPods are one, and newer Creative Zen, and SanDisks do too. Having already spent $30 dollars though, I was determined to get this to play on my slightly older MP3 player. Unfortunately, the only way to do this (without spending $20 to $30 on software that removes DRM illegally) is a time-consuming, and somewhat laborious process.

Burn, Burn, Burn… Rip, Rip, Rip

I was a bit thrown off of the MP3 mention:

Saying MP3 player (to me) seems a bit too generic to me and sadly it had me boot up my dusty Windows install :) to be able to start the process. I did bit of research and booting to Windows is necessary – there is no way to convert .aa files in Linux as of yet. I copied my .aa files to the Windows partition, rebooted to Windows, and then installed iTunes. To begin: in iTunes I had to create a new playlist ‘File > New Playlist’, and drag an .aa file to it. I had multiple .aa files so I had to do them separately, one at a time. After that, I did ‘File > Burn Playlist to Disc’, select ‘Gap Between Songs’ as ‘none’, and hit ‘Burn’. This is where the long part of the process takes. For my three part audiobook (three .aa files) the total ~15 hour audiobook spanned 13 discs. I did this for each .aa with a new playlist. I tested a CD after it was done and it played fine but oddly I noticed that iTunes had decided to break the audiobook up into 8 minute tracks – wish it didn’t do. When finished, I decided to rip in Linux. Reboot.

In Linux, Ripit is a good command line tool for ripping CDs.

Lame is required for encoding. Make a new directory for the audiobook. In my case:

mkdir -p ~/Audiobooks/Stephen\ King/Full\ Dark\,\ No\ Stars\ \(Unabridged\)
cd ~/Audiobooks/Stephen\ King/Full\ Dark\,\ No\ Stars\ \(Unabridged\)

And begin burning:

ripit --playlist 0 --bitrate 64 --quality 0 --loop 1 --outputdir ~/Audiobooks/Stephen\ King/Full\ Dark\,\ No\ Stars\ \(Unabridged\)

I did a bit of research on this and for most audiobooks the are encoded in 32bit mono but since some have sound effects, 64bit is the way to go. Also using 64bit helps because a bit of quality will be lost in the conversion. This unfortunately makes the MP3s slightly larger (the original files were about 75MB each, afterward they were around 150) but is really the best choice. The other commands here do: playlist 0 (don’t create a playlist), quality 0 (encode slower for slightly better MP3 quality), loop 1 (will eject disc after rip and prompt for a new one), and outputdir (to specify where to put the ripped folders). Ripit automatically queries the FreeDB database for MP3 tagging (there won’t be any valid entries likely) and there is no way to override it. So for each CD I had to enter into it: not to use a DB entry (0 none of the above); to label with the “Default Album…”; and for genre I just hit enter (none). Ripit burned the CDs into folders named ‘Unknown Artist – Unknown Album’ and was smart enough not to overwrite the folders of the same name and sequenced them. When it was done, I had a list like this:

ls -1
Unknown Artist - Unknown Album
Unknown Artist - Unknown Album 1
Unknown Artist - Unknown Album 10
Unknown Artist - Unknown Album 11
Unknown Artist - Unknown Album 12
Unknown Artist - Unknown Album 2
Unknown Artist - Unknown Album 3
Unknown Artist - Unknown Album 4
Unknown Artist - Unknown Album 5
Unknown Artist - Unknown Album 6
Unknown Artist - Unknown Album 7
Unknown Artist - Unknown Album 8
Unknown Artist - Unknown Album 9

Put it Together, Polish it Up

To be able to put the audiobook back together, I’d have to join the numerous MP3s back together. Here, I choose to use mp3cat. I was a bit unsure which way to go. The best source I could find to do this was this question at stack overflow. I decided to use mp3cat because here it is said that (later on in post by joelhardi) that mp3wrap “inserts its own custom data format in amongst the MP3 frames (the “wrap” part), which causes issues with playback, particularly on iTunes and iPods.” mp3cat pulls the tag (ID3) information out (which leaves only the binary part of the file) and then joins the MP3s together. To install:

wget http://tomclegg.net/software/mp3cat-0.4.tar.gz
tar xvf mp3cat-0.4.tar.gz
cd mp3cat-0.4/
make install
sudo cp mp3cat /usr/local/bin

For my audiobook, part 1 of my audiobook spanned the first folder (0) to folder 4, part 2 from 5-8, and part 3 from 9 to 12. To concatenate the files back together, I’d have to define the folder span of the MP3s to put together. However, because the folders will are not going to be recognized in the correct order (e.g. folder 10 will come after folder 1 [as recognized by the shell]) I had to zero pad them (e.g. …Album 000, …Album 001,…):

mv Unknown\ Artist\ -\ Unknown\ Album/ Unknown\ Artist\ -\ Unknown\ Album\ 0
rename 's/\d+/sprintf("%03d",$&)/e' *
ls -1
Unknown Artist - Unknown Album 000
Unknown Artist - Unknown Album 001
Unknown Artist - Unknown Album 002
...

The rename command here grabs any number and turns it into a it’s three digit equivalent. Since all my folders had numbering at the end of the name this solution worked good in this case. I created a script to concatenate the MP3s with for ease of use if I ever have to do this again. I had help from some people at the Arch Linux forums to help finish this, particularly rockin turtle. Thanks guys!

#!/bin/bash
# Define span of multiple folders and join mp3s inside - useful for audio that
# spans more than one CD
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <dir1> <dir2> <filename>.mp3 - folder span mp3 join"
exit
fi
# Create mp3 filelist
declare -a filelist
for (( i="$1"; i <= "$2"; i++ ))
do
suffix=$(printf '%03d' "$i")
f="Unknown Artist - Unknown Album $suffix"
filelist+=("$f"/*.mp3)
done
# Concatenate mp3s
cat "${filelist[@]}" | mp3cat - - > "$3".mp3
view raw mp3cat-mdir hosted with ❤ by GitHub

To use it for example:

mp3cat-multiplefolders 0 4 "01 Part1"

This did exactly as I wanted except for one thing: I learned that the track length information is also part of the binary file. This would cause some MP3 players to report the length incorrectly thinking that the MP3 was an eight minute track instead of the five or so hours that each actually was. To fix this, the only program I could find was MP3 Diags. This is a great tool to repair damaged MP3s with. Unfortunately, it a GUI utility only and I was hoping for a command line one. I just clicked on 4 to fix everything (which was just the track length issue (bc)).

Tag Line and Submit

I searched online for tag information of the audiobook on both the FreeDB and MusicBrainz databases but had no luck. At this point I knew I’d have to create the audiobook information tags (ID3) manually. Originally I used EasyTag but it created a couple issues afterward when I went back and checked it with MP3 Diags, particularly when adding cover art (problems with frames and such). So it looks like its best to use MP3 Diags tag editor as it had all the basic parts I needed. The tag editor was basic but worked nice and I found the only tricky thing was adding cover art (which I had to be copied to the clipboard and pasted in). The only way I could find to put an image to the clipboard was to find the image in Firefox and copy it from there. The only question I have now is if MP3 Diags correctly assigned it as CoverArt as it has no ability to specify it. However, when playing the files in Banshee the CoverArt is show correctly.

Since this audiobook hadn’t been listed in an ID3 database, I thought I’d put it up in case anyone else was crazy enough to do this :). After looking at FreeDB some more, I read in the forums that they didn’t think this was a place for audiobooks and that the FreeDB was geared toward audio CDs. However, MusicBrainz had audiobook listings so I decided to put it there. Originally I had tried to use MusicBrainz’s own application (Picard) to tag the MP3s with but to tag with Picard the original needs to be a CD (the DiscID creator feature requires a CD to be inserted). However, Picard does have a plugin available called “Add cluster as release” that works. I installed it following the instructions, put the audiobook into a cluster, right-clicked the ‘Album’ > Plugin > Add cluster as release, created an account (required to submit), and filled out the form as best as I could:

Finally, I found the audiobook on Amazon and did ‘Relate to URL’ to add coverart. When done I was told that MusicBrainz has a process that puts new entries into a queue for peer review.

Thoughts and Conclusion

All and all the process went smooth so I’m happily listening to my audiobook now. I’m happy with the quality for the MP3s except for one thing: when I reach the length in the track where the segments were joined I can hear a slight dip in volume. Barely noticeable so I’m not too worried. I also would have liked to be able to fix the track length error from the command line and enter ID3 information from there as well. If anyone knows of anything, I’d appreciate hearing from you. And finally, if anyone knows if it is possible to get audiobooks in MP3 format that would help me quite a bit.

9 thoughts on “Audible, Linux and learning to cope with my error

  1. sxj

    Great advertisement to not buy audiobooks at audible.com.:) You may as well just buy the CD version and rip them yourself. Now what if you didn’t have that old Windows install? Would you buy a new Windows license as well, just to get the audio book?

    Reply
  2. Ondrej Grover

    For CLI ID3 eidtor use id3v2 or mid3v2 (mutagen replacement)
    Hope this helps ;)
    DRM must die !

    Reply
  3. Daenyth

    If you like audio books, check out the “Escape artist” set – Podcastle, Escape Pod, Pseudopod (fantasy, scifi, horror). I’ve found lots of great stories from them.

    Reply
  4. Todd Partridge (Gen2ly) Post author

    Daenyth :

    If you like audio books, check out the “Escape artist” set – Podcastle, Escape Pod, Pseudopod (fantasy, scifi, horror). I’ve found lots of great stories from them.

    Hey, these look pretty neat. Just a little background. These are genre-specific podcast magazines. As they put it:

    “…short stories from some of today’s best horror authors, in convenient audio format for your computer or MP3 player.

    We pay our authors, but we will always be 100% free. We are supported through listener donations, so if you like what you hear, please consider donating via our PayPal button!

    Escape Pod centers on Science Fiction; Podcastle Fantasy; and Pseudopod Horror.

    http://escapepod.org
    http://podcastle.org
    http://pseudopod.org

    Sweet, I’ll look into these.

    Reply
  5. Todd Partridge (Gen2ly) Post author

    Next time if I’d like to do it perfect, I’ll use cdda2wav first (ripit has support for this) and combine the wav files first to avoid the very unnoticeable bump where they are combined.

    Reply
  6. Todd Partridge (Gen2ly) Post author

    @ Ryo Cook

    Why not using OGG instead of MP3 if you have to rip it anyway? Better quality, less space, and damn free.

    I agree Ryo. I like OGG quite a bit. However, I tend to use portable MP3 players from time to time and OGG, ehh. For now its what I got.

    Reply

Leave a reply to Todd Partridge (Gen2ly) Cancel reply