Portaudio does not work for me. Maybe it's because I don't use cygwin
or mingw, but every time I tried to install it, it failed. Last time
there was an error "c2hs.exe: does not exist" even if c2hs.exe was in
the same directory. I'm not sure if I do something wrong or if it's
simply windows that does not work proper with some Haskell programs...
if I were sure it was me, I would not be giving up that early everytime
I try to get realtime audio working on windows :-) I attached my latest small test program for sox; its some simplified code from sox-0.0.1. It hangs after 10 seconds, like the versions before. That's the current state of affairs. I would be happy if anyone else with sox on windows could share his or her experience. Thanks Daniel John Lato schrieb: If you just need to play audio, have you tried the portaudio package, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/portaudio?It worked out of the box for me (mac osx 10.4, ghc-6.10.1), at least as far as playing back about 7 minutes of 16-bit, 48K stereo. John Lato On Wed, Apr 22, 2009 at 2:39 PM, Daniel van den Eijkel <d...@gmx.net> wrote:Using forkIO makes no difference. I tried the following code (and some variations) but the program still hangs after ca. 40sec at a sampling rate11025 and ca. 10 sec at 44100. Maybe I'm doing something wrong. But now I need a break before the next attempt, can't hear this saw anymore :-) extended write srcOpts dstOpts sampleRate stream = do mvar <- newEmptyMVar bracket (Proc.runInteractiveProcess "play" (Args.decons $ mconcat $ OptPriv.toArguments (mconcat $ srcOpts : Option.numberOfChannels (Frame.withSignal Frame.numberOfChannels stream) : Option.sampleRate sampleRate : Option.format (Frame.withSignal Frame.format stream) : []) : Args.pipe : OptPriv.toArguments dstOpts : []) Nothing Nothing) (\(input,output,err,_proc) -> mapM_ IO.hClose [input, output, err]) (\(input,_,_,proc) -> do -- hSetBuffering input (BlockBuffering Nothing) -- hSetBinaryMode input True forkIO $ do write input stream xcode <- Proc.waitForProcess proc putMVar mvar xcode --putStrLn "done" return () readMVar mvar) Henning Thielemann schrieb: On Tue, 21 Apr 2009, Daniel van den Eijkel wrote: Still no success. I tried all of the following, but the program always hangs after ca. 40 seconds at a sampling rate of 11025. I dont' know what to do now - maybe switch to linux? That's certainly the best. :-) Maybe I'm using runInteractiveProcess the wrong way. The example in the documentation of runInteractiveProcess uses forkIO for feeding the shell command but it doesn't tell whether one must use forkIO. Can you please try whether it works with forkIO? _______________________________________________ haskell-art mailing list haskell-art@lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art _______________________________________________ haskell-art mailing list haskell-art@lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art_______________________________________________ haskell-art mailing list haskell-art@lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art |
-- Using sox-14.2.0 -- -- this program hangs on my windows xp sp3 after ~10sec. Sometimes ctrl-c works then, and sometimes not. -- -- some code taken from sox-0.0.1 -- -- ghc --make sx.hs -threaded -- import Control.Concurrent import Data.Int --import qualified Data.StorableVector.Lazy as StorableVector import Foreign.Storable (Storable (..), ) import Foreign (Ptr, alloca, sizeOf, poke, peek, ) import System.IO import qualified System.Process as Proc --d1 = StorableVector.iterate (StorableVector.ChunkSize 10000) -- (1000+) -- (0::Data.Int.Int16) d2 = iterate (1000+) (0::Data.Int.Int16) main = do mv <- newEmptyMVar (input, output, err, proc) <- Proc.runInteractiveProcess "play" ["-c", "1", "-r", "44100", "-t", "sw", "-"] Nothing Nothing hSetBinaryMode input True hSetBuffering input (BlockBuffering (Just 10000)) tid <- forkIO $ do put input d2 --StorableVector.hPut input d1 xc <- Proc.waitForProcess proc putMVar mv xc xc <- readMVar mv return () put :: Storable a => Handle -> [a] -> IO () put h signal = alloca $ \p -> mapM_ (putFrame h p) signal putFrame :: Storable a => Handle -> Ptr a -> a -> IO () putFrame h p n = poke p n >> hPutBuf h p (sizeOf n)
_______________________________________________ haskell-art mailing list haskell-art@lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art