WAVE-0.1: WAVE audio file IO libraryContentsIndex
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
data WAVE = WAVE {
waveHeader :: WAVEHeader
waveSamples :: WAVESamples
}
data WAVEHeader = WAVEHeader {
waveNumChannels :: Int
waveFrameRate :: Int
waveBitsPerSample :: Int
waveFrames :: Maybe Int
}
type WAVESample = Int32
type WAVESamples = [[WAVESample]]
hGetWAVE :: Handle -> IO WAVE
getWAVEFile :: String -> IO WAVE
hPutWAVE :: Handle -> WAVE -> IO ()
putWAVEFile :: String -> WAVE -> IO ()
sampleToDouble :: WAVESample -> Double
doubleToSample :: Double -> WAVESample
tile :: Int -> Int -> [a] -> [[a]]
collect :: Int -> [a] -> [[a]]
Documentation
data WAVE
The header and stream read or written.
Constructors
WAVE
waveHeader :: WAVEHeader
waveSamples :: WAVESamples
data WAVEHeader
Descriptive information for the audio source.
Constructors
WAVEHeader
waveNumChannels :: IntSamples per frame.
waveFrameRate :: IntFrames per second.
waveBitsPerSample :: IntNumber of significant bits of left-justified value.
waveFrames :: Maybe IntIf present, number of frames in the stream. Otherwise, can be (inefficiently) inferred from the length of the stream.
type WAVESample = Int32
Each sample is a left-justified signed integer, with significant bits as given in the header.
type WAVESamples = [[WAVESample]]
A stream is a list of frames, each of which is a list of samples with one sample per channel.
hGetWAVE :: Handle -> IO WAVE
Read the WAVE file at the given handle and return the audio data.
getWAVEFile :: String -> IO WAVE
Read the WAVE file at the given path and return the audio data.
hPutWAVE :: Handle -> WAVE -> IO ()
Write the given audio data to the given handle as a WAVE file.
putWAVEFile :: String -> WAVE -> IO ()
Write the given audio data to the given path as a WAVE file.
sampleToDouble :: WAVESample -> Double
Utility routine for working with audio data in floating point format.
doubleToSample :: Double -> WAVESample
Utility routine for working with audio data in floating point format.
tile :: Int -> Int -> [a] -> [[a]]
collect :: Int -> [a] -> [[a]]
Produced by Haddock version 2.1.0