File::Headerinfo::WAV - an extractor of useful information from WAV files.


File-Headerinfo documentation Contained in the File-Headerinfo distribution.

Index


Code Index:

NAME

Top

File::Headerinfo::WAV - an extractor of useful information from WAV files.

DESCRIPTION

Top

File::Headerinfo::WAV uses Audio::WAV to read the headers of .wav files and extract useful information like their duration and filesize and, er, that's it at the moment.

COPYRIGHT

Top

SEE ALSO

Top

File::Headerinfo, Audio::WAV


File-Headerinfo documentation Contained in the File-Headerinfo distribution.
package File::Headerinfo::WAV;

use strict;
use base qw(File::Headerinfo);
use Audio::Wav;

sub parse_file {
    my $self = shift;
    my $w = Audio::Wav->new;
    my $info = $w->read($self->path);
    return unless $info;
    my $details = $info->details;

    $self->filetype( 'wav' );
    $self->filesize($info->length);
    $self->duration($info->length_seconds);
    $self->metadata($info->get_info);
    $self->freq($details->{sample_rate});
    $self->datarate($details->{bytes_sec});
    
    undef $info;
}

1;