WAVE-0.1.1: WAVE audio file IO library

Data.WAVE

Description

This module implements reading and writing of the most common kinds of WAVE files. WAVE files are Microsoft RIFF audio sample files originally based on the AIFF format, and commonly have the .wav filename extension. This module currently supports reading and writing single-section little-endian PCM audio files containing up to 32-bit samples encoded according to the well-known WAVE sample encoding. The interface audio stream format is a list of frames of 32-bit (Int32) left-justified signed PCM samples; each frame has one sample per channel. The audio reader and writer are sufficiently lazy that files larger than memory can be processed.

Synopsis

Documentation

data WAVE Source

The header and stream read or written.

Constructors

WAVE 

data WAVEHeader Source

Descriptive information for the audio source.

Constructors

WAVEHeader 

Fields

waveNumChannels :: Int

Samples per frame.

waveFrameRate :: Int

Frames per second.

waveBitsPerSample :: Int

Number of significant bits of left-justified value.

waveFrames :: Maybe Int

If present, number of frames in the stream. Otherwise, can be (inefficiently) inferred from the length of the stream.

type WAVESample = Int32Source

Each sample is a left-justified signed integer, with significant bits as given in the header.

type WAVESamples = [[WAVESample]]Source

A stream is a list of frames, each of which is a list of samples with one sample per channel.

hGetWAVE :: Handle -> IO WAVESource

Read the WAVE file at the given handle and return the audio data.

getWAVEFile :: String -> IO WAVESource

Read the WAVE file at the given path and return the audio data.

hPutWAVE :: Handle -> WAVE -> IO ()Source

Write the given audio data to the given handle as a WAVE file.

putWAVEFile :: String -> WAVE -> IO ()Source

Write the given audio data to the given path as a WAVE file.

sampleToDouble :: WAVESample -> DoubleSource

Utility routine for working with audio data in floating point format.

doubleToSample :: Double -> WAVESampleSource

Utility routine for working with audio data in floating point format.