mpeg3

  1. mpeg3
    1. Introduction
    2. Examples
      1. Show information of an MPEG3 audio file
    3. Authors
    4. License
    5. Version History

Introduction

The MPEG3 is a thin wrapper around the libmpeg3 C library.

The official documentation for the C library is available here:

Examples

Show information of an MPEG3 audio file

(use mpeg3 format-modular)

(define *path* "/tmp/file.mp3")

; Verify that the file has the right signature:

(unless (mpeg3-check-sig *path*)
  (error "Invalid file type"))

; Open the file:

(define *file* (mpeg3-open *path*))

; Make sure the file has audio:

(unless (mpeg3-has-audio *file*)
  (error "File doesn't have audio"))

; Get the total number of audio streams in the file:

(define *total-streams* (mpeg3-total-astreams *file*))

; Print information for each audio stream in the file:

(let loop ((stream 0))
  (unless (= stream *total-streams*)
    (format #t "Stream: ~A~%  Channels: ~A~%  Sample rate: ~A~%  Samples: ~A~%"
            stream
            (mpeg3-audio-channels *file* stream)
            (mpeg3-sample-rate *file* stream)
            (mpeg3-audio-samples *file* stream))
    (loop (+ stream 1))))

; Close the file.  This step is optional: if you don't do it, Chicken
; will close it when it no longer is required.  However, if you open
; a lot of files you will want to close them as soon as you know you'll
; no longer require them.

(mpeg3-close *file*)

Authors

The mpeg3 egg was created by Alejandro Forero Cuervo.

License

Copyright (C) 2006 Alejandro Forero Cuervo <azul@freaks-unidos.net>

The mpeg3 egg is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The mpeg3 egg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the mpeg3 egg; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Version History

0.2
Include documentation from the wiki.
0.1
Initial release