Twitter: @fumieval
fumieval / bindings-portaudio Goto Github PK
View Code? Open in Web Editor NEWRaw bindings for portaudio 2.0
License: Other
Raw bindings for portaudio 2.0
License: Other
Twitter: @fumieval
cabal file points at bindings-builtins repostiory rather than this one
Compiling with ghc-7.8.3, Linux Mint 17.
I installed bindings-portaudio with flag -fALSA
, and while trying to compile exapmle/sine.hs, I got the error as follows:
~$ ghc -package-db=.cabal-sandbox/x86_64-linux-ghc-7.8.3-packages.conf.d/ example/sine.hs
Linking example/sine ...
/usr/bin/ld: ~/workspace/github/bindings-portaudio/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.3/bindings-portaudio-0.0/libHSbindings-portaudio-0.0.a(pa_unix_util.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Currently, the library requires you to have a type constructor that is storable, applicative, and foldable. Moreover, you can't really make it variable length, so you need to hardcode the number of channels.
I suggest an alternative. Use a 2D array from here. The one dimension is time, and the other is the channel index. Specifically, it would use StorableArray (Int, Int) a
where a
is the sample type. (Also, Storable
would become a superclass of the portaudio sample class to make the type signatures easier.) You might need to use unsafeForeignPtrToStorableArray.
Alternatively, simple lists could be used. The type would be [f a]
for foldable f and sample type a
, which would then be converted to [a]
. This list is then written to an array using pokeArray.
bindings-portaudio/example$ example-portaudio 500 500
Initialization: 0
Available APIs:
Opening the default stream: -9985
example-portaudio: user error (Failed.)
The system has ALSA installed and flashplayer works well.
Any workaround?
I find the System.PortAudio module quite handy! I suggest adding a way to see if the stream is finished to it. Currently, the only way to figure out if the stream is done playing yet is to try to figure out the timing.
Perhaps the module should expose a "Stream" object, which can be stopped, started, and checked if finished. I also see that there is a way to make callbacks that are fired when the stream is finished, so that would be helpful too!
Installing dependencies is what package managers are for. Portaudio is an actively developed project which makes it even more troublesome as any fixes upstream won't immediately be reflected in this package.
Perhaps there's a deeper reason why you need to bundle it so please say so if that's the case.
PS: the link to portaudio in README is broken, after all, that project is not a Haskell one so it's not on Hackage.
The version on github exposes a System.PortAudio
module, but the version on Hackage does not. Would be nice to see an updated version on Hackage.
https://gist.github.com/kazu-yamamoto/a6947c34aa19bde299df
% ghc hello-world.hs -L/usr/lib -L/opt/local/lib
Linking hello-world ...
Undefined symbols for architecture x86_64:
"_PaUtil_AllocateMemory", referenced from:
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o)
"_PaUtil_FreeMemory", referenced from:
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o)
_Pa_Terminate in libHSbindings-portaudio-0.0.1.a(pa_front.o)
"_PaUtil_InitializeClock", referenced from:
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o)
"_paHostApiInitializers", referenced from:
_Pa_Initialize in libHSbindings-portaudio-0.0.1.a(pa_front.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.