following up on haskell-cafe ... On 07.07.10 04:07, Maria Gabriela Valdes wrote: > Does anybody know what are the analogous functions and data types in the > haskell library "Sound.File.Sndfile" of the libsndfile library in C ?
the decision may be debatable, but where it seemed appropriate the C identifiers map to identifiers commonly used in haskell. > data type : SNDFILE Sound.File.Sndfile.Handle > function: sf_open Sound.File.Sndfile.openFile > function : sf_read_short the most lowlevel interface is the hGetBuf method of Sample; you have to allocate buffer memory yourself. hGetBuffer returns a newly allocated instance of Buffer; see the packages hsndfile-vector [1] and hsndfile-storablevector [2] for instances and examples [3]. hGetContents returns the contents of the whole file at once while hGetContentChunks returns a lazy list of buffers. readFile and readFileChunks are just wrappers around openFile and hGetContents. i just noticed though that the lazy versions don't work correctly because they don't take closing the file handle into account properly. i think they should be removed from the API, for incremental processing an iteratee interface would probably be more appropriate. <sk> [1] http://hackage.haskell.org/package/hsndfile-vector [2] http://hackage.haskell.org/package/hsndfile-storablevector [3] http://hackage.haskell.org/packages/archive/hsndfile-vector/0.4.0/doc/html/src/Sound-File-Sndfile-Buffer-Vector-Examples.html#normalizeSoundFile _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe