sw17ch / portaudio

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

Some more updates #2

Closed avaitla closed 12 years ago

avaitla commented 12 years ago

Again, thanks for writing these great bindings!

I've made a number of changes and included a working example of playing a sine wave. I had to change a number of things in the original code, specifically, addition of final callbacks and typed streams.

For the most part callback io through ffi, is pretty poor, as the example shows, I'm not sure why (possibly garbage collection, but I'm not sure what would need to be freed, any way that's something to investigate). However blocking io is much clearer. Typed streams are necessary since the streamread and streamwrite need to know how to cast back data into the appropriate type.

I've also addded a base Buffer typeclass, so that people can eventually use vector/storablevector instead of raw pointer operations.

Please let me know your thoughts, and if there might be a way to update the existing package to Hackage (which seems extremely outdated). If it's not quite ready to update in your view, please let me know what else I can do.

sw17ch commented 12 years ago

I really appreciate your opinions and code here. I haven't seen anything that would prevent me from merging most of this in. I've been sick the last few days and haven't had the energy to pay attention.

I'll try and take a look, test out what you've done, and cut a new version on hackage soon (the version on hackage was my first attempt at a Haskell library several years ago, it has suffered some serious bitrot).

Thanks again for your interest in this project.

avaitla commented 12 years ago

It actually seems that the sine wave player may not sound right (have pauses), after testing on another computer. However the audio file player works fine on both my machines.

avaitla commented 12 years ago

Hi there! Just wanted to point to a cool example https://github.com/a-wild-tigger/simple-player, its a music player with spectrum visualizer! It depends on this latest version of portaudio binding, but overall there are some things I think would be useful for the future versions, which I will try to work on. Definityl need to make the buffer instances for storable vectors, since it is just really messy to use pointers all the time. In addition I think maybe organizing all the imports in teh examples would be nice (Ill do that soon).

Is there anything else you'd like to see, or any changes to the bindings in this pull request you don't like or don't understand?

avaitla commented 12 years ago

Hi Jon, I jsut wanted to point you to my latest example of a ascii visualizer. It requires libsnd, hsndfile, hsndfile-vector, and hscurses, but I thought it was a fairly cool example. Here is a youtube video of it in action: http://www.youtube.com/watch?v=KOp9SHMuZOw. I was thinking of just making it a separate cabal file outside of portaudio, since it has a number of dependencies.

avaitla commented 12 years ago

HI Jon. I'm sure you're quite busy. Maybe I can help maintain this package on hackage? Some folks were interested in maybe using it in their apps.

sw17ch commented 12 years ago

Hi Anil, I'm going to add you as a contributor to the portaudio package. I am sorry I haven't gotten to your patches. Please feel free to update the package on hackage as well. :)

Also, I'm merging this pull request now.