The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Audio::Mad - Perl interface to the mad MPEG decoder library

SYNOPSIS

  use Audio::Mad qw(:all);
  
  my $stream   = new Audio::Mad::Stream();
  my $frame    = new Audio::Mad::Frame();
  my $synth    = new Audio::Mad::Synth();
  my $timer    = new Audio::Mad::Timer();
  my $resample = new Audio::Mad::Resample(44100, 22050);
  my $dither   = new Audio::Mad::Dither();

  my $buffer = join('', <STDIN>);
  $stream->buffer($buffer);

  FRAME: {
        if ($frame->decode($stream) == -1) {
                last FRAME unless ($stream->err_ok());

                warn "decoding error: " . $stream->error();
                next FRAME;
        }

        $synth->synth($frame);
        my $pcm = $dither->dither($resample->resample($synth->samples()));

        print $pcm;
        next FRAME;
  }
                             

DESCRIPTION

 This module is an attempt to provide a perl interface to the MAD
 (MPEG Audio Decoder) library,  written by Robert Leslie.  It has
 been designed to be 100% object oriented,  and to follow the MAD
 interface as closely as possible.

 So far,  most of the MAD library,  plus two companion modules
 are provided as part of the interface.  Seperate documentation 
 is provided in perldoc for all of the modules in the
 Audio::Mad framework.

EXPORT

    None by default.

EXPORT_OK

  • :dither

            MAD_DITHER_S8             MAD_DITHER_U8
            MAD_DITHER_S16_LE         MAD_DITHER_S16_BE
            MAD_DITHER_S24_LE         MAD_DITHER_S24_BE
            MAD_DITHER_S32_LE         MAD_DITHER_S32_BE
  • :error

            MAD_ERROR_BADHUFFDATA     MAD_ERROR_LOSTSYNC       
            MAD_ERROR_BADCRC          MAD_ERROR_BADBITALLOC  
            MAD_ERROR_BADBITRATE      MAD_ERROR_BADSAMPLERATE
            MAD_ERROR_BADBLOCKTYPE    MAD_ERROR_BADHUFFTABLE   
            MAD_ERROR_BADSCFSI        MAD_ERROR_NOMEM        
            MAD_ERROR_BUFLEN          MAD_ERROR_BADFRAMELEN
            MAD_ERROR_BADPART3LEN     MAD_ERROR_BADSTEREO
            MAD_ERROR_BUFPTR          MAD_ERROR_BADLAYER
            MAD_ERROR_BADSCALEFACTOR  MAD_ERROR_BADDATAPTR
            MAD_ERROR_BADEMPHASIS     MAD_ERROR_BADBIGVALUES
            
  • :flag

            MAD_FLAG_COPYRIGHT        MAD_FLAG_FREEFORMAT
            MAD_FLAG_INCOMPLETE       MAD_FLAG_I_STEREO
            MAD_FLAG_LSF_EXT          MAD_FLAG_MS_STEREO
            MAD_FLAG_MC_EXT           MAD_FLAG_MPEG_2_5_EXT
            MAD_FLAG_NPRIVATE_III     MAD_FLAG_ORIGINAL
            MAD_FLAG_PROTECTION       MAD_FLAG_PADDING
  • :f

            MAD_F_ONE                 MAD_F_MAX
            MAD_F_FRACBITS            MAD_F_MIN 
  • :layer

            MAD_LAYER_I               MAD_LAYER_III
            MAD_LAYER_II
  • :mode

            MAD_MODE_SINGLE_CHANNEL   MAD_MODE_STEREO
            MAD_MODE_DUAL_CHANNEL     MAD_MODE_JOINT_STEREO
  • :timer

            MAD_TIMER_RESOLUTION
  • :units

            MAD_UNITS_8000_HZ         MAD_UNITS_MILLISECONDS
            MAD_UNITS_11025_HZ        MAD_UNITS_CENTISECONDS
            MAD_UNITS_12000_HZ        MAD_UNITS_DECISECONDS
            MAD_UNITS_16000_HZ        MAD_UNITS_SECONDS
            MAD_UNITS_22050_HZ        MAD_UNITS_MINUTES
            MAD_UNITS_24000_HZ        MAD_UNITS_HOURS
            MAD_UNITS_32000_HZ
            MAD_UNITS_44100_HZ
            MAD_UNITS_48000_HZ
            

AUTHOR

Mark McConnell <mischke@cpan.org>

SEE ALSO

perl(1)

Audio::Mad::Stream(3) Audio::Mad::Frame(3) Audio::Mad::Synth(3) Audio::Mad::Resample(3) Audio::Mad::Dither(3) Audio::Mad::Timer(3)