NAME

AudioFile::Info - Perl extension to get info from audio files.

SYNOPSIS

use AudioFile::Info;

my $song = AudioFile::Info->new($some_mp3_or_ogg_vorbis_file);

print 'Title:  ', $song->title, "\n",
      'Artist: ', $song->artist, "\n".
      'Album:  ', $song->album, "\n",
      'Track:  ', $song->track, "\n";
      'Year:   ', $song->year, "\n",
      'Genre:  ', $song->genre, "\n";

ABSTRACT

AudioFile::Info is a simple way to get track information out of an audio file. It gives a unified interface for extracting information from both MP3 and Ogg Vorbis files.

DESCRIPTION

What is AudioFile::Info

I rip all of my audio files into Ogg Vorbis files. But some of my older rips are in MP3 format. If I'm writing a program to access information from my audio files it's annoying when I have to handle MP3 and Ogg Vorbis files completely separately.

AudioFile::Info is my solution to that problem. It works on both MP3 and Ogg Vorbis files and gives an identical interface for dealing with both of them.

AudioFile::Info is just a wrapper around the modules MP3::ID3Lib and Ogg::Vorbis::Header, so you'll need to have these installed.

Incidently, it's also got a simpler inteface than either of its two underlying modules.

Using AudioFile::Info

To use AudioFile::Info in your programs you simply load the module as normal.

use AudioFile::Info;

You then create an object using the new method and passing it the pathname of an audio file.

my $song = AudioFile::Info->new($some_mp3_or_ogg_vorbis_file);

The module works out whether the file is in MP3 or Ogg Vorbis format and creates an object which can extract the information from the correct type of file. You can then use this object to access the various pieces of information about the file.

print 'Title:  ', $song->title, "\n",
      'Artist: ', $song->artist, "\n".
      'Album:  ', $song->album, "\n",
      'Track:  ', $song->track, "\n";
      'Year:   ', $song->year, "\n",
      'Genre:  ', $song->genre, "\n";

Currently you can access the title, artist, album, track number, year and genre of the file.

Currently you can only read data from the files. You can't alter it an write it back.

EXPORT

None.

SEE ALSO

TO DO

  • Using alternative ID3 and Ogg Vorbis header reading modules.

  • Make more data available.

  • Changing and writing data.

AUTHOR

Dave Cross, <dave@dave.org.uk>

COPYRIGHT AND LICENSE

Copyright 2003 by Dave Cross

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.