sw17ch / portaudio

Haskell bindings to the portaudio library.
MIT License
10 stars 5 forks source link

some api changes and an example. #1

Closed avaitla closed 12 years ago

avaitla commented 12 years ago

Hi there! This is a great binding! Thanks for all the hardwork. I just wanted to add some changes, specifically:

  1. Fixed Some Types in the hsc file to correspond with http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html,
  2. Added a working example
  3. Added some additional helper functions to the main api.

The reason for 3 is mostly for usability, but its also important that users have access to latency. For instance, with the same C code, we could run at 64 items per buffer, (try changing line 25 in paex_sine.hs), and you'll realize that the sound is very jaggedy, now increase this number to 2000 and its very smooth. This is a result of the number of frames and line 90 where we specify the latency, with low frame count we can fix the sound by changing that to defaultHighOutputLatency.

The issue I believe is the FFI overhead actually becoming noticeable, but if you have other thoughts please let me know.

I hope to write a few more examples and maybe add some functions to the api to deal with high use cases.

Also, are you considering updating the version on hackage? I really think this version is much simpler and easier to use!

avaitla commented 12 years ago

Also, never, ever debug audio related programs with your headphones on... such a bad idea.... haha

avaitla commented 12 years ago

Actually, there are some issues I'd like to resolve in the code before doing the pull.

sw17ch commented 12 years ago

Any progress on this? You seemed to have some good stuff.

avaitla commented 12 years ago

Yes, I guess I've been quite busy with stuff as well recently. In general the examples should all work, it's just that I need to make the things storables so people don't have to work with pointers when loading they're data. And of course the docs.

emilioidk commented 12 years ago

| Also, never, ever debug audio related programs with your headphones on... such a bad idea.... haha

Yes! At the same time I recommend if you are making a program that catches input and reproduce it right away be sure to be using headphones. Else if the mic and the speakers are close to each other it can go really bad really fast :P

While making the program I also suggest to check the mic is on when trying it and don't go nuts thinking what went wrong.

EMILIO!