# Low Level Audio - Writing bytes to the sound card?

56 messages
123
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

 Compiling the C PortAudio library for either Cygwin or MinGW will be challenging at the moment. The current release doesn't compile as is, and although there should be patch for the configure script as an attachment to this message it seems to have gone amiss: http://music.columbia.edu/pipermail/portaudio/2009-May/009116.htmlI'd look for a different library to talk to the sound card... Best wishes Stephen 2009/12/4 M Xyz <[hidden email]> > > What is the most minimal (preferably platform independent) library available for writing bytes to the sound card? I see 60 wonderful libraries on Hackage, but I really just need the Haskell equivalent of an audio.write(byte[]) method. What sound api are these 60 libraries using? > > I think the portaudio library is the only contender but when I try to install it I get: > _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

 In reply to this post by Andrew Coppin Try Mac. On 6 Dec 2009, at 01:00, Andrew Coppin wrote: > Daniel Fischer wrote: >> I'm constantly amazed by those who manage to use Windows. >> >> >> (In case you want to misunderstand, it's not a Windows bashing, I   >> just never managed to work with it > > I've not had a lot of luck with Linux. I imagine this is merely due   > to having a lot more experience with Windows. > > FWIW, I used to hate Windows too - AmigaOS is far nicer. ;-) > > But now we're drifting wildly off-topic. For better or worse,   > Windows is the most popular desktop OS currently. > > _______________________________________________ > Haskell-Cafe mailing list > [hidden email] > http://www.haskell.org/mailman/listinfo/haskell-cafe_______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

 Miguel Mitrofanov wrote: > Try Mac. > > You're not the first to suggest this either. ;-) Maybe once I get hired by some financial modelling consultants and get paid shedloads of money to write Haskell all day, I'll be able to afford a Mac. But until then... _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?

Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

In reply to this post by Stephen Tetley-2
 Stephen, I had no problem compiling the portaudio binaries on Windows. It came with a msvc project that worked. The problem I'm getting currently is that when I "cabal install portaudio etc etc" I get a "c2hs.exe does not exist error" when c2hs.exe clearly exists and is in my system path. Just like this post from months ago: http://www.mail-archive.com/[hidden email]/msg00101.html--- On Sat, 12/5/09, Stephen Tetley <[hidden email]> wrote:From: Stephen Tetley <[hidden email]>Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?To: [hidden email]Date: Saturday, December 5, 2009, 5:00 PMCompiling the C PortAudio library for either Cygwin or MinGW will bechallenging at the moment.The current release doesn't compile as is, and although there shouldbe patch for the configure script as an attachment to this message itseems to have gone amiss:http://music.columbia.edu/pipermail/portaudio/2009-May/009116.htmlI'd look for a different library to talk to the sound card...Best wishesStephen2009/12/4 M Xyz >> What is the most minimal (preferably platform independent) library available for writing bytes to the sound card? I see 60 wonderful libraries on Hackage, but I really just need the Haskell equivalent of an audio.write(byte[]) method. What sound api are these 60 libraries using?>> I think the portaudio library is the only contender but when I try to install it I get:>_______________________________________________Haskell-Cafe mailing listHaskell-Cafe@...http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
[hidden email]
Open this post in threaded view
|

## Re: binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?

 In reply to this post by John Lask Hi John Fair points - but aren't you always going to 'need' at least MinGW? (for some degree of 'need' of course, I use it quite a bit though prefer Cygwin, I suppose Andrew C. would care not to use either). GHC brings with it gcc and ld, ar ... but not much else, so when a C library isn't all but self-contained, you would have to use MinGW to get the .a file - SDL for instance just distributes the .dll in the runtime library package. Also gnuwin32 is a wee bit spartan by my consideration [1], but perhaps you could knock my 95% guess for Hackage bindings libraries needing Unix emulation down to 60%, or 50%. Likely I was wrong with my guestimate in the first place by thinking mainly about 'multimedia' libraries. Best wishes Stephen [1] Presumably you mean here? http://gnuwin32.sourceforge.net/http://gnuwin32.sourceforge.net/packages.html_______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

 In reply to this post by M Xyz Am Sonntag 06 Dezember 2009 00:10:05 schrieb M Xyz: > Stephen, > I had no problem compiling the portaudio binaries on Windows. It came with > a msvc project that worked. The problem I'm getting currently is that when > I "cabal install portaudio etc etc" I get a "c2hs.exe does not exist error" > when c2hs.exe clearly exists and is in my system path. Just like this post > from months ago: > http://www.mail-archive.com/haskell-art@.../msg00101.htmlTry cabal install --with-c2hs="C:\path\to\c2hs.exe" portaudio maybe that'll work. If not, run cabal --verbose=3 install portaudio, perhaps that gives more information about what went wrong. _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

_______________________________________________
[hidden email]
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

 --- On Sat, 12/5/09, Daniel Fischer <[hidden email]> wrote:If you have cpphs, hugs, jhc, greencard etc., it is probably something about your environment. If you don't have them, it's clear that they aren't found.I don't know what those things are. I have nothing but what came with HP other than installing c2hs today. If that works, the problem is somewhere in cabal, otherwise in c2hs, either way, we'll know more.Alright, I followed the instructions and everything was as you said. I still get "c2hs.exe does not exist". C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>"C:\Program Files\Has kell\bin\c2hs.exe" --include=dist\build --cppopts=-D__GLASGOW_HASKELL__=610 --cp popts=-IC:\A\install\programming\portaudio\portaudio\include --output-dir=dist\b uild --output=Sound\PortAudio\Base.hs .\Sound\PortAudio\Base.chs c2hs.exe: does not exist C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>pause Press any key to continue . . .By the way, I have posted this problem to the c2hs mailing list in case they have some insight.

_______________________________________________
[hidden email]
Open this post in threaded view
|

 Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz: I just had another idea. dafis@linux-mkk1:~> c2hs -o memyself.hs memyself.chs c2hs: does not exist it's not that c2hs isn't found or something, c2hs doesn't find Base.chs! Try installing from the unpacked sources (cd portaudio; cabal install) or the old- fashioned way: cd portaudio-0.0.1 ghc --make Setup ./Setup configure --help (choose your options, prefix, profiling, ...) ./Setup configure $OPTIONS ./Setup build if all's well, ./Setup haddock ./Setup install (dies for me with dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei oder Verzeichnisnicht gefunden c2hs: Error during preprocessing custom header file cabal: Error: some packages failed to install: portaudio-0.0.1 failed during the building phase. The exception was: exit: ExitFailure 1 because I don't have portaudio installed) _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe Reply | Threaded Open this post in threaded view | ## RE: Low Level Audio - Writing bytes to the sound card?  I don't know whether this will help you but I just downloaded an builtthe haskell portaudio package ... (I had a windows msvc build ofportaudio dll already) the process I used ... ghc 6.10.4, portaudio-19make an import lib for ghc from dll:pexports libpa19.dll > libpa19.defdlltool --input-def libpa19.def --output-lib libpa19.aedit the .cabal file or use command line flags extra-Libraries: pa19 extra-lib-dirs: c:\portaudio19\lib include-dirs: c:\portaudio19\include runghc setup configuremake sure you have cpp i.e. the c-preprocessor on your exe path,otherwise you will get'cpp' is not recognized as an internal or external command,operable program or batch file.c2hs.exe: Error during preprocessing custom header filerunghc setup buildbuilds ok ...??> From: [hidden email]> To: [hidden email]> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?> Date: Sun, 6 Dec 2009 02:34:17 +0100> CC: [hidden email]> > Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz:> > I just had another idea.> > dafis@linux-mkk1:~> c2hs -o memyself.hs memyself.chs> c2hs: does not exist> > it's not that c2hs isn't found or something, c2hs doesn't find Base.chs!> > Try installing from the unpacked sources (cd portaudio; cabal install) or the old-> fashioned way:> > cd portaudio-0.0.1> > ghc --make Setup> > ./Setup configure --help> (choose your options, prefix, profiling, ...)> > ./Setup configure$OPTIONS> ./Setup build> > if all's well,> > ./Setup haddock> ./Setup install> > (dies for me with> dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei oder > Verzeichnisnicht gefunden> c2hs: Error during preprocessing custom header file> cabal: Error: some packages failed to install:> portaudio-0.0.1 failed during the building phase. The exception was:> exit: ExitFailure 1> because I don't have portaudio installed)> _______________________________________________> Haskell-Cafe mailing list> [hidden email]> http://www.haskell.org/mailman/listinfo/haskell-cafe Australia's #1 job site If It Exists, You'll Find it on SEEK _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

In reply to this post by Daniel Fischer-4
 --- On Sat, 12/5/09, Daniel Fischer <[hidden email]> wrote:cd portaudio-0.0.1ghc --make Setup./Setup configure --help(choose your options, prefix, profiling, ...)./Setup configure $OPTIONS./Setup buildEverything went well until "Setup build" which yielded our friend "c2hs.exe does not exist".C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>ghc --make Setup[1 of 1] Compiling Main ( Setup.hs, Setup.o )Linking Setup.exe ...C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>Setup configure --helpUsage: Setup configure [FLAGS]Flags for configure: .......(edited out).................C:\A\install\programming\portaudio\haskell\portaudio-0..0.1>Setup configure --extra-include-dirs="C:\A\install\programming\portaudio\portaudio\include" --extra-lib-dirs="C:\A\install\programming\portaudio\portaudio\build\msvc\Win32\Release"Configuring portaudio-0.0.1...C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>Setup buildPreprocessing library portaudio-0.0.1...c2hs.exe: does not exist _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe Reply | Threaded Open this post in threaded view | ## RE: Low Level Audio - Writing bytes to the sound card? In reply to this post by John Lask  I am going to give this a try. Thanks.Where can I get the pexports and dlltool utilities?Google yields:http://www.emmestech.com/software/pexports-0.43/download_pexports.htmlhttp://sourceware.org/binutils/Are those correct?--- On Sat, 12/5/09, john lask <[hidden email]> wrote:From: john lask <[hidden email]>Subject: RE: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?To: [hidden email], [hidden email]Cc: [hidden email]Date: Saturday, December 5, 2009, 9:03 PM I don't know whether this will help you but I just downloaded an builtthe haskell portaudio package ... (I had a windows msvc build ofportaudio dll already) the process I used ... ghc 6.10.4, portaudio-19make an import lib for ghc from dll:pexports libpa19.dll > libpa19.defdlltool --input-def libpa19.def --output-lib libpa19.aedit the .cabal file or use command line flags extra-Libraries: pa19 extra-lib-dirs: c:\portaudio19\lib include-dirs: c:\portaudio19\include runghc setup configuremake sure you have cpp i.e. the c-preprocessor on your exe path,otherwise you will get'cpp' is not recognized as an internal or external command,operable program or batch file.c2hs.exe: Error during preprocessing custom header filerunghc setup buildbuilds ok ...??> From: [hidden email]> To: [hidden email]> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?> Date: Sun, 6 Dec 2009 02:34:17 +0100> CC: [hidden email]> > Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz:> > I just had another idea.> > dafis@linux-mkk1:~> c2hs -o memyself.hs memyself.chs> c2hs: does not exist> > it's not that c2hs isn't found or something, c2hs doesn't find Base.chs!> > Try installing from the unpacked sources (cd portaudio; cabal install) or the old-> fashioned way:> > cd portaudio-0.0.1> > ghc --make Setup> > ./Setup configure --help> (choose your options, prefix, profiling, ...)> > ./Setup configure$OPTIONS> ./Setup build> > if all's well,> > ./Setup haddock> ./Setup install> > (dies for me with> dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei oder > Verzeichnisnicht gefunden> c2hs: Error during preprocessing custom header file> cabal: Error: some packages failed to install:> portaudio-0.0.1 failed during the building phase. The exception was:> exit: ExitFailure 1> because I don't have portaudio installed)> _______________________________________________> Haskell-Cafe mailing list> [hidden email]> http://www.haskell.org/mailman/listinfo/haskell-cafe Australia's #1 job site If It Exists, You'll Find it on SEEK

_______________________________________________
[hidden email]
Open this post in threaded view
|

## PortAudio library successfully built on Windows

In reply to this post by John Lask

_______________________________________________
[hidden email]
Open this post in threaded view
|

## Re[2]: Low Level Audio - Writing bytes to the sound card?

 In reply to this post by Andrew Coppin Hello Andrew, Sunday, December 6, 2009, 1:09:18 AM, you wrote: > Maybe once I get hired by some financial modelling consultants and get > paid shedloads of money to write Haskell all day, I'll be able to afford > a Mac. But until then... with such attitude you will never be hired by financial sector. try instead: mac? great! windows? i love it! unix? i've used it since 60's -- Best regards,  Bulat                            mailto:[hidden email] _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Low Level Audio - Writing bytes to the sound card?

 Bulat Ziganshin wrote: > Hello Andrew, > > Sunday, December 6, 2009, 1:09:18 AM, you wrote: > >   >> Maybe once I get hired by some financial modelling consultants and get >> paid shedloads of money to write Haskell all day, I'll be able to afford >> a Mac. But until then... >>     > > with such attitude you will never be hired by financial sector. try instead: > > mac? great! windows? i love it! unix? i've used it since 60's >   That's OK. I'm reasonably sure I will never get hired by the financial sector /anyway/. :-( _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?

Open this post in threaded view
|

## Re: Re: binding to C libraries on Windoww

 In reply to this post by Stephen Tetley-2 Stephen Tetley wrote: > Hi John > > Fair points - but aren't you always going to 'need' at least MinGW? > (for some degree of 'need' of course, I use it quite a bit though > prefer Cygwin, I suppose Andrew C. would care not to use either). >   I guess there's a difference in culture here. On Unix, it is usual to distribute programs as source, and build from source. (I guess in part because each one of the 12,657,234 different Unix variants is slightly different, and the program needs to work differently.) On Windows, it is usual to distribute everything as compiled binaries. (Indeed, for most commercial software, the sources simply aren't available at all.) And users get a binary program and binary DLLs or whatever. Developers get a binary DLL and whatever header files or import libraries are necessary to use it. > GHC brings with it gcc and ld, ar ... but not much else. If I'm understanding this correctly, John is saying that GCC requires a different form of import library before you can access a DLL. For binary-only DLLs, this presumably won't be available. Hence the (abnormal) requirement to build the whole library from source, rather than just drop in a DLL and be done with it. Unix *expects* you to build everything from source, and so there are standard toolchains which are almost always available, and standard installation locations and so on and so forth. Windows does *not* expect you to be building things from source, and so is less-well set up in that regard. I don't suppose there's any danger of GHC ever switching to a native Win32 toolchain? (I don't actually know if one even exists with a sufficiently liberal license...) _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

## Re: Re: binding to C libraries on Windoww

 Hi Andrew 2009/12/6 Andrew Coppin <[hidden email]>: > > On Windows, it is usual to distribute everything as compiled binaries. > (Indeed, for most commercial software, the sources simply aren't available > at all.) And users get a binary program and binary DLLs or whatever. > Developers get a binary DLL and whatever header files or import libraries > are necessary to use it. Indeed, but the Haskell libraries you want to use are in source form, no? Being a Haskell developer you're at least one step out of the usual, and most of the libraries are coming from developers on Unix so they can't be expected to package things for Windows.  > If I'm understanding this correctly, John is saying that GCC requires a > different form of import library before you can access a DLL. For > binary-only DLLs, this presumably won't be available. Hence the (abnormal) > requirement to build the whole library from source, rather than just drop in > a DLL and be done with it. John mentioned pexports in another message. I'd never come across it before - it would seem to improve the situation significantly, certainly for libraries that are more easily compilable with MSVCC like PortAudio, Shiva OpenVG, or where you have a reasonable DLL distributed like SDL. Best wishes Stephen _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
123