MusicL - Lame MP3 Front-End

Frequently Asked Questions

INDEX

Overview

1) - What is it?

2) - Why?

3) - How does it do that?

4) - What is LAME and why is it needed?

5) - How do I get LAME or MusicL and what does it cost?

6) - MusicL is a dumb name. Why did you pick it?

7) - What do I need to use MusicL?

About Perl

8) - Perl?  What is Perl?

9) - Why Perl?
(10) - How do I get Perl and what does it cost?
(11) - What are the Packages and how do I get them?
(12) - Where are these packages?

(13) - Back to Why Perl?
(14) - Why make users mess with all this Perl stuff, Why not just give them an EXE?

(15) - Why no installer?

(16) - So what do I need to write Perl code? There's no editor, no development GUI. What do I do?

 

Getting Started

(17) - Exactly how do I get started?

(18) - What is in this ZIP file?


 

1) - What is it?

MusicL is a program intended to help automate the process of transcoding large numbers of .WAV files into MP3 files and creating all the proper MP3 tags, and then copying the files into a music library file tree where another application such as the HAL 2000 Digital Music Center music player can easily find them.  It is also offered as an illustration of a moderately non-trivial Perl program that may be studied and tinkered with as an educational exercise.

2) - Why?

HAL can rip CD tracks to it's own music library.  This is fine if that's all you want.  But it has several disadvantages.  First HAL only rips to the Microsoft proprietary, DRM encumbered WMA file format.  This document will not discuss the merits or lack thereof of this issue, or why we think this is an unfortunate choice for the consumer.  You are encouraged to research this subject for yourself.  However if you understand the issues and want to do things a little differently, this program is one tool, among many, that can be used to exert finer control over your personal music choices.

But the more important reason for this tool becomes evident if you digitize your own recordings.  Perhaps you have a lot of vinyl from your youth. Or even acetate from your parent's youth.  There are various techniques for recording these collectable gems into digital files.  Usually the desired result is a PCM file recorded at 44.1 KHz ready to burn to a CD.  But for HAL, you really want an MP3 file.  This program not only turns your WAV files into MP3s at extremely high quality, but fills in the MP3 tag data and copies the MP3 files into the HAL music library.

3) - How Does It Do That?

When creating WAV files from analog recordings, it is usually the custom to name the file such that basic information about the recording is retained.  Consider an old record I recently digitized.  The song is "Pretty Eyed Baby" with Al Trace and his Silly Symphonists.
  With Windows long filenames support we can store all the information about the song in the filename.  Thus the recording might be named something like:

            01 - Al Trace - Pretty Eyed Baby - Mercury 5609 - 1951 - Pop.wav

    So What?

MP3 files don't need any such super long name.  MP3 files contain what is known as "Metadata" which contains tags that hold this data in an easily readable format.  MusicL can read the long filename and parse out the information and place it in the MP3 tags.

    Again, So What?

Once the MP3 file is created with all the data in the tags, the resulting song may be named simply "Pretty Eyed Baby.MP3" and yet have all the other information easily accessible to programs.

    Is there anything else?

The program can also create a directory tree in the HAL music library and place the file, renaming it to only the title as in the example.  Thus in this example, the program will create a directory named "Al Trace" and a file in that directory named "Pretty Eyed Baby.MP3".

4) - What is LAME and why is it needed?

LAME is an open source MP3 encoder.  It is also arguably the best MP3 encoder available. Properly used, it creates MP3 files with much better sound than the proprietary Windows WMA encoder.  So rather than try to reinvent the wheel and write our own encoder, we simply use Perl scripting to "drive" LAME.

5) - How do I get LAME or MusicL and what does it cost?

LAME is free, and freely downloadable.  MusicL is also free and you get it from my web page.

6) - MusicL is a dumb name. Why did you pick it?

Every program needs a name.  As I wrote it, I experimented with several names.  I settled on MusicL because I liked it.  By the way, it is a contraction of Music Library and pronounced "Musical"

7) - What do I need to use MusicL?

Beyond the obvious, (A computer, some music, etc.) you need LAME and Perl.

8) - Perl?  What is Perl?

Perl is a language. It was created in 1987, and has become largely the dominate language underpinning the Internet. While a bit dated, and slowly being supplanted by newer languages, it is nonetheless pretty much everywhere, and has a huge following. There are also a great many supporting packages, or modules that can be installed to enhance Perl capabilities.  The Wikipedia entry is here: http://en.wikipedia.org/wiki/Perl

9) - Why Perl?

Several reasons.

First, I like Perl.

Second, it is extremely easy to do very complex things in Perl.

Finally, Perl is an interpreted language, and as such, it is very easy to distribute source code.  Free software should come with source code.

(10) - How do I get Perl and what does it cost?

Perl is completely free. Just download it from
http://www.ActiveState.com

The full link to the current version at this moment is:
http://www.activestate.com/store/download.aspx?prdGUID=81fbce82-6bd5-49bc-a915-08d58c2648ca

Unfortunately, this is not likely to be a permanent link as it changes when new updates are released.  But a little searching should find it.  You want the Windows .MSI package. Download and run it, and it will set up all you need.


(11) - What are the Packages and how do I get theem?

Perl Modules, sometimes called Packages, are pre-written, tested and debugged chunks of code, written by some good Samaritan and published to to a public repository. They are universally free. This is one of the great parts about Perl. Almost anything you want to do, someone has already done, and you can grab their code and use it with very little effort.  This is unlike many other languages where developers will happily sell you their closed library modules, and availability of free and reusable modules is limited.

With the Perl package linked above comes something called the PPM, the Perl Package Manager. This is a GUI front-end to a large number of archives of Perl modules that are freely available. Simply run the PPM, and navigate to the package needed by name, and 1 click downloads and installs the package.

MusicL uses two packages:
Tk.pm written by Nick Ing-Simmons.  It provides a set of Graphical User Interface widgets to make nice GUI displays with.
Tk::Balloon.pm, an adjunct to Tk that provides balloon help messages

Both of these packages are readily available via the PPM with automatic installation just a few clicks away.

(12) - Where are these packages?

There are various archives on the Internet. They are called Repostiories. PPM comes by default from ActiveState with several repositories already set up, others you can add. The biggest archive is CPAN, but strangely enough CPAN is not accessible directly from the PPM as a repository. Instead ActiveState keeps a copy of the CPAN in their archive. Or most of it. Don't ask why. It's complicated.

(13) - Back to Why Perl? Isn't this just a case of "when the only tool you have is a Hammer"?

Uh, No. I have Visual C++, Visual Basic, Delphi (Pascal) and others too numerous to mention, and could have written this in any of them. But having used all of those, I find that giving someone else the source code is a pain as re-creating someone else's original programming environment can be tricky.  Further, when using fancy GUI oriented developer tools, I find myself seduced into spending hours fiddling with the complex User Interface, hours that could be spent programming. Perl is un-matched for the ease with which one can quickly churn out a moderately complex function.

Further, I am convinced that unless one knows Perl, one is not quite proficient with a computer. Perl is a "down to the bare metal" and "Get things done", no nonsense tool.

This exercise was intended to be educational. To provide a clear and well documented example of precisely how to build a moderately complicated application, with examples and sample code that any nominal non-programmer can figure out. By doing this in Perl, I introduce the student to the language and give them everything they will need, by example, to write their own applications. Yes it's a little daunting at first. Anything worthwhile is. But if you've ever done anything more complex than "Hello World" in, say, Basic, you will quickly find Perl to be both easy and powerful.

(14) - Why make users mess with all this Perl stuff, Why not just give them an EXE?

I could indeed purchase a commercial Perl to EXE compiler and do just that. I may one day. It's actually on my to-do list. But the purpose of this exercise is educational. Get your hands dirty and learn something! Darn it!! 

I'm not selling, or even giving away an application, I'm teaching programming skills and computer literacy.

(15) - Why no installer?

I could easily provide an installer to hide all the bones, hide the Perl, etc. As to why not, see the previous two questions.  Get your hands dirty!


(16) - So what do I need to write Perl code? There's no editor, no development GUI.

        What do I do?

Those things are certainly available. ActiveState will sell you fancy GUI tools. But you don't need them. In fact, I think they get in the way. You do not need anything more than Windows Notepad. Although to be fair, notepad is a bit too minimalist. At minimum you need an editor that will tell you what line you are on. Some folks may be familiar with Emacs or Jove, or even Vi. Those all work fine for Perl. But if those names are meaningless to you, consider PCE (Perl Code Editor) from Perlvision.com. It's free for the download, and does most of what you would want or need.

Everyone interested in Perl should own a Camel Book. The name comes from O'Reilly Media (the publisher) and their practice of putting an animal on the cover of every book. When "Programming Perl" was released, it had a Camel on the cover. Hence the bible of the language is known simply as the Camel Book.

There are many, many books about Perl, some worthwhile, some not. But the web has all the documentation and tutorials you really need. You don't even need the Camel book, really. But come on, it's cheap.

 

(17) - Exactly how do I get started?


First start with Perl itself. 

Download it and run the .msi installation file.

Then go to Start|Run and type 'cmd'

In the resulting dos box, type 'cd \Perl'

Next, type 'Perl -v'

    Perl should respond 'This is Perl,' followed by version numbers and some other information.

    Perl itself is now installed and functional.

 

Next install the particular Packages we need

type 'PPM'.

This should open a GUI application to manage the Packages.

Select View|All Packages

In the search box type 'Tk'

The display should narrow to just a few packages.  Right-Click on Tk 804.027-r6 and select 'Install'

Select 'Action|Install' and let it install the package.  It will take a few minutes to download and install it.

 

After Perl is installed, download and install the zip file containing MusicL.

 

MusicL should install in C:\Perl\

 

(18) - What is in this ZIP file?

The zip file contains a plain-text file named "MusicL.pl" that is the Perl Source code for the application.  It also contains the Perl modules for the balloon tooltips.

 

These are all the files really necessary for the program.  Everything else is a part of perl, or downloaded from the PPM archive. 

 

Simply unpacking the zip file should place these files properly.