man Audio::FLAC () - An object-oriented interface to FLAC file information and comment fields, implemented entirely in Perl.

NAME

Audio::FLAC - An object-oriented interface to FLAC file information and comment fields, implemented entirely in Perl.

SYNOPSIS

        use Audio::FLAC;
        my $flac = Audio::FLAC->new("song.flac");

        my $flacInfo = $flac->info();

        foreach (keys %$flacInfo) {
                print "$_: $flacInfo->{$_}\n";
        }

        my $flacTags = $flac->tags();

        foreach (keys %$flacTags) {
                print "$_: $flacTags->{$_}\n";
        }

DESCRIPTION

This module returns a hash containing basic information about a FLAC file, a representation of the embedded cue sheet if one exists, as well as tag information contained in the FLAC file's Vorbis tags. There is no complete list of tag keys for Vorbis tags, as they can be defined by the user; the basic set of tags used for FLAC files include:

        ALBUM
        ARTIST
        TITLE
        DATE
        GENRE
        TRACKNUMBER
        COMMENT

The information returned by Audio::FLAC::info is keyed by:

        MINIMUMBLOCKSIZE
        MAXIMUMBLOCKSIZE
        MINIMUMFRAMESIZE
        MAXIMUMFRAMESIZE
        TOTALSAMPLES
        SAMPLERATE
        NUMCHANNELS
        BITSPERSAMPLE
        MD5CHECKSUM

Information stored in the main hash that relates to the file itself or is calculated from some of the information fields is keyed by:

        trackLengthMinutes      : minutes field of track length
        trackLengthSeconds      : seconds field of track length
        trackLengthFrames       : frames field of track length (base 75)
        trackTotalLengthSeconds : total length of track in fractional seconds
        bitRate                 : average bits per second of file
        fileSize                : file size, in bytes
        filename                : filename with path

CONSTRUCTORS

Opens a FLAC file, ensuring that it exists and is actually an FLAC stream, then loads the information and comment fields.

INSTANCE METHODS

Returns a hashref containing information about the FLAC file from the file's information header.

The optional parameter, key, allows you to retrieve a single value from the info hash. Returns CWundef if the key is not found. Returns a hashref containing tag keys and values of the FLAC file from the file's Vorbis Comment header.

The optional parameter, key, allows you to retrieve a single value from the tag hash. Returns CWundef if the key is not found. Returns an arrayref which contains a textual representation of the cuesheet metada block. Each element in the array corresponds to one line in a .cue file. If there is no cuesheet block in this FLAC file the array will be empty. The resulting cuesheet should match the output of metaflac's --export-cuesheet-to option, with the exception of the FILE line, which includes the actual file name instead of dummy.wav. Writes the current contents of the tag hash to the FLAC file, given that there's enough space in the header to do so. If there's insufficient space available (using pre-existing padding), the file will remain unchanged, and the function will return a non-zero value.

SEE ALSO

<http://flac.sourceforge.net/format.html>

AUTHOR

Erik Reckase, <cerebusjam at hotmail dot com>, with lots of help from Dan Sully, <daniel@cpan.org>

COPYRIGHT

Copyright (c) 2003, Erik Reckase.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.