sndfile-enumerators-0.7.0: 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 

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 r. (MonadCatchIO m, Functor m) => MEnumeratorM (IOB r Word8) (IOB r Word8) m a) 
WENDUB (forall a m r. (MonadCatchIO m, Functor m) => MEnumeratorM2 (IOB r Word8) (IOB r 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) => MIteratee (IOB r Word8) m (Maybe WAVEDict)Source

The library function to read the WAVE dictionary

readRiff :: MonadCatchIO m => MIteratee (IOB r Word8) m ()Source

Read the RIFF header of a file.

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

-> MIteratee (IOB r Word8) m (Maybe AudioFormat) 

Read the specified format chunk from the WAVE dictionary

dictReadFirstFormat :: (MonadCatchIO m, Functor m) => WAVEDict -> MIteratee (IOB r Word8) m (Maybe AudioFormat)Source

Read the first format chunk in the WAVE dictionary.

dictReadLastFormat :: (MonadCatchIO m, Functor m) => WAVEDict -> MIteratee (IOB r 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

-> MIteratee (IOB r Double) m a 
-> MIteratee (IOB r Word8) m (MIteratee (IOB r Double) m a) 

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

dictProcessData_Source

Arguments

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

Index in the data chunk list to read

-> WAVEDict

Dictionary

-> MIteratee (IOB r Double) m a 
-> MIteratee (IOB r 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 -> MIteratee (IOB r Word8) m (Maybe (AudioFormat, Integer))Source

Get the AudioFormat and data length from a file

Wave writing files

Writing iteratees

writeWave :: FilePath -> AudioFormat -> MIteratee (IOBuffer r 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 :: IOBuffer r Double -> AudioMonad ()Source

Write a data chunk.