Cultured Perl: Fun with MP3 and Perl, Part 1
Ted writes "Every self-respecting computer and music fan needs to be able to manipulate MP3s -- the defacto standard for recreational digital music use. In this article, I'll look at ways to manage and manipulate MP3s (searching, tagging, renaming, commenting, etc.) using the autotag.pl application. I'll also take you through the application, illustrating how CPAN modules enable the application."
SLASHTREK, THE NEXT MASTURBATION
a screenplay from the library of Trollkore.
SCENE 1: ABOARD THE STARSHIP ENTERPRISE - A worried L.T. Commander Data addresses Captain Picard.
Data: Captain, sensors indicate a de-cloaking Slashdot ship one hundred meters off the starboard bow.
Picard: On screen!
Worf: Captain! We are dealing with a highly idiotic, ignorant and Linux-using species. They have been known to attack those who have superior social skills and official Microsoft qualifications in computer literacy out of fear and confusion - I recommend we attack them before they do us!
Picard: That is not the way the federation do things, Mr. Worf. When dealing with such mindless slashbots there is only one course of action to take. Ensign Wheaton hail the Slashdot ship.
Wheaton: Yes sir... but are these slashbots really so bad, according to my knowledge the open source community is a highly developed and sophisticated race of people - it would be unfair to discriminate against them just because of their foul stench and greasy complexion.
Picard: Shut up Wesley!!!
Data: The Slashdot ship has responded to our hail.
Picard: On screen.
--- Cut to a dark and lifeless ship, featuring posters of Kathleen Fent engaging in all manner of sexual acts upon the walls, with a barely visible silhouette of Michel Simms vigorously beating his cock in the background.
CMDRTACO: Captain, you are encroaching on our space, leave our territory at once and never return.
Picard: We are on an important scientific mission, studding a collapsing star - I can offer you goods in exchange for passage trough your space.
CMDRTACO: -1, Redundant. You have nothing you can offer us... End Trans...
Picard: WAIT! I have... Goatse.
CMDRTACO: Then it is agreed, your safe passage trough our space in exchange for the image. End Transmission.
--- The view screen turns off and TACO looks over to his first mate, Cowboy Neil.
CMDRTACO: Put the image on main screen.... I wish to ejaculate.
I'm going to say "Where the ogg version?" :)
Rus
Cheap UK and US VPS
The Army reading list
We have a large discussion happening on IRC right now. Check it out.
irc.perfectping.com
#finite
CmdrTaco posted an mp3-related story and didn't make some gushing comment about iPod or iTunes?
WOW.
Next on IBM:
Fly to the moon using Linux
Install Perl on your credit card
TCP/IP over cups-and-string
Nanobots made simple with C
STAY TUNED!!
Fortress of Insanity
It's nice to know you can do this, and I've used the modules referenced for custom fixes. But don't reinvent the wheel if you don't have to: EasyTag probably does 90% of what you would write something custom for.
Identifying Music with MusicBrainz
-- Sorry, I can't think of anything funny to say here.
To be honest, I'm waiting for the Common Lisp port...
indeed
Have those lossless compression afficionados no dignity?
N.C. State -11.5 (-$510) Kansas 62
Why can't I moderate something "Wrong" or at least "Grossly Misinformed"?
MP3 is waaaaay too common. Even my grandmother can manipulate MP3's with PERL. Now, Ogg Vorbis, that's a TRUE geek's music format.
ID3v1 tagged before the MP3 stream. ID3v2 tagged behind the MP3 stream.
And in celebration of inconsistency: ID3v3 will put it's tag in the fucking middle of the broken-to-be MP3 stream.
BTW... cddb (and it's free counterpart) DON'T(!) need ID3vX to identify anything correctly.
We're in an exciting time when many of the scripting languages are being augmented to be able to handle Real Data (Numpy is another example).
Especially when there is a patent-free option (ogg) available. MP3 is Evil. It is based on the same system that killed many due to "patent protection" on AIDS drugs. Do not use or support an evil system, especially when alternatives are available.
-Libertarian secular transhumanist
Recently I was googling for neat tricks or hacks with Perl. This directory listing on Yahoo has some links to some REALLY good sites. Looking at the code of some of them, there are a lot of nifty things going on. I didn't quite figure out a few of them at first, until reading the author's comments. I reccommend it for any and all Perl programmers. It will really get you thinking!
If you find this post offensive, don't read it! THINK ABOUT YOUR BREATHING! I am what I am because of how apes behave.
You're on the right site for that! Tag, you're it!
Seriously, I've been thinking it would be cool to have an emacs mode for MP3 files. The raw data wouldn't be displayed, but the ID3 tags would be available for editing.
Does anyone remember that perl module that would "listen" to the mp3 and decide which musical genre it thought it was? I'm not referring to matching the ID3 tags against something... it would make a guess based on stuff like the tempo and frequency range, et cetera. (I have no idea how it actually works, and I have no idea if it is even real. I just know I read about it a long time ago and figured someday it might be something a nonprogrammer like me could use)
slashdot: where everyone yells sarcastic metaphors to themselves to understand the issue
This story was on codingstyle.com like, a week ago. :p
Let us pray that iTunes and iPods can help to destroy MP3 forever.
How did it come to pass that mp3 ripper's don't pull this data from the CD? RealPlayer, Windows Media player, etc. all show me data for the CD I am listening to, if available. Are there really that few CD's that include the proper information?
Furthermore, are there programs that are erasing the data from these MP3's when they are being circulated?
stuff |
;-)
nirvanis
Seriously.
We know you like ogg. There's no need for someone to mention ogg in every thread that has anything to do with audio.
When Bugs Bunny dresses up like Marilyn Monroe do you get funny feelings... down there?
Sorry, MP3 playback does not need to be builtin to the OS. Having MP3 playback handled by another app is ok.
Damn, did you used to work for Microsoft?
The system didn't kill people, AIDS did.
The system encouraged someone to research and provide a treatement that saved some lives.
The system isn't evil, it is just indifferent. Come up with a better system, aboloshing IP wouldn't have stopped those AIDS related deaths that WERE prevented (or delayed)
MP3s -- the defacto standard for recreational digital music use
um, what about WIndows Media Format.
sincerely,
Bill G.
My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
I did some testing between flac and ogg at its highest setting. Quite simply the ogg was very good BUT on certain parts, with some strange harmonics, the ogg would drop certain frequencies. Besides, with hard disk space so cheap these days I have no qualms ripping my music to .flac. I'm going to lose the CD anyway, might as well have a viable backup (/me cannot hold on to a CD for more than a few months without scratching it).
Photos.
True, but the point of MusicBrainz is not to hold a database of released CD's but more snapshots of MP3 tracks.
At the moment, without MusicBrainz I cannot automatically populate my ID3 tags with the information about an album unless I get it out of the cupboard and type the details in myself.
MusicBrainz allows me to do all this without any access to the CD's
Avantslash - View Slashdot cleanly on your mobile phone.
...called mp3 rage. Does the job without /.'s help.
Jonathanjk.com
I know their are currently about five thousand object persistence modules for Perl, but I wanted one that was designed for audio metadata (artist name, album title, genres, etc etc) and provided for easy searching of metadata.
About 4 years ago I bought an mp3 player. People told me mp3 would never catch on. "Oh it's too difficult" "but it doesn't sound as good as CD". Then I showed somebody else "wow - no moving parts, that's cool". Guess who was on the right track and who was wrong ?
How is it done in python?
Any takers?
The only thing I want to do with mp3s besides playing them is to "rehash" them, ie have a program that will go thru my collection and generate and save new hash codes. Mp3's are all well and good but the issue now is security.
"It's so convenient to have a system where everyone is a criminal" - A. Hitler
Actually, I use OGG on my Karma, so I guess it has caught on with me who have used mp3's since Franny's encoder was released.
:) It's happening buddy. Sorry you can't see it.
Since I rip all my cd's anyway, its no big deal switching. I'm sure filesharing services have plenty of ogg's for others.
I don't understand why people say "never going to happen" like they have a crystal ball that doesn't see change
--
CodeRed, the lower user #. No relation to SirCam.
Is there a quick and dirty Windows utility that will let me batch tag MP3s?
:)
For every MP3 I get that has no URL tag put in, I just put in my website name. A little bit of free advertising
Where's the Visual Basic code Waaaaah....
"Eve of Destruction", it's not just for old hippies anymore...
Some say that with hardware getting cheaper and HD space no longer at a premium, mp3 and other compression schemes have very little hope of surviving the next decade. In fact, I wouldn't be surprised if the record companies actually release their catalogs in an even better quality format than wav.
2 questions:
What is the bitrate at which the human ear can distinguish quality from crap?
At what point will compression become obsolete?
oh big goddamn whoopdeefuck
.. i think anyone who posts another
id3 tag editors have become the new 'hello world'
for programmers
freaking mp3 'utility' to freshmeat should be
hunted down and given a thousand and one wedgies
until they learn how to do something useful
and lets not forget our slashdot editors
won't someone please shut this site down?
...you're weighed down with the bigger hard drive your portable requires. ;)
Ph-nglui mglw'nafh Gates M'dna wgah'nagl fhtagn.
It is based on the same system that killed many due to "patent protection" on AIDS drugs. Do not use or support an evil system, especially when alternatives are available.
What the "system" you refer to does is set up a risk-to-reward ratio that encourages ideas to be pursued and developed. It is a serious money risk to develop AIDS drugs, or any other complex product for that matter. To encourage the capital outlay required, the reward is granted to encourage development.
With out this "Evil" system, the AIDS drugs would likely not have even be pursued, and all the people would have died. Regardless of weather overpriced drugs cause some people to not be able to afford drugs, less people died with the current system than would have in a system in which no risk-reward ratio exists.
Take communist Russia for example. When people are guaranteed equal pay regardless of effort, the effort level of everyone goes down. Eventually, no work is being done and pay drops to zero, resulting in a very bad situation. If there were to be no return on AIDS drug research, there would be no research even started. Of course, governments could always fund it, but governments need resources too. And the best system in which to increase resources in one that encourages rewards.
-- Fighting mediocrity one bad post at a time.
There's another guide called Bringing beauty and order to massive MP3 collections which approaches the same problem (beautifying millions of MP3s) from a different angle.
Anyone have a good suggestion as to what to use for creating CD inserts for jewel cases? I use eroaster and I've ended up writing a script that parses the CD songlist and creates a printable text document. I'm pretty sure eroaster is not writing the song/artist track info to the CD :-(
I wrote my own little Perl scripts using MP3::Info and MP3::ID3v1Tag. While you're at it, you may want to check out Apache::MP3 and my own pet project, TVDinner Streaming MP3 Server.
Wooden armaments to battle your imaginary foes!
Fuck perl, just use EasyTag
But can it pitch shift? I realize this is a bit offtopic but does anyone know how I can pitch shift mp3s in realtime? Winamp has a plugin. Is there something comparable for Macs? It's about the only thing I don't like about iTunes. Thanks!
harmonious design
freedb.org haven't added a general purpose search to the cddbd server. It can only be searched by discid.
The full-text search is still labelled experimental in CVS, though the page at freedb.org doesn't warn about that anymore.
I've chosen to download the database to a local server and tweak the server code (in C-- I'm nowhere with Perl) to allow full-text searches. I ripped about 30 CDs with EAC before I knew how to set the tagging options right so I'm missing track numbers.
I've tried some German program called MP3Tag, but I'm looking for something better. Does anyone have a recommendation for the best mp3 tagging and renaming utility for windows?
Ogg files do not decompress as simply as MP3s. More processing activity == more power used == less battery life. So Ogg is dead in the portable market.
Last week I started re-ripping my 2,000+ CD collection to OGG. It's going well. I should be finished near end of 2004.
I've thought it would be a great idea to start looking at an open source project and learn to code that way. Unfortunately it's been a hair pulling experience. I know the basics (like loops, variables, functions etc...) and I can write small little programs but I never quite know how to help a large project. I've looked at the kernel... voom, right over my head.
My biggest luck has recently been with perl. I've found it very useful in even writing small useful programs. Since it is one of the higher level languages, there is usually less code and can sometimes be quite readable. (though sometimes not) Howevever the desire is still there to help on larger projects in c or c++.... I just don't know where to start. Can anyone recommend a smallish well documented program that a beginner can look at and possibly help with?
-Chris
Anyway, it's called 'Audiotag,' and is designed to be a decent mass tagger with sane options and supports MP3, OGG, and FLAC.
If you're interested... Audiotag
To use a utility like this.
So I wrote my own. When you use a utility that downloads the information off the internet, you're sometimes left with foreign or otherwise incorrect spelling, incorrect information, and incomplete information. So I spend an extra couple of minutes at rip time and ensure my ripper has the right information. The result: All my ID3 tags are properly formatted have have the correct inforamation, with Track, Artist, Album, Genre, and Year.
At current count, I've got 8,486 files, totalling 44.5GB.
The information is stored in a mysql database, as well as the ID3 tags in the files themselves.
This looks very similar to a little Perl program I recently wrote, although mine doesn't use a CDDB-type system.
Anyway, it's called 'Audiotag,' and is designed to be a decent mass tagger with sane options and supports MP3, OGG, and FLAC.
If you're interested... Audiotag
Sticking feathers up your butt does not make you a chicken - Tyler Durden
Tag & Rename is a great utility (windows) for . . .you guessed it - Tagging and Renaming MP3's (works for .ogg and .wma too). It can connect to FreeDB to retreive track info from your mp3's (if they're in the correct order, organized by album, etc). I've use it since ver. 1.3 and have loved it, once you get used to the interface.
Wasn't the searching/orginization/manipulation of extended attribute info for a file done with the orginal macintosh OS filesystem?
/. linux readers complain about the lack of desktop linux usage.
For the most part, this mp3 file/tag orginization library, package, user interface thingy is a solution looking for a problem to solve.
If i use both the artist, cd title, and song title in the file name, and use a seperate directory for each artist and maybe if i use a subdirectory for each cd....
How about spending the time to write a user friendly front end and user friendly documentation for text processing/text manipulation/file searching/file manipulation which does everything using the standard diff, cat, grep, tail, cut, sed, awk, etc.... included in unix/linux?
Please exclude the 'RTFM' comments since 99% of end users won't want to use command line tools and many
redtail1's point and attitude is sadly a bit rare. Learning, exploring, sharing; while understanding those who "just want to get [var.thing] done". But I'd say the former is more central to the open source way, than the latter.
..once in a blue moon.) We should concentrate on finding all-the-possible-(GPL-or-BSD-compliant)-uses-under -the-sun for all this open source.
Pride in one's accomplishments is fine, but--and I'm not saying that's what the grandparent (jargoone) is doing--the bashing and negativity is so unuseful (unless very witty); stop energy as Dave Winer calls it. I mightn't like Winer very much, but I've learned plenty from him and his code.
There are things to learn, and to improve upon, everywhere. (Even stuff out of fortress Redmond
Good post, redtail1. Power to you. Sorry to go OT on y'all.
668.5
This doesn't do tagging, but I'd love to see someone hack support for it in the shell... any takers?
Here you go: mkaudiocd.sh
hmmmm.... interesting.
Today I found mp3cddb, a Perl/shell program to do just that. It's a little old -- it only supports ID3v1 -- but it's GPL, so we can fix that.
Hoping some other folks find this useful ...
How did it come to pass that mp3 ripper's don't pull this data from the CD?
The rippers do pull it. But ripping is not encoding.
I rip to WAV and get the data in the file name. If/when I later batch-encode to mp3 (with lame), there is no tag. I may add it later with yet a different tool.
Windows Media player, etc. all show me data for the CD I am listening to
It may have improved, but it used to show completely wrong data from god knows where. It was not querying freedb or cddb which had the correct data, but some other broken database. It was amazing.
id3.org contains good reference material for both id3v1 and id3v2 tagging information. There is also an overview of ID3 tags implementations for C/C++, Java, ActiveX and Delphi. The implementation page also has pointers to most of the sources referenced in the excellent IBM article.
MS will force Clippy on you, whereas Emacs will let you use him if you alt-c-ctr-p-delete-ctr2-pageup. ie you have to want something to get it.
GENERATION 26: The first time you see this, copy it into your sig on any forum and add 1 to the generation.
I've written an MP3 / Ogg Vorbis cataloger, Audiolink, which reads ID3 info from MP3s and Ogg Vorbis comments and populates this info in a database. You can also enter extra information, like "male artist", "female artist", "composer", etc. You can later search the database for music by your favorite composer, or your favorite artists. The search results can be exported to a playlist (symlinks to the original music, so it's audio-player format-free!).
Perl is my favorite dataprocessing language. Tag editing is great, but where's the Perl module for extracting metadata from the audio data? Tempos? Rhythms? Instrument identification? Tablature transcription? Bayesian correlation? Or in-stream editing MP3S? Mixing? Volume? EQ? Looping/branching on pitches? C'mon, Perl, impress me with your eclecticism.
--
make install -not war
Hey, it looks like Slashdotters think that MusicBrainz does some of this stuff. Any other contenders?
--
make install -not war
it's a godsend for large collections. You can really make file listings look professional
You know what keeps listings of large collections from looking professional?
The fact that they're almost certainly made up of illegally copied music. Yup, really professional there, Skippy.
Why do it in two steps when CDEX will rip and encode with LAME, it also will put the files into a folder named with the artist name
Snowden and Manning are heroes.
Why do it in two steps
Because I do it on an old P200. Encoding is very slow, and when I rip I usually want the WAV files fast (for a custom CD, or just for a playlist to use right now). The encoding can wait.
Also, I now encode on my new P4 notebook, but still want to rip on the old P200 which has a Plextor SCSI CD-ROM.