sndfile-enumerators-0.9.0.1: Audio file reading/writing

Sound.Iteratee.Codecs.Wave

Contents

Synopsis

Types

Internal types

data WaveCodec Source

Data type to specify WAVE-formatted data

Constructors

WaveCodec 

type WAVEDict = IntMap [WAVEDE]Source

A WAVE directory is a list associating WAVE chunks with a record WAVEDE

data WAVEDE Source

Constructors

WAVEDE 

Fields

wavedeCount :: Int

length of chunk

wavedeType :: WAVECHUNK

type of chunk

wavedeEnum :: WAVEDEENUM

enumerator to get values of chunk

Instances

data WAVEDEENUM Source

Constructors

WENBYTE (forall a m. (MonadCatchIO m, Functor m) => MEnumeratorM (Vector Word8) (Vector Word8) m a) 
WENDUB (forall a m. (MonadCatchIO m, Functor m) => MEnumeratorM2 (Vector Word8) (Vector Double) m a) 

WAVE CHUNK types

data WAVECHUNK Source

Standard WAVE Chunks

Constructors

WAVEFMT

Format

WAVEDATA

Data

WAVEOTHER String

Other

chunkToString :: WAVECHUNK -> StringSource

Convert a WAVECHUNK to the representative string

Wave reading Iteratees

Basic wave reading

waveReader :: (MonadCatchIO m, Functor m) => Iteratee (Vector Word8) m (Maybe WAVEDict)Source

The library function to read the WAVE dictionary

readRiff :: MonadCatchIO m => Iteratee (Vector Word8) m BoolSource

Read the RIFF header of a file. Returns True if the file is a valid RIFF.

waveChunk :: String -> Maybe WAVECHUNKSource

Convert a string to WAVECHUNK type

WAVE Dictionary reading/processing functions

dictReadFormatSource

Arguments

:: (MonadCatchIO m, Functor m) 
=> Int

Index in the format chunk list to read

-> WAVEDict

Dictionary

-> Iteratee (Vector Word8) m (Maybe AudioFormat) 

Read the specified format chunk from the WAVE dictionary

dictReadFirstFormat :: (MonadCatchIO m, Functor m) => WAVEDict -> Iteratee (Vector Word8) m (Maybe AudioFormat)Source

Read the first format chunk in the WAVE dictionary.

dictReadLastFormat :: (MonadCatchIO m, Functor m) => WAVEDict -> Iteratee (Vector Word8) m (Maybe AudioFormat)Source

Read the last fromat chunk from the WAVE dictionary. This is useful when parsing all chunks in the dictionary.

dictProcessDataSource

Arguments

:: (MonadCatchIO m, Functor m) 
=> Int

Index in the data chunk list to read

-> WAVEDict

Dictionary

-> Iteratee (Vector Double) m a 
-> Iteratee (Vector Word8) m (Iteratee (Vector Double) m a) 

Read the specified data chunk from the dictionary, applying the data to the specified Iteratee.

dictProcessData_Source

Arguments

:: (MonadCatchIO m, Functor m) 
=> Int

Index in the data chunk list to read

-> WAVEDict

Dictionary

-> Iteratee (Vector Double) m a 
-> Iteratee (Vector Word8) m (Maybe a) 

Information on WAVE chunks

dictGetLengthBytes :: WAVECHUNK -> Int -> WAVEDict -> Maybe IntegerSource

Get the length of data in a dictionary chunk, in bytes.

dictGetLengthSamples :: AudioFormat -> Int -> WAVEDict -> Maybe IntegerSource

Get the length of a data chunk, in samples.

dictSoundInfo :: (MonadCatchIO m, Functor m) => WAVEDict -> Iteratee (Vector Word8) m (Maybe (AudioFormat, Integer))Source

Get the AudioFormat and data length from a file

Wave writing files

Writing iteratees

writeWave :: FilePath -> AudioFormat -> Iteratee (Vector Double) AudioMonad ()Source

Create an iteratee to write data to a wave file.

Primitive wave writing functions

openWave :: FilePath -> AudioMonad ()Source

Open a wave file for writing

writeFormat :: AudioFormat -> AudioMonad ()Source

Write a data format block to the open wave file

writeDataHeader :: AudioMonad ()Source

Write the header for a Data chunk.

writeDataChunk :: Vector Double -> AudioMonad ()Source

Write a data chunk.