AudioFile::Info

davorg on 2003-07-27T12:56:39

Like most right-minded people I encode all of my music to Ogg Vorbis. However I still occasionally "acquire" prehistoric MP3 files from various places and I have some older MP3 files knocking around.

All this means that when I'm extracting or manipulating the data in my Audio files, I often need to write the program to handle Ogg Vorbis and MP3 separately. This gets tiresome. So a few weeks ago I started working on a module called AudioFile::Info which works on both types of file and gives me an identical interface to them both. Internally it's just a pretty thin wrapper around MP3::ID3Lib or Ogg::Vorbis::Header.

I was reminded of this module when watching blech's talk in Paris last week and I realised that it also had a far simpler interface than both of its underlying modules (which was one of blech's complaints about the existing modules).

So that encouraged me to release the module. It's currently uploading to PAUSE and should be available soon.

Share and enjoy.


I was just saying yesterday that it existed

podmaster on 2003-07-27T15:08:35

I was just saying yesterday how much I wished that this existed.

I'd have named it Audio::Info (after Video::Info).

The other thing I would have done is used the pure-perl versions, like

    Ogg-Vorbis-Header-PurePerl-0.01
    and
    MP3::Tag or MP3::Info

I went ahead and wrote Audio::Info

podmaster on 2003-07-31T09:18:52

I stole your ogg stuff, then massaged (no autoload).

http://crazyinsomniac.perlmonk.org/perl/files/Audio-Info-0.01.tar.gz

        use Audio::Info;
        {
                local $\ = "\n";
                my $song = Audio::Info->new('t/test.mp3') or die "something's wrong $@";
                print ref $song; # Audio::Info::MP3
                print 'title ', $song->title;
                print 'artist ', $song->artist;
                print 'album ', $song->album;
                print 'track ', $song->track;
                print 'year ', $song->year;
                print 'genre ', $song->genre;
                print 'length ', $song->length; # seconds
                print 'frequency ', $song->frequency; # hertz
        }
        __END__