libvorbis-0.1.0.0: Haskell binding for libvorbis, for decoding Ogg Vorbis audio files

Safe HaskellNone

Codec.Audio.Vorbis.File

Contents

Description

High level API for decoding Ogg-Vorbis files or streams. This module is intended to be imported qualified, e.g.

 import qualified Codec.Audio.Vorbis.File as V

Synopsis

Opening file or streams

openFile :: FilePath -> IO FileSource

Open the specified Ogg-Vorbis file for decoding.

openCallbacksSource

Arguments

:: (Int -> Int -> IO ByteString)

Read function, taking size and nmemb

-> IO ()

Close function

-> Maybe (SeekMode -> Integer -> IO (), IO Integer)

Seek and tell functions

-> IO File 

Decode Ogg-Vorbis using the specified callbacks to do the back-end I/O. Seek and tell functions are optional.

withFile :: FilePath -> (File -> IO a) -> IO aSource

Open the specified Ogg-Vorbis file for decoding.

Opens it using the loan pattern: Guaranteed to call close for you on completion (exception safe), so you must not call close explicitly.

withCallbacksSource

Arguments

:: (Int -> Int -> IO ByteString)

Read function, taking size and nmemb

-> IO ()

Close function

-> Maybe (SeekMode -> Integer -> IO (), IO Integer)

Seek and tell functions

-> (File -> IO a) 
-> IO a 

Decode Ogg-Vorbis using the specified callbacks to do the back-end I/O. Seek and tell functions are optional.

Opens it using the loan pattern: Guaranteed to call close for you on completion (exception safe), so you must not call close explicitly.

File metadata

data Info Source

Constructors

Info 

Instances

data Channels Source

Constructors

Mono 
Stereo 

Read data from file

readSource

Arguments

:: File 
-> Int

Maximum bytes to read (will typically return less than this)

-> Endianness

How to encode the samples as bytes

-> WordSize

Desired word size

-> Signedness

Whether you want signed or unsigned values

-> IO (Maybe (ByteString, Int)) 

Read data from the file. Returns the data block and the number of the current logical bitstream. Nothing for end of file.

data Endianness

represent the CPU endianness

Big endian system stores bytes with the MSB as the first byte. Little endian system stores bytes with the LSB as the first byte.

middle endian is purposely avoided.

Constructors

LittleEndian 
BigEndian 

getSystemEndianness :: Endianness

return the system endianness

Close file

close :: File -> IO ()Source

Close the file once we've finished with it. Must be used with the handles returned by openFile and openCallbacks.