I boiled the problems down to a simple example. There are no errors reported about the messages, but the result is not what we expect.
{- This module tries to reproduce results of the real-time synthesizer in scsynth's non-real-time mode. -} import Sound.OpenSoundControl(OSC(Bundle), encodeOSC) import Sound.OpenSoundControl.Byte (encode_i32) import Sound.OpenSoundControl.Time(utc) import Sound.OpenSoundControl.Transport(send) import Sound.SC3 import qualified Sound.SC3.Server.Play as Play import qualified Data.ByteString.Lazy as B import System.Cmd (rawSystem) beep = out 0 (sinOsc AR 440 0) name ="Beep" installSound n = d_recv . graphdef n . graph bundle start t = Bundle (start+t) rootId = 0 homeId = 1 autoId = -1 latency = 0.1 msgs :: [(Double, [OSC])] msgs = (0, g_freeAll [rootId] : g_new [(homeId, AddToTail, rootId)] : installSound name beep : s_new name autoId AddToTail homeId [] : []) : (1, g_freeAll [homeId] : []) : [] attachTimeStamps :: [(Double, [OSC])] -> IO [OSC] attachTimeStamps ms = do now <- utc return (map (uncurry (bundle (now+latency))) ms) realtime = Play.withSC3 $ \fd -> mapM (send fd) =<< attachTimeStamps msgs encodeMsg :: OSC -> B.ByteString encodeMsg msg = let b = encodeOSC msg n = fromIntegral (B.length b) in B.append (encode_i32 n) b oscFileName = "tone.osc" nonrealtime = do let tsMsgs = map (uncurry Bundle) msgs B.writeFile oscFileName (B.concat (map encodeMsg tsMsgs)) rawSystem "scsynth" ["-o", "1", "-N", oscFileName, "_", "tone.aiff", "44100", "AIFF", "int16"] main = realtime >> nonrealtime $ ghci NonRealtime.hs *Main> realtime ................ audible beep *Main> nonrealtime Using Altivec: no *** ERROR: open directory failed 'synthdefs' start time 0.501933 *Main> :! wc -c tone.aiff 44342 tone.aiff That is, the length is wrong (must be around 88000). The audio file contains constant zero as signal. Can someone reproduce this? _______________________________________________ haskell-art mailing list haskell-art@lists.lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art