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).
that makes the companies who wouldn't negoitiate a decent liscensing deal evil, not 'the system'. By which, I assume, You mean the Patent system.
Now, if there wasn't away to make money from their discovery, how many companies would pour the millions into research?
I'll tell you: ZERO.
Of course 'the system' also allows for linux and ogg to exist. by 'the system' I mean copyright.
The Kruger Dunning explains most post on
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
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)
great I'll switch to it! where's the ogg firmware for my car stereo, my audiotron, my portable CD player, my Mp3 capable boom box, my pocket mp3 player and my dvd player...
oh wait... Ogg isnt supported on any of those... so in order to support this "FREE" format I need to go spend $5000.00 on all noew gear...oh wait I can't even BUY anything that support's ogg except for one obscure pocket mp3 player...
nevermind, I'll stick with the mp3 format that is free as far as I'm concerned and use the items I already own.
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.
You are an idiot. First of all Emacs is not an operating system (all joking aside). Secondly, he was talking about editting ID3 tags, not playing MP3s. You could've clearly seen this if you were capable of reading. Third, MS does not have any way of playing back MP3s "builtin to the OS".
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.
I thought it was stuffing that was evil? (re:Good Eats-Food Network) ;)
I swear by MacOS X. Although I use to swear *at* MacOS 9...
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
...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.
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 :-(
"MS does not have any way of playing back MP3s "builtin to the OS"."
Yes, They do.
Windows Media Player (Part of the Microsoft Windows System, as they proved to a court) plays them. It actually is pretty embeded, if you click on an mp3 file or are in a dir filled with mp3s there is a 'play all' button on the left, or play song if only one is highlighted. All of the 'Sort By' stuff becomes ID3 info (which is annoying, I wan't to sort my mp3s by creation date.)
Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
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!
It was a joke.
And EMACS is an OS. What do you think SkyNET evolved from?
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.
You are an idiot. First of all Emacs is not an operating system (all joking aside). Secondly, he was talking about editting ID3 tags, not playing MP3s. You could've clearly seen this if you were capable of reading. Third, MS does not have any way of playing back MP3s "builtin to the OS".
Sure they do! It is called Windows Media Player.
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.
"Sanity is not statistical", George Orwell, "1984"
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.
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.
1. how good is your stereo?
.wav i assmue you mean better than a perfect rip of a CD. as long as master recordings are available in high quality analog or as better than 16bit 44.1khz digital files you can create a better better quality digital file..but it will be bigger.
2. how good are your ears?
i can't stand 128bit mp3's - they sound squidgy. but at 256bit on my decent home stereo i don't mind them at all. but, when i listen to uncompressed - there's just something a little bit more sparkly about the music.
compression is already obsolete as long as you've got the drive space and the bandwidth.
there's no such thing as better than a lossless compression, so by better than
Go read some bible: nubible.com
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.
You are an idiot. First of all Emacs is not an operating system (all joking aside). Secondly, he was talking about editting ID3 tags, not playing MP3s. You could've clearly seen this if you were capable of reading. Third, MS does not have any way of playing back MP3s "builtin to the OS".
Sure they do! It is called Windows Media Player.
special purpose app + shell integration != OS component
Well, Microsoft seems to think it is an OS component. You certainly cannot remove it and it does come with the OS. So it is as much an OS component as IE. Dither over whether MS knows what an OS is much less an OS component if you will, but...
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.
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?
There is no better format than WAV, as it is uncompressed audio. However, there are two new formats called DVD-Audio and Super Audio CD, both of which store uncompressed audio data on a DVD. Since DVDs hold 7 times more data than a CD, the sound can be much higher quality. You can actually buy SACDs of quite a few albums now. The great thing is that they are dual layered discs. One layer has just conventional CD audio on it that is playable on all current players.
The MP3 bitrate in which the vast majority of the population cannot distinguish from CD is 256 kbps, from what I've heard. If you used Ogg, this number would be closer to 190 or even 168, as it is a far superior codec.
Many audiophiles use FLAC, the Free Lossless Audio Codec, which will give you WAV quality lossless sound at around a third the size.
At what point will compression become obsolete?
A couple years down the road, when I have maybe 500-1000 gigs of storage, I may see no reason to encode my audio that I rip from CDs. An entire album would take up about 600 megabytes. That is an infestimal portion of such a huge amount of storage. However, compression still will be needed to distribute songs over the internet.
If you don't understand any of my sayings, come to me in private and I shall take you in my German mouth.
Sorry :) It's hard to tell where the troll ends sometimes these days :)
That's because compression drops data from the very high and very low ends of the audio spectrum (typically taken to be 20Hz-20kHz for most home audio equipment). That's why 128kbit mp3s never have good bass and seem to have a static hiss (static is high frequency sound, >~16kHz) in the background. 256k or any bitrate has the same effect but to a lesser degree, which is why you can still hear a difference (albeit maybe too small and difficult to put into words) between a CD and a 256k mp3.
However with 256k mp3s we're already in the sort of area where you can correct a significant portion of the damage with good equaliser settings. Play with the equaliser in your winamp or xmms or whatever, and you'll see what I mean (provided you play with it 'correctly' ;p). Of course it won't be as good as an uncompressed recording, but a damn sight better than without the compensation. Certainly close enough that you won't hear the difference on any headphones/speakers costing less than $50 ;p
compression is already obsolete as long as you've got the drive space and the bandwidth.I dunno, I have a PC with a 120gb drive, but I dunno if my (measely) 10gb of mp3s would fit on it uncompressed. Maybe just barely, and I do use a good portion of the drive for other stuff (no, not pr0n, that goes on CDs for archiving ;p). They certainly wouldn't fit on my 20gb Nomad Jukebox - compression still has a very propsperous future life in portable devices.
"Why are you watching the washing machine?"
"I love entertainment, as long as it's clean"
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
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.