Re: [haskell-art] Sox wrapper

2009-04-24 Thread Balazs Komuves
On Fri, Apr 24, 2009 at 11:13 AM, Henning Thielemann 
lemm...@henning-thielemann.de wrote:

If playback with
 DirectSound works, that's fine. But it's not portable, right? Thus,
 getting something out of PortAudio would be better.


Yes, that's right. The plan is to put the DirectSound library together with
my CoreAudio code,
and maybe in the future some kind of Linux audio system (though to be
honest, at the moment
I cannot imagine myself writing ALSA code, which seems to be the most
widespread low-level
Linux audio system, unless I have really good reasons to do it); so it will
become in effect a
cross-platform audio library written in Haskell. I started writing these
because I was not
satisfied with the existing solutions (I didn't try PortAudio though). For
example I have OpenAL
playback code too, and that's cross-platform, but unfortunately it seems
that OpenAL is not really
well-suited for this task (there is no callback/signaling mechanism, you
have to poll continuously,
and I don't know why but it is really unstable unless you have like a half
second buffer, which
is completely unacceptable for a realtime synth).

Also, the more working solutions we have, the better it is, or not? Then one
can choose the
best for the given task.

Balazs
___
haskell-art mailing list
haskell-art@lurk.org
http://lists.lurk.org/mailman/listinfo/haskell-art


Re: [haskell-art] Sox wrapper

2009-04-24 Thread Daniel van den Eijkel




I have no problem creating ~80MB files using sox (-0.0.1). Just
playback hangs after a while. I also believe it's a windows-sox
problem. 

I agree absolutely that a portable solution would be much better.
Currently I am happy that DirectSound works, but I will take a look at
PortAudio again for that reason.

Henning Thielemann schrieb:

  On Thu, 23 Apr 2009, Daniel van den Eijkel wrote:

  
  
Using sox to write files works without problems, so I did not try it with forkIO. But
playback still stops after 414917 values. I will take a look at DirectSound now.

  
  
Can Sox play large files at all? Can it play from a pipe? Maybe the 
problem is not a Haskell problem, but a Sox problem. If playback with 
DirectSound works, that's fine. But it's not portable, right? Thus, 
getting something out of PortAudio would be better.
___
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


Re: [haskell-art] Sox wrapper

2009-04-22 Thread Henning Thielemann

Daniel van den Eijkel schrieb:

 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)

Hm, complicated. Did you try the Write module in the same way? Does it
also hang? Did you try to write a file with StorableVector.hPut directly?
___
haskell-art mailing list
haskell-art@lurk.org
http://lists.lurk.org/mailman/listinfo/haskell-art