[Haskell-cafe] OpenAL and Hsndfile

stefan kersten sk at k-hornz.de
Wed Dec 9 10:17:05 EST 2009

hi matthew,

On 09.12.09 14:37, Matthew wrote:
> Yesterday, I set out to accomplish the challenge of loading and playing
> a sound from a file.
> So far, my attempts have resulted only in silence... rather
> disheartening after all the effort
> it took to get everything to build and run cleanly.
> I currently take the following steps:
> - Load samples from file into an IOCArray using hsndfile
> - Create an OpenAL buffer which points to the IOCArray
> - Play sound using OpenAL
> code is at: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=13836

could you isolate the problem by checking if the array returned by hsndfile
actually contains non-zero sample frames? e.g. by computing the maximum amplitude:

(Data.List.foldl' (max) 0 . fmap abs) `fmap` Data.Array.MArray.getElems buffer

you could also try to test OpenAL  with a synthesized sound, e.g.
sin(2*pi*f/fs*k); i'm not familiar with OpenAL, though.


More information about the Haskell-Cafe mailing list