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."
I'm going to say "Where the ogg version?" :)
Rus
Cheap UK and US VPS
The Army reading list
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...
Have those lossless compression afficionados no dignity?
Why can't I moderate something "Wrong" or at least "Grossly Misinformed"?
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
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
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
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)
Score: -1? Why? At least give a moderation reason, editors. :p
;-)
And quite frankly, your moderation being what it is, the simple fact is that this story WAS posted on codingstyle.com much earlier than Slashdot had it.
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.
1. Read the FAQ before posting.
2. Moderation is done by users, not editors.
3. Slashdot is a news digest, not a news source. They never break new stories, just link to existing ones so people can discuss them, so telling people that the story appeared elsewhere first (or even on Slashdot before) is utterly pointless.
4. Read the FAQ before posting, dumbass.
...called mp3 rage. Does the job without /.'s help.
Jonathanjk.com
In other words, it was crap.
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.
Oh, I assumed it was. In that case, it is CERTAINLY the best work of literature the world has ever seen. You should be nominated for the Nobel Prize. How can I contribute to your literacy campaign?
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 ?
All those points are true with the exception of (2). Editors have unlimited mod points and occasionally DO moderate people into oblivion. There are several documented cases of this abuse. You should read at -1 threshold so your eyes can be opened.
Obviously, this particular case is just user moderation as nobody gives a flying shit!
1. I've been using this site long enough to have a 4 digit userid. I think I know how it works.
2. Editors also can, and often do, moderate postings. They have no shortage of points, and do not face retribution for bad moderation through meta-moderation.
3. Codingstyle.com is also a news digest, posting links to existing stories. The point of my post was to point out the fact that codingstyle.com linked to the story days earlier.
4. Go fuck your hat, fuckie.
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?
...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?
When was the last time you heard someone say they were going to download some wmas off the internet? MP3 is what people use to refer to digital music files, be it an actual mp3, a wma, an ogg, or whatever.
:)
Personally I think that wma will gain a foothold only because the default tools in windows only rip to that, but I think that mp3 is "easier" as all the hardware and software that plays digital music play it. It might not be as good as ogg or aac or wma, or allow the music industry to control it through DRM, but it's the lowest common denominator that everyone understands and supports.
Also, I doubt that there's a WMA *only* hardware player out there
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
WMA actually has some real uses which will give it at least a small minority share. (Until Microsoft's DRM tech doubtless obliterates them, by about Longhorn). If you've ever seen an MP3 sampled at 192 or 256 K and 44 Khz stereo, for a source on analog tape or LP, Microsoft offers free (as in beer) conversion programs that will make it a WMA file about 1/5th to 1/10th the size with no significant losses. (Naturally for MS, they don't work the other way). Until a lot of home rippers realize that there is just no way to get more quality out of a source than it has, or someone writes OSS to "distill" an oversized MP3 to a smaller one, this will make WMA popular with people whose hard drives have become overly filled with oversampled old Vinyl.
Who is John Cabal?
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.
Thank you very much for saying that. It keeps me from having to say it myself.
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.
holy crap. what's a guy gotta do, surround my comments with ahumor tag?
My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
Sorry :) It's hard to tell where the troll ends sometimes these days :)
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.