[current path: main]

Jun 22, 2009

Patching PACPL for Album Art and WMA Lossless Support

PACPL, the Perl Audio Converter, is a great Perl script that will batch transcode audio files from one format to another.  For a variety of reasons, my music library is in the WMA Lossless format, and I wanted to use PACPL to transcode the WMA files to MP3.  By default, PACPL does not support transcoding of WMA Lossless files, so I patched the script to add the support.  While I was under the hood, I added support for the “Composer” and “Album Artist” meta tags for WMA decoding and MP3 encoding.  The Album Artist tag helps media players like iTunes group songs by album, even if there are different performers. I also added support for embedding album art into MP3 files.

PACPL normally uses ffmpeg to decode WMA files, but ffmpeg does not support WMA Lossless.  With the patch, PACPL has the option to use mplayer to decode WMA files.  This works fine, with one exception.  Some versions of mplayer (like the one I use: 1.0rc1-4.1.2) have a bug that prevents it from properly creating files with commas in the filename or path.  I added options to remove commas from decoded filenames and to use the /tmp directory for decoding.  Edit the script and set both options to 1 if you have problems with mplayer.

# decoding options for temp files
# use /tmp/ directory for temporary decoded .wav files
my $decode_usetmp = 0;
# replace commas in decode filename to work around mplayer bug
my $decode_replacecommas = 0;

For embedded album art, I added a command line option --albumart= to specify the source album art JPG file name.  It expects a JPG file that is in the same directory as the source audio files.  If it finds the JPG, it will embed the image into the MP3 header.  I did not add album art support to any other output formats, though it should be easy enough to do if their Perl modules support it.

I ended up learning more about the MP3 ID3 metadata format than I intended.  What a mess. Fortunately, the MP3::Tag module is pretty robust.  That said, I did find a bug. The test file I used was a Stevie Ray Vaughan song, which has the genre “Blues.”  This is the first genre in the ID3 genre list, and has the ID of 0.  For the life of me, I couldn’t figure out why the script was losing the genre tag until I realized that a genre ID of 0 was getting skipped by MP3::Tag.  I added a workaround to change the Blues genre name to be “Blues & Roots”, which forces the genre to be encoded as a string instead of ID number.

I also found that different media players treat album art in different ways.  That is, some players are very forgiving of bad metadata headers, while others are not. I tested album art in iTunes, Foobar 2000, Windows Media Player, VLC, Winamp, and Amarok.  For reference, here’s the magic header for JPG album art that works with all of the tested media players:

# important to set unsync to false, otherwise ID3v2 data can appear "corrupt"
MP3::Tag->config("id3v23_unsync_size_w",0);
MP3::Tag->config("id3v23_unsync",0);

$tag_m = MP3::Tag->new("$out_file");

# ID3v2 Tags
unless(exists($tag_m->{ID3v2})) { $tag_m->new_tag("ID3v2"); }

$tag_m->{ID3v2}->add_frame("APIC", "\x00", "image/jpeg", "\x03", "Cover (front)", $imagedata);

With my patches, here’s the shell command I use for transcoding a directory tree of WMA Lossless files to high-bitrate mp3 files:

pacpl -v -t mp3 -r -p -o wma --albumart="Folder.jpg" --defopts 0 --eopts="-q 0 -v -V 0 -b 320 -F" --decoder mplayer /music/WindowsMedia/ --outdir /music/mp3/

works-on-my-machine-starburst_3Unfortunately, I stink at Perl, so a lot of my Perl code looks like C.  I tested the patches on my personal WMA Lossless collection on two different installs of ZenWalk Linux.  Therefore, I hereby grant this code the honorary Scott Hanselman badge of “Works on My Machine.”

You can download the patched Perl script here: pacpl-wmal-patched.tar.gz

I’ll send the patches up to the maintainer of PACPL, but I’m not sure if he’s interested (or if he’ll recoil in horror at my code).  I’ll add a comment if I hear back from him.

http://pacpl.sourceforge.net/

UPDATE: Turns out that I accidentally switched the Artist and Album Artist metadata tags, which is critical for iTunes. I fixed it and re-uploaded the tarball.

post time: 02:08 | category: /media | comments | Share/Save/Bookmark

Jun 15, 2009

Great CD Sleeves from Slappa

I still buy CDs.  And until Amazon.com or iTunes starts selling music in a lossless format, I’ll likely continue to do so.  However, I rip CDs to my PC immediately after purchase, leaving me with the problem of where to store the CD.  Dumping the CD jewel case and storing just the CD and liner notes can save a ton of space, so I decided to buy some thin CD sleeves.

You can buy plain paper CD sleeves from numerous sources, but they usually don’t have room for liner notes.  There are also many CD cases with built-in sleeves available, but they’re usually pretty crummy.  The sleeves are often made of cheap plastic that tears easily, and can stick to the CD. They rarely have a slot for the liner notes, and you can’t remove the sleeves from the case.

Slappa makes the best CD sleeves I’ve found.  Each sleeve has a fabric slot for the CD and another slot with a matte polypropylene clear cover for liner notes.  They are stitched around the sides instead of glued or melted, so they won’t come apart over time.  They have an optional interlocking slot system that let’s you easily remove and re-sort a CD collection.  A single sleeve holds two CDs and two liner notes, and Slappa sells a model that holds four CDs for two double-CD sets. These things are fantastic.

Slappa CD sleeves

I intended to buy the sleeves on their own, but it was a tad cheaper to buy them with an included case.  The cases are impressive too – very rugged.  There is a pocket in the front of the case that I use to store the back sides of CD inserts.

Slappa CD sleeve case

Slappa also makes a version of the sleeves for DVDs.  I bought a set of them and tossed the original cases for a bunch of movies and video games.  It’s amazing how many DVDs and video games you can store in a single drawer after ditching their cases.

I ordered everything directly from the Slappa web site, but it looks like they are now also available on eBags.com, possibly with cheaper shipping.

The only downside is what to do with the leftover CD jewel cases. It turns out that they are very difficult to recycle, and can’t be put in the recycling bin.  Apparently, you can mail them to a couple of companies who will then try to re-sell them or grind them up, but I’m not sure I want to pay to mail hundreds of empty cases somewhere.  If you know of any ideas, please post a comment.


post time: 01:58 | category: /media | comments | Share/Save/Bookmark

Apr 11, 2009

Suntory Yamazaki Whisky | Uncrate

The Uncrate “buyers guide for men” has discovered one of my favorite beverages.

 yamazaki-whisky.jpg

Suntory Yamazaki Whisky | Uncrate

Here’s what Uncrate has to say:

Born from the pure waters of the Vale of Yamazaki and handcrafted at Japan's oldest distillery, Suntory Yamazaki Whisky is a great way to wind down after a hard day at the office. Aged for either 12 ($40) or 18 years ($100), Yamazaki has a lengthy, dry finish, with the 12-year variety offering a delicate, mellow taste and the 18-year providing a spicier punch, with cherry-like tones. For maximum enjoyment, serve on the rocks with an ice ball, which you can make yourself using the Spherical Ice Tray Set ($16) from MoMA.

Hmmm, I must look into this Spherical Ice Tray Set…

post time: 20:22 | category: /general | comments | Share/Save/Bookmark

Apr 04, 2009

A Cheap Grind

Most coffee aficionados (like me) insist that whole bean coffee should be ground in a conical burr grinder. Never use a blade grinder. The typical reason is that a burr grinder creates a more even grind at a lower speed, as opposed to a blade grinder’s uneven grind at a high speed.  An uneven grind makes for an unpredictable brew, and the high speed of the blade grinding process can heat up the beans, thereby altering the flavor a bit.

However, where the generally despised Krups blade grinder [B00004SPEU] is under $20, a good conical burr grinder can be expensive.  And while the burr grinder advice is important for folks grinding espresso, it isn’t quite as important if you’re grinding coffee for a coffee press or paper cone filter.

Most people associate blade grinders with the Krups grinder.  The Krups is avoided by coffee fanatics due some notable flaws:

But not all blade grinders are like the Krups. In fact, the Ueshima Coffee Company in Hawaii uses a giant custom-made machine called the “Crackulater” which is in essence a high-quality, high-consistency blade grinder.

I needed a new grinder, and found that Mr. Coffee, of all companies, makes a surprisingly good blade grinder [B000BRLXUI] for the same price as the Krups ($20).  And it solves all of the problems associated with the Krups.  The Mr. Coffee Grinder has settings for the grind size and amount, which sets the speed and duration of the grind.  You just hold the button down on the top of the grinder, and it will stop automatically when the grinding is complete.  You then detach the container (right-side up), give the top a couple of twists, and the static-free ground coffee is free to pour into the filter or coffee press.  Simple, effective, and consistent.  What’s not to like about that?

I’m sure I’ll pick up a nice burr grinder at some point, but for twenty bucks, the Mr. Coffee Grinder is a steal.  And nothing beats freshly ground coffee.


post time: 20:23 | category: /general | comments | Share/Save/Bookmark

Mar 15, 2009

Mounting an iPhone 3G in an Audi A4

There are a lot of solutions for using an iPod or iPhone in a car, but if you want the ideal combination of safety, good sound quality, and in-car charging, the options narrow quickly.  The options narrow even more if you want the final results to look clean and neat.

For my iPhone 3G, I ended up using a mount from ProClip, and an adapter from Kensington.

Audi A4 iPhone Car Mount

I initially purchased the Kensington Car Charger Deluxe [B0011ULQ1K], as it looked like a Griffin TuneFlex designed for the iPhone, but discovered that it a) didn’t fit properly in the lighter socket in the Audi, and b) did not support line-out audio.  I returned it and purchased another Kensington adapter called the LiquidAUX [B0011UK2HE].  The LiquidAUX supports proper line-out audio and doesn’t include the balky mounting bracket.  It also includes a totally useless wireless remote control, which I left in the box.

Audi A4 iPhone Car Mount

I purchased a dashboard mount from ProClip.  The ProClip mounts are actually made in Sweden by a company called Brodit.  They’re purchased in two parts.  The first is a generic device mount that is specific to a car model.  It uses a tool-less installation process that snaps in between the stereo and the dashboard console.  The second is a device-specific mount that is screwed directly into the generic mount.  The combination is a bit expensive, as I paid $35 for each of the two parts.  However, it’s a sturdy, classy combination for a specific device and car model, which in my case is a mount for an iPhone 3G in a 2001 Audi A4.

Audi A4 iPhone Car Mount

The combination of the ProClip mount with the Kensington adapter gave me exactly what I wanted: a clean and neat in-car iPhone 3G solution with safe placement, good sound quality, and in-car charging.

Audi A4 iPhone Car Mount


post time: 21:18 | category: /gadgets | comments | Share/Save/Bookmark


MikeyP.com

About This Site
Main Page
About MikeyP
Subscribe to Feed