Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capturing audio input from microphone, with Haskell?

Tags:

io

haskell

audio

Is there a mature library that could enable audio input and output and work within Haskell? (A nice wrapper is fine, of course.)

I'm looking for something that can easily capture microphone input and, perhaps, play various audio files as well.

like image 620
new guy Avatar asked Mar 12 '10 19:03

new guy


2 Answers

easily capture microphone input and, perhaps, play various audio files as well..

It will strongly depend on your OS platform: there are standard C libraries for this functionality on each OS, and you'll be looking for Haskell bindings to them (e.g. PulseAudio, etc). Look in the Sound category on Hackage:

  • http://hackage.haskell.org/packages/archive/pkg-list.html#cat:sound

E.g. HSndFile for audio file writing, http://hackage.haskell.org/package/HSoundFile

like image 198
Don Stewart Avatar answered Nov 11 '22 16:11

Don Stewart


the module pulse-simple exposes bindings to capture sound from the microphone, see the second example at the top of the page;
https://hackage.haskell.org/package/pulse-simple-0.1.13/docs/Sound-Pulse-Simple.html
pulse audio libraries required by cabal are obtainable via cygwin (search "pulse" in the cygwin installer).

there is a also binding to sox, which looks promising. https://hackage.haskell.org/package/sox

im sure there are other api wrappers to be found in hackage sound category.

for linux there is a binding to jack, has "unix" as a dependency, it WILL NOT build on windows...

like image 30
error Avatar answered Nov 11 '22 16:11

error